Skip to content

Commit

Permalink
Merge branch 'main' into improve_bruker_get_streams
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Jun 11, 2024
2 parents 3ffc60a + 40629f1 commit e7f1ffc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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

0 comments on commit e7f1ffc

Please sign in to comment.