I'd use the function
spm_imatrix
If your affine matrix is M, the command
P = spm_imatrix(M);
gives the decomposition of M into a vector of numbers which specify the zooms, rotations, etc.
According to the help for the "sister" function spm_matrix, the zooms are P(7), P(8), and P(9). So set them all equal to 1:
P(7:9) = 1;
Then get the new matrix via
M_new = spm_matrix(P);
Note that in addition to zooms, rotations, and translations, in the most general case there could be shears. And regarding the zooms, the zooms could involve flips (mirror imaging) if the sign is negative.
|