Hi,
I'm looking for help with how to translate between transformation matrices created in AFNI and FSL. Specifically, I have performed a T1 to epi coregistration using AFNI's align_epi_anat.py protocol, which I would like to use within a FEAT analysis, instead of the default FLIRT coregistrations. I've read the general description of how to insert a custom registration in the FSL FAQ, at:
http://www.fmrib.ox.ac.uk/fslfaq/#feat_customreg
but this description does not define exactly how to interpret a .mat file, i.e. how FSL goes from XYZ to XYZtrans using the transformation matrix X. Can anyone help with this? I'm pasting below some information about AFNI transformation matrices. Has anyone successfully imported AFNI transformation matrices into FSL? How do they need to be modified to function as .mat files within FSL?
Thanks so much in advance for any guidance.
Jeff Miller
DESCRIPTION OF AFNI TRANSFORMATION MATRICES FROM AFNI HELP:
AFNI transformation matrix information
-1Dmatrix_save ff = Save the transformation matrix for each sub-brick into
file 'ff' (1 row per sub-brick in the source dataset).
If 'ff' does NOT end in '.1D', then the program will
append '.aff12.1D' to 'ff' to make the output filename.
*N.B.: This matrix is the coordinate transformation from base
to source DICOM coordinates. In other terms:
Xin = Xsource = M Xout = M Xbase
or
Xout = Xbase = inv(M) Xin = inv(M) Xsource
where Xin or Xsource is the 4x1 coordinates of a
location in the input volume. Xout is the
coordinate of that same location in the output volume.
Xbase is the coordinate of the corresponding location
in the base dataset. M is ff augmented by a 4th row of
[0 0 0 1], X. is an augmented column vector [x,y,z,1]'
To get the inverse matrix inv(M)
(source to base), use the cat_matvec program, as in
cat_matvec fred.aff12.1D -I
----------------------------------------------
DEFINITION OF AFFINE TRANSFORMATION PARAMETERS
----------------------------------------------
The 3x3 spatial transformation matrix is calculated as [S][D][U],
where [S] is the shear matrix,
[D] is the scaling matrix, and
[U] is the rotation (proper orthogonal) matrix.
Thes matrices are specified in DICOM-ordered (x=-R+L,y=-A+P,z=-I+S)
coordinates as:
[U] = [Rotate_y(param#6)] [Rotate_x(param#5)] [Rotate_z(param #4)]
(angles are in degrees)
[D] = diag( param#7 , param#8 , param#9 )
[ 1 0 0 ] [ 1 param#10 param#11 ]
[S] = [ param#10 1 0 ] OR [ 0 1 param#12 ]
[ param#11 param#12 1 ] [ 0 0 1 ]
The shift vector comprises parameters #1, #2, and #3.
|