You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.1 KiB

  1. import unittest
  2. from nd2reader.label_map import LabelMap
  3. from nd2reader.artificial import ArtificialND2
  4. class TestLabelMap(unittest.TestCase):
  5. def setUp(self):
  6. self.raw_text, self.locations = ArtificialND2.create_label_map_bytes()
  7. self.label_map = LabelMap(self.raw_text)
  8. def test_image_data_location(self):
  9. self.assertEqual(self.locations['image_frame_0'][0], self.label_map.get_image_data_location(0))
  10. def test_image_text_info(self):
  11. self.assertEqual(self.locations['image_text_info'][0], self.label_map.image_text_info)
  12. def test_image_metadata(self):
  13. self.assertEqual(self.locations['image_metadata'][0], self.label_map.image_metadata)
  14. def test_image_attributes(self):
  15. self.assertEqual(self.locations['image_attributes'][0], self.label_map.image_attributes)
  16. def test_image_metadata_sequence(self):
  17. self.assertEqual(self.locations['image_metadata_sequence'][0], self.label_map.image_metadata_sequence)
  18. def test_image_calibration(self):
  19. self.assertEqual(self.locations['image_calibration'][0], self.label_map.image_calibration)
  20. def test_x_data(self):
  21. self.assertEqual(self.locations['x_data'][0], self.label_map.x_data)
  22. def test_y_data(self):
  23. self.assertEqual(self.locations['y_data'][0], self.label_map.y_data)
  24. def test_z_data(self):
  25. self.assertEqual(self.locations['z_data'][0], self.label_map.z_data)
  26. def test_roi_metadata(self):
  27. self.assertEqual(self.locations['roi_metadata'][0], self.label_map.roi_metadata)
  28. def test_pfs_status(self):
  29. self.assertEqual(self.locations['pfs_status'][0], self.label_map.pfs_status)
  30. def test_pfs_offset(self):
  31. self.assertEqual(self.locations['pfs_offset'][0], self.label_map.pfs_offset)
  32. def test_guid(self):
  33. self.assertEqual(self.locations['guid'][0], self.label_map.guid)
  34. def test_description(self):
  35. self.assertEqual(self.locations['description'][0], self.label_map.description)
  36. def test_camera_exposure_time(self):
  37. self.assertEqual(self.locations['camera_exposure_time'][0], self.label_map.camera_exposure_time)
  38. def test_camera_temp(self):
  39. self.assertEqual(self.locations['camera_temp'][0], self.label_map.camera_temp)
  40. def test_acquisition_times(self):
  41. self.assertEqual(self.locations['acquisition_times'][0], self.label_map.acquisition_times)
  42. def test_acquisition_times_2(self):
  43. self.assertEqual(self.locations['acquisition_times_2'][0], self.label_map.acquisition_times_2)
  44. def test_acquisition_frames(self):
  45. self.assertEqual(self.locations['acquisition_frames'][0], self.label_map.acquisition_frames)
  46. def test_lut_data(self):
  47. self.assertEqual(self.locations['lut_data'][0], self.label_map.lut_data)
  48. def test_grabber_settings(self):
  49. self.assertEqual(self.locations['grabber_settings'][0], self.label_map.grabber_settings)
  50. def test_custom_data(self):
  51. self.assertEqual(self.locations['custom_data'][0], self.label_map.custom_data)
  52. def test_app_info(self):
  53. self.assertEqual(self.locations['app_info'][0], self.label_map.app_info)