3D图像旋转简单的ITK Python(3D Image Rotation Simple ITK Python)
我正在尝试使用Simple ITK旋转3D图像。 这是我的代码: imagetoresize是原始图像。 图像大小为(512,512,149)
targetimage = imagetoresize
origin = imagetoresize.GetOrigin()
targetimage = imagetoresize
imagetoresize.SetOrigin((0,0,0))
transform = sitk.VersorTransform((0,0,1), np.pi)
transform.SetCenter((256,256,74))
outimage=sitk.Resample(imagetoresize,targetimage.GetSize(),transform,sitk.sitkLinear,[0,0,0], imagetoresize.GetSpacing(), imagetoresize.GetDirection())
outimage.SetOrigin(origin)
代码旋转图像但中心移动。
旋转后的 原始图像
有人可以向我解释为什么中心会被转移吗?
任何帮助都感激不尽。
I'm trying to rotate a 3D-Image with Simple ITK. Here is my Code: imagetoresize is the original image. The size of the image is (512,512,149)
targetimage = imagetoresize
origin = imagetoresize.GetOrigin()
targetimage = imagetoresize
imagetoresize.SetOrigin((0,0,0))
transform = sitk.VersorTransform((0,0,1), np.pi)
transform.SetCenter((256,256,74))
outimage=sitk.Resample(imagetoresize,targetimage.GetSize(),transform,sitk.sitkLinear,[0,0,0], imagetoresize.GetSpacing(), imagetoresize.GetDirection())
outimage.SetOrigin(origin)
The code rotates the image but the center is shifted.
Orginal Image Image after rotate
Can someone explain to me why the center is shifted?
Any help will be much appreciated.
原文:https://stackoverflow.com/questions/44457722
2020-02-11 14:53
满意答案
您将以像素而不是物理空间设置旋转中心。
SimpleITK&#x