From d2255ee123c7e721e46c66905c4b234ed08e2b01 Mon Sep 17 00:00:00 2001 From: Ruben Verweij Date: Wed, 15 Mar 2017 16:48:01 +0100 Subject: [PATCH] Last test of LabelMap --- nd2reader/artificial.py | 3 ++- nd2reader/label_map.py | 9 --------- tests/test_label_map.py | 3 +++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/nd2reader/artificial.py b/nd2reader/artificial.py index d8c56f2..4510ee0 100644 --- a/nd2reader/artificial.py +++ b/nd2reader/artificial.py @@ -78,7 +78,8 @@ class ArtificialND2(object): 'lut_data': "CustomDataVar|LUTDataV1_0!", 'grabber_settings': "CustomDataVar|GrabberCameraSettingsV1_0!", 'custom_data': "CustomDataVar|CustomDataV2_0!", - 'app_info': "CustomDataVar|AppInfo_V1_0!" + 'app_info': "CustomDataVar|AppInfo_V1_0!", + 'image_frame_0': "ImageDataSeq|0!" } data = {} diff --git a/nd2reader/label_map.py b/nd2reader/label_map.py index 790d541..c46f785 100644 --- a/nd2reader/label_map.py +++ b/nd2reader/label_map.py @@ -12,15 +12,6 @@ class LabelMap(object): self._data = raw_binary_data self._image_data = {} - def image_attributes(self): - """Get the location of the image attributes - - Returns: - int: The location of the image attributes - - """ - return self._get_location(six.b("ImageAttributesLV!")) - def _get_location(self, label): try: label_location = self._data.index(label) + len(label) diff --git a/tests/test_label_map.py b/tests/test_label_map.py index 3fb13dd..c9a2369 100644 --- a/tests/test_label_map.py +++ b/tests/test_label_map.py @@ -8,6 +8,9 @@ class TestLabelMap(unittest.TestCase): self.raw_text, self.locations = ArtificialND2.create_label_map_bytes() self.label_map = LabelMap(self.raw_text) + def test_image_data_location(self): + self.assertEqual(self.locations['image_frame_0'][0], self.label_map.get_image_data_location(0)) + def test_image_text_info(self): self.assertEqual(self.locations['image_text_info'][0], self.label_map.image_text_info)