So I got this transformation matrix from itk-snap when I tried to register a stack of CT images to a stack of MRI images.
T =
2.0523 -0.0277 0.1518 0
0.0123 2.0405 0.3059 0
-0.1249 -0.2292 1.5095 0
270.7916 280.5018 148.7597 1.0000
Now I want to perform the registration using imwarp in Matlab, something like this
Tform = affine3d(T);
CT_stack_warp= imwarp(CT_stack,Rmoving,Tform,'OutputView',Rfixed);
But the problem is that once you feed Matlab the information of pixel size and slice thickness, you don not need to scale or do translation as specified in the T matrix. My question is how to convert the original T to the the T I am supposed to use in Matlab.
In case you need the information,
Rmoving =
imref3d with properties:
XWorldLimits: [0.2441 250.2441]
YWorldLimits: [0.2441 250.2441]
ZWorldLimits: [0.5000 185.5000]
ImageSize: [512 512 185]
PixelExtentInWorldX: 0.4883
PixelExtentInWorldY: 0.4883
PixelExtentInWorldZ: 1
ImageExtentInWorldX: 250
ImageExtentInWorldY: 250
ImageExtentInWorldZ: 185
XIntrinsicLimits: [0.5000 512.5000]
YIntrinsicLimits: [0.5000 512.5000]
ZIntrinsicLimits: [0.5000 185.5000]
Rfixed =
imref3d with properties:
XWorldLimits: [0.4063 260.4063]
YWorldLimits: [0.4063 260.4063]
ZWorldLimits: [0.7500 192.7500]
ImageSize: [320 320 128]
PixelExtentInWorldX: 0.8125
PixelExtentInWorldY: 0.8125
PixelExtentInWorldZ: 1.5000
ImageExtentInWorldX: 260
ImageExtentInWorldY: 260
ImageExtentInWorldZ: 192
XIntrinsicLimits: [0.5000 320.5000]
YIntrinsicLimits: [0.5000 320.5000]
ZIntrinsicLimits: [0.5000 128.5000]
Thank you!