0

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!

Q_1.0
  • 183
  • 9
  • What is the problem with your `T` matrix that MATLAB can't cope with it? It's not very clear in your question. – Adriaan Nov 29 '16 at 22:36
  • If you look at the translation values in the original T matrix, ie. 270, 280, apparently you dont have to shift an image by that much in Matlab since Matlab does it in image space. I am wondering if anyone is familiar with the different coordinate systems or the pipeline used in itk and matlab. – Q_1.0 Nov 29 '16 at 22:45

1 Answers1

0

Current ITK index to world transform, and some background behind it. Additional explanation of coordinate systems used in medical imaging.

Judging by the WorldLimits in Matlab, I would guess that world origin is ignored when reading an image into Matlab. This renders the transform matrix computed by ITK-SNAP (or other properly behaving software) effectively useless.

Dženan
  • 3,329
  • 3
  • 31
  • 44