From 91588b5e1048920459da6f811b70d0ebded4d671 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 19 Jan 2024 16:31:58 -0500 Subject: [PATCH] Correct spacing of images read from zarr files. The order was not reversed. --- sitkibex/io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sitkibex/io.py b/sitkibex/io.py index f20e775..ab64852 100644 --- a/sitkibex/io.py +++ b/sitkibex/io.py @@ -90,7 +90,8 @@ def _zarr_read_channel(filename: Path, channel=None) -> sitk.Image: arr = arr[0, channel_number, ...] img = sitk.GetImageFromArray(arr.astype(arr.dtype.newbyteorder("=")), isVector=False) - img.SetSpacing(spacing[2:]) + # Select XYZ spacing from input TCZYX + img.SetSpacing(spacing[:1:-1]) return img