From 1fe728a52c582c7abd61318bfca6f1150c9e9532 Mon Sep 17 00:00:00 2001 From: jbf81tb Date: Thu, 9 May 2019 12:59:59 -0400 Subject: [PATCH] get_frame_2D fix --- nd2reader/parser.py | 4 ++-- nd2reader/reader.py | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/nd2reader/parser.py b/nd2reader/parser.py index 8a71b0b..4f17992 100644 --- a/nd2reader/parser.py +++ b/nd2reader/parser.py @@ -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()) diff --git a/nd2reader/reader.py b/nd2reader/reader.py index 74d99b6..bbb2353 100644 --- a/nd2reader/reader.py +++ b/nd2reader/reader.py @@ -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):