Dear Iris,
it is an 4x4 matrix since it is not possible to encode a complete affine
transformation (translation, scaling and rotation) in a 3x3 matrix.
actually you don't need to worry about it, but it is always good to know
what you are doing. i can recommend literature about 3d computer
graphics or 3d game programming. especially in last mentioned books, the
transformation matrices are usually explained very understandable. i
will try to sum up the most important stuff about it here.
at the beginning you have seperated matrices for the translation, the
skaling and rotation. they are encoded like this:
Translation T =
(1,0,0,0)
(0,1,0,0)
(0,0,1,0)
(tx,ty,tz,1)
the translation vector is therefor placed in the last line of the
matrix, the rest looks like a unit matrix.
Scaling S =
(sx,0,0,0)
(0,sy,0,0)
(0,0,sz,0)
(0,0,0,1)
the rotation matrix is somehow more complicated and results from 3
seperated rotation matrices, one for the rotation around each axis
(x,y,z). put together the rotation is encoded in the upper left 3x3
matrix, for details see the literature.
Rotation R =
(r1,r2,r3,0)
(r4,r5,r6,0)
(r7,r8,r9,1)
(0, 0, 0, 1)
luckily one can multiply the matrices together. if you do it in the
right way, you will end up with one transformation matrix, the one
freesurfer offers: A = T * S * R
in A everything is included, the translation, the scaling and the rotation.
it doesn't really matter that the matrix is 4x4, but of course you can
only multiply it with a 4-dimensional vector for transformation purposes.
to do so, you just have to expand the familiar 3-dimensional vector by
one dimension and put in a 1 at the 4th dimension.
Vector v =
(x)
(y)
(z)
(1)
now you will be able to multiply this one with the 4x4 transformation
matrix and you will end up with the transformed point. you just have to
ignore the 4th dimension of the vector, or you can change it back to a
3-dimensional one, by just cutting away the 4th dimension.
v * A = v_transformiert
i hope i was able to help you with this problem. good luck!
greetings,
patrick
p.s.: i got a question about using this mailinglist: did i answer
correctly to Iris' email, so that everyone gets the answer and it will
show up in the mailing list archive?
Steinmann, Iris schrieb:
Dear Freesurfers,
I have a question concerning the register.dat. In Freesurfer-Wiki I found that
sentence:
'The last four lines of register.dat have the values of the registration matrix
that converts a location in anatomical space to a location in functional space'
I want convert one special point from my high resolution anatomical space
(256x256) to my low resolution functional space (64x64). So I want apply the
register.dat-Matrix to the Vektor from this point in anatomical space. But why
is it an 4x4 Matrix? I supposed that I need an 3x3-matrix for an translation in
x,y,z-direction.
How can I get this anatomical point in my functional space?
Thanks for your answer
------------------------------------------------------------------------
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer