Domain-validated guidance for fMRI preprocessing decisions: motion correction, slice timing, spatial normalization, smoothing, confound regression, and quality control
fMRI preprocessing transforms raw scanner data into a form suitable for statistical analysis. Unlike generic data cleaning, every preprocessing decision in fMRI involves domain-specific trade-offs: choosing the wrong step order can introduce artifacts that mimic neural signal, smoothing at the wrong scale destroys the spatial information needed for multivariate analyses, and failing to correct for susceptibility distortions misaligns brain regions by several millimeters.
A competent programmer without neuroimaging training would get many of these decisions wrong. This skill encodes the domain knowledge required to make correct preprocessing choices for different analysis goals.
Before executing the domain-specific steps below, you MUST:
For detailed methodology guidance, see the research-literacy skill.
This skill was generated by AI from academic literature. All parameters, thresholds, and citations require independent verification before use in research. If you find errors, please open an issue.
The standard preprocessing order is well-established, but branch points exist depending on the analysis type. The canonical order is:
1. DICOM to NIfTI conversion (BIDS format)
2. Discard non-steady-state volumes
3. Slice timing correction (conditional)
4. Motion correction (rigid body)
5. Distortion correction (fieldmap-based)
6. Coregistration (functional to structural)
7. Spatial normalization (to MNI/template space)
8. Smoothing (conditional on analysis type)
Decision points:
Is your TR < 1 second (e.g., multiband)?
|
+-- YES --> Skip slice timing correction; use temporal derivative in GLM instead
| (Sladky et al., 2011; HCP consortium recommendation)
|
+-- NO --> Apply slice timing correction before motion correction
(AFNI and SPM convention; Sladky et al., 2011)
What is your analysis type?
|
+-- Task activation (univariate GLM)
| --> Full pipeline with smoothing (FWHM = 2-3x voxel size)
|
+-- Resting-state connectivity
| --> Full pipeline + aggressive confound regression; smoothing 4-6 mm
|
+-- MVPA / multivariate decoding
--> Full pipeline WITHOUT smoothing (or minimal, <= 2 mm)
Smooth only after first-level pattern extraction
Convert raw DICOM files to NIfTI format organized in BIDS (Brain Imaging Data Structure; Gorgolewski et al., 2016). BIDS standardizes file naming and metadata, enabling automated pipeline tools like fMRIPrep to detect acquisition parameters automatically.
Tools: dcm2niix (Li et al., 2016), heudiconv, BIDScoin
The first few volumes of an fMRI run are acquired before the MR signal reaches T1 equilibrium, producing artificially high signal intensity. Discard the first 3-5 volumes (approximately 5-10 seconds) unless the scanner automatically acquired dummy scans (Poldrack et al., 2011, Ch. 5).
Domain insight: Modern scanners often acquire dummy scans that are not saved. Check the acquisition protocol. fMRIPrep detects non-steady-state volumes automatically using signal intensity changes.
Within each TR, slices are acquired sequentially (not simultaneously), creating temporal offsets of up to one full TR between first and last slices. Slice timing correction (STC) interpolates each slice to a common time point (Sladky et al., 2011).
| Condition | Recommendation | Rationale |
|---|---|---|
| TR > 2 s, interleaved acquisition | Always apply STC | Temporal offset is large; significant benefit (Sladky et al., 2011) |
| TR 1-2 s | Apply STC; moderate benefit | Still corrects meaningful timing offsets |
| TR < 1 s (multiband) | Skip STC; use temporal derivative in GLM | Minimal offset; correction provides negligible benefit (HCP consortium) |
| Using dynamic causal modeling (DCM) | Mandatory STC | DCM requires precise timing alignment across regions |
Order debate: STC before motion correction is standard in AFNI and SPM. FSL applies STC after motion correction. Both are acceptable; the optimal order depends on the level of motion and slice acquisition pattern (Parker & Razlighi, 2019). Ideally, joint correction would be applied (Roche, 2011), but this is not yet standard in major packages.
Align all volumes to a reference volume using 6-parameter rigid body (3 translation, 3 rotation) transformation (Jenkinson et al., 2002). This is the single most critical preprocessing step.
| Parameter | Recommendation | Source |
|---|---|---|
| Degrees of freedom | 6 (rigid body) | Jenkinson et al., 2002 |
| Reference volume | Mean image or middle volume | Jenkinson et al., 2002 |
| Cost function | Normalized correlation | Jenkinson et al., 2002 (MCFLIRT default) |
| Interpolation | Trilinear (during estimation); sinc or spline (final reslice) | Poldrack et al., 2011, Ch. 5 |
Domain insight: Motion correction is inherently imperfect because each slice within a volume was acquired at a different time. When the head moves during a TR, each slice has a slightly different rigid-body transformation, but whole-volume correction applies a single transformation. This is an unavoidable limitation (Jenkinson et al., 2002).
Output: Save the 6 motion parameters for use as confound regressors in the GLM (see fmri-glm-analysis-guide).
EPI images suffer geometric distortions along the phase-encoding direction due to B0 field inhomogeneities. Distortions are worst near air-tissue boundaries: orbitofrontal cortex, anterior temporal lobes, and inferior temporal regions (Jezzard & Balaban, 1995).
| Method | Data Required | Tool | Source |
|---|---|---|---|
| Fieldmap-based (FUGUE) | Dual-echo gradient echo fieldmap | FSL FUGUE | Jezzard & Balaban, 1995 |
| Reverse phase-encoding (TOPUP) | Opposite-PE EPI pair (AP/PA) | FSL TOPUP | Andersson et al., 2003 |
| SyN-based (fieldmapless) | T1-weighted image only | ANTs SyN-SDC | fMRIPrep fallback |
Domain warning: If no fieldmap data were acquired, fMRIPrep can perform fieldmapless distortion correction using nonlinear registration to the T1, but this is less accurate than fieldmap-based methods. Always acquire fieldmap data when possible.
Align the functional (EPI) image to the subject's structural (T1-weighted) image. This enables projecting functional results onto anatomical space and provides the bridge to template normalization.
Warp each subject's brain to a standard template space to enable group-level comparisons.
| Parameter | Recommendation | Source |
|---|---|---|
| Template | MNI152NLin2009cAsym (fMRIPrep default) or MNI152NLin6Asym | Fonov et al., 2011 |
| Method | Nonlinear (ANTs SyN or SPM Unified Segmentation) | Ashburner & Friston, 2005; Avants et al., 2008 |
| Output resolution | 2 mm isotropic (standard) | Convention; matches MNI template resolution |
| For high-resolution data | Match native resolution (e.g., 1.5 mm) | Preserve spatial detail |
Domain warning: Always visually inspect normalization quality. Check that major sulci (central sulcus, Sylvian fissure) and subcortical structures (caudate, putamen) align with the template. Poor normalization is a common but silent source of error in group analyses.
Smoothing with a Gaussian kernel increases SNR, satisfies the smoothness assumptions of Random Field Theory, and reduces inter-subject anatomical variability (Mikl et al., 2008).
| Analysis Type | FWHM Recommendation | Rationale | Source |
|---|---|---|---|
| Univariate (task GLM) | 2-3x voxel size (e.g., 6-8 mm for 2-3 mm voxels) | Matches expected activation extent; maximizes sensitivity | Mikl et al., 2008; Poldrack et al., 2011 |
| Resting-state connectivity | 4-6 mm | Moderate smoothing; balance noise reduction and spatial specificity | Ciric et al., 2017 |
| MVPA / decoding | None or <= 2 mm | Smoothing destroys fine-grained spatial patterns essential for decoding | Misaki et al., 2013 |
| Searchlight analysis | None | Searchlight already averages within the sphere | Etzel et al., 2013 |
Domain warning: Smoothing before MVPA is one of the most common preprocessing errors. For multivariate analyses, skip smoothing during preprocessing entirely. If group-level smoothing is needed, apply it only after the first-level pattern analysis is complete (Misaki et al., 2013).
Confound regression removes variance from non-neural sources. This step is typically performed during the statistical model (GLM) rather than as a separate preprocessing step, but the preprocessing pipeline must output the confound time series.
For detailed confound regression guidance, see the fmri-glm-analysis-guide skill.
Key confounds to extract during preprocessing:
| Step | Task Activation | Resting-State Connectivity | MVPA |
|---|---|---|---|
| Non-steady-state removal | Yes | Yes | Yes |
| Slice timing correction | Yes (if TR > 1 s) | Yes (if TR > 1 s) | Yes (if TR > 1 s) |
| Motion correction | Yes | Yes | Yes |
| Distortion correction | Yes | Yes | Yes |
| Coregistration | Yes | Yes | Yes |
| Normalization | Yes (2 mm) | Yes (2 mm) | Optional; can stay in native space |
| Smoothing | 6-8 mm FWHM | 4-6 mm FWHM | None |
| High-pass filter | 128 s (in GLM) | 0.01 Hz (in preprocessing) | 128 s (in GLM) |
| Band-pass filter | No | 0.01-0.1 Hz (controversial) | No |
| Motion threshold (FD) | 0.5 mm (spike regress) | 0.2 mm (scrub or regress) | 0.5 mm |
| Confound model | 24-param + aCompCor | 36-param or aCompCor + GSR | Minimal (6-param motion) |
fMRIPrep (Esteban et al., 2019) is recommended as the default preprocessing tool for most fMRI studies. It provides:
What fMRIPrep does NOT do:
Domain insight: fMRIPrep outputs the preprocessed BOLD data in both MNI space and native space. For MVPA, use the native-space output. For group analyses, use the MNI-space output.
Smoothing before MVPA: Spatial smoothing destroys the fine-grained voxel patterns that multivariate methods rely on. Skip smoothing entirely for MVPA and searchlight analyses (Misaki et al., 2013)
Wrong interpolation for final reslicing: Use sinc or spline interpolation for the final reslice step. Trilinear interpolation is acceptable during motion parameter estimation but introduces blurring in final images (Poldrack et al., 2011, Ch. 5)
Not checking normalization quality: Normalization can fail silently, especially in populations with atypical anatomy (older adults, patients with lesions, pediatric). Always visually inspect the overlap of normalized functional images with the template
Motion-connectivity confound in resting-state: Head motion creates spurious short-distance correlations and reduces long-distance correlations in functional connectivity (Power et al., 2012). For resting-state analyses, use stringent motion thresholds (FD < 0.2 mm; Power et al., 2014) and aggressive confound regression (Ciric et al., 2017)
Skipping distortion correction: Without distortion correction, orbitofrontal and anterior temporal signals are mislocalized by several millimeters. This is especially problematic for studies of emotion, reward, and memory, which involve these regions (Jezzard & Balaban, 1995)
Applying band-pass filtering for task fMRI: Band-pass filtering (0.01-0.1 Hz) is appropriate for resting-state connectivity analysis but removes task-related signal in event-related and block designs. For task fMRI, use only high-pass filtering in the GLM
Not discarding non-steady-state volumes: The first few volumes have inflated signal intensity. If not removed, they can bias motion estimates and inflate variance (Poldrack et al., 2011, Ch. 5)
For detailed step-by-step parameters and software-specific guidance, see references/step-by-step-pipeline.md.
For quality control metrics, thresholds, and exclusion criteria, see references/quality-control.md.
See references/ for detailed pipeline parameters and quality control procedures.