Hi Jim,
>
> I wonder how the .mat file that is created with reorientation relates to
> the new origin. For example, if I have the Source image and the .mat file,
> how is the .mat file used to create the Destinantion. The reorientation
> looks good but the numbers in what I thought was the translation column in
> the matrix are (I think) very high, sometimes > FOV/2.
>
They would appear a bit high, wouldn't they?
Here is a typical .mat file for a 64x64x64 EPI image volume
M =...
[3.0000 0 0 -97.5000;...
0 3.0000 0 -97.5000;...
0 0 3.0060 -94.6894;...
0 0 0 1.0000];
This is in fact the .mat file of the first image in a time-series (i.e. the
reference), so by definition there are no movements here. Why then the large
values in the third column (the translations)?
I think of this as the image->world matrix, i.e. the mapping between
voxel-coordinates and metric (mm) coordinates. Let us say we have a voxel at
coordinates [30 25 12]. We can then "translate" that into world coordinates
by the operation
wc = M*[30 25 12 1]'
Any "proper" reorientations will then be applied on the world coordinates.
For example if we want to rotate (in-plane) the image by 45 degrees we would
do it like
R = spm_matrix([0 0 0 0 0 45*pi/180])
and then apply this rotation matrix to all world coordinate vectors
corresponding to original voxel centers. So for the coordinate above we would
get
rwc = R*wc
or
rwc = R*M*[30 25 12 1]'
The final thing we need to do is to map the transformed coordinates back into
voxel-coordinates (cause after all, that is how we address the intensity
values in the image) and we do that by
vrwc = inv(M)*rwc
or
vrwc = inv(M)*R*M*[30 25 12 1]'
Now what is then the relation to a sample .mat file for a single image
volume?
There these operations have been combined so that if we assume that the
transformation from a given image volume (i) to the reference image is given
by R, then the corresponding .mat file for that image will be
M_i = inv(R)*M
such that the mapping above can be created by
vrwc = inv(M_i)*M*[30 25 12 1]' = inv(M)*R*M*[30 21 12 1]'
So, why do we need the world-coordinates in the first place then?
Two reasons
1. It will set the center of rotation to the middle (or at least typically
close to the middle of the image volume) which makes the outcome of a
rotation much more intuitive to the observer). It is the fourth column that
is "responsible for this".
2. More importantly. If I have a rotation matrix R and apply that directly to
a voxel-coordinate vector (e.g. [30 25 12 1]) it will constitute a "true
rotation" only when the voxel size is identical in all three directions. As
soon as the voxels are anisotropic the effect will be a combination of shear
and rotation. The elements on the diagonal of the upper left 3x3 submatrix is
responsible for that.
Good luck Jesper
>
> Thanks in advance
> Jimmy
>
> --------------------------------------------
> Jimmy Jensen, PhD
> PET centre
> Centre for Addiction and Mental Health
> Clarke Division
> 250 College St.
> Toronto, ON, M5T 1R8
>
> Phone (416) 535-8501 ext. 6280
> Fax (416) 979-4656
|