Simple ITK slicing on coronal direction ends up with an upside down image?

75 Views Asked by At

SimpleITK version '2.2.0'. Python version 3.9.3 Numpy version 1.24.2

I was using SimpleITK to read in an image and then slicing it on different direction. For example, the image is 'image.mhd', I read it in as:

image = sitk.ReadImage('image.mhd')

Then I slice it on coronal view by:

myslice = image[:, index, :]

Then I save this slice back as mhd by using sitk.WriteImage(myslice, 'slice.mhd').

When I load it back to ITK-Snap, the image is upside down. Any reason why? Did I do anything wrong?

Trying to slice an image loaded by SimpleITK

1

There are 1 best solutions below

0
Dženan On

Your image might have non-identity directions. Try using DICOMOrientImageFilter with identity (LPS) direction before slicing.