Statistical Parametric Mapping (SPM)

SPM is provided by the Wellcome Trust Centre for Neuroimaging at UCL.

We currently provide support for SPM 8 and SPM 12.

Nia Goulden's notes on how to use SPM.

Data setup

I usually have a folder for each subject with the raw data, the pre-processed data also gets saved here. I then have a separate folder called 'Analysis' and save each person's first level analysis in there, as well as any second level analyses.

Runs in Matlab, SPM code simply needs to be downloaded to use (www.fil.ion.ucl.ac.uk/spm)

Download the code for the latest version of SPM (currently SPM12)

Code needs to be unzipped and saved

Also download and install any updates (overwrites the other version of the code)

In Matlab go to File → Set Path, then click 'Add with subfolders' then select the folder where the SPM code is saved

To start SPM for fMRI analysis either type in 'spm' in the Matlab window, press enter, and then select 'fMRI' from the modality options in the popup window or type in 'spm fmri' in the command window

In SPM jobs need to be specified in the order that you want them done so I will specify which steps were taken – jobs can be saved and used for the next subject, simply changing the data

Some of your fMRI data may not be included in the analysis. At the beginning of the scanning session T1 effects will dominate the image and so these scans are usually not included in the analysis. Typically the first 4-5 scans would be discarded.

Go to TASKS and BATCH to get a job window up, then to add each of the following jobs go to SPM and Spatial:

(This analysis information comes from the manual)

Realignment – data all aligned to first scan, estimates translation and rotation relative to the first image, also produces a mean image

1. Go to 'Realign' and select 'Realign: Estimate & Reslice' to estimate the realignment parameters and reslice the image

2. Select 'Data' and then 'New Session'

3. Select 'Specify Files' and select your data, a filter can be used if that is easier

Coregister (estimate) – Parameters to register functional data to structural image are estimated at this stage

1. Go to 'Coreg' and select 'Coreg: Estimate'

2. Click on 'Reference Image', click 'Dependency' (bottom right of window) and select “Mean Image” to use the mean image from the realignment

3. Click on Source Image and add in the structural (T1-weighted) image

Segment – Structural image is segmented to gray matter, white matter and CSF and normalised to standard space (Montreal Neurological Institute (MNI) space)

1. Select 'Segment'

2. Click on Data, click 'Dependency' and select 'Coregistered Images' to use the coregistered anatomical image

Normalise (write) – Normalises the functional data to MNI space using the parameters from the coregistration and the segmentation

1. Go to 'Normalise' then 'Normalise: Write'

2. Change any necessary parameters from bounding box, voxel size and interpolation (double click to change something, I would normally only change the voxel size)

3. Go to Parameter File, click on 'Dependency' and select 'Norm Params File Subj → MNI (Subj 1)'

4. Go to Images to Write, click on 'Dependency' and select 'Resliced Images (Sess 1)'

Smooth – Convolves the data with a gaussian kernel of 6mm in each direction

First level analysis – Specify the design of the task to apply the general linear model (glm)

1. Select 'Smooth'

2. Double click to change 'FWHM'. This stands for full width at half maximum, it is the width of the Gaussian kernel at half it's height. This is normally 3 times the voxel size.

3. Go to Images to Smooth, click on 'Dependency' and select 'Normalised Images (Subj 1)'

First-level Analysis – Analyse the data for a single subject

1. Go to SPM → Stats and select 'fMRI model specification'

2. Enter the “Units for design” (I would normally choose seconds but it depends whether it is easier for you think of your task in terms of the number of scans) and the “Interscan interval” (the TR of your experiment)

3. Click on 'Data & Design' and add a new 'Session', add in your conditions to define your experiment i.e. for this task add in a condition, call it 'Stimulus', then specify the onset times for the stimulus blocks and the block duration (42s, only needs to be entered once because all block durations are the same, if you had blocks of differing lengths you would need to enter the duration for each block), note that we do not need to specify the baseline. SPM will then estimate how closely the activity in each voxel follows this pattern.

Select the Directory for the analysis to be written to

Go to scans, click on 'Dependency' and select 'Smoothed Images'

If you have an event-related task with different onsets for each subject, if you save the onsets for each subject in a file you can then load that file

If you have a factorial design you can specify the different factors by clicking on 'Factorial design'

Also if you have more than one session you can enter more than one session

It is possible to use the parameters estimated from the realignment as regressors of no interest, to do this click on 'Multiple regressors', click on 'Dependency' and select 'Realignment Param File (Sess 1)'

4. Go to SPM → Stats and select 'Estimate' and select 'Classical' (It is possible to perform a Bayesian estimation)

Click on Select SPM.mat, click on 'Dependency' and select 'SPM.mat File (Design&Data)'

5. Go to SPM → Utils → Contrast Manager

Go to Select SPM.mat, click 'Dependency' and select 'SPM.mat File (Estimation)'

This is where you define the contrasts for your experiment. It is possible to specify t-contrasts (which assess signal change in one direction) or F-contrasts (which will report signal change in either direction). For this data we would specify a t-contrast of 1 (because we only have one condition which will be compared to activity in the baseline period (SPM treats any undefined periods of time during the task as a baseline))

You are finished specifying the job so press 'Save' to save it and then click on the green arrow to run the job. You can use this job for other subjects, just change the functional and anatomical data.

Group Analysis

1. In the SPM top left window click on 'Specify 2nd-level'

2. Click on Design and one-sample t-test (you can also do two-sample t-tests, paired sample t-tests, ANOVAs)

3. Click on 'Scans' and select the contrast you are interested in (e.g. contrast number 1, which would be named con001) for each subject (so select each subject's con001).

4. Run this job, save it.

5. Go to estimate, select the SPM.mat and run the job.

6. Look at results as for first level analysis, either specify contrasts using the contrast manager as before or from the pop-up window (Just go to t-contrast, give it a name and enter 1 for the contrast).