Browse Source

Last test of LabelMap

master
Ruben Verweij 8 years ago
parent
commit
627cbe7aa3
3 changed files with 5 additions and 10 deletions
  1. +2
    -1
      nd2reader/artificial.py
  2. +0
    -9
      nd2reader/label_map.py
  3. +3
    -0
      tests/test_label_map.py

+ 2
- 1
nd2reader/artificial.py View File

@ -78,7 +78,8 @@ class ArtificialND2(object):
'lut_data': "CustomDataVar|LUTDataV1_0!", 'lut_data': "CustomDataVar|LUTDataV1_0!",
'grabber_settings': "CustomDataVar|GrabberCameraSettingsV1_0!", 'grabber_settings': "CustomDataVar|GrabberCameraSettingsV1_0!",
'custom_data': "CustomDataVar|CustomDataV2_0!", 'custom_data': "CustomDataVar|CustomDataV2_0!",
'app_info': "CustomDataVar|AppInfo_V1_0!"
'app_info': "CustomDataVar|AppInfo_V1_0!",
'image_frame_0': "ImageDataSeq|0!"
} }
data = {} data = {}


+ 0
- 9
nd2reader/label_map.py View File

@ -12,15 +12,6 @@ class LabelMap(object):
self._data = raw_binary_data self._data = raw_binary_data
self._image_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): def _get_location(self, label):
try: try:
label_location = self._data.index(label) + len(label) label_location = self._data.index(label) + len(label)


+ 3
- 0
tests/test_label_map.py View File

@ -8,6 +8,9 @@ class TestLabelMap(unittest.TestCase):
self.raw_text, self.locations = ArtificialND2.create_label_map_bytes() self.raw_text, self.locations = ArtificialND2.create_label_map_bytes()
self.label_map = LabelMap(self.raw_text) 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): def test_image_text_info(self):
self.assertEqual(self.locations['image_text_info'][0], self.label_map.image_text_info) self.assertEqual(self.locations['image_text_info'][0], self.label_map.image_text_info)


Loading…
Cancel
Save