Browse Source

force three zoom levels

feature/load_slices
Jim Rybarski 10 years ago
parent
commit
01783026f8
2 changed files with 8 additions and 7 deletions
  1. +3
    -3
      nd2reader/__init__.py
  2. +5
    -4
      nd2reader/service/__init__.py

+ 3
- 3
nd2reader/__init__.py View File

@ -11,8 +11,8 @@ class Nd2(BaseNd2):
def __init__(self, filename):
super(Nd2, self).__init__(filename)
def get_image(self, timepoint, fov, channel_name, z_level):
image_set_number = self._calculate_image_set_number(timepoint, fov, z_level)
def get_image(self, time_index, fov, channel_name, z_level):
image_set_number = self._calculate_image_set_number(time_index, fov, z_level)
timestamp, raw_image_data = self._reader.get_raw_image_data(image_set_number, self.channel_offset[channel_name])
return Image(timestamp, raw_image_data, fov, channel_name, z_level, self.height, self.width)
@ -34,7 +34,7 @@ class Nd2(BaseNd2):
"""
Gets all the images for a given field of view and
"""
timepoint_set = xrange(self.timepoint_count) if time_indices is None else time_indices
timepoint_set = xrange(self.time_index_count) if time_indices is None else time_indices
channel_set = [channel.name for channel in self.channels] if channels is None else channels
z_level_set = xrange(self.z_level_count) if z_levels is None else z_levels


+ 5
- 4
nd2reader/service/__init__.py View File

@ -61,7 +61,7 @@ class BaseNd2(object):
return self._metadata['ImageEvents']['RLxExperimentRecord']['uiCount']
@property
def timepoint_count(self):
def time_index_count(self):
"""
The number of images for a given field of view, channel, and z_level combination.
Effectively the number of frames.
@ -73,7 +73,8 @@ class BaseNd2(object):
@property
def z_level_count(self):
return self._image_count / self._sequence_count
# return self._image_count / self._sequence_count
return 3
@property
def field_of_view_count(self):
@ -106,8 +107,8 @@ class BaseNd2(object):
def _metadata(self):
return self._reader.metadata
def _calculate_image_set_number(self, timepoint, fov, z_level):
return timepoint * self.field_of_view_count * self.z_level_count + (fov * self.z_level_count + z_level)
def _calculate_image_set_number(self, time_index, fov, z_level):
return time_index * self.field_of_view_count * self.z_level_count + (fov * self.z_level_count + z_level)
class Nd2Reader(object):


Loading…
Cancel
Save