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.

79 lines
3.2 KiB

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