I can give you some hints, but I can't give you a final answer
because I don't know how the transformations have been
parameterised for these other registration methods. The factors
include:
1) What order are the parameters applied? If you
pitch by 90 degrees followed by roll by 90 degrees,
then you get a different transformation than if you
do it the other way around.
2) Which point are the rotations applied around? The
definitions of the translations will differ, depending
how this origin is specified.
3) Is the first voxel considered to be 1,1,1 (as in SPM)
or at 0,0,0 (as in some other packages)?
SPM uses spm_matrix.m to parameterise a series of parameters into
4x4 affine transformation matrices. It may be worth taking a look
at this routine. The help pages on data format may also have some hints.
Assuming that the registration routine can produce a 4x4 affine mapping (M)
from voxels in one image (G.img), to those in the other (F.img), then you
would do something like the following to make the results compatible
with SPM (by keeping G.img stationary, and updating the F.mat to bring it
into register with G.img):
% voxel-to-voxel mapping M can be thought of as being
% decomposed into M = MF\R*MG, where MF and MG are affine
% transformations mapping from voxels to some mm space, and
% R is a rigid body rotation. Therefore R = MF*M/MG
% Get initial transformation matrices MF and MG
MG = spm_get_space('G.img');
MF = spm_get_space('F.img');
R = MF*M/MG;
if sum((svd(R(1:3,1:3))-ones(3,1)).^2)>0.0001,
disp('This is wrong, because the matrix is not rigid body');
else,
MFnew = R\MF;
% Update the transformation matrix for F.img
spm_get_space('F.img',MFnew);
end;
I know that some others have already worked out how to do transformations
from the registration parameters obtained from other packages, to those
of SPM. If you are working with AIR, or the Mutual Information registration
program from Guys Hospital in London, then I'm sure that there is someone on
the mailing list who can help.
Regards,
-John
| Dear SPMers:
|
| In order to evaluate some registration algorithms I need
| to specify arbitrary transformation parameters. I wonder
| whether SPM allows one to give translation/rotation in
| mm and degrees and convert them to *.mat file. This is
| easy to do provided one knows the structure of the mat
| file and its correspondence with real variables.
|
| Someone must have asked this question before. I would
| appreciate any pointers on the answer. Many thanks...
|
| Regards,
|
| Yilong Ma
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|