Contributions
HTW, SLM wrote the software, HTW, SLM wrote the report
Competing interests
None
Acknowledgements
The authors would like to thank the organizers and attendees of Brainhack Global Montreal 2020. Especially, we would like to thank Elizabeth DuPre and Chris Markiewicz for discussions on the choice of test data.
Event
Brainhack Global 2020 Montreal
License
Load fMRIprep confounds in Python
- 1CRIUGM
- 2Harvard University
Abstract
load_confounds is a tool for loading a sensible subset of the fMRI confounds generated with fMRIprep in python (Esteban et al., 2019). The outputs can be directly passes to nilearn NifitMasker for denoising. The aim at Brainhack MTL 2020 is to implement new strategies as well as imporving the existing functions and documentations for a potential Beta release.
Introduction
fMRIprep (Esteban et al. 2019) is a popular minimal preprocessing software for functional MRI data. ‘Minimal preprocessing’ refers to motion correction, field unwarping, normalization, bias field correction, and brain extraction. Confound regression and smoothing are excluded from the workflow. Instead, fMRIprep provides users with a large set of potential confound regressors that covers many denoising strategies. The users have to select the confound regressors for denoising in subsequent analyses. Loading a sensible subset of confounds is difficult and error-prone for many strategies, such as ICA-AROMA (Pruim et al. 2015) and CompCor (Behzadi et al. 2007). load confounds can extract confound variables and implement preset strategies for confound selections. The loaded format is compatible with nilearn analysis functions such as NiftiMasker and the GLM modules. Our aim was to provide a easy and foolproof API for users to perform subsequent denoising of fMRIprep outputs.
Progress
At Brianhack Global Montreal 2020, our goal was to prepare the package for a potential Beta release. To prepare for the release, related issues involved implementing several preset strategies and improving the user experience with better examples and error messages. Several issues had been identified before Brainhack, and the full discussion can be found under the load confounds GitHub issue page. Participants at Brainhack were encouraged to pick up existing issues from the list. The following issues have been discussed and/or resolved:
Strategies
We worked on three strategies:
Added ICA-AROMA (Pruim et al. 2015) (contributed by Hao-Ting Wang)
Added Scrubbing (Power et al. 2012)(contributed by Steven Meisler)
Improved the anatomical mask selection for anatomical CompCor (Behzadi et al. 2007) (contributed by Steven Meisler)
ICA-AROMA
ICA-AROMA is only applicable to fMRIprep outputs generated with usearoma. fMRIprep produces files with suffix descsmoothAROMAnonaggr bold and outputs ICA components in the confounds file. Using the descsmoothAROMAnonaggr bold output is the recommanded way of applying ICA-AROMA and implemented in load confounds as a preset strategy. When passing regular fMRIprep outputs suffixed with descprepro bold, load confounds retreives the noise independent compoenents for aggressive denoising.
Scrubbing
load confounds provides both a basic and full approach for scrubbing. The basic scrubbing approach flags and censors time frames with excessive motion, using thresholds on framewise displacement and standardized DVARS. For full scrubbing, described in Power et al (Power et al. 2012), after censoring volumes as in the basic approach, the full approach further remove continuous segments containing fewer than 5 volumes.
Anatomical CompCor
fMRIprep uses three kinds of anatomical masks to compute CompCor components, WM, CSF and the combination of the two. Metadata in fMRIPrep’s confounds .json file specify the anatomical compartment associated with each component. The previous iteration of load confounds did not consider the metadata, hence the difference of masks were not taken into account. In the revised aCompCor approach, load confounds provides selections of anaotomical maps (WM, CSF, and combined) to avoid regressing relevant signal twice, which may introduce noise.
Demo
An executable demo using the nilearn developmental fMRI dataset (OpenNeuro ds000228) was added (contributed by Michael W. Weiss). The demo was adapted from an exisitng nilearn example on denoising ’Extracting signals from a brain parcellation’. This example notebook shows how to extract signals from a brain parcellation and compute a correlation matrix, using different denoising strategies from the package.
Error message
A new class NotFoundConfoundException was added for collecting all the missing parameters needed for the given noise component(s). A final error would be raised with the list of all parameters missing, rather than just the first encountered missing parameter. (Contributed by Michael W. Weiss and François Paugam)
Identify test dataset
OpenNeuro ds000003 was adopted as the new test data, including all ICA-AROMA related components. However, non-steady-state volume and motion estmation mertic RMSD (Jenkinson et al. 2002) are still missing. We plan on preprocessing the nilearn demo dataset (OpenNeuro ds000228) with the latest stable fMRIprep LTS release for collecting all possible confounds in the future. (Discussions amongs Pierre Bellec, Hao-Ting Wang, Elizabeth DuPre, and Chris Markiewicz)
All contributor bot
allcontributors bot is added to track community contributions (Contributed by Pierre Bellec).
Add load confounds to nixtract
In addition to the main package, there was a collaborative project with the developers of nixtract. nixtract is a tool that extract and process timeseries data from neuroimaging files. Annabelle Harvey and Dan Gale added load confounds as a dependency of nixtract for reading fMRIPrep confound variables.
Results
load confounds has now covered most of the strategies tested in Ciric et al. (Ciric et al. 2017). The following noise components and a set of paramaters for dedicated approaches are supported.
motion: motion parameters, including 6 translation/rotation (basic), and optionally derivatives, squares, and squared derivatives (full).high pass: basis of discrete cosines covering slow time drift frequency band.wm csfthe average signal of white matter and cerebrospinal fluid masks (basic), and optionally derivatives, squares, and squared derivatives (full).global: the global signal (basic), and optionally derivatives, squares, and squared derivatives (full).compcor(Behzadi et al. 2007): the results of a PCA applied on a mask based on either anatomy (anat) or temporal variance (temp). For aCompCor, one can choose either separate or combined WM and CSF compartments, as well as choosing to extract components contributing 50% of variance or a set number of components (typically 5).ica aroma(Pruim et al. 2015): the results of an idependent component analysis (ICA) followed by identification of noise components. This can be implementing by incorporating ICA regressors (basic) or directly loading a denoised file generated by fMRIprep (full).scrub(Power et al. 2012): regressors coding for time frames with excessive motion, using thresholds on framewise displacement and standardized DVARS (basic) and suppressing short time windows using the (Power et al., 2014) appreach (full).
load confounds can produce the following strategies from Ciric et al. (Ciric et al. 2017). The following table highlights the relevant options:
| Strategy | high pass | motion | wm csf | global | compcor | ica aroma | scrub |
|---|---|---|---|---|---|---|---|
Params2 | x | basic | |||||
Params6 | x | basic | |||||
Params9 | x | basic | basic | basic | full | ||
Params9scrub | x | basic | basic | ||||
Params24 | x | full | |||||
Params36 | x | full | full | full | full | ||
Params36scrub | x | full | full | ||||
AnatCompCor | x | full | anat | ||||
TempCompCor | x | temp | |||||
ICAAROMA | x | basic | full | ||||
AROMAGSR | x | basic | basic | full | |||
AggrICAAROMA | x | basic | basic | basic |
The future direction is to integrate load confounds in nilearn for better reach to a wider range of users who may benifit from the package. To facilitate the nilearn inegration, we will add sample mask to support volume-sensoring based scrubbing and improve the nilearn NiftiMasker related feature.
References
Behzadi, Yashar, Khaled Restom, Joy Liau, and Thomas T. Liu. 2007. “A Component Based Noise Correction Method (Compcor) for Bold and Perfusion Based fMRI.” NeuroImage 37 (1): 90–101. https://doi.org/10.1016/j.neuroimage.2007.04.042.
Ciric, Rastko, Daniel H. Wolf, Jonathan D. Power, David R. Roalf, Graham L. Baum, Kosha Ruparel, Russell T. Shinohara, et al. 2017. “Benchmarking of Participant-Level Confound Regression Strategies for the Control of Motion Artifact in Studies of Functional Connectivity.” Neuroimage 154: 174–87.
Esteban, Oscar, Christopher J Markiewicz, Ross W Blair, Craig A Moodie, A Ilkay Isik, Asier Erramuzpe, James D Kent, et al. 2019. “FMRIPrep: A Robust Preprocessing Pipeline for Functional Mri.” Nature Methods 16 (1): 111–16.
Jenkinson, Mark, Peter Bannister, Michael Brady, and Stephen Smith. 2002. “Improved Optimization for the Robust and Accurate Linear Registration and Motion Correction of Brain Images.” NeuroImage 17 (2): 825–41. https://doi.org/10.1006/nimg.2002.1132.
Power, Jonathan D., Kelly A. Barnes, Abraham Z. Snyder, Bradley L. Schlaggar, and Steven E. Petersen. 2012. “Spurious but Systematic Correlations in Functional Connectivity Mri Networks Arise from Subject Motion.” NeuroImage 59 (3): 2142–54. https://doi.org/10.1016/j.neuroimage.2011.10.018.
Pruim, Raimon H. R., Maarten Mennes, Daan van Rooij, Alberto Llera, Jan K. Buitelaar, and Christian F. Beckmann. 2015. “ICA-Aroma: A Robust Ica-Based Strategy for Removing Motion Artifacts from fMRI Data.” NeuroImage 112: 267–77. https://doi.org/10.1016/j.neuroimage.2015.02.064.