Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.

Nilearn/Nistats pipelines for task-based functional connectivity analysis

Building a pipeline and tutorial for task fMRI analysis in nistats and functional connectivity analysis in nilearn

Data description

Human Connectome Project N-back task fMRI data (N = 35)

Emotional Music (N = 21; 11 controls and 10 patients w/ MDD)

N-back task description

Within each run, the 4 different image types are presented in separate blocks within the run. Within each run, ½ of the blocks use a 2-back working memory task (respond ‘target’ whenever the current stimulus is the same as the one two back) and ½ use a 0-back working memory task (a target cue is presented at the start of each block (Barch et al. 2013, NeuroImage; Moser et al. 2017, Molecular Psychiatry).

Emotional music description

Participants listened to blocks of positive and negative music. (2x2 matrix: MDD vs. control; postive vs. negative music) (Lepping et al. 2016, PLOS ONE)

Pipeline overview

Data processing and signal extraction

Whole brain connectivity analysis for HCP

Peak ROI connectivity analysis for emotional music

Whole brain connectivity analysis for emotional music

Nistats steps

  1. Load Working Memory fMRI HCP data or Emotional Music fMRI data
  • tfMRI_WM_RL.nii.gz <- BOLD data for run 1
  1. Smoothing
  2. Define the design matrix using onset timing
  3. Conduct GLM (including appropriate confounds)
  4. Compute contrasts (e.g., 2back, 0back, and 2back vs. 0back)
  5. Save z_maps and peak ROI coordinates

Nilearn analyses

  1. Peak ROI connectivity analysis
  2. Whole brain connectivity analysis


Tutorials for task-based activation and network analysis using Python based modules: Nilearn and Nistats. Notebooks prepared on Neurohackademy 2018 (



No releases published


No packages published