The sn.mat files combine an affine transform with a small deformation,
parameterised by a linear combination of a few 3D cosine transform basis
functions. You may find it easier to work with y_* files generated by the
Creating an average will be a lot more difficult than you anticipate.
You probably need to combine the displacements with the affine transforms.
Averaging affine transforms can be achieved as described in eg
Characterizing volume and surface deformations in an atlas framework: theory,
applications, and implementation
NeuroImage, Volume 18, Issue 3, March 2003, Pages 769-788
Roger P. Woods
You could probably also opt for a Procrustes method, which would involve
factoring out translations, rotations and possibly an isotropic zoom. There
is code for this in spm8/toolbox/Seg/spm_get_closest_affine.m or
spm8/spm_prep2sn.m . After factoring out the affine transforms, the
displacement fields could probably be dealt with is a relatively simple way.
Shapes do not actually add and subtract in a nice linear way. However, if
displacements are small enough, then linear approximations are probably a
reasonably close Taylor series approximations. If you want the maths, then
there are a few textbooks by authors such as Ian Dryden. If you want the full
maths, then try books by Ron Kimmel or Ulf Grenander.
On Wednesday 25 March 2009 02:58, Anton Orlichenko wrote:
> Dear SPM experts,
> This may sound like a dumb question, but how does spm5 warp images
> with displacement fields, such as those derived from an _sn.mat file?
> I have looked at the code but would be really grateful if someone
> could say a few words about the subject.
> The reason I ask is that I'm trying to get an average deformation from
> several different deformations. I read in displacement fields and take
> the average. This mostly works except but I apply the average
> deformation to an image I get a result that is to my eye the correct
> shape but shifted and rotated.
> Has anyone here tried doing something similar? If so how did you go about