Browse Source

Fix the number of frames

feature/load_slices
Ruben Verweij 8 years ago
parent
commit
107c05293d
2 changed files with 8 additions and 10 deletions
  1. +3
    -10
      nd2reader/raw_metadata.py
  2. +5
    -0
      nd2reader/reader.py

+ 3
- 10
nd2reader/raw_metadata.py View File

@ -33,14 +33,15 @@ class RawMetadata(object):
if self._metadata_parsed is not None: if self._metadata_parsed is not None:
return self._metadata_parsed return self._metadata_parsed
frames_per_channel = self._parse_total_images_per_channel()
self._metadata_parsed = { self._metadata_parsed = {
"height": self._parse_if_not_none(self.image_attributes, self._parse_height), "height": self._parse_if_not_none(self.image_attributes, self._parse_height),
"width": self._parse_if_not_none(self.image_attributes, self._parse_width), "width": self._parse_if_not_none(self.image_attributes, self._parse_width),
"date": self._parse_if_not_none(self.image_text_info, self._parse_date), "date": self._parse_if_not_none(self.image_text_info, self._parse_date),
"fields_of_view": self._parse_fields_of_view(), "fields_of_view": self._parse_fields_of_view(),
"frames": self._parse_frames(),
"frames": np.arange(0, frames_per_channel, 1),
"z_levels": self._parse_z_levels(), "z_levels": self._parse_z_levels(),
"total_images_per_channel": self._parse_total_images_per_channel(),
"total_images_per_channel": frames_per_channel,
"channels": self._parse_channels(), "channels": self._parse_channels(),
"pixel_microns": self._parse_if_not_none(self.image_calibration, self._parse_calibration), "pixel_microns": self._parse_if_not_none(self.image_calibration, self._parse_calibration),
} }
@ -114,14 +115,6 @@ class RawMetadata(object):
""" """
return self._parse_dimension(r""".*?XY\((\d+)\).*?""") return self._parse_dimension(r""".*?XY\((\d+)\).*?""")
def _parse_frames(self):
"""The number of cycles.
Returns:
list: list of all the frame numbers
"""
return self._parse_dimension(r""".*?T'?\((\d+)\).*?""")
def _parse_z_levels(self): def _parse_z_levels(self):
"""The different levels in the Z-plane. """The different levels in the Z-plane.


+ 5
- 0
nd2reader/reader.py View File

@ -147,6 +147,11 @@ class ND2Reader(FramesSequenceND):
if loop['stimulation']: if loop['stimulation']:
continue continue
if loop['sampling_interval'] == 0:
# This is a loop were no data is acquired
current_time += loop['duration']
continue
timesteps = np.concatenate( timesteps = np.concatenate(
(timesteps, np.arange(current_time, current_time + loop['duration'], loop['sampling_interval']))) (timesteps, np.arange(current_time, current_time + loop['duration'], loop['sampling_interval'])))
current_time += loop['duration'] current_time += loop['duration']


Loading…
Cancel
Save