Examples¶
Warning
If you want to run the examples, make sure you execute them in a directory where you have write permissions, or you copy the examples into such a directory. If you install nilearn manually, make sure you have followed the instructions.
Basic tutorials¶
Introductory examples that teach how to use nilearn.

Basic nilearn example: manipulating and looking at data

Intro to GLM Analysis: a single-run, single-subject fMRI dataset
Visualization of brain images¶
See Plotting brain images for more details.

Controlling the contrast of the background when plotting

Technical point: Illustration of the volume to surface sampling schemes

Visualizing Megatrawls Network Matrices from Human Connectome Project

Visualizing a probabilistic atlas: the default mode in the MSDL atlas

Visualizing multiscale functional brain parcellations
Decoding and predicting from brain images¶
See Decoding and MVPA: predicting from brain images for more details.

Decoding of a dataset after GLM fit for signal extraction

Decoding with ANOVA + SVM: face vs house in the Haxby dataset

Decoding with FREM: face vs house vs chair object recognition

Different classifiers in decoding the Haxby dataset

Encoding models for visual stimuli from Miyawaki et al. 2008

ROI-based decoding analysis in Haxby et al. dataset

Reconstruction of visual stimuli from Miyawaki et al. 2008

The haxby dataset: different multi-class strategies

Voxel-Based Morphometry on Oasis dataset with Space-Net prior
Functional connectivity¶
See Clustering to parcellate the brain in regions, Extracting functional brain networks: ICA and related or Extracting times series to build a functional connectome for more details.

Classification of age groups using functional connectivity

Clustering methods to learn a brain parcellation from fMRI

Comparing connectomes on different reference atlases

Computing a connectome with sparse inverse covariance

Connectivity structure estimation on simulated data

Deriving spatial maps from group fMRI data using ICA and Dictionary Learning

Extracting signals of a probabilistic atlas of functional regions

Group Sparse inverse covariance for multi-subject connectome

Producing single subject maps of seed-to-voxel correlation

Regions extraction using dictionary learning and functional connectomes
GLM: First level analysis¶
These are examples focused on showcasing first level models functionality and single subject analysis.
See Analyzing fMRI using GLMs for more details.

Analysis of an fMRI dataset with a Finite Impule Response (FIR) model

First level analysis of a complete BIDS dataset from openneuro

Generate an events.tsv file for the NeuroSpin localizer task
GLM: Second level analysis¶
These are examples focused on showcasing second level models functionality and group level analysis.
See Analyzing fMRI using GLMs for more details.

Second-level fMRI model: true positive proportion in clusters

Second-level fMRI model: two-sample test, unpaired and paired
Manipulating brain image volumes¶
See Manipulating images: resampling, smoothing, masking, ROIs… for more details.

Computing a Region of Interest (ROI) mask manually

Extracting signals from brain regions using the NiftiLabelsMasker

Regions Extraction of Default Mode Networks using Smith Atlas
Advanced statistical analysis of brain images¶

Beta-Series Modeling for Task-Based Functional Connectivity and Decoding

Massively univariate analysis of a calculation task from the Localizer dataset

Massively univariate analysis of a motor task from the Localizer dataset

Massively univariate analysis of face vs house recognition

Multivariate decompositions: Independent component analysis of fMRI

NeuroVault meta-analysis of stop-go paradigm studies

Surface-based dataset first and second level analysis of a dataset