From 8731bfa1b3db355d28fa7e17ff3fc9854a595442 Mon Sep 17 00:00:00 2001 From: Ruben Verweij Date: Thu, 23 Aug 2018 15:45:47 +0200 Subject: [PATCH] Refactor --- nd2reader/artificial.py | 77 ++++++++++++----------------------------- 1 file changed, 23 insertions(+), 54 deletions(-) diff --git a/nd2reader/artificial.py b/nd2reader/artificial.py index b69e9a1..861c613 100644 --- a/nd2reader/artificial.py +++ b/nd2reader/artificial.py @@ -6,6 +6,27 @@ import struct from nd2reader.common import check_or_make_dir from os import path +global_labels = ['image_attributes', 'image_text_info', 'image_metadata', + 'image_metadata_sequence', 'image_calibration', 'x_data', + 'y_data', 'z_data', 'roi_metadata', 'pfs_status', 'pfs_offset', + 'guid', 'description', 'camera_exposure_time', 'camera_temp', + 'acquisition_times', 'acquisition_times_2', + 'acquisition_frames', 'lut_data', 'grabber_settings', + 'custom_data', 'app_info', 'image_frame_0'] + +global_file_labels = ["ImageAttributesLV!", "ImageTextInfoLV!", + "ImageMetadataLV!", "ImageMetadataSeqLV|0!", + "ImageCalibrationLV|0!", "CustomData|X!", "CustomData|Y!", + "CustomData|Z!", "CustomData|RoiMetadata_v1!", + "CustomData|PFS_STATUS!", "CustomData|PFS_OFFSET!", + "CustomData|GUIDStore!", "CustomData|CustomDescriptionV1_0!", + "CustomData|Camera_ExposureTime1!", "CustomData|CameraTemp1!", + "CustomData|AcqTimesCache!", "CustomData|AcqTimes2Cache!", + "CustomData|AcqFramesCache!", "CustomDataVar|LUTDataV1_0!", + "CustomDataVar|GrabberCameraSettingsV1_0!", + "CustomDataVar|CustomDataV2_0!", "CustomDataVar|AppInfo_V1_0!", + "ImageDataSeq|0!"] + class ArtificialND2(object): """Artificial ND2 class (for testing purposes) @@ -97,58 +118,6 @@ class ArtificialND2(object): return locations, data - @staticmethod - def _get_labels(): - return ['image_attributes', - 'image_text_info', - 'image_metadata', - 'image_metadata_sequence', - 'image_calibration', - 'x_data', - 'y_data', - 'z_data', - 'roi_metadata', - 'pfs_status', - 'pfs_offset', - 'guid', - 'description', - 'camera_exposure_time', - 'camera_temp', - 'acquisition_times', - 'acquisition_times_2', - 'acquisition_frames', - 'lut_data', - 'grabber_settings', - 'custom_data', - 'app_info', - 'image_frame_0'] - - @staticmethod - def _get_file_labels(): - return ["ImageAttributesLV!", - "ImageTextInfoLV!", - "ImageMetadataLV!", - "ImageMetadataSeqLV|0!", - "ImageCalibrationLV|0!", - "CustomData|X!", - "CustomData|Y!", - "CustomData|Z!", - "CustomData|RoiMetadata_v1!", - "CustomData|PFS_STATUS!", - "CustomData|PFS_OFFSET!", - "CustomData|GUIDStore!", - "CustomData|CustomDescriptionV1_0!", - "CustomData|Camera_ExposureTime1!", - "CustomData|CameraTemp1!", - "CustomData|AcqTimesCache!", - "CustomData|AcqTimes2Cache!", - "CustomData|AcqFramesCache!", - "CustomDataVar|LUTDataV1_0!", - "CustomDataVar|GrabberCameraSettingsV1_0!", - "CustomDataVar|CustomDataV2_0!", - "CustomDataVar|AppInfo_V1_0!", - "ImageDataSeq|0!"] - def create_label_map_bytes(self): """Construct a binary label map @@ -157,8 +126,8 @@ class ArtificialND2(object): """ raw_text = six.b('') - labels = self._get_labels() - file_labels = self._get_file_labels() + labels = global_labels + file_labels = global_file_labels file_data, file_data_dict = self._get_file_data(labels)