SPM sn3d to AIMS transformation converter

Extracts the affine part of a SPM normalization transformation (*_sn.mat or *_sn3d.mat) and converts it to an Aims transformation file

Description

Only the affine part of SPM transformation is extracted from matlib files. Elastic deformations are not handled by Aims/Anatomist. If tou want to keep non-linear information from the norlalization, apply the normalization in SPM and save the normalized volume (n*.img under SPM99 or w*.img under SPM >= 2).

This process does not use Matlab any longer, and reads the .mat files thanks to the scipy Python module, which is a great improvement for those who, like me, do not have Matlab.

Remarq: internal coordinates systems (referentials) used by SPM and Aims are completely different. So in addition to the matrix extraction itself, some coordinates conversions are done. This is why you don't find in the output .trm file the contents of the affine matrix of SPM. For more information about referentials and transformations, see http://brainvisa.info/doc/html/aims/en/referentials.html.

The output transformation has as source referential the AIMS referential (x: right to left, y: front to rear, z: top to bottom, origin in the center of the first voxel right, front, top) of the source volume, and as destination referential, depending on the target parameter value:

Note that the normalized_volume parameter is only used in this last case target = normalized volume in AIMS orientation.

Parameters

read: SPM normalization matrix ( input )
SPM normalization file (SPM99: *_sn3d.mat or SPM2: *_sn.mat)
write: Transformation matrix ( output )
Aims transformation file
target: Choice ( input )
Specifies to which referential the converted transformation should transform to. Depending on this parameter value, the normalized_volume will get used or not.
source_volume: 4D Volume ( optional, input )
Source volume used to perform the normalization, but which is not resampled in the normalized space. Any other volume with exactly the same field of view (number and size of voxels) could be used instead.
normalized_volume: 4D Volume ( optional, input )
SPM-normalized volume. This file is only used in the case target = normalized volume in AIMS orientation. If it is not used, the extracted transformation will be the transformation between the original referential to the normalization template.
removeSource: Boolean ( input )
If this parameter is set to True, the original matlab file is erased after conversion. This option is strongly unadvisable since it can lose some precious information. Use it only if you exactly know what you are doing.

Technical information

Toolbox : Tools

User level : 0

Identifier : SPMsn3dToAims

File name : brainvisa/toolboxes/tools/processes/converters/SPMsn3dToAims.py

Supported file formats :

read :
Matlab file
write :
Transformation matrix
source_volume :
NIFTI-1 image, SPM image
normalized_volume :
NIFTI-1 image, SPM image