我有 DICOM 图像,我想在 x 轴上向左平移 2 毫米,在 y 轴上向下平移 24 毫米。我有翻译命令:affine2d 和 imwarp。我比较了翻译前后的两张图片。翻译图像绘制在正确的位置,但你的矩阵大小与翻译前的图像不一样。这是关于翻译,而不是关于更改矩阵大小。这是我的代码:
x=-2;
y=24;
T3 = [1 0 0;0 1 0; x y 1];
tform = affine2d(T3);
for j1=1:512
Sagittal_3D_CBCT_Trans4(:,:,j1)=imwarp(Sagittal_3D_CBCT2(:,:,j1), tform,'OutputView', imref2d(size(Sagittal_3D_CBCT2(:,:,j1)),Hoehe_des_Pixels_CT,1));
end
figure(1),subplot(1,2,1),imshow(Sagittal_3D_CBCT2 (:,:,q),[]),,axis on,axis tight,subplot(1,2,2),imshow(Sagittal_3D_CBCT_Trans4(:,:,q),[]),axis on,axis tight
下图显示了翻译前(左)和翻译后(右)的差异。我画了这条红线来告诉你区别。
我请你解决我的问题,我非常感激。
