Sample fMRI Event-Related Design Analysis using SPM

Background

This tutorial describes how to analyze a simple fMRI dataset using SPM8. To complete this tutorial you will need:
  1. MATLAB installed on your computer.
  2. SPM8 installed on your computer.
  3. Download and extract the sample dataset that includes the fMRI data (in NIfTI format), an anatomical scan (e.g. T1-weighted image) and text files that describe the timing.

About the sample dataset

This was a simple finger tapping task. The screen rapidly flashed with an arrow (< or >). When the arrow pointed right (>) they were intstructed to tap their right index finger, and when it pointed left (<) they were requested to push their left index finger. These events repeated for the whole scanning session (302 T2*-weighted volumes, about 10 minutes). The MRI scanner actually recorded 304 volumes, but automatically discarded the first two (as these have T1 effects), with all event onset times referring to the start of the first stored volume. The onsets of the tasks are recorded in the text files (LEVent.tab,REvent.tab). The image below shows the three event types (left, right arrow) as marks at the top of the image (with red and green indicating the changes in hemodynamic responses to left/right movement, and the blue showing hemodynamic increases to periods of rest). The colored lines show the expected HRF response.
task order

Analyzing the dataset

  1. First, start Matlab
  2. from the Matlab command prompt, change to the directory where your data is, e.g. 'cd c:\tutorial' or 'cd "\my documents\tutorial"'
  3. from the Matlab command prompt, launch SPM8 by typing "spm fmri". If SPM does not launch, make sure you have downloaded SPM and it is in your Matlab path.
  4. Setting the origin: SPM's normalization does a great job of aligning brains from different people, but it is pretty sensitive to the origin used as an initial alignment between the image and the template. By default, scanners set the origin to be the center of the scanner, whereas SPM expects this to be the anterior commissure. It is often helpful to set your origin before processing. If you are not familiar with the anterior commissure, see my web page
  5. Lets set the origin. From SPM's menu window, press the "Display" button and select your highest resolution image (in the tutorial, T1s005 is our high resolution T1-weighted image).
  6. FMRI scans usually have spatial distortions that can be minimized by using a field map to measure field inhomogeneities and then djusting the fMRI data. The tutorial data includes fieldmaps data if you want to do this, but that is beyond the scope of this tutorial. If you want to do this, take a look at my fieldmap web page. For our fMRI data, the readout time was 16.96ms (echo spacing = 0.54ms, 32 lines [interpolated to 64 using GRAPPA r=2]), and the fieldmaps used echo times of 4.92 and 7.38ms.
  7. From the main SPM menu window, press the "Batch" button
  8. A new window appears showing the Batch editor. We will use this for a while...
  9. Choose the menu item SPM/Spatial/Realign/Realign:Estimate & Reslice from the Batch window. A new set of items appear to refine our motion correction:
  10. Let's do do slice timing correction (as this is an event-related design). In the Batch Editor window, select SPM/Temporal/SliceTiming.
  11. There are two options for normalization: either to estimate this directly from our EPI-based fMRI data or to use a high resolution T1 scan. In the next step I describe the latter option. However, the block design web page describes how to normalize the fMRI data directly.
  12. Lets normalize our data. From the Batch window, select SPM/Spatial/Segment. Note that we will use the Unifed Normalization Segment function rather than the Normalization function. In general this produces better results, as long as you have a T1 scan with good tissue contrasts.
  13. Lets now apply the normalization parameters to our fMRI data. From the Batch window, select SPM/Spatial/Normalize:Write.
  14. Lets now apply the normalization parameters to our T1 scan. This is useful for checking the quality of our normalization and creating a group mean anatomical scan. From the Batch window, select SPM/Spatial/Normalize:Write.
  15. Now we blur our data with a gaussian. From the Batch window, select SPM/Spatial/Smooth
  16. Now we are ready to set up our statistics. From SPM's main window, press the "Specify 1st-level"