TemplateFlow: Standardizing standard 3D spaces in neuroimaging
Oscar Esteban1, Rastko Ciric1, Christopher J Markiewicz2, Yaroslav O Halchenko3, Mathias Goncalves4, Satrajit S Ghosh4, Russell A Poldrack1, and Krzysztof J Gorgolewski2

1Psychology, Stanford University, Stanford, CA, United States, 2Stanford University, Stanford, CA, United States, 3Dartmouth College, Hanover, NH, United States, 4Massachusetts Institute of Technology: MIT, Cambridge, MA, United States


New community templates are generated to improve the resolution of data, to offer better alignment of brain structures across individuals incorporated into the template, and to ensure a better correspondence between the study cohort and the template. The resource is modular, thereby allowing researchers to easily use templates "off-the-shelf" or add new templates to the repository. Spatial mappings are distributed with the templates to allow transferring brain landmarks, masks, surfaces, segmentations, and parcellations between templates.


Reporting the spatial localization of brain activity has traditionally been a challenging problem for analyses of functional imaging of the human brain [1]. There exist two extended approaches to such spatial localization: first, mapping the individual's information onto a brain template, which generally is a standardized space where coordinates are stereotaxic; and second, mapping anatomical landmarks and annotations from one brain atlas in standard space into the individual's image being analyzed. In both cases, an image registration process to find the mapping between the individual and the standard space is necessary. Over the past twenty years of neuroimaging, a multiplicity of brain templates and atlases have been published [2], and although the "MNI" template [3] and later revisions [4, 5] are the most widely used, a centralized resource that provides the mapping between them is lacking. Hence, we propose TemplateFlow, a resource of neuroimaging templates and mappings between them that allows easy navigation through standard neuroimaging spaces. The modular design of the resource facilitates access by both humans and machines and permits trivial integration with existing image processing workflows and visualization tools.


  1. Download and formal normalization: files pertaining to openly shared templates are downloaded and reorganized following a BIDS[6] -like data organization. The template is given a unique, identifying name (e.g. "MNI152Lin") and all the files undergo the following sanity checks: i) datatypes are adjusted, setting integer with 16 bits resolution for averaged MR contrast images (e.g. T1-weighted templates), double precision (32 bits) floating-point numbers for the case of probability maps, unsigned integer (16-bit) for multi-label segmentations, and unsigned integer (8-bit) for binary masks and multi-label segmentations with less than 255 regions; ii) NIfTI format headers are revised, ensuring that all relevant fields, and the s/q-form orientation matrices, in particular, are correctly set and consistent with a RAS voxel orientation; iii) additional metadata files (description of the template, details about available spatial resolutions, etc.) are included to ensure the completeness of the template.
  2. Version control: Once a first version of the template has passed the first quality assessment, DataLad [7] is used to keep track of the template changes and to ensure a modular, permanent accessibility of the template. New templates are independently stored under DataLad's "superdataset" ///templateflow with the prefix "tpl-" (e.g. "///templateflow/tpl-MNI152Lin").
  3. Mapping between templates: we also propose a methodology (Figure 1) to calculate mappings from each new template to all existing ones in the database, to allow neuroimaging practitioners "navigate" across these brain templates and standardized spaces (the brain atlas concordance problem [8]). First, we selected ten subjects out of the 152 used to generate the MNI152 templates, picked randomly across those whose T1-weighted (T1w) images were manually rated by author OE as "Excellent", using MRIQC [9] visual reports. Those ten subjects are nonlinearly co-registered to the target templates that are to be mapped between and correspondingly resampled in those template spaces through the spatial transform. A final image registration process between templates is then run, using the T1w images resampled in each space as 10-channel, moving and reference images.


We have built a modular repository for digital, 3D brain-templates. Leveraging DataLad for version control and data management, we have released the resource including three templates: MNI152Lin [3], MNI152NLin2009cAsym [5] and OASIS [10]. These three initial templates are accompanied by corresponding transformation files to project data bi-directionally between them (i.e. six transformation files). The registration framework to estimate mappings between templates, as well as the ten subjects selected from the ICBM for registration, are also released to allow scientists to aggregate their templates.

Discussion and Conclusion

During the development of fMRIPrep [11] we identified the inflexibility of hard-coding standard templates within neuroimaging processing software. Although the MNI152 Nonlinear-Asymmetric version 2009c template [5] satisfies the need for a standard space for most fMRIPrep users, in some cases it is desirable to easily change the standard space for spatial normalization of subjects (e.g. a pediatric template). Currently, this is not possible because there is no standardized interface to access, retrieve, and apply brain templates. TemplateFlow addresses this limitation and provides a platform where knowledge about brain anatomy and function (e.g. parcellations, landmarks, atlases, etc.) can be easily propagated from the original space they were defined on to other templates available in the resource. Therefore, this repository will not only allow researchers to reliably access template information and modularly add their templates, but also to build cross-species mappings of macro-anatomical regions of brains as new templates (e.g. primate, rodent) are added to the resource.


This work was supported by the Laura and John Arnold Foundation, NIH grants NBIB R01EB020740, NIMH R24MH114705, and R24MH117179.


[1]M. Brett, I. S. Johnsrude, and A. M. Owen, “The problem of functional localization in the human brain,” Nat. Rev. Neurosci., vol. 3, pp. 243–249, 2002.

[2]D. A. Dickie et al., “Whole Brain Magnetic Resonance Image Atlases: A Systematic Review of Existing Atlases and Caveats for Use in Population Imaging,” Front. Neuroinformatics, vol. 11, 2017.

[3]D. L. Collins, P. Neelin, T. M. Peters, and A. C. Evans, “Automatic 3D Intersubject Registration of MR Volumetric Data in Standardized Talairach Space,” J. Comput. Assist. Tomogr., vol. 18, no. 2, pp. 192–205, Mar. 1994.

[4]J. C. Mazziotta, A. W. Toga, A. Evans, P. Fox, and J. Lancaster, “A Probabilistic Atlas of the Human Brain: Theory and Rationale for Its Development: The International Consortium for Brain Mapping (ICBM),” NeuroImage, vol. 2, no. 2, Part A, pp. 89–101, Jun. 1995.

[5]V. Fonov, A. Evans, R. McKinstry, C. Almli, and D. Collins, “Unbiased nonlinear average age-appropriate brain templates from birth to adulthood,” NeuroImage, vol. 47, Supplement 1, p. S102, Jul. 2009.

[6]K. J. Gorgolewski et al., “The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments,” Sci. Data, vol. 3, p. 160044, Jun. 2016.

[7]Yaroslav Halchenko et al., “datalad/datalad 0.9.1,” Zenodo, Oct. 2017.

[8]J. W. Bohland, H. Bokil, C. B. Allen, and P. P. Mitra, “The Brain Atlas Concordance Problem: Quantitative Comparison of Anatomical Parcellations,” PLOS ONE, vol. 4, no. 9, p. e7200, Sep. 2009.

[9]O. Esteban, D. Birman, M. Schaer, O. O. Koyejo, R. A. Poldrack, and K. J. Gorgolewski, “MRIQC: Advancing the Automatic Prediction of Image Quality in MRI from Unseen Sites,” PLOS ONE, vol. 12, no. 9, p. e0184661, Aug. 2017.

[10]B. Avants and N. Tustison, “ANTs/ANTsR Brain Templates,” 17-Oct-2018. [Online]. Available: https://doi.org/10.6084/m9.figshare.915436.v2. [Accessed: 02-Nov-2018].

[11]O. Esteban et al., “FMRIPrep: a robust preprocessing pipeline for functional MRI,” Nat. Methods (in press), p. 306951, Jul. 2018. https://doi.org/10.1101/306951

[12]B. B. Avants, C. L. Epstein, M. Grossman, and J. C. Gee, “Symmetric diffeomorphic image registration with cross-correlation: Evaluating automated labeling of elderly and neurodegenerative brain,” Med. Image Anal., vol. 12, no. 1, pp. 26–41, 2008.


Nonlinear registration framework to align templates. TemplateFlow uses a selection of ten anatomical images (T1-weighted MRI, in this case) showing high-quality as assessed by an expert using MRIQC visual reports. The ten images are brain-extracted using an adaptation of antsBrainExtraction (Step 1). Then, they are registered to Template A (reference) and to Template B (moving) using antsRegistration (Step 2). Finally, a single registration process with antsRegistration calculates the template-to-template maping (Step 3). The ten original images resampled into Template-A space are used as multi-channel registration reference and the ten original images resampled into Template-B are used as registration moving image. ANTS [12] v2.1.0 was used.

Proc. Intl. Soc. Mag. Reson. Med. 27 (2019)