Analysis of task-based functional MRI data preprocessed with fMRIPrep


Functional magnetic resonance imaging (fMRI) is a standard tool to investigate the neural correlates of cognition. fMRI noninvasively measures brain activity, allowing identification of patterns evoked by tasks performed during scanning. Despite the long history of this technique, the idiosyncrasies of each dataset have led to the use of ad-hoc preprocessing protocols customized for nearly every different study. This approach is time consuming, error prone and unsuitable for combining datasets from many sources. Here we showcase fMRIPrep (, a robust tool to prepare human fMRI data for statistical analysis. This software instrument addresses the reproducibility concerns of the established protocols for fMRI preprocessing. By leveraging the Brain Imaging Data Structure to standardize both the input datasets (MRI data as stored by the scanner) and the outputs (data ready for modeling and analysis), fMRIPrep is capable of preprocessing a diversity of datasets without manual intervention. In support of the growing popularity of fMRIPrep, this protocol describes how to integrate the tool in a task-based fMRI investigation workflow.

Access options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Fig. 1: Overall workflow of the fMRIPrep protocol.
Fig. 2: Running fMRIPrep on HPC.
Fig. 3: Output of the first-level analysis step.
Fig. 4: Group analysis results.

Data availability

This protocol uses ds000003, a dataset publicly available at under the terms of the CC0 license. OpenNeuro and other neuroimaging archives contain a large number of open datasets in which this protocol can be exercised and evaluated. The outcomes of preprocessing ds000003 are available using DataLad ( under a CC0 license, with DataLad dataset locator ///labs/poldrack/ds003_fmriprep. Results of the analysis workflow described in this protocol are also distributed under the CC0 license and can be accessed with DataLad, with DataLad dataset locator ///labs/poldrack/NP-180740.

Code availability

fMRIPrep is open source, available at under a three-clause Berkeley Software Distribution license. The code for the exemplary analysis and visualizations is available at under an Apache-2.0 license.


  1. 1.

    Poldrack, R. A. & Farah, M. J. Progress and challenges in probing the human brain. Nature 526, 371–379 (2015).

    CAS  PubMed  Google Scholar 

  2. 2.

    Ogawa, S., Lee, T. M., Kay, A. R. & Tank, D. W. Brain magnetic resonance imaging with contrast dependent on blood oxygenation. Proc. Natl Acad. Sci. USA 87, 9868–9872 (1990).

    CAS  PubMed  Google Scholar 

  3. 3.

    Poldrack, R. A. et al. Toward open sharing of task-based fMRI data: the OpenfMRI project. Front. Neuroinformatics 7, 12 (2013).

    Google Scholar 

  4. 4.

    Gorgolewski, K. J., Esteban, O., Schaefer, G., Wandell, B. & Poldrack, R. A. OpenNeuro—a free online platform for sharing and analysis of neuroimaging data. in Organization for Human Brain Mapping 1677 (2017).

  5. 5.

    Carp, J. On the plurality of (methodological) worlds: estimating the analytic flexibility of fMRI experiments. Front. Neurosci. 6, 149 (2012).

    PubMed  PubMed Central  Google Scholar 

  6. 6.

    Bowring, A., Maumet, C. & Nichols, T. E. Exploring the impact of analysis software on task fMRI results. Hum. Brain Mapp. 40, 3362–3384 (2019).

    PubMed  PubMed Central  Google Scholar 

  7. 7.

    Esteban, O. et al. fMRIPrep: a robust preprocessing pipeline for functional MRI. Nat. Methods 16, 111–116 (2019).

    CAS  PubMed  Google Scholar 

  8. 8.

    Xue, G. & Poldrack, R. A. The neural substrates of visual perceptual learning of words: implications for the visual word form area hypothesis. J. Cogn. Neurosci. 19, 1643–1655 (2007).

    PubMed  Google Scholar 

  9. 9.

    Gorgolewski, K. et al. Nipype: a flexible, lightweight and extensible neuroimaging data processing framework in Python. Front. Neuroinform. 5, 13 (2011).

    PubMed  PubMed Central  Google Scholar 

  10. 10.

    Jenkinson, M., Beckmann, C. F., Behrens, T. E. J., Woolrich, M. W. & Smith, S. M. FSL. NeuroImage 62, 782–790 (2012).

    PubMed  Google Scholar 

  11. 11.

    Esteban, O. et al. MRIQC: advancing the automatic prediction of image quality in MRI from unseen sites. PLoS One 12, e0184661 (2017).

    PubMed  PubMed Central  Google Scholar 

  12. 12.

    Gorgolewski, K. J. et al. The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments. Sci. Data 3, 160044 (2016).

    PubMed  PubMed Central  Google Scholar 

  13. 13.

    Working draft of BIDS Derivatives (BIDS Extension Proposals 3, 11, 12, 13, 14, and 16): representation of the outputs of common processing pipelines. Available at (accessed 18 March 2019) (2019).

  14. 14.

    Ciric, R. et al. Mitigating head motion artifact in functional connectivity MRI. Nat. Protoc. 13, 2801–2826 (2018).

    CAS  PubMed  Google Scholar 

  15. 15.

    Finc, K., Chojnowski, M. & Bonna, K. fMRIDenoise: automated denoising, denoising strategies comparison, and functional connectivity data quality control. (accessed 30 September 2019) (2019).

  16. 16.

    Detre, J. A., Leigh, J. S., Williams, D. S. & Koretsky, A. P. Perfusion imaging. Magn. Reson. Med. 23, 37–45 (1992).

    CAS  PubMed  Google Scholar 

  17. 17.

    Qiu, D., Zaharchuk, G., Christen, T., Ni, W. W. & Moseley, M. E. Contrast-enhanced functional blood volume imaging (CE-fBVI): enhanced sensitivity for brain activation in humans using the ultrasmall superparamagnetic iron oxide agent ferumoxytol. NeuroImage 62, 1726–1731 (2012).

    PubMed  PubMed Central  Google Scholar 

  18. 18.

    Lu, H., Golay, X., Pekar, J. J. & van Zijl, P. C. M. Functional magnetic resonance imaging based on changes in vascular space occupancy. Magn. Reson. Med. 50, 263–274 (2003).

    PubMed  Google Scholar 

  19. 19.

    Davis, T. L., Kwong, K. K., Weisskoff, R. M. & Rosen, B. R. Calibrated functional MRI: mapping the dynamics of oxidative metabolism. Proc. Natl Acad. Sci. USA 95, 1834–1839 (1998).

    CAS  PubMed  Google Scholar 

  20. 20.

    Sikka, S. et al. Towards automated analysis of connectomes: the configurable pipeline for the analysis of connectomes (C-PAC). in 5th INCF Congress of Neuroinformatics. 117 (2014).

  21. 21.

    Van Essen, D. C. et al. The Human Connectome Project: a data acquisition perspective. NeuroImage 62, 2222–2231 (2012).

    PubMed  PubMed Central  Google Scholar 

  22. 22.

    Glasser, M. F. et al. The minimal preprocessing pipelines for the Human Connectome Project. NeuroImage 80, 105–124 (2013).

    PubMed  PubMed Central  Google Scholar 

  23. 23.

    Poldrack, R. A., Mumford, J. A. & Nichols, T. E. Handbook of Functional MRI Data Analysis (Cambridge University Press, 2011).

  24. 24.

    Mumford, J. A. & Nichols, T. E. Power calculation for group fMRI studies accounting for arbitrary design and temporal autocorrelation. NeuroImage 39, 261–268 (2008).

    PubMed  Google Scholar 

  25. 25.

    Nichols, T. E. & Holmes, A. P. Nonparametric permutation tests for functional neuroimaging: a primer with examples. Hum. Brain Mapp. 15, 1–25 (2002).

    PubMed  Google Scholar 

  26. 26.

    Halchenko, Y. O. et al. Open Brain Consent: make open data sharing a no-brainer for ethics committees. (accessed 18 March 2019) (2018).

  27. 27.

    Cox, R. W. & Hyde, J. S. Software tools for analysis and visualization of fMRI data. NMR Biomed. 10, 171–178 (1997).

    CAS  PubMed  Google Scholar 

  28. 28.

    Avants, B. B. et al. A reproducible evaluation of ANTs similarity metric performance in brain image registration. NeuroImage 54, 2033–2044 (2011).

    PubMed  Google Scholar 

  29. 29.

    Fischl, B. FreeSurfer. NeuroImage 62, 774–781 (2012).

    PubMed  PubMed Central  Google Scholar 

  30. 30.

    Abraham, A. et al. Machine learning for neuroimaging with scikit-learn. Front. Neuroinform 8, 14 (2014).

    PubMed  PubMed Central  Google Scholar 

  31. 31.

    Kennedy, D. N. et al. Everything matters: the ReproNim perspective on reproducible neuroimaging. Front. Neuroinform. 13, 1 (2019).

    PubMed  PubMed Central  Google Scholar 

  32. 32.

    Halchenko, Y. O. et al. Open Source Software: Heudiconv. (accessed 18 March 2019) (2018).

  33. 33.

    Yoo, A. B., Jette, M. A. & Grondona, M. SLURM: simple Linux utility for resource management. in Job Scheduling Strategies for Parallel Processing (eds. Feitelson, D., Rudolph, L. & Schwiegelshohn, U.) 44–60 (Springer, 2003).

  34. 34.

    Kurtzer, G. M., Sochat, V. & Bauer, M. W. Singularity: scientific containers for mobility of compute. PLoS One 12, e0177459 (2017).

    PubMed  PubMed Central  Google Scholar 

  35. 35.

    Feingold, F., Esteban, O. & Markiewicz, C. fMRIPrep tutorial: running the docker image. (accessed 18 March 2019) (2019).

  36. 36.

    Esteban, O. et al. Open Source Software: Task fMRI Analysis using FSL and data preprocessed with fMRIPrep. (accessed 10 April 2019) (2019).

  37. 37.

    Smith, S. M. & Brady, J. M. SUSAN—a new approach to low level image processing. Int. J. Comput. Vis. 23, 45–78 (1997).

    Google Scholar 

  38. 38.

    Woolrich, M. W., Ripley, B. D., Brady, M. & Smith, S. M. Temporal autocorrelation in univariate linear modeling of FMRI data. NeuroImage 14, 1370–1386 (2001).

    CAS  PubMed  Google Scholar 

  39. 39.

    Woolrich, M. W., Behrens, T. E. J., Beckmann, C. F., Jenkinson, M. & Smith, S. M. Multilevel linear modelling for FMRI group analysis using Bayesian inference. NeuroImage 21, 1732–1747 (2004).

    PubMed  Google Scholar 

  40. 40.

    Mechelli, A., Friston, K. J. & Price, C. J. The effects of presentation rate during word and pseudoword reading: a comparison of PET and fMRI. J. Cogn. Neurosci. 12, 145–156 (2000).

    PubMed  Google Scholar 

  41. 41.

    Mechelli, A., Gorno-Tempini, M. L. & Price, C. J. Neuroimaging studies of word and pseudoword reading: consistencies, inconsistencies, and limitations. J. Cogn. Neurosci. 15, 260–271 (2003).

    PubMed  Google Scholar 

  42. 42.

    Gorgolewski, K. J. et al. BIDS apps: improving ease of use, accessibility, and reproducibility of neuroimaging data analysis methods. PLoS Comput. Biol. 13, e1005209 (2017).

    PubMed  PubMed Central  Google Scholar 

  43. 43.

    Tustison, N. J. et al. N4ITK: improved N3 bias correction. IEEE Trans. Med. Imaging 29, 1310–1320 (2010).

    PubMed  PubMed Central  Google Scholar 

  44. 44.

    Dale, A. M., Fischl, B. & Sereno, M. I. Cortical surface-based analysis: I. segmentation and surface reconstruction. NeuroImage 9, 179–194 (1999).

    CAS  PubMed  Google Scholar 

  45. 45.

    Klein, A. et al. Mindboggling morphometry of human brains. PLoS Comput. Biol. 13, e1005350 (2017).

    PubMed  PubMed Central  Google Scholar 

  46. 46.

    Fonov, V. et al. Unbiased average age-appropriate atlases for pediatric studies. NeuroImage 54, 313–327 (2011).

    PubMed  Google Scholar 

  47. 47.

    Avants, B. B., Epstein, C. L., Grossman, M. & Gee, J. C. Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain. Med. Image Anal. 12, 26–41 (2008).

    CAS  PubMed  Google Scholar 

  48. 48.

    Zhang, Y., Brady, M. & Smith, S. Segmentation of brain MR images through a hidden Markov random field model and the expectation-maximization algorithm. IEEE Trans. Med. Imaging 20, 45–57 (2001).

    CAS  Google Scholar 

  49. 49.

    Huntenburg, J. M. Evaluating nonlinear coregistration of BOLD EPI and T1w images (Freie Universität, Berlin, Germany, 2014).

  50. 50.

    Wang, S. et al. Evaluation of field map and nonlinear registration methods for correction of susceptibility artifacts in diffusion MRI. Front. Neuroinform. 11, 17 (2017).

    PubMed  PubMed Central  Google Scholar 

  51. 51.

    Treiber, J. M. et al. Characterization and correction of geometric distortions in 814 diffusion weighted images. PLoS One 11, e0152472 (2016).

    PubMed  PubMed Central  Google Scholar 

  52. 52.

    Greve, D. N. & Fischl, B. Accurate and robust brain image alignment using boundary-based registration. NeuroImage 48, 63–72 (2009).

    PubMed  PubMed Central  Google Scholar 

  53. 53.

    Jenkinson, M., Bannister, P., Brady, M. & Smith, S. Improved optimization for the robust and accurate linear registration and motion correction of brain images. NeuroImage 17, 825–841 (2002).

    PubMed  Google Scholar 

  54. 54.

    Power, J. D. et al. Methods to detect, characterize, and remove motion artifact in resting state fMRI. NeuroImage 84, 320–341 (2014).

    PubMed  Google Scholar 

  55. 55.

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

    PubMed  PubMed Central  Google Scholar 

  56. 56.

    Lanczos, C. Evaluation of noisy data. J. Soc. Ind. Appl. Math. Ser. B Numer. Anal. 1, 76–85 (1964).

    Google Scholar 

Download references


We thank the many community contributors who have helped fMRIPrep with code and documentation ( This work was supported by the Laura and John Arnold Foundation (R.A.P. and K.J.G.), the NIH (grant NBIB R01EB020740; S.S.G.) and NIMH (R24MH114705 and R24MH117179; R.A.P.). K.F. was supported by the Foundation for Polish Science, Poland (START 23.2018). D.E.P.G. was supported by a Marie Curie FP7-PEOPLE-2013-ITN ‘Initial Training Networks’ Action from the European Union (Project Reference Number: 608123). F.L. was supported by the University Research Priority Program ‘Dynamics of Healthy Aging’ at the University of Zurich. N.J. was supported by a National Science Foundation Graduate Research Fellowship (grant number DGE 16-44869). H.S. was supported by the Max Planck Society, Munich, Germany (grant number 647070403019). S.U. and E.D. were supported by Brain Canada.

Author information




O.E., R.A.P. and K.J.G. contributed to conceptualization, data curation and funding acquisition. O.E., R.C. and K.F. contributed to formal analysis, investigation, methodology and validation and wrote the original draft. K.F. contributed visualizations. O.E., J.W. and W.H.T. contributed to interpretation and overall framing of the protocol. R.A.P. and K.J.G. contributed to project administration, resources and supervision. All the authors have contributed software and/or documentation, read the manuscript and edited/revised the original draft and later versions.

Corresponding author

Correspondence to Oscar Esteban.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Peer review information Nature Protocols thanks Jo Etzel and Angela Laird for their contribution to the peer review of this work.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Related links

Key references using this protocol

Esteban, O. et al. Nat. Methods 16, 111–116 (2019):

Key data used in this protocol

Xue, G. & Poldrack, R. A. J. Cogn. Neurosci. 19, 1643–1655 (2007):

Supplementary information

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Esteban, O., Ciric, R., Finc, K. et al. Analysis of task-based functional MRI data preprocessed with fMRIPrep. Nat Protoc 15, 2186–2202 (2020).

Download citation


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.