Nilearn — Machine Learning for NeuroImaging
Python library for ML on brain imaging data: fMRI decoding, connectivity analysis, surface plotting.
Nilearn — Machine Learning for NeuroImaging
Nilearn is a Python library for machine learning on neuroimaging data (fMRI, MRI). It bridges scikit-learn with nibabel/NifTI data formats, enabling brain decoding, functional connectivity analysis, and biomarker extraction without low-level data wrangling.
Key features
- Mass-univariate GLM for fMRI task analysis (SPM-compatible)
- Functional connectivity matrices and ICA-based parcellations
- 30+ built-in brain atlases (AAL, Destrieux, Schaefer, DiFuMo)
- High-quality 3D/4D brain plot functions (glass brain, stat maps, surfaces)
- Compatible with BIDS-formatted datasets via niworkflows
Quick start
pip install nilearn
from nilearn import datasets, plotting
from nilearn.connectome import ConnectivityMeasure
# Load example resting-state data
data = datasets.fetch_development_fmri(n_subjects=5)
measure = ConnectivityMeasure(kind="correlation")
matrices = measure.fit_transform([img for img in data.func])
plotting.plot_matrix(matrices[0], colorbar=True)
plotting.show()
npx ai-supply add nilearn-neuroimaging-ml
Curated mirror of the open-source Nilearn (BSD-3-Clause). Get it from the source.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/nilearn-neuroimaging-ml/check). Click a policy:
Consume Nilearn — Machine Learning for NeuroImaging programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/nilearn-neuroimaging-ml
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/nilearn-neuroimaging-ml/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add nilearn-neuroimaging-ml
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/nilearn-neuroimaging-ml/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "nilearn-neuroimaging-ml" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.