What is classed as the rotation matrix will depend on how the transform
is parameterised. The spm_imatrix function does one decomposition into
various parameters that can then be used to reconstruct a rotation
matrix, but there are others. My own favourite is the following, but
there are occasional problems with complex results:
V=logm(M(1:3,1:3));
R=real(expm(0.5*(V-V')))
Another possibility is to decompose it into rotate, zoom, rotate with
singular value decomposition, and then reconstruct without the zooms (as
used by Procrustes analysis):
[U,S,V]=svd(M(1:3,1:3));
R=U*V'
Best regards,
-John
On Mon, 2009-11-09 at 10:35 +0000, Giulia wrote:
> Hi everybody!
>
> A simple question: is there a way to automatically obtain the rotation matrix,
> starting from the affine transformation matrix of a coregistration?
> With SPM5, I use the command
>
> m= spm_get_space(ReferenceImage\SourceImage)
>
> in order to get the transformation matrix of the coregistration between Ref.
> and Source Image.
> However, I'd like to extract from the affine matrix, only the rotation matrix.
> How can I do?
>
> Thanks you very much if anybody can help me.
> Best regards,
> Giulia
>
--
John Ashburner <[log in to unmask]>
|