Nilearn: Streamlined neuroimaging analysis now with surface data support

Poster No:

1838 

Submission Type:

Abstract Submission 

Authors:

Himanshu Aggarwal1, Rémi Gau1, Alexis Thual1, Elizabeth DuPre2, Hande Gözükan1, Hao-Ting Wang3, Jérôme Dockès1, Michelle Wang4, Mohammad Torabi5, Nicolas Gensollen6, Taylor Salo7, Victoria Shevchenko8, Yasmin Mzayek1, Bertrand Thirion1

Institutions:

1INRIA Saclay, Paris, Ile-de-France, 2Université de Montréal, Montréal, Quebec, 3Montreal Geriatrics Institute (CRIUGM), Montréal, Quebec, 4McGill University, Montreal, Quebec, 5Montreal Neurological Institute-Hospital, Montréal, Quebec, 6INRIA Paris, Paris, Ile-de-France, 7University of Pennsylvania, Philadelphia, PA, 8Cognitive Neuroanatomy Lab, Université Paris Cité, INCC UMR 8002, CNRS, Paris, Île-de-France

First Author:

Himanshu Aggarwal  
INRIA Saclay
Paris, Ile-de-France

Co-Author(s):

Rémi Gau  
INRIA Saclay
Paris, Ile-de-France
Alexis Thual  
INRIA Saclay
Paris, Ile-de-France
Elizabeth DuPre  
Université de Montréal
Montréal, Quebec
Hande Gözükan  
INRIA Saclay
Paris, Ile-de-France
Hao-Ting Wang  
Montreal Geriatrics Institute (CRIUGM)
Montréal, Quebec
Jérôme Dockès  
INRIA Saclay
Paris, Ile-de-France
Michelle Wang  
McGill University
Montreal, Quebec
Mohammad Torabi  
Montreal Neurological Institute-Hospital
Montréal, Quebec
Nicolas Gensollen  
INRIA Paris
Paris, Ile-de-France
Taylor Salo, PhD  
University of Pennsylvania
Philadelphia, PA
Victoria Shevchenko  
Cognitive Neuroanatomy Lab, Université Paris Cité, INCC UMR 8002, CNRS
Paris, Île-de-France
Yasmin Mzayek  
INRIA Saclay
Paris, Ile-de-France
Bertrand Thirion  
INRIA Saclay
Paris, Ile-de-France

Introduction:

Nilearn is a Python package that aims to simplify statistical analysis and machine learning on brain images, with an increasing user base and over 200 contributors on GitHub. It leverages scikit-learn's [1] established API design philosophy and extends its machine-learning models specifically for neuroimaging data.
Nilearn is widely recognized within the neuroscience research community, with 277 citations in open-access publications [2]. Our recently integrated support for surface data (i.e., GIfTI files), therefore, promises to be of significant interest to a wide portion of the neuroimaging community. Over the past year, surface data support has moved from an experimental feature to fully integrated across all modules, such as decoding, general linear modeling (GLM), and visualization.
In addition, Nilearn's documentation now consists of several guides and examples to help users interact with this new surface API. As Nilearn follows "documentation-driven development," this adoption provides opportunities for additional, significant advances in surface support in the Python neuroimaging open-source software ecosystem as additional user-stories are identified. Other highlights include improved reporting, enforcing code formatting rules via Ruff [3], and making Nilearn's estimators more compliant with scikit-learn's guidelines [4].

Methods:

Nilearn is designed to be accessible to researchers and developers. The documentation comprises a comprehensive user guide and an illustrative example gallery tailored for specific research use cases, along with detailed contribution and maintenance guidelines.
We actively engage with the community via Neurostars, GitHub, Discord, X, and Bluesky and welcome questions, bug reports, enhancement suggestions, and direct involvement in refining the source code. Nilearn is also actively showcased in various tutorials and workshops held annually, such as the OHBM Brainhack and the Montreal Artificial Intelligence and Neuroscience (MAIN) Educational Workshop.
We follow standard software development practices, including version control, automated continuous integration infrastructure that ensures constant testing, and rigorous reviews for contributions.

Results:

With over 10 years of ongoing development, Nilearn has reached more than 1200 stars, 600 forks, and is used by more than 200 packages on GitHub. Its continuous growth is evident via an increase in downloads over the years, reaching a peak of 600k in 2024 (Fig.1).
Nilearn now supports brain image manipulation, GLM-based analysis, predictive modeling, classification, decoding, connectivity analysis, and visualization of brain imaging data. In the latest release (v0.11.0) [5], we extended all of these modules to work with surface data (i.e., GIfTI). This ensures that all the analyses that were previously only possible on volumetric data can now also be done on the surface representation of brain imaging data (Fig. 2).
Furthermore, now all the maskers – the module that allows users to extract brain signals from fMRI data – can produce reports that contain visualizations and other important information, providing an overview of the manipulations done during data processing.
Maintenance is critical for user trust in a software. We have thus continued to focus significant attention on code maintenance, including the adoption of Ruff formatting and linting rules to improve codebase standardization and consistency. In addition, we also extended our test suite to include scikit-learn's estimator checks to ensure that Nilearn's estimators comply with scikit-learn's recommendations.
Supporting Image: downloads_pypi.png
   ·Fig. 1: Nilearn package downloads over the years via PyPI (or pip) since 2016.
Supporting Image: merged.png
   ·Fig. 2: Code snippet demonstrating loading of surface data, creating a SurfaceImage object that can then be used with SurfaceMasker to extract brain signals and finally for visualization.
 

Conclusions:

The growing reliance on Nilearn underscores its accessibility and utility within the neuroimaging community. Future planned work includes extending further support for cortical surface analyses, including support of the CIFTI file format. In addition, as the package grows, improving the codebase to meet the new standards will ensure the robustness of this tool.

Modeling and Analysis Methods:

Classification and Predictive Modeling 2
Connectivity (eg. functional, effective, structural)
Methods Development

Neuroinformatics and Data Sharing:

Informatics Other 1

Keywords:

Computational Neuroscience
Computing
Data analysis
Machine Learning
Modeling
Open-Source Code
Open-Source Software

1|2Indicates the priority used for review

Abstract Information

By submitting your proposal, you grant permission for the Organization for Human Brain Mapping (OHBM) to distribute your work in any format, including video, audio print and electronic text through OHBM OnDemand, social media channels, the OHBM website, or other electronic publications and media.

I accept

The Open Science Special Interest Group (OSSIG) is introducing a reproducibility challenge for OHBM 2025. This new initiative aims to enhance the reproducibility of scientific results and foster collaborations between labs. Teams will consist of a “source” party and a “reproducing” party, and will be evaluated on the success of their replication, the openness of the source work, and additional deliverables. Click here for more information. Propose your OHBM abstract(s) as source work for future OHBM meetings by selecting one of the following options:

I am submitting this abstract as an original work to be reproduced. I am available to be the “source party” in an upcoming team and consent to have this work listed on the OSSIG website. I agree to be contacted by OSSIG regarding the challenge and may share data used in this abstract with another team.

Please indicate below if your study was a "resting state" or "task-activation” study.

Other

Healthy subjects only or patients (note that patient studies may also involve healthy subjects):

Healthy subjects

Was this research conducted in the United States?

No

Were any human subjects research approved by the relevant Institutional Review Board or ethics panel? NOTE: Any human subjects studies without IRB approval will be automatically rejected.

Not applicable

Were any animal research approved by the relevant IACUC or other animal research panel? NOTE: Any animal studies without IACUC approval will be automatically rejected.

Not applicable

Please indicate which methods were used in your research:

Computational modeling
Other, Please specify  -   Open-source Software

For human MRI, what field strength scanner do you use?

If Other, please list  -   None

Which processing packages did you use for your study?

Other, Please list  -   Nilearn

Provide references using APA citation style.

[1] Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E. (2011). Scikit-learn: Machine Learning in Python, Journal of Machine Learning Research, 12, 2825-2830.

[2] NiLearn (RRID:SCR_001362)

[3] https://docs.astral.sh/ruff/

[4] https://scikit-learn.org/stable/developers/develop.html

[5] Nilearn contributors, Chamma, A., Frau-Pascual, A., Rothberg, A., Abadie, A., Abraham, A., Gramfort, A., Savio, A., Cionca, A., Sayal, A., Thual, A., Kodibagkar, A., Kanaan, A., Pinho, A. L., Joshi, A., Idrobo, A. H., Kieslinger, A.-S., Kumari, A., Rokem, A., … Nájera, Ó. (2024). nilearn (0.11.0). Zenodo. https://doi.org/10.5281/zenodo.14259676

UNESCO Institute of Statistics and World Bank Waiver Form

I attest that I currently live, work, or study in a country on the UNESCO Institute of Statistics and World Bank List of Low and Middle Income Countries list provided.

No