Hi,
In order to make a flirt matrix which can be used to resample
the image along the new axes, specified by the direction cosines,
you need to do the following:
1 - select an origin in voxel coordinates, where coordinates
start at zero in the first voxel stored in the image (normally
the bottom left of the first slice). It is common, but not
compulsory, to pick the centre of the volume.
2 - multiply the coordinates from step 1 by the voxel dimensions
in mm (e.g. the voxels might be 2mm x 2mm x 3mm, making a
coordinate of 2,5,7 become 4,10,21)
3 - the coordinate from step 2 must be made negative and put in the
fourth column of the affine matrix
4 - the first three columns of the matrix are formed from the
direction cosines - with all the cosines related to the new
x-axis in the first row, those for the y-axis in the second
row and those for the z-axis in the third row. Don't forget
that this forms the first three columns, with the fourth
column set by step 3.
5 - the fourth row needs to be set to 0 0 0 1
That's it - if you do the above and put it in a text file with
one row per line and one or more spaces between the column entries
then you have a valid flirt affine matrix.
To test it, use the -applyxfm -init options to flirt in order to
see what the resampled image looks like.
All the best,
Mark
On 19 Jan 2005, at 22:53, Wang, Liqin wrote:
> Hi, Could anyone give me a hint about how to convert a 3x3 direction
> cosine matrix to affine transformation matrix?
>
> Thanks,
>
> Liqin Wang
|