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

BUG: Pass mode to to_zarr superclass method #69

Merged
merged 3 commits into from
Jul 22, 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
2 changes: 1 addition & 1 deletion multiscale_spatial_image/multiscale_spatial_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ def to_zarr(
ngff_metadata = {"multiscales": multiscales, "multiscaleSpatialImageVersion": 1}
self._dt.ds = self._dt.ds.assign_attrs(**ngff_metadata)

self._dt.to_zarr(store, **kwargs)
self._dt.to_zarr(store, mode=mode, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ def itk_image_to_multiscale(
# Orient 3D image so that direction is identity wrt RAI coordinates
image_dimension = image.GetImageDimension()
input_direction = np.array(image.GetDirection())
oriented_image = image
if anatomical_axes and image_dimension == 3 and not (np.eye(image_dimension) == input_direction).all():
desired_orientation = itk.SpatialOrientationEnums.ValidCoordinateOrientations_ITK_COORDINATE_ORIENTATION_RAI
oriented_image = itk.orient_image_filter(image, use_image_direction=True, desired_coordinate_orientation=desired_orientation)

elif anatomical_axes and image_dimension != 3:
raise ValueError(f'Cannot use anatomical axes for input image of size {image_dimension}')

image_da = itk.xarray_from_image(image)
image_da = itk.xarray_from_image(oriented_image)
image_da.name = name

image_dims: Tuple[str, str, str, str] = ("x", "y", "z", "t") # ITK dims are in xyzt order
Expand Down
Loading
Loading