fMRI minimal preprocessing pipeline
This section contains an online copy of the book chapter:
Nieto-Castanon, A. (2020). FMRI minimal preprocessing pipeline. In Handbook of functional connectivity Magnetic Resonance Imaging methods in CONN (pp. 3–16). Hilbert Press. doi:10.56441/hilbertpress.2207.6599
Please use the reference above when citing contents of this section
alternative sources: pdf (ResearchGate); e-book (Google Books); paperback (Amazon)
Default preprocessing pipeline
CONN's default preprocessing pipeline (labeled "default preprocessing pipeline for volume-based analyses (direct normalization to MNI-space)" in CONN's gui, or 'default_mni' in CONN's batch commands), performs the following preprocessing steps: functional realignment and unwarp; slice-timing correction; outlier identification; direct segmentation and normalization; and functional smoothing
Functional realignment and unwarp
Functional data is realigned using SPM12 realign & unwarp procedure (Andersson et al. 2001), where all scans are coregistered and resampled to a reference image (first scan of the first session) using b-spline interpolation. This procedure also addresses potential susceptibility distortion-by-motion interactions by estimating the derivatives of the deformation field with respect to head movement, and resampling the functional data to match the deformation field of the reference image. If a double-echo sequence is available, the field inhomogeneity inside the scanner (fieldmap) is also estimated and used for Susceptibility Distortion Correction (SDC) as part of the unwarp step, where the functional data is resampled along the phase-encoded direction in order to correct the absolute deformation state of the reference image caused by field inhomogeneities within the scanner
Preprocessing step name: functional_realign&unwarp (&fieldmap)
Inputs: functional data (in primary dataset)
Optional inputs: double-echo sequence (one magnitude and one phase-difference image, in secondary fmap dataset), or direct fieldmap file in Hz units (in secondary fmap dataset), or pre-computed voxel-displacement map (in secondary vdm dataset). Double-echo timing information can be entered manually or automatically read from sidecar .json files
Outputs: realigned functional data (in primary dataset). New reference image for functional data (average across all scans after realignment). Estimated motion parameters (as a .txt file for each subject/session, and also as a first-level covariate labeled 'realignment')
See also: #rtm, #vdm_t1, #vdm_t2, #vdm_ert, #vdm_blip, #vdm_type, #vdm_fmap fields for advanced options
Slice-Timing Correction
Temporal misalignment between different slices of the functional data, introduced by the sequential nature of the fMRI acquisition protocol, is corrected using SPM12 slice-timing correction (STC) procedure (Henson et al. 1999), where the functional data is time-shifted and resampled using sinc-interpolation to match the time in the middle of each TA (acquisition time)
Preprocessing step name: functional_slicetime
Inputs: functional data (in primary dataset). Slice acquisition order information (or slice acquisition time, for simultaneous multislice acquisitions) can be entered manually, selected from a list of common acquisition sequences, or automatically read from sidecar .json file
Outputs: STC-corrected functional data (in primary dataset)
See also: #sliceorder, #ta fields for advanced options
Outlier identification
Potential outlier scans are identified from the observed global BOLD signal and the amount of subject-motion in the scanner. Acquisitions with framewise displacement above 0.9mm or global BOLD signal changes above 5 s.d. are flagged as potential outliers (note: an alternative "conservative" setting in CONN uses 0.5mm and 3 s.d. thresholds, while an alternative "liberal" setting uses 2mm and 9 s.d. thresholds). Framewise displacement is computed at each timepoint by considering a 140x180x115mm bounding box around the brain and estimating the largest displacement among six control points placed at the center of this bounding-box faces. Global BOLD signal change is computed at each timepoint as the change in average BOLD signal within SPM's global-mean mask scaled to standard deviation units
Preprocessing step name: functional_art
Inputs: functional data (in primary dataset). estimated head-motion parameters (created during realignment step; alternatively manually entered as first-level covariate labeled 'realignment' )
Outputs: list of potential outliers (as a .txt file for each subject/session, and also as a first-level covariate labeled 'scrubbing'). List of scan-to-scan global BOLD change and head-motion measures (as a .txt file for each subject/session, and also as a first-level covariate labeled 'QC_timeseries'). New reference image for functional data (average across all scans except potential outlier scans)
See also: #art_thresholds field for advanced options. See also conn_convertl12l1covariate function to transform between different framewise displacement definitions (Jenkinson/Power/CONN) and/or to estimate a new list of outliers by applying different threshold values to an already preprocessed dataset
Direct segmentation and normalization
Functional and anatomical data are normalized into standard MNI space and segmented into grey matter, white matter, and CSF tissue classes using SPM12 unified segmentation and normalization procedure (Ashburner and Friston, 2005). This procedure iteratively performs tissue classification, estimating the posterior tissue probability maps (TPMs) from the intensity values of the reference functional/anatomical image, and registration, estimating the non-linear spatial transformation best approximating the posterior and prior TPMs, until convergence. Direct normalization applies this unified segmentation and normalization procedure separately to the functional data, using the mean BOLD signal as reference image, and to the structural data, using the raw T1-weighted volume as reference image. Both functional and anatomical data are resampled to a default 180x216x180mm bounding box, with 2mm isotropic voxels for functional data and 1mm for anatomical data, using 4th order spline interpolation
Preprocessing step name: functional_segment&normalize_direct, structural_segment&normalize
Inputs: functional data (in primary dataset), structural data
Outputs: MNI-space functional and structural data. grey matter, white matter, and CSF masks. Skull-stripped structural volume
See also: #affreg, #boundingbox, #coregtomean, #interp, #tpm_template, #tpm_ngaus, #voxelsize_anat, #voxelsize_func fields for advanced options
Functional smoothing
Last, functional data is smoothed using spatial convolution with a Gaussian kernel of 8mm full width half maximum (FWHM), in order to increase BOLD signal-to-noise ratio and reduce the influence of residual variability in functional and gyral anatomy across subjects
Preprocessing step name: functional_smooth
Inputs: functional data (in primary dataset)
Outputs: smoothed functional data (in primary dataset)
See also: #fwhm field for advanced options
Alternatives/additions to the default preprocessing pipeline
While the above preprocessing pipeline is designed to offer robust performance in most common scenarios, researchers are encouraged to explore different alternatives tailored to the specificities of their scanning protocol or analysis plans. Some popular alternatives either directly implemented or supported by CONN are:
1. default preprocessing pipeline for volume-based analyses (indirect normalization to MNI-space) (also known as 'default_mnifield' in CONN's batch commands) is an alternative preprocessing pipeline designed for cases when high-quality fieldmaps are available for susceptibility distortion correction. In those cases it can be argued (Calhoun et al. 2017) that an indirect normalization procedure results in better performance compared to a direct normalization procedure. In a direct normalization procedure the functional and anatomical data are normalized separately/independently, each using its own non-linear transformation to project the data from its original space to a common MNI-space. In contrast, in an indirect normalization procedure both sets use the same non-linear transformation, which is estimated using only the structural data (often with higher spatial resolution, better tissue contrast, and more anatomical detail). In particular, this pipeline uses the same sequence as CONN's default pipeline, but enforcing the usage of fieldmaps for susceptibility distortion correction during the functional realignment & unwarp step, as well as using an Indirect segmentation and normalization step instead of the original Direct segmentation and normalization step (see "indirect segmentatioon and normalization" section below for details about this step)
2. default preprocessing pipeline for surface-based analyses (also known as 'default_ssfield' in CONN's batch commands) is an alternative preprocessing pipeline designed for surface-based rather than volume-based data analyses. It requires the structural data to have been already processed using FreeSurfer. The pipeline uses the same sequence as CONN's default pipeline, but: 1) enforcing the usage of fieldmaps for susceptibility distortion correction during the functional realignment & unwarp step; 2) using a functional/anatomical coregistration step instead of the original Direct segmentation and normalization step (see "functional/anatomical coregistration" section below for details about this step); 3) sampling the functional data only within the cortical surface (see “resample to fsaverage space” section below for details); and 4) using a functional surface-based smoothing step instead of the original functional smoothing step (see "surface-level smoothing" section below for additional details about this step)
3. fMRIPrep preprocessing pipeline. It is also possible to use data in CONN that has been already either fully or partially preprocessed using other software packages like SPM or FSL. One popular and robust preprocessing pipeline combining multiple tools is fMRIPrep. When using data preprocessed by fMRIPrep, CONN can automatically import the resulting preprocessed MNI-space functional and anatomical volumes, as well as Grey/White/CSF tissue masks, a full list of potential confound regressor variables, and an associated CONN-formatted first-level realignment, scrubbing, and QC_timeseries covariates that can be directly used by CONN's default denoising procedure. After importing fMRIPrep data it is recommended to run only an additional functional_smoothing preprocessing step before directly proceeding to Denoising the resulting functional data (see fMRIPrep documentation for additional details about fMRIPrep preprocessing pipeline)
Indirect segmentation and normalization
Functional data is first co-registered using an affine transformation to the structural data using SPM12 inter-modality coregistration procedure with a normalized mutual information cost function (Collignon et al. 1995, Studholme et al. 1998). Then the anatomical data is normalized into standard MNI space and segmented into grey matter, white matter, and CSF tissue classes using SPM12 unified segmentation and normalization procedure (Ashburner and Friston, 2005). This procedure iteratively performs tissue classification, estimating the posterior tissue probability maps (TPMs) from the intensity values of the reference anatomical image, and registration, estimating the non-linear spatial transformation best approximating the posterior and prior TPMs, until convergence. Indirect normalization applies this unified segmentation and normalization procedure to the structural data using the raw T1-weighted volume as reference image, and then applies the same estimated non-linear transformation to the functional data. Both functional and anatomical data are resampled to a default 180x216x180mm bounding box, with 2mm isotropic voxels for functional data and 1mm for anatomical data, using 4th order spline interpolation
Preprocessing step name: functional_segment&normalize_indirect
Inputs: functional data (in primary dataset), structural data
Outputs: MNI-space functional and structural data. Grey matter, Whiter matter, and CSF masks. Skull-stripped structural volume
See also: #affreg, #boundingbox, #interp, #tpm_template, #tpm_ngaus, #voxelsize_anat, #voxelsize_func fields for advanced options
Functional/anatomical coregistration
Functional data is co-registered to the structural data using using SPM12 inter-modality coregistration procedure with a normalized mutual information cost function (Collignon et al. 1995, Studholme et al. 1998). This procedure estimates an optimal affine transformation between the reference functional image (mean BOLD signal) and the reference structural image (T1-weighted volume) that maximizes the mutual information between the two, storing this information in the functional image voxel-to-world mapping header information without resampling the data
Preprocessing step name: functional_coregister_affine_noreslice
Inputs: functional data (in primary dataset), structural data
Outputs: functional data voxel-to-world mapping updated
See also: #coregtomean field for advanced options
Resample to fsaverage space
Functional data is resampled at the location of the subject-specific FreeSurfer-estimated cortical ribbon. This procedure computes the BOLD signal at the location of each vertex in fsaverage icosahedral level-8 tessellation (163,842 vertices and 327,680 faces), projected to the subject-specific white matter surface, and averaged across 10 intervals along the normal between the white matter and pial surfaces
Preprocessing step name: functional_surface_resample
Inputs: functional data in same space as FreeSurfer T1w reference (in primary dataset)
Outputs: functional data in surface-level fsaverage space (in primary dataset)
Functional surface-level smoothing
Functional data in fsaverage space is smoothed using iterative diffusion smoothing with 40 iterations, approximately 8mm FWHM kernel (Hagler et al. 2006), in order to increase BOLD signal-to-noise ratio and reduce the influence of residual variability in functional and gyral anatomy across subjects
Preprocessing step name: functional_surface_smooth
Inputs: functional data in surface-level fsaverage space (in primary dataset)
Outputs: smoothed functional data in surface-level fsaverage space (in primary dataset)
See also: #diffusionsteps field for advanced options
References
Andersson JLR, Hutton C, Ashburner J, Turner R, Friston K (2001). Modelling geometric deformations in EPI time series. NeuroImage 13:90-919
Ashburner, J. and Friston, K. (1997). Multimodal image coregistration and partitioning—a unified framework. Neuroimage, 6(3), 209-217.
Ashburner, J. and Friston, K.J.. (2005). Unified segmentation. NeuroImage, 26:839–851
Calhoun, V. D., Wager, T. D., Krishnan, A., Rosch, K. S., Seymour, K. E., Nebel, M. B., ... & Kiehl, K. (2017). The impact of T1 versus EPI spatial normalization templates for fMRI data analyses. Human brain mapping, 38(11), 5331-5342.
Collignon, A., Maes, F., Delaere, D., Vandermeulen, D., Suetens, P., & Marchal, G. (1995, June). Automated multi-modality image registration based on information theory. In Information processing in medical imaging (Vol. 3, No. 6, pp. 263-274)
Friston KJ, Williams SR, Howard R, Frackowiak RSJ and Turner R (1995). Movement-related effect in fMRI time-series. Magn Reson Med 35:346-355
Hagler Jr, D. J., Saygin, A. P., & Sereno, M. I. (2006). Smoothing and cluster thresholding for cortical surface-based group analysis of fMRI data. Neuroimage, 33(4), 1093-1103.
Henson, R. N. A., Buechel, C., Josephs, O., & Friston, K. J. (1999). The slice-timing problem in event-related fMRI. NeuroImage, 9, 125
Studholme, Hill & Hawkes (1998). A normalized entropy measure of 3-D medical image alignment. Proc. Medical Imaging 1998, vol. 3338, San Diego, CA, pp. 132-143
How to run CONN preprocessing pipeline
CONN's default preprocessing pipeline can be run using any of the following options:
Option 1: using CONN's gui
After entering in CONN the raw functional data (in Setup.functional) and raw structural data (in Setup.structural) for one or multiple subjects, click on the 'Preprocessing' button, select the first option/pipeline there, labeled 'default preprocessing pipeline for volume-based analyses (direct normalization to MNI-space)' and click 'Ok' and 'Start' (optionally change the 'local processing' option available in that window to 'distributed processing' if you want to parallelize this pipeline across multiple processors or nodes in an HPC cluster)
note: alternatively, if fieldmap sequence files are available, enter these (e.g. Magnitude and PhaseDiff images) in Setup.functional labeled as a 'fmap' secondary dataset, and then select the second or third pipelines here (for indirect or direct normalization procedures, respectively)
Option 2: using CONN's batch commands
Similarly, if you have already entered your raw functional/anatomical files in CONN (either using the GUI or batch commands), you may run the default preprocessing pipeline using Matlab command syntax:
conn_batch( 'Setup.preprocessing.steps', 'default_mni' )
optionally adding to this command any desired alternative field name/value pairs (see doc conn_batch for additional details), for example:
conn_batch( 'filename', '/data/Cambridge/conn_Cambridge.mat', ...
'Setup.preprocessing.steps', 'default_mni', ...
'Setup.preprocessing.sliceorder', 'interleaved (Siemens)', ...
'Setup.preprocessing.fwhm', 12 )
Option 3: using CONN's modular functions
If you prefer to run this preprocessing pipeline separately from the rest of CONN's functionality (e.g. to preprocess some data and then continue analyzing the preprocessed data on a different software package), you may also run CONN's default preprocessing pipeline using the following Matlab command syntax:
conn_module( 'preprocessing', ...
'structurals', {'/data/anat.nii'}, ...
'functionals', {'/data/func.nii'}, ...
'steps', 'default_mni' )
optionally adding to this command any desired alternative field name/value pairs (see doc conn_module and doc conn_batch for additional details), for example:
conn_module( 'preprocessing', ...
'structurals', {'/data/anat.nii'}, ...
'functionals', {'/data/func.nii'}, ...
'steps', 'default_mni', ...
'RT', 2, ...
'sliceorder', 'interleaved (Siemens)', ...
'fwhm', 12 )