Dear David,
It is normally easier to use voxel coordinates and the tools img2imgcoord, img2stdcoord and std2imgcoord to get the appropriate coordinate transformations. The internal coordinate system (that the FLIRT matrix refers to) is very different from the NIFTI coordinate system, which is why you see these strange values.
For example, if you want to convert from nifti voxel coordinates to nifti world coordinates (in mm) then you can do:
img2stdcoord -img imagename -std imagename -xfm /usr/local/fsl/etc/flirtsch/ident.mat coords.txt
where coords.txt contains the list of coordinates and "imagename" is the name of the image.
Similarly, to go from world to voxel coordinates:
std2imgcoord -img imagename -std imagename -xfm /usr/local/fsl/etc/flirtsch/ident.mat -vox coords.txt
And to go from voxel to voxel coordinates (between two images related by a registration) use img2imgcoord with the two different images and the FLIRT transformation for the -xfm.
All the best,
Mark
On 4 Dec 2012, at 18:41, David Hammond <[log in to unmask]> wrote:
> Dear FSL experts,
>
> I am using FLIRT for registering normalized mean diffusion images to
> structural T1 images (as part of a larger workflow involving
> tractography), and am having trouble understanding the transform
> produced by FLIRT. I need to find the rigid transform that maps points
> in physical space for the normalized mean diffusion image (called here
> nmd.nii.gz) to physical space for the T1 image (called here t1.nii.gz)
> . Running
>
> flirt -cost mutualinfo -dof 6 -in nmd.nii.gz -ref t1.nii.gz -omat nmd_to_t1_mat -o nmd_to_t1
>
> gives me a transform matrix
>
> 1 2.63489e-05 0.000986414 -41.1032
> 6.68576e-05 0.995537 -0.0943711 -4.3183
> -0.000984498 0.0943711 0.995537 72.1989
> 0 0 0 1
>
> Run this way, FLIRT does acceptably register the images, as I can
> check for instance by overlaying the original t1.nii.gz and the
> transformed, resampled nmd_to_t1 image.nii.gz images. However, this
> transform matrix does *not* map points in the corresponding physical
> spaces to each other. For example, the AC appears at point (-2.6, 5.7,
> -1.6) in the nmd image (in what ITK-SNAP calls Nifti world
> coordinates); whereas the AC is at (-2.06,8.35,-3.1) in the T1
> image(Nifti world coordinates). These are not related by the above
> rigid transform, which is roughly a 83 mm displacement.
>
> Can any of you help me understand how to use FLIRT to find the matrix
> corresponding to the rigid mapping in world coordinates ? Clearly,
> internally FLIRT is able to correctly resample images using this
> matrix, but I can't use it for the rest of my workflow unless I can
> express it in terms of physical (world) coordinates.
>
> Thank you kindly,
>
> David Hammond
>
|