# fMRI denoising pipeline

This section contains an online copy of the book chapter:

Nieto-Castanon, A. (2020). FMRI denoising pipeline. In *Handbook of functional connectivity Magnetic Resonance Imaging methods in CONN *(pp. 17–25). Hilbert Press. https://doi.org/10.56441/hilbertpress.2207.6600

alternative sources: pdf (ResearchGate); e-book (Google Books); paperback (Amazon)

Please use the reference above when citing contents of this section

## Default denoising pipeline

CONN's default denoising pipeline combines two general steps: linear regression of potential confounding effects in the BOLD signal, and temporal band-pass filtering

### Linear regression

Factors that are identified as potential confounding effects to the estimated BOLD signal are estimated and removed separately for each voxel and for each subject and functional run/session, using Ordinary Least Squares (OLS) regression to project each BOLD signal timeseries to the sub-space orthogonal to all potential confounding effects. Potential confounding effects used in CONN’s default denoising pipeline implement an anatomical component-based noise correction procedure (**aCompCor**), and include noise components from cerebral white matter and cerebrospinal areas (Behzadi et al. 2007), estimated subject-motion parameters (Friston et al. 1995), identified outlier scans or scrubbing (Power et al. 2014), constant and first-order linear session effects, and constant task effects, if applicable (Whitfield-Gabrieli and Nieto-Castanon, 2012):

**noise components from white matter and cerebrospinal areas:**potential confounding effects are defined from the observed BOLD signal within each of two anatomically-defined noise areas computed by applying a one-voxel binary erosion step to the masks of voxels with values above 50% in white matter and CSF posterior probability maps. Within each area five potential noise components (Chai et al. 2012) are estimated: the first computed as the average BOLD signal, and the next four computed as the first four components in a Principal Component Analysis of the covariance within the subspace orthogonal to the average BOLD signal and all other potential confounding effects**estimated subject-motion parameters**: a total of 12 potential noise components are defined from the estimated subject-motion parameters in order to minimize motion related BOLD variability, 3 translation and 3 rotation parameters plus their associated first-order derivatives**scrubbing**: a variable number of noise components (one for each identified outlier scan during the outlier identification preprocessing step) are used as potential confounding effects to remove any influence of these outlier scans on the BOLD signal**session and task effects:**constant and linear BOLD signal trends within each session, as well as main task or session effects convolved with a canonical hemodynamic response function, are defined as additional noise components in order to reduce the influence of slow trends, initial magnetization transients, as well as constant task-induced responses in the BOLD signal, if applicable

### Temporal band-pass filtering

Temporal frequencies below 0.008 Hz or above 0.09 Hz are removed from the BOLD signal in order to focus on slow-frequency fluctuations while minimizing the influence of physiological, head-motion and other noise sources. Filtering is implemented using a discrete cosine transform windowing operation to minimize border effects, and performed after regression to avoid any frequency mismatch in the nuisance regression procedure (Hallquist et al. 2013)

## Evaluating denoising outputs

The effect of denoising acting to minimize the influence of artifactual factors on functional connectivity measures can best characterized by estimating the distribution of functional connectivity values (FC) between randomly-selected pairs of points within the brain before and after denoising (available as part of CONN's Quality Control plots). Considering the BOLD signal after a standard minimal preprocessing pipeline (but before denoising), FC distributions show extremely large inter-session and inter-subject variability, and skewed distributions with varying degrees of positive biases, consistent with the influence of global or large-scale physiological and subject-motion effects. After denoising FC distributions show approximately centered distributions, with small but noticeable larger tails in the positive side, and considerably reduced inter-session and inter-subject variability

Other useful ways to evaluate the quality of the denoising procedure outputs include computing QC-FC correlations (Ciric et al. 2017). QC-FC correlations look, again, at the connectivity values (FC) between randomly-selected pairs of points within the brain, but instead of simply displaying the distribution of these values, this method evaluates whether FC values are correlated, across subjects, with other Quality Control (QC) measures (e.g. subject-motion indicators). The method computes a QC-FC correlation value for each randomly-selected pair of points within the brain, and then it displays the distribution of the resulting QC-FC correlation values (shown in gray before and after denoising in the plots below). In addition, this distribution can be directly compared to an associated null-hypothesis (NH) distribution (shown as red dashed lines), with an associated percent match value quantifying the degree of similarity between the two (95% or higher match with NH indicate lack of noticeable QC-FC associations)

## Alternatives/additions to the default denoising pipeline

While the above denoising pipeline is designed to remove most outlier, physiological, including respiratory and cardiac effects, and residual subject-motion effects from the BOLD signal, researchers are strongly encouraged to evaluate the quality of their data after denoising and consider modifying these or using additional denoising steps as necessary. In addition to simple variations of the default denoising strategy, such as using different scrubbing options (e.g. identifying outliers based on a lower framewise displacement threshold) or selecting a higher number of aCompCor noise components, some useful additional denoising approaches include:

**1. ICA denoising** is a data-driven approach where Independent Component Analyses are used to identify potential noise-related temporal components either manually or semi-automatically (Griffanti et al. 2017) which can then be entered in CONN as additional potential confounding effects in the standard Linear Regression denoising step

**2. Retroicor **(Glover et al 2000) is a popular technique to use cardiac and respiratory state information recorded during the scanning session to build a series of predicted sine and cosine components of the respiratory and cardiac effects, which can then be used in CONN as additional potential confounding effects in the standard Linear Regression denoising step

**3. Simult** (Hallquist et al. 2013) is an alternative implementation of the standard sequential regression followed by filtering approach, where both regression and filtering are implemented simultaneously as a single regression step (either by explicitly adding low- and high- frequency regressors or by pre-filtering the matrix of linear regressors). This approach can be used in CONN directly (e.g. switching the default '*RegBP*' option to '*Simult*'), or it can be used selectively over a subset of regressors only (by selecting the '*Filtered*' option on the selected subset of potential confounding effects). Since *Simult* is equivalent to removing the frequency-specific effect of potential confounder variables (the effect estimated only within the frequency window defined by the band-pass filter) it is recommended to not apply this filtering to confounders such as outliers which are broadband and not frequency-modulated

**4. Friston24** (Friston et al. 1996) is a richer set of motion-related regressors designed to remove an autoregressive-moving-average model of the effects of subject motion on the BOLD signal. In CONN this can be used simply selecting a polynomial expansion (quadratic effects) for the realignment parameters, in addition to the temporal expansion (first-order derivatives) that is already part of the default denoising strategy

**5. Global Signal Regression** (GSR) is an alternative approach which uses the average BOLD signal (across the entire brain) as a potential confounding effect. This approach is generally not recommended, since it can introduce artifactual biases (Murphy et al. 2009), remove potentially meaningful neural components (Chai et al. 2012), and introduce confounding effects across populations. It is nevertheless possible to use as a last resort or reference alternative approach in CONN simply defining a new ROI encompassing the entire brain (e.g. a subject-specific brain mask resulting from the outlier detection step during preprocessing, or gray matter mask resulting from the segmentation step) and using this ROI as an additional potential confounding effect in the standard Linear Regression denoising step

## References

Behzadi, Y., Restom, K., Liau, J., & Liu, T. T. (2007). A component based noise correction method (CompCor) for BOLD and perfusion based fMRI. *Neuroimage*, *37*(1), 90-101

Chai, X. J., Castañón, A. N., Öngür, D., & Whitfield-Gabrieli, S. (2012). Anticorrelations in resting state networks without global signal regression. *Neuroimage*, *59*(2), 1420-1428

Ciric, R., Wolf, D. H., Power, J. D., Roalf, D. R., Baum, G. L., Ruparel, K., ... & Gur, R. C. (2017). Benchmarking of participant-level confound regression strategies for the control of motion artifact in studies of functional connectivity. *Neuroimage*, *154*, 174-187

Friston, K. J., Williams, S., Howard, R., Frackowiak, R. S., & Turner, R. (1996). Movement‐related effects in fMRI time‐series. *Magnetic resonance in medicine*, *35*(3), 346-355.

Glover, G. H., Li, T. Q., & Ress, D. (2000). Image‐based method for retrospective correction of physiological motion effects in fMRI: RETROICOR. *Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine*, *44*(1), 162-167.

Griffanti, L., Douaud, G., Bijsterbosch, J., Evangelisti, S., Alfaro-Almagro, F., Glasser, M. F., ... & Beckmann, C. F. (2017). Hand classification of fMRI ICA noise components. *Neuroimage*, *154*, 188-205.

Hallquist, M. N., Hwang, K., & Luna, B. (2013). The nuisance of nuisance regression: spectral misspecification in a common approach to resting-state fMRI preprocessing reintroduces noise and obscures functional connectivity. *Neuroimage*, *82*, 208-225

Murphy, K., Birn, R. M., Handwerker, D. A., Jones, T. B., & Bandettini, P. A. (2009). The impact of global signal regression on resting state correlations: are anti-correlated networks introduced?. *Neuroimage*, *44*(3), 893-905.

Power, J. D., Mitra, A., Laumann, T. O., Snyder, A. Z., Schlaggar, B. L., & Petersen, S. E. (2014). Methods to detect, characterize, and remove motion artifact in resting state fMRI. *Neuroimage*, *84*, 320-341

Whitfield-Gabrieli, S., & Nieto-Castanon, A. (2012). Conn: a functional connectivity toolbox for correlated and anticorrelated brain networks. *Brain connectivity*, *2*(3), 125-141

## How to run CONN denoising pipeline

CONN's default denoising pipeline can be run using any of the following options:

### Option 1: using CONN's gui

If you have already imported your data in CONN and run either one of CONN or fMRIPrep preprocessing pipelines, go to CONN's *Denoising* tab. All options here will be set by default to implement the denoising procedure described above, so simply click '**Done**' and '**Start**' to run CONN's default denoising pipeline (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)

### Option 2: using CONN's batch commands

Similarly, if you have already entered and pre-processed your functional/anatomical files in CONN (either using the GUI or batch commands), you may run the default denoising pipeline using Matlab command syntax:

conn_batch( 'Denoising.done', true )

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', ...

'Denoising.done', true, ...

'Denoising.filter', [0.008 inf], ...

'Denoising.regbp', 2 )

### Option 3: using CONN's modular functions

If you prefer to run this denoising pipeline separately from the rest of CONN's functionality (e.g. to preprocess and denoise some data that is then to be used by a different software package), you may also run CONN's default denoising pipeline simply as two additional preprocessing steps following CONN's minimal preprocessing pipeline or similar. For example, the following Matlab command syntax runs CONN's default minimal preprocessing pipeline (realignment + STC + outlier identification + direct segmentation & normalization + smoothing) followed by CONN's default denoising steps (aCompcor + scrubbing + motion regression + filtering):

conn_module( 'preprocessing', ...

'structurals', {'/data/anat.nii'}, ...

'functionals', {'/data/func.nii'}, ...

'steps', {'default_mni', 'functional_regression', 'functional_bandpass'}, ...

'reg_names', {'realignment','scrubbing','White Matter','CSF'}, ...

'reg_dimensions',[inf, inf, 5, 5], ...

'reg_deriv', [1, 0, 0, 0], ...

'bp_filter', [0.008 inf] )

modifying the parameter name/value pairs when appropriate.

Alternatively, if your data is already fully preproccessed, and you already have the subject motion timeseries (e.g. a rp_func.txt file), the list of potential outliers (e.g. an art_regression_outliers_func.mat file), and the white matter and CSF masks (e.g. c2anat.nii and c3anat.nii files), you may use the following syntax to apply denoising alone (aCompCor + scrubbing + motion regression + filtering) to your functional data:

conn_module('preprocessing',...

'functionals', {'/data/func.nii'}, ...

'covariates', struct(...

'names', {{'realignment','scrubbing'}},...

'files', {{'/data/rp_func.txt', '/data/art_regression_outliers_func.mat'}}),...

'masks', struct(...

'White', {{'/data/c2anat.nii'}},...

'CSF', {{'/data/c3anat.nii'}}), ...

'steps', {'functional_regression', 'functional_bandpass'}, ...

'reg_names', {'realignment','scrubbing','White Matter','CSF'}, ...

'reg_dimensions',[inf, inf, 5, 5], ...

'reg_deriv', [1, 0, 0, 0], ...

'bp_filter', [0.008 inf] )

again modifying the parameter name/value pairs when appropriate (see *doc conn_module** *and *doc conn_batch* for additional details)