Hello Freesurfer Forum,
We have a question about the M matrix, found in the .mgz file header.
We loaded an .mgz file into Matlab and took a look at the affine transform matrix M from the header:
M(1,:) = [-1 0 0 132.7486]; M(2,:) = [ 0 0 1 -105.7281]; M(3,:) = [ 0 -1 0 131.7424]; M(4,:) = [ 0 0 0 1 ];
Let's call these numbers:
M(1,:) = [ a 0 0 xt ]; M(2,:) = [ 0 0 c yt ]; M(3,:) = [ 0 b 0 zt ]; M(4,:) = [ 0 0 0 1 ];
We interpret a b and c as controlling rotation. xt yt zt govern translation. However, we cannot see how this matrix controls scaling.
We were expecting to see the following:
M(1,:) = [ xs 0 0 xt ]; M(2,:) = [ 0 ys 0 yt ]; M(3,:) = [ 0 0 zs zt ]; M(4,:) = [ 0 0 0 1 ];
...where xs yx zs control scaling. In our empirical matrix they do not seem to be serving that function. (xs appears to be used for rotation only, ys and zs are zero).
So the first question is: does the matrix control scaling, and if so, how?
The second question: Is the scaling built into the image, such that each voxel is 1mm by 1mm by 1mm? If so, how can the program tell when this is the case, and when it is not? Does ndim1 represent the number of voxels in that dimension, or the distance across that dimension in millimeters? Does ras_good_flag simply indicate that the image is in the proper orientation, or does it also indicate that each voxel in the image measures 1mm x 1mm x 1mm?
Thanks for your help.
Jerry Chen and Geoff Pope
Hi Jerry and Geoff,
when you compose a scaling and rotation matrix it's no longer so easy to assign a meaning like "x scaling" to any one component.
cheers, Bruce
On Thu, 12 Jul 2007, Jerry Yeou-Wei Chen wrote:
Hello Freesurfer Forum,
We have a question about the M matrix, found in the .mgz file header.
We loaded an .mgz file into Matlab and took a look at the affine transform matrix M from the header:
M(1,:) = [-1 0 0 132.7486]; M(2,:) = [ 0 0 1 -105.7281]; M(3,:) = [ 0 -1 0 131.7424]; M(4,:) = [ 0 0 0 1 ];
Let's call these numbers:
M(1,:) = [ a 0 0 xt ]; M(2,:) = [ 0 0 c yt ]; M(3,:) = [ 0 b 0 zt ]; M(4,:) = [ 0 0 0 1 ];
We interpret a b and c as controlling rotation. xt yt zt govern translation. However, we cannot see how this matrix controls scaling.
We were expecting to see the following:
M(1,:) = [ xs 0 0 xt ]; M(2,:) = [ 0 ys 0 yt ]; M(3,:) = [ 0 0 zs zt ]; M(4,:) = [ 0 0 0 1 ];
...where xs yx zs control scaling. In our empirical matrix they do not seem to be serving that function. (xs appears to be used for rotation only, ys and zs are zero).
So the first question is: does the matrix control scaling, and if so, how?
The second question: Is the scaling built into the image, such that each voxel is 1mm by 1mm by 1mm? If so, how can the program tell when this is the case, and when it is not? Does ndim1 represent the number of voxels in that dimension, or the distance across that dimension in millimeters? Does ras_good_flag simply indicate that the image is in the proper orientation, or does it also indicate that each voxel in the image measures 1mm x 1mm x 1mm?
Thanks for your help.
Jerry Chen and Geoff Pope _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
These types of issues are discussed at length in:
https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems?action=AttachFil...
if you just want to get the voxel size from M, then you can compute the sqrt of the sum of each col.
doug
Jerry Yeou-Wei Chen wrote:
Hello Freesurfer Forum,
We have a question about the M matrix, found in the .mgz file header.
We loaded an .mgz file into Matlab and took a look at the affine transform matrix M from the header:
M(1,:) = [-1 0 0 132.7486]; M(2,:) = [ 0 0 1 -105.7281]; M(3,:) = [ 0 -1 0 131.7424]; M(4,:) = [ 0 0 0 1 ];
Let's call these numbers:
M(1,:) = [ a 0 0 xt ]; M(2,:) = [ 0 0 c yt ]; M(3,:) = [ 0 b 0 zt ]; M(4,:) = [ 0 0 0 1 ];
We interpret a b and c as controlling rotation. xt yt zt govern translation. However, we cannot see how this matrix controls scaling.
We were expecting to see the following:
M(1,:) = [ xs 0 0 xt ]; M(2,:) = [ 0 ys 0 yt ]; M(3,:) = [ 0 0 zs zt ]; M(4,:) = [ 0 0 0 1 ];
...where xs yx zs control scaling. In our empirical matrix they do not seem to be serving that function. (xs appears to be used for rotation only, ys and zs are zero).
So the first question is: does the matrix control scaling, and if so, how?
The second question: Is the scaling built into the image, such that each voxel is 1mm by 1mm by 1mm? If so, how can the program tell when this is the case, and when it is not? Does ndim1 represent the number of voxels in that dimension, or the distance across that dimension in millimeters? Does ras_good_flag simply indicate that the image is in the proper orientation, or does it also indicate that each voxel in the image measures 1mm x 1mm x 1mm?
Thanks for your help.
Jerry Chen and Geoff Pope _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
freesurfer@nmr.mgh.harvard.edu