I used the function niftiApplyXformto change the orientation of a nifti file (e.g. from 'LAS' to 'ILP'). However, the resolution of the new nifti computed by the transformation matrix is changed. Below is MATLAB script that I used
ni = readFileNifti('epi1.nii');
T = ni.sto_xyz;
xform = [0 0 -1 0;
1 0 0 0;
0 -1 0 0;
0 0 0 1]
ni_new = niftiApplyXform(ni, xform);
T_new = ni_new.sto_xyz;
% Show the resolution from the transformation matrix
r1 = sqrt(sum(T(1:3,1:3).^2))
r2 = sqrt(sum(T_new(1:3,1:3).^2))
r1 and r2 are the resolutions of nifties. I think that the isotropic resolution should be kept with the given xform. However, they are not the same (e.g. r1 = [0.5 0.5 0.5] and r2 = [2 2 2]).
Do you have any idea about where I am wrong? Any offer is highly appreciated.
I used the function
niftiApplyXform
to change the orientation of a nifti file (e.g. from 'LAS' to 'ILP'). However, the resolution of the new nifti computed by the transformation matrix is changed. Below is MATLAB script that I usedr1
andr2
are the resolutions of nifties. I think that the isotropic resolution should be kept with the givenxform
. However, they are not the same (e.g.r1 = [0.5 0.5 0.5]
andr2 = [2 2 2]
).Do you have any idea about where I am wrong? Any offer is highly appreciated.