user1836485
user1836485

Reputation: 41

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

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

Upvotes: 0

Views: 122

Answers (1)

Dženan
Dženan

Reputation: 3395

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

Upvotes: 0

Related Questions