我正在使用Python中的Simpleitk在图像图像和MRI图像之间进行图像编码。
我正在进行重新采样,以使地图集与图像相同的元数据(来源,方向,间距等...)
这是Atlas 3D图像:
atlas
此步骤将将Atlas物理框架移至图像框架,但不会移动实际的Atlas图像和体素,因此我在图像和地图集之间应用一个中心的转换初始函数,如下:
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())
如果Atlas和Atlas和该图像位于同一解剖平面(在我的情况下,在我的情况下为冠状平面),但是如果图像在不同的解剖平面中,则地图集将移至该特定平面,但切片将变形:
atlas变形
虽然我应该得到这个:
我应该实现的目标
不要介意灰度差异,我正在进行直方图匹配,这就是Atlas看起来不同的原因。
我认为问题是,当我应用中心变换初始化器功能时,地图集将转换为新的图像来源和中心,但是由于这两个图像都有不同的方向,因此我需要旋转以获取正确的切片。
如何利用两个图像的余弦方向矩阵(image.getDirection())以在两个图像之间获得正确的旋转,以便我获得正确的切片?有人以前遇到过这个问题吗?
谢谢
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)
您的MRI图像是DICOM格式吗?也许MRI和ATLAS图像在不同的坐标系中,即LPS与RAS。
如果是这样,您可以尝试使用Simpleitk的DicomorientimageFilter类来重新定位图像以匹配。这是课程的文档:
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