Hi all,
I’m working with a DICOM processing pipeline where I use sitk.DICOMOrient(image, "LPS")
to reorient an original series. Later, I need to revert this lps_oriented_image
back to match the exact voxel data order and geometric metadata (Origin, Spacing, Direction, Size) of the original image, assuming no resampling occurred during DICOMOrient
.
Simply applying lps_oriented_image.CopyInformation(original_image)
isn’t enough if DICOMOrient
permuted data axes, as CopyInformation
doesn’t change pixel data order or image size, leading to mismatches.
My core challenge is to reliably determine and apply the inverse data axis permutations and flips that DICOMOrient
performed. I’ve tried inferring this from the direction cosine matrices, but it’s proven tricky and I couldn’t make it work.
Is there a recommended or canonical method in SimpleITK to:
- Either directly obtain the inverse data permutation/flip operations applied by
DICOMOrient
? - Or, robustly calculate these inverse operations based on the original and LPS-oriented image’s metadata to perfectly restore the original voxel data layout?
The goal is for the “reverted” image to be identical to the original, not just geometrically equivalent for viewing, but also in its underlying voxel array structure and content (ideally having original and “reverted” series indistinguishable in a dicom viewer).
Any general strategies or insights would be greatly appreciated.
Thanks!