Using FLIRT Registration Transformation Matrix in MATLAB

1 visualizzazione (ultimi 30 giorni)
Hello,
I have registered a 3D image (moving) to another 3D image (reference) using FLIRT. Both of these images are anisotropic with same spacing (voxel size). After registration, FLIRT saves the 4D transformation matrix as a .mat file. When I load it in MATLAB, it looks like this:
[a,b,c,d;
e,f,g,h;
i,j,k,l;
0,0,0,1]
Now, I want to use this transformation matrix in MATLAB, but first I want to make sure that I can load it properly in MATLAB and its coordinate system because the FSL/FLIRT is using a coordinate system in mm not voxel coordinate system. For this purpose, I am applying the same transformation matrix to the moving image in MATLAB to make sure that the MATLAB registered image is the same as the FLRIT registration output. Therefore, I run the following code in MATLAB:
T = load('FLIRTtransformation'); % FLIRT output transformation
T = T';
T(4,1:3)=T(4,1:3)./spacing; % FSL/FLIRT works in mm coordinate space not voxel coordinates
tform = affine3d(T);
R = imref3d(N); % N is image size
img_transformedMATLAB = imwarp(img,tform,'OutputView',R);
However the registered image from MATLAB and FLIRT are different. I tried some other modifications of T matrix, but none of them gave me the same registration result.
I would appreciate any help in this regard.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by