Hi,
On Thu, Feb 16, 2012 at 8:46 AM, John Ashburner <[log in to unmask]> wrote:
> I'm not sure which matrices you need, but if you have a pair of
> coregistered images, you can map from voxels in one image to voxels in
> the other by:
>
> NA=nifti('A.nii');
> NB=nifti('B.nii');
>
> % Map from voxel x,y,z in A to corresponding location in B
> M = NB.mat\NA.mat;
> xyzB = M(1:3,:)*[x;y;z;1]
>
> % Map from voxel x,y,z in B to corresponding location in A
> M = NA.mat\NB.mat;
> xyzA = M(1:3,:)*[x;y;z;1]
>
>
> Converting these M matrices into a form that FSL can work with may
> require a bit of messing about. Also note that SPM indexes the first
> voxel as 1,1,1 (because it is MATLAB based), whereas FSL indexes the
> first voxel as 0,0,0 (as it is mostly written in C++). For this
> reason, the matrices in the NIfTI headers are adjusted in order to
> obtain NA.mat and NB.mat that work for the MATLAB indexing.
There some code to try and deal with FSL matrices here, with an
attempt to explain the problem:
http://nipy.sourceforge.net/dipy/reference/dipy.external.fsl.html
See you,
Matthew
|