0

I'm using simpleITK in python to do image registration between an atlas image and an MRI image. I'm doing a resampling to give the atlas the same metadata as the image (origin, direction, spacing etc...) here's the atlas 3D image : atlas this step will move the atlas physical frame to the image frame but will not move the actual atlas image and voxels, so I'm applying a centered transform initialiser function between the image and the atlas like the following :

initial_transform = sitk.CenteredTransformInitializer(
image,
atlas,
sitk.Similarity3DTransform(),
sitk.CenteredTransformInitializerFilter.GEOMETRY ,
)
atlas = sitk.Resample(atlas, size=(image.GetSize()),
                  transform=initial_transform,
                  interpolator=sitk.sitkLinear,
                  outputOrigin=image.GetOrigin(),
                  outputSpacing=image.GetSpacing(),
                  outputDirection=image.GetDirection(),
                  defaultPixelValue=0.0,
                  outputPixelType=image.GetPixelID())

this works fine if the atlas and the image are in the same anatomical plane (coronal plane in my case for the atlas), but if the image is in a different anatomical plane the atlas will moved to that specific plane, but the slices will be deformed : atlas deformed while I'm supposed to get this : what I'm supposed to achieve don't mind the grayscale difference, I'm doing an histogram matching that's why the atlas looks different.

I think that the problem is that when I'm applying the centered transform initializer function, the atlas is translated to the new image origin and center but since both images have different directions, I need to apply a rotation to get the right slices. How can I exploit the cosine direction matrices of both images (image.GetDirection()) to get the right rotation between both images so I can get the right slices? anyone faced this problem before ? Thank you

1 Answers1

0

Is your MRI image in DICOM format? Perhaps the MRI and the atlas images are in different coordinate systems, i.e., LPS vs RAS.

If so, you can try using SimpleITK's DICOMOrientImageFilter class to reorient the images to match. Here's the documentation for the class:

https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DICOMOrientImageFilter.html#details

Dave Chen
  • 1,905
  • 1
  • 12
  • 18
  • thank you for your response, well I tried, it's not enough, actually the centered transform initializer can do the same job automatically without imposing an orientation, here's what's happening, I'm initializing a transform, I'm applying it in the resample, then the directions are getting changed in the resampling too, so the slices are not straight, they are not the same as before, here's a picture to help demonstrate the situation, the blue one is the image and the yellow one is the atlas that needs resampling : https://imgur.com/a/0OGRhVx – 97nevermore Apr 27 '22 at 10:47
  • Can you share your images so I can try it out? – Dave Chen Apr 27 '22 at 12:01
  • yes, thank you ! http://www.fileconvoy.com/dfl.php?id=gd4f8f6eed8ecb62d10004262795146cff9867e73ec – 97nevermore Apr 27 '22 at 12:31
  • I don't think your resample atlas is deformed. I think it's just that the slicing when you extract that 2d image is not aligned. If you look at the Altas as a 3d image in space, it is aligned with the MRI. – Dave Chen Apr 27 '22 at 18:01