From c3fcfea2fe89ba4ba5f0e3747f44621f873212b1 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Tue, 19 Sep 2023 11:08:43 -0700 Subject: [PATCH] Added legacy metadata parsing function --- .../scanimagetiffimagingextractor.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py b/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py index d0796f58..91ad03d7 100644 --- a/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py +++ b/src/roiextractors/extractors/tiffimagingextractors/scanimagetiffimagingextractor.py @@ -93,6 +93,35 @@ def parse_metadata(metadata): return metadata_parsed +def parse_metadata_v3_8(metadata): + """Parse metadata dictionary to extract relevant information and store it standard keys for ImagingExtractors. + + Requires old version of metadata (v3.8). + Currently supports + - sampling frequency + - num_channels + - num_planes + + Parameters + ---------- + metadata : dict + Dictionary of metadata extracted from the TIFF file. + + Returns + ------- + metadata_parsed: dict + Dictionary of parsed metadata. + """ + sampling_frequency = float(metadata["state.acq.frameRate"]) + num_channels = int(metadata["state.acq.numberOfChannelsSave"]) + num_planes = int(metadata["state.acq.numberOfZSlices"]) + metadata_parsed = dict( + sampling_frequency=sampling_frequency, + num_channels=num_channels, + num_planes=num_planes, + ) + + class MultiPlaneImagingExtractor(ImagingExtractor): """Class to combine multiple ImagingExtractor objects by depth plane."""