Hi Nicolas,
Multiplying by a matrix transforms one coordinate system into another.
In spm,
the .mat files transform from the raw voxel coordinates of the img file, to
another space. In your case, the output space after the matrices are applied
to both images may or may not be in register with a standard space, but since
they are coregistered, this space is the same for both images. So, using vc
to stand for "voxel coordinates", and cs for "common space", we have:
M1 * vc_1 = cs
M2 * vc_2 = cs
We want matrix M3 so that
M3 * vc_1 = vc_2.
Multiplying the second equation by inv(M2), we get
inv(M2) * M2 * vc_2 = inv(M2) * cs
or
vc_2 = inv(M2) * cs
Now substitute in the first equation to get
vc_2 = inv(M2) * M1 * vc_1
Your M3 is equal to inv(M2)*M1. Notice in the proof that care was
taken not to
mix up the order of multiplication-- it is not commutative with matrices.
Good luck,
Ken
Quoting Nicolas Wotawa <[log in to unmask]>:
> Dear All,
>
> I wonder how I can invert the transformation due to a .mat file (the
> famous transformation eventually linked to the .hdr/.img files). I
> could not find this information neither in the archives nor in the
> help.
>
> More specifically, my problem is the following:
>
> - Input data:
> i1 with its transformation matrix M1 (i.e.M1 = the 4x4 matrix
> M when I do in matlab: load 'i1.mat')
> i2 with its transformation matrix M2
>
> When applying a chek_reg of both images, the coregistration is correct.
>
> - Pb: how can I compute the matrix M3 such that i1 with the
> transformation matrix M3 will be registered with i2 *without* its M2
> matrix (i.e. in matlab: M2=eye(4)).
>
> Thank you very much for your hints.
>
> Nicolas.
>
----------------------------------------------------
Ken Roberts
Woldorff Laboratory
Center for Cognitive Neuroscience, Duke University
(919) 668-1334
----------------------------------------------------
|