Hello,
The data are stored in a proprietary Matlab form. To just store an identity
matrix for files named Vol_01.img and Vol_01.hdr, use the following code:
mat = eye(4);
M = eye(4);
save Vol_01.mat M mat
The final line saves the variables from the workspace called M and mat to the
file Vol_01.mat. The M matrix is described in spm_format.man, and was used in
previous versions of SPM. The mat matrix is essentially similar, but may
contain a flip in the R-L dimension, and removes ambiguity about whether or not
to flip the images during normalization. There was a lot of helpful discussion
about orientation back when SPM2b came out.
If you are using a separate program to generate the matrices, be sure to
understand the differences between the M and mat matrices, and check your work
carefully- personally Ive found it is very easy to make a mistake in this area.
Ken
Quoting Kathleen Ores Walsh <[log in to unmask]>:
> Is there any spm code to apply a transformation matrix to a volume?
>
> Say, given a matrix M and an image I.img, that does not have any
> associated .mat file with it, is there a way in SPM2/Matlab to apply a
> transformation matrix M, that I have created externally, ie just input into
> Matlab? Basically, I want to create the subsequent .mat file and then be
> able to reslice I.img using that .mat file.
>
> Thank you in advance.
>
>
> Kathleen Ores Walsh
>
----------------------------------------------------
Ken Roberts
Woldorff Laboratory
Center for Cognitive Neuroscience, Duke University
(919) 668-1334
----------------------------------------------------
|