Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change criteria for volumetric in Bruker tiff extractor #342

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Fixed the typing returned by the `InscopixImagingExtractor.get_dtype` method: [#326](https://github.com/catalystneuro/roiextractors/pull/326)
* Detect Changelog Updates was moved to its own dedicated workflow to avoid daily testing failures: [#336](https://github.com/catalystneuro/roiextractors/pull/336)
* Fixed the Daily testing workflows by passing along the appropriate secrets: [#340](https://github.com/catalystneuro/roiextractors/pull/340)
* Change the criteria of determining if Bruker data is volumetric [#342](https://github.com/catalystneuro/roiextractors/pull/342)

### Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _determine_frame_rate(element: ElementTree.Element, file_names: Optional[Lis


def _determine_imaging_is_volumetric(folder_path: PathType) -> bool:
"""Determine whether imaging is volumetric based on 'zDevice' configuration value.
"""Determine whether imaging is volumetric.

Parameters
----------
Expand All @@ -70,11 +70,24 @@ def _determine_imaging_is_volumetric(folder_path: PathType) -> bool:
xml_file_path = folder_path / f"{folder_path.name}.xml"
assert xml_file_path.is_file(), f"The XML configuration file is not found at '{xml_file_path}'."

is_series_type_volumetric = {
"TSeries ZSeries Element": True, # XYZT
"TSeries Timed Element": False, # XYT
"ZSeries": True, # ZT (not a time series)
"Single": False, # Single image (not a time series)
}

is_volumetric = False
for event, elem in ElementTree.iterparse(xml_file_path, events=("start",)):
if elem.tag == "PVStateValue" and elem.attrib.get("key") == "zDevice":
is_volumetric = bool(int(elem.attrib["value"]))
break # Stop parsing as we've found the required element
if elem.tag == "Sequence":
series_type = elem.attrib.get("type")
if series_type in is_series_type_volumetric:
is_volumetric = is_series_type_volumetric[series_type]
break
else:
raise ValueError(
f"Unknown series type: {series_type}, please raise an issue in roiextractor repository"
)

return is_volumetric

Expand Down
Loading