> I am trying to tweak a few source code files of SPM for VBM analysis
> and I need the following info:
>
> 1. What each of the variables in the sn3D file mean?
>
> Affine: transformation 4x4 matrix for affine transforms
> M: another 4x4 matrix??
> MF: another one!
> MG: and another one!
> mgc: prolly to check endian i think
> Dims: 1. bounding box?
> 2. ??
> 3. voxel sizes
> 4. Center of volume?
> 5. Dims(x,y,z)?
> 6. scale factor??
>
> Transform: The non-linear transform functions ?
Affine is a voxel to voxel affine transformation matrix mapping between voxels in template
and voxels in the image that the parameters were estimated from.
M is not actually in the _sn3d.mat file. It must have been somewhere in your workspace.
MF is the voxel to millimeter mapping from the image that the parameters were estimated from.
MG is the voxel to millimeter mapping for the template image.
mgc is just there to make sure that it really is an sn3d.mat file.
Dims(1,:) - template image dimensions.
Dims(2,:) - dimensions of Transform
Dims(3,:) - voxel size of template
Dims(4,:) - origin of template
Dims(5,:) - dimensions of image that the parameters were estimated from
Dims(6,:) - voxel sizes of this image
Transform are the coefficients of the DCT bases, which need reshaping by [Dims(2,:) 3]
>
>
> 2. After extracting the above values I want to apply them to another image
> volume. I tried tweaking the code of reslice.m (past SPM post), but somehow
> did not work out. Any advice?
>
> * I know you could tell me to press buttons, but i am a command-line guy :)
Providing that the second image is coregistered with the first then the command line is something like:
matname = 'xxxxx_sn3d.mat'; % Name of sn3d.mat file
P = 'xxxxx.img'; % Name of image to transform
Hold = 1; % for trilinear interpolation
bb = [-78 -112 -50 ; 78 76 85]; % Bounding box for normalised image
vxf = [2 2 2]; % Isotropic 2mm voxels
spm_write_sn(P,matname,Hold,bb,vxf)
Note that the coregistration should have been done before the spatial normalisation parameters were
estimated, or the 2nd image was registered to match the first.
Best regards,
-John
--
Dr John Ashburner.
Functional Imaging Lab., 12 Queen Square, London WC1N 3BG, UK.
tel: +44 (0)20 78337491 or +44 (0)20 78373611 x4381
fax: +44 (0)20 78131420 http://www.fil.ion.ucl.ac.uk/~john
|