Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Nilearn

Nilearn is the Python library that sits between a preprocessed dataset and an analysis. It handles the operations that are conceptually trivial and tediously easy to get wrong: masking, resampling to a common space, applying an atlas, extracting region timeseries, building connectivity matrices, and plotting the result on a brain.

Its practical value is that it makes the standard path short. Turning fMRIPrep output into a functional connectome — apply an atlas, extract timeseries, regress confounds, correlate — is a handful of lines against a well-tested implementation rather than a bespoke script whose indexing you will be re-checking in six months. It reads BIDS derivatives directly and its confound-loading utilities understand fMRIPrep’s regressor files, which removes a common source of error.

It appears throughout this book without ever being introduced: giga_connectome is built on it, and Hao-Ting Wang is a core developer.