Summary of fMRI Preprocessing Steps in the SPM Template Scripts


This is a list of descriptions of the various preprocessing steps included in the SPM fMRI preprocessing template batch scripts. They are presented in the order in which they are applied in the SPM template scripts.

0. Selection of Image Volumes to Preprocess (“3D to 4D File Conversion” and “Expand Image Frames”)

These two modules are in place to allow the script to easily handle input data that are in the form of a single 4D file or many separate 3D files. While their main function is mostly to make sure the volume list passed to the Slice Timing module is in the correct format, this is also where any pre-steady-state(*) image volumes can be excluded from the preprocessing. Note: pre-steady-state volumes (a.k.a. “disdaqs”) may have already been excluded from the data before being exported from the scanner.

1. Slice-Time Correction (“Slice Timing”)

This module adjusts the fMRI signal of every slice in order to correct for the fact that not all slices were actually acquired at the same time. Between the first slice acquisition and the last slice acquisition of each volume, almost an entire TR (usually 2 seconds) has passed. This time difference is not insignificant given the temporal scale of the hemodynamic response. Slice-Time correction interpolates the signal of each slice to the timing of a desired reference slice in order to account for this temporal discrepancy.

2. Motion Correction (“Realign: Estimate & Reslice”)

This module spatially realigns each volume of the fMRI series to a reference volume using a 6-parameter affine transformation (rotation and translation about and in the x, y, and z axes). This is meant to correct for movement of the participant’s head in the scanner during acquisition, so that each image voxel represents the same 3D chunk of tissue throughout all time-points.

3. Segmentation of T1 and Calculation of MNI152-Space Transforms (“VBM8: Estimate & Write”)

This is a (well-known) third-party module for SPM that creates white matter, grey matter, and cerebral spinal fluid masks from the T1 image. In the process, it moves the T1 to standard MNI-152 space using a non-linear, diffeomorphic warp. Although the MNI-space version of the T1 is not saved, the module does write out the transform data necessary to carry out this transformation. Segmentation masks are stored in the native T1 space (i.e. not MNI).

4. Creation of a Brain Mask from the T1 Data (“Image Calculator”)

In general, the Image Calculator module can be used to carry out mathematical operations on image data. In this case, it is used to piece together the three segmentation masks created by VBM8 into a full-brain mask (just by adding the three segmentation masks together).

5. Skull-Stripping the T1 Image (“Image Calculator”)

This instance of Image Calculator multiplies the T1 image by a binarized (voxels equal to 1 if they are in the mask, 0 outside the mask) version of the brain mask created in the previous Image Calculator. The resulting image only contains the brain.

6. Register the fMRI to the T1 (“Coregister: Estimate”)

This module spatially registers the fMRI image to the T1 using an affine transformation. In general, the two images should be very close to each other before this step. Coregistration is meant to account for any participant head movement between the acquisition of the T1 and the acquisition of the fMRI data.

7. Move the T1 to Standard MNI-152 Space (“Deformations”)

This module applies the deformation field created by the VBM8 module to the skull-stripped T1, creating a version of the T1 in standard MNI-152 space.

8. Move the fMRI Data to Standard MNI-152 Space (“Deformations”)

As with the T1, this module applies the deformation fields created by VBM8 to the fMRI data. Because the fMRI data have been coregistered to the T1, the deformation field created for the T1 can be used on the fMRI data. This module also uses a pre-existing 3D template image to write the transformed fMRI data into a grid space with voxel sizes similar to those of the original fMRI data rather than the T1 data. T1 voxels sizes are much smaller. fMRI data files resampled to a T1 grid-space are very, very large.

9. Spatial Smoothing of the fMRI Data (“Smooth”)

This module applies a 3D spatial smoothing kernel to each fMRI volume. The template uses a default kernel full-width at half-max. (FWHM) of 6mm in each direction. Smoothing of fMRI data is generally done in an attempt to “average out” some of the random noise while maintaining neural activity-related signal.

10. Create Quality Assurance Pictures and Metrics (“QArunall”)

This is a module I wrote to quickly and automatically create some initial quality assurance (QA) information on the T1 and fMRI images. It is meant to provide a look at the general quality of the image data. More information about the output from this module can be found in the documentation file, QA_output_notes.docx.

11. Clean Up (“Move/Delete Files”)

This module deletes several intermediate image files once everything has run, which can save a lot of hard drive space in the long-run.


(*)Before the first excitation pulse the longitudinal (in line with the main magnetic field) component of the hydrogen nuclei group magnetization is at a maximum. After the first pulse the longitudinal component is decreased and begins recovering at an exponential rate based on the degree to which it was decreased (The excitation pulse knocks a portion of the hydrogen nuclei into a high-energy state in which their magnetic moments are anti-aligned to the main magnetic field. These then randomly return to the initial lower-energy state. The rate at which hydrogen nuclei are returning to the lower-energy state in the whole sample is thus dependent on the number of hydrogen nuclei in the excited state (dx = a*x), leading to an exponential decay in the whole sample’s longitudinal magnetization.). In steady-state, the longitudinal magnetization is “in synch” with the excitation pulses such that it always returns to the same value before the next pulse arrives. Before this happens, the fMRI signal will be very different between volumes.