Browse Source

get_frame_2D fix

zolfa-add_slices_loading
jbf81tb 6 years ago
parent
commit
75f19554e4
2 changed files with 3 additions and 8 deletions
  1. +2
    -2
      nd2reader/parser.py
  2. +1
    -6
      nd2reader/reader.py

+ 2
- 2
nd2reader/parser.py View File

@ -77,7 +77,7 @@ class Parser(object):
else:
return image
def get_image_by_attributes(self, frame_number, field_of_view, channel_name, z_level, height, width):
def get_image_by_attributes(self, frame_number, field_of_view, channel, z_level, height, width):
"""Gets an image based on its attributes alone
Args:
@ -94,7 +94,7 @@ class Parser(object):
"""
image_group_number = self._calculate_image_group_number(frame_number, field_of_view, z_level)
try:
timestamp, raw_image_data = self._get_raw_image_data(image_group_number, self._channel_offset[channel_name],
timestamp, raw_image_data = self._get_raw_image_data(image_group_number, channel,
height, width)
except (TypeError, NoImageError):
return Frame([], frame_no=frame_number, metadata=self._get_frame_metadata())


+ 1
- 6
nd2reader/reader.py View File

@ -67,14 +67,9 @@ class ND2Reader(FramesSequenceND):
numpy.ndarray: The requested frame
"""
try:
c_name = self.metadata["channels"][c]
except KeyError:
c_name = self.metadata["channels"][0]
x = self.metadata["width"] if x <= 0 else x
y = self.metadata["height"] if y <= 0 else y
return self._parser.get_image_by_attributes(t, v, c_name, z, y, x)
return self._parser.get_image_by_attributes(t, v, c, z, y, x)
@property
def parser(self):


Loading…
Cancel
Save