If you wanted to do it nonlinearly, you could use the deformations
utility of SPM to generate an inverse of this transform, which could
warp your surface using spm_swarp in SPM8.
Your question is about affine transforms though, so I'd better give you
an answer on that. Line 183 of spm_normalise.m says:
Affine = inv(VG(1).mat\M*VF1(1).mat);
VG(1).mat is the voxel-to-world mapping of the template, and VF1(1).mat
is the voxel-to-world mapping of the scan that was aligned with the
template.
The matrix you need is M, which (if my maths is correct) is obtained by:
M = sn.VG(1).mat*inv(sn.Affine)*inv(sn.VF(1).mat)
Best regards,
-John
On Thu, 2009-12-10 at 11:59 -0600, Martin Luessi wrote:
> Hi,
>
> I'm trying to transform the vertex coordinates of a 3D cortex mesh
> which has been obtained from a non-normalized T1 image (let's call it
> "subject.nii") into normalized MNI coordinates. The vertex of the mesh
> are in millimeters in the native space of subject.nii. What I would
> like to find is the following transform "T":
>
> vertex (mm, native) ---- T ----> vertex(mm, normalized)
>
> which can be written as
>
> v_norm = A*v_native,
>
> where v_norm and v_native are homogeneous coordinates of the vertex in
> normalized and native space, respectively, and A is an affine
> transform matrix.
>
> To find the transform matrix I tried the following:
>
> 1) Normalized the subject.nii image to the T1.nii template using the
> SPM8 normalize function. This creates file called subject_sn.mat with
> transform parameters.
>
> 2) Load the "sn" file: sn = load(subject_sn.mat)
>
> The sn struct has a field called "Affine" which is an affine transform
> matrix. However, I'm not sure with respect to what coordinate system
> this transform is. Can anyone tell me how I can get A from the
> parameters in the "sn" file. Obviously I tried "A = sn.Affine" but the
> result does not seem to be correct.
>
> Thanks,
>
> Martin
>
>
--
John Ashburner <[log in to unmask]>
|