By members and collaborators of the Functional Imaging Laboratory



SPM2 is very old now. Consider using SPM12.


SPM2 is a major update to the SPM software, containing substantial theoretical, algorithmic, structural and interface enhancements over previous versions.

Previously, SPM has used unbiased ordinary least squares (OLS) estimators that, under assumptions of identically and independently distributed errors (i.i.d. or sphericity) are the same as maximum likelihood (ML) estimators.

SPM2 now uses restricted maximum likelihood REML estimates of variance components (pooled over voxels) to allow departures from i.i.d. assumptions. The ensuing non-sphericity estimates are then used to form ML estimates using weighted least squares (WLS). This increases the scope of data that can be analysed with SPM and provides more efficient and precise [hyper-]parameter estimates.

Classical inference about parameters, or contrasts of the model parameters, proceeds using conventional parametric statistics to provide P values pertaining to the maxima, spatial extent of voxel-clusters or number of clusters. These P values are used to reject the null hypothesis. The P values have to be adjusted to protect against family-wise false-positives over the search volume. This adjustment uses a Random Field Theory (RFT) correction that, for spatially extended continuous data, plays the same role as a Bonferroni correction does with discrete data.

In addition to WLS estimators and classical inference, SPM2 also supports Bayesian estimation and inference. In this instance the statistical parametric maps become posterior probability maps Posterior Probability Maps (PPMs), where the posterior probability is a probability of an effect given the data. There is no multiple comparison problem in Bayesian inference and the posterior probabilities do not require adjustment.

These web pages provide further details of new features and structural and functional improvements in the software.


SPM2 is available for download but we ask you to complete a registration form prior to downloading. Having completed the form, you will be directed to the download location, via a keyword enabled URL. You should also periodically check the updates.


Updates to the software that fix known bugs will be posted on the list, and described in the README.txt file in the SPM2_updates download area, at http://www.fil.ion.ucl.ac.uk/spm/download/spm2_updates.


You need the following to run SPM2:

  • MATLAB 6.0 - MATLAB 6.5: Matlab is a high level numerical mathematics environment optimised for operations on untyped matrices. It's syntax is close to that of matrix algebra, making the code an effective pseudo-code for the algorithms, and leading to fast development times. SPM2 is written for Matlab 6.0, and may not work with earlier versions. Matlab is produced by The MathWorks, Inc. Natick, MA, USA. SPM2 requires only core Matlab to run (no special toolboxes are required).
  • Whilst the majority of the code is implemented as Matlab M-files & functions containing standard Matlab commands, a number of features specific to the UNIX version have been used. SPM also uses external C programs, linked to Matlab as C-mex files, to perform some of the more computationally intensive operations. Some of these latter C programs use direct system calls to implement SPMs "memory mapping", mapping disk resident image volumes into memory.
    • Pre-compiled binaries are provided with the distribution for Solaris2 (*.mexsol), Linux (*.mexlx), and Windows (*.dll). If you are lucky, you may be able to get SPM2 running under MacOS X (but no Deformations toolbox). For these platforms you only need Matlab.
    • For other UNIX platforms, you will need an ANSII C compiler to compile external mex files. A Makefile is provided with the distribution, configured for various platforms. If you have to tweak the Makefile to compile the SPM mex-files for your platform, please send us the details so we can include them in the distributed Makefile. Additionally, if you send us the compiled binaries, we would be happy to host archives of compiled mex-files in the user contributions area, for other users benefit.
  • SPM uses the simple header and flat binary image file format of ANALYZE-7 (Mayo Clinic, Rochester, USA.), with slight customisations to the header. See "Data Format" in the online help [spm_format.man in the distribution]. SPM can also read some MINC & ECAT-7 images. A utility is provided that will convert DICOM files into a form that SPM2 can work with. It has been tested with data from our Siemens Sonata and Allegra scanners, but may not work as well for data from other systems. Information about other image format conversion utilities can be found at http://www.mricro.com/mricro.html#DICOM.


Although SPM2 still uses the Analyze file format, and will therefore read image files from previous versions of SPM, there are differences in the algorithms, templates and models used in SPM2 over previous releases. Therefore, we recommend you use a single SPM version for any given project.

One thing to watch out for is the image orientation. The proper Analyze format uses a left-handed co-ordinate system, whereas Talairach uses a right-handed one. In SPM99, images were flipped at the spatial normalisation stage (from one co-ordinate system to the other). In SPM2, a different approach is used, so that either a left- or right-handed co-ordinate system is used throughout. The SPM2 program is told about the handedness that the images are stored with by the spm_flip_analyze_images.m function and the defaults.analyze.flip parameter that is specified in the spm_defaults.m file. These files are intended to be customised for each site. If you previously used SPM99 and your images were flipped during spatial normalisation, then set defaults.analyze.flip=1. If no flipping took place, then set defaults.analyze.flip=0.

Check that when using the Display facility (possibly after specifying some rigid-body rotations) that:

  • The top-left image is coronal with the top (superior) of the head displayed at the top and the left shown on the left. This is as if the subject is viewed from behind.
  • The bottom-left image is axial with the front (anterior) of the head at the top and the left shown on the left. This is as if the subject is viewed from above.
  • The top-right image is sagittal with the front (anterior) of the head at the left and the top of the head shown at the top. This is as if the subject is viewed from the left.