Browse Source

fix to allow reading of ND2-files with missing frames, due to e.g. skipping z-positions in one channel of a multichannel image; based on most recent commit of master

zolfa-add_slices_loading
unknown 5 years ago
parent
commit
1fed0c1fb1
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      nd2reader/parser.py

+ 7
- 1
nd2reader/parser.py View File

@ -283,7 +283,13 @@ class Parser(object):
if np.any(image_data): if np.any(image_data):
return timestamp, Frame(image_data, metadata=self._get_frame_metadata()) return timestamp, Frame(image_data, metadata=self._get_frame_metadata())
raise NoImageError
# If a blank "gap" image is encountered, generate an empty frame (black image) of corresponding height and width to avoid
# errors with ND2-files with missing frames.
else:
empty_frame = np.zeros([height, width])
return timestamp, Frame(empty_frame, metadata=self._get_frame_metadata())
# raise NoImageError # <-- delete?
def _get_frame_metadata(self): def _get_frame_metadata(self):
"""Get the metadata for one frame """Get the metadata for one frame


Loading…
Cancel
Save