The official website for SPM can be found here.

This page describes the processes used to analyse fMRI data using SPM in its GUI mode.

DICOM Conversion

The output files from a scan are not in a format that can be processed by SPM, so they have to be converted to the DICOM format. This can be done using SPM, or a seperate package such as MRI convert.


Coregistration refers to the spatial alignment of a series of images. The subject's T1 anatomical image needs to be coregistered to the T1 template at the start of pre-processing the scan data. Further coregistration is done later on in the process, using images from each run of the scan.

  1. On the SPM menu, click "Coregister," and from the drop-down menu select "Est and Res" (estimate and reslice).
  2. For the "Reference Image", navigate to the following path: Documents --> MATLAB --> spm8 --> templates, and select the T1.nii file.

  3. For the "Source image", navigate to the folder containing the subject's T1 anatomical image (labelled mprage), and select the image file.
  4. Leave all the other settings as they are, save and run the batch.
  5. The newly coregistered image should be saved in the mprage folder.


Each run of each scan contains a few dummy runs in the beginning of the scan, which should be kept seperate from the rest of the data as it can have an influence on later processing.


The next step is realignment (aka motion correction). This step registers all the images of a specified run from one subject to each other, and gives us information regarding how much the subject moved their head during the scan. This information is later used to ensure that functional images are accurately mapped onto structural ones.

  1. On the SPM menu, click "Realign," and from the drop-down menu, select "Est and Res".
  2. Under the "Data" heading, use the "Session" file selector to select all the converted DICOM files of the specified run for the subject.
  3. For "Estimation options," "Quality" controls the quality of the images generated, on a range of 0 to 1. The "Interpolation" option also increases quality of images, with higher degree B-Spline options producing higher quality images. This should be changed to a minimum of "4th Degree B-Spline." The rest of the "Estimation Options" can be left as they are.
  4. Under "Reslice Options," the "Resliced Images" option should be changed to "Mean Image only". The rest of the options can be left as they are. Save and run the batch.
  5. Repeat for all images in each run of the scan.


This step of coregistration is slightly different from the one completed previously; here, we coregister each image of a run to the coregistered image we generated earlier.

  1. For the "Reference Image," navigate to the anatomical image folder, where the coregistered anatomical image should be saved (the file starting with r), and select it.
  2. For the "Source Image," navigate to the folder of the run you want to coregister and select the mean image that was generated during the realignment phase (the file starting with the word "mean").
  3. For the "Other images," select the whole series of images EXCEPT the mean image.

  4. The rest of the options can be left as they are. Save and run the batch. Repeat for each run.


Add a section in for this around here.


Spatial smoothing is a tool used to cope with functional anatomical variability not compensated by normalisation and improves the signal to noise ratio.

  1. On the SPM menu, click the "Smooth" button.
  2. For the "Images to smooth" section, navigate to a folder containing one run of subject, and select all of the riles with the prefix "r" EXCEPT the mean images. These "r" prefix images were generated during the coregistration step.

  3. "FWHM" refers to the size of voxel that you want to smooth. This can be changed according to your study (but should be the same in each run). We tend to use "6 6 6".
  4. Leave the other options as they are and run the batch.


  1. Click the "Specify 1st-level" button on the SPM interface.
  2. For the directory, navigate to the folder where you want your statistical analysis to be output. Put some run information in the folder name, so you can identify folders with specific analyses later.
  3. For the "Units of design," select seconds. For the interscan interval, enter the duration of each of your scans in seconds (usually 1s for multiband and 2.5s for non-multiband but check the specific durations for your experiment).
  4. Under "Data & Design," select "New:Subject/session," and for "Scans," select the newly smoothed files, which have the "s" prefix (make sure the mean files are not selected). Under "Conditions," select "New:Condition."

  5. Each condition of a study is represented by a "New:Condition" option. For example, if you are analysing left hemisphere actiavtion vs right hemisphere activation in the visual cortex, You would name your condition left or right, set stimulus onsets and durations for each condition depending on your study. The "Time modulations" and "Parametric Modulations" options can be left unchanged, as can all of the following options.

  6. Once the conditions are set up, save and run the batch.


  1. For this step, click "Estimate" on the SPM menu, and select the SPM.mat file you just generated from the folder you saved it in.
  2. Leave the other options as they are and run the batch.


  1. Click the results button on the SPM interface. Navigate to the folder where your estimated SPM.mat file is saved and select it.
  2. In the SPM contrast manager, click "Define new contrast..." For this example, where we continue the comparison between left and right hemisphere visual cortex activation, one of the contrasts will be left vs. right. Assuming that the left visual stimulus was onset before the right, the design matrix should be named "Left > Right", and filled as 1 -1. After entering these values in the box, press submit, and the design matrix in the dialogue box should highlight the targetted contrasts. Then click OK.

  3. Now select your Left > Right contrast and press "Done.

  4. On the results window, select "none" for "apply masking," hit enter when the title for comparison is shown, press none for the "p value adjustment," decide on the threshold p value (eg. 0.001), and the number of voxels you want in your extent threshold (eg. 5).
  5. To see activation over a 3D image of the subject's brain, click overlay, and select your co-registered mprage anatomical image.

rapwiki: StatisticalParametricMapping (last edited 2016-07-15 19:03:43 by RafayKhan)