我正在尝试使用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)
代码旋转了图片,但中心点发生了偏移。
原始图片 旋转后的图片 有人能解释一下为什么会出现中心点偏移吗?
非常感谢您的帮助。
维度:3 尺寸:512 512 149 矩阵: 0.832031 0 0 0 0.832031 0 0 0 1.5 偏移量:[-200.584, -382.084, -1431.5] 中心点:[0, 0, 0] 平移:[-200.584, -382.084, -1431.5] 逆矩阵: 1.20188 0 0 0 1.20188 0 0 0 0.666667 缩放:1 1 1 原点:[-200.584, -382.084, -1431.5] 间距:[0.832031, 0.832031, 1.5] 均匀间距:1 方向向量:[0, 0, 1] 切片数:149 - Noobie555