AIMS: SPM format notes

AIMS: SPM format notes



SPM images IO: ***CAUTION***, behaviour change in AIMS 3.1

Date: 2008/01/05

The default settings in AIMS now conform to the SPM2 behaviour, not SPM99 anymore. This affects Aims, Anatomist, Vip and all of our software. User-level options can still override this, of course.
Read the config files documentation.
However to avoid problems, it is recommended to avoid the SPM/Analyze format and to use NIFTI-1 instead: NIFTI is the new standard format used by SPM5, FSL and several other software. Unfortunately NIFTI-1 was not supported in AIMS 3.0 and prior versions. 3.1 supports NIFTI-1.

SPM images IO: ***CAUTION***, behaviour change in AIMS 2.13

Date: 26/11/2003

Image orientation

As SPM2 changed its image storage conventions regarding neurological / radiological images storage compared to SPM99, we had to do something quite similar, but it's kind of a mess:
  • in SPM99:
    • images were considered to be in neurological convention (left/right not flipped) unless a default was changed in SPM settings. This flag affected how images were read.
    • Normalized images were always stored in neurological convention, so in labs (like ours) where images were acquired in radio mode, normalized images were flipped compared to original images.
    • Visualization always showed images in their own mode (no flip when viewing them).
  • in SPM2:
    • images are still considered to be in neurological convention unless a setting is changed in SPM
    • Normalized images are now stored in their original convention, ie following the setting, so radiological images normalized with SPM99 and the same images normalized withg SPM2 are not written in the same direction. The setting is taken into account for calculations (ie internally flipping the normalization template or something like this).
    • Visualization now always shows images in neurological convention, not what it did before.
    • As far as we know, there is no way to know how an image has been written, this means we can't guess if it was normalized with SPM99 or with SPM2, and so we don't know if a normalized image made from a radiological raw image is in neuro or radio convention.
We can't automatically know when reading an image, so YOU have to tell what happened to your images (see below).
In AIMS/Anatomist, it' another mess:
  • in 2.2.x packages and earlier (AIMS 2.12, anatomist 1.29, VIP 2.4):
    • Non-normalized images were always considered to be in radiological convention (left/right flipped) because, er... just because it's the way we use them in our lab...
    • Normalized images were always considered in neurological mode as SPM99 wrote them.
    • Visualization always showed images in radiological convention
    • There was (and is still) no clean way to guess if an image is normalized or not. The only thing we can do is compare the image field of view to those of standard normalization templates used in SPM (like the MNI template), which hopefully have so funny dimensions that we can more or less reliably recognize them. But using a custom template, or using an non-normalized image with the same dimensions as the template, can abuse our detection.
  • in 2.3.x packages and later (AIMS 2.13, anatomist 1.30):
    We can't guess everything, so we now use settings, like SPM does. Like in SPM, a settings configuration is not able to read correctly every image. You will have to change Aims settings when switching between SPM99 and SPM2 images. There is a "site-wide" settings file (located in $AIMS_PATH/shared/aimsrc or $SHFJ_SHARED_PATH/aims/aimsrc), and a "personal" settings file, located if $HOME/.aimsrc. See the configuration file documentation for more details.
    For SPM files, the following parameters can change the behaviour of reading/writing SPM files by Aims:
    • spm_input_radio_convention
    • spm_input_spm2_normalization
    • spm_output_radio_convention
    • spm_output_spm2_normalization
    • spm_force_output_convention
    All these parameters are described in the config file documentation.
    Tags are set in .minf files saved with images in SPM format by Aims/Anatomist, so the next time we read them, we know how to read them.
    These tags are:
    • spm_radio_convention
    • spm_spm2_normalization
    and are the equivalents of the above input/output flags of the settings.

Be careful, any mistake in these options can result in flipped images with left and right switched. This is not always visible at the first sight and can mess a whole study if you don't pay attention to that.

Warning: VIP library and commands have not changed, they are still in "SPM99/radiological" mode.

4D volumes

SPM99 could not read 4D Analyze/SPM images. It used to read/write series of 3D volumes, so a 4D volume had to be split. SPM2 now supports 4D volumes.

AIMS 2.12 and earlier versions followed SPM rule when writing 4D volumes: they were split into a series of 3D volumes. Aims 2.13 is able to write 4D volumes that can be read by SPM2. The behaviour of AIMS is determined by an option in the settings file: spm_output_4d_volumes. This variable is 1 if not specified (4D enabled), but is disabled by default in the global config file going with the AIMS 2.13 distribution so as to keep complete compatibility with SPM99.

4D Volumes saved as 3D series can now be read as a 4D volume if:

  • they were saved by AIMS 2.13 or later
  • the first volume of the series is given as input to Aims or Anatomist
  • Aims 2.13 saves indications about the series (timesteps number, files in the series) in the .minf header of the first 3D volume.

    Note: AIMS 2.12 and earlier had a bug and did not write correctly 4D volumes as a series, the .minf meta-header should be removed from those volumes, and they cannot be re-read as a 4D volume (unless the .minf is manually fixed).