fMRI preprocessing
- Rafay Khan

- Jul 22, 2020
- 2 min read
Here I am going to walk through preprocessing fMRI data for analysis the GUI in SPM12 (https://www.fil.ion.ucl.ac.uk/spm/software/spm12/). This whole procedure can also be set up as a batch or scripted.
(Before starting make sure the images are in the right format: https://rafayak.wixsite.com/brains/post/first-things-first-converting-images-to-the-right-format)
Note that there are many steps that can be changed from the procedure described here (e.g. one coregistration step rather than two). This is just a processing pipeline I have used for recent projects.
Before getting started, it's usually convenient to change into the directory where the data is saved. This makes it easier to orient yourself to the location of each file of interest.
Each of the following steps have to be carried out for each subject individually:
Type "spm fmri" in the matlab window
Slice timing correction
Select "Slice timing correction" from the window. This step is used to correct slice-dependent delays caused by shifting the time series of each slice to temporally align all slices to a reference time point.
Data: select all of the functional images from your output for one subject
Number of slices, TR, TA: Each of these depend on your scan parameters
Slice order: This also depends on your scan parameters e.g. if you used a multiband sequence for image acquisition, your slice order will look different than if you used serial image acquisition
Reference slice: Again depends on your acquisition but likely the first number in the slice order
Realignment
Select "Realign: Estimate and Reslice from the window." This step is used to bring all the functional images into an aligned space
Data: select all of the functional images from the last step
Estimation options: All of the options can be left default unless you have reason to change them
Resliced image: Mean image only
All other Reslice options can be left at default
Co-registration 1
Select "Co-register: Estimate." Coregistration is the alignment and overlay of fMRI data from a single subject with that subject's own anatomical image
Reference image: Mean image from the realignment step
Source image: Low-res structural image (T2) for that subject
Other images: None
All other options can be left at default
Co-registration 2
Select "Co-register: Estimate."
Reference image: Co-registered T2
Source image: High-res structural image (T1) for that subject
Other images: None
All other options can be left at default
Normalization
Select "Normalize: Estimate & Write." Here multiple subjects can be run simultaneously.
Data: For each subject select "New subject"
Images to align: Use the co-registered image from the last step (co-registered T1)
Image to write: Slice timing images, realigned images, resliced mean, co-registered structurals
The rest of the options can be left at default. A bounding box can be set as needed (if needed to be different from default).
Smooth
Select "Smooth."
Images to smooth: Normalized images
FWHM: [8 8 8], or a smaller smoothing kernel can be used
All other options at default
Comments