CNS Open Data
Latest UpdatesOpen DatasetsClinical TrialsResearch GuidesTrend ReportsGlossaryData SourcesAbout
CNS Open Data— Open Science Portal for Central Nervous System Research|Research Guides|Trend Reports|Glossary|Ranking|Open Datasets|About|Privacy Policy
AlzforumOpenNeuroDANDI ArchiveAgora (AMP-AD)
Back to Research Playbooks & Guides
Modality & Pipeline TutorialBroad CNS / NeuroimagingfMRI

BIDS Neuroimaging Pipeline Guide: Reproducible MRI, fMRI & PET Analysis in Python

End-to-end engineering tutorial for downloading, validating, preprocessing, and modeling OpenNeuro BIDS datasets.

CNS Open Data Neuroimaging Engineering TeamUpdated: 2026-10-1614 min read
Executive Summary

The Brain Imaging Data Structure (BIDS) has transformed neuroimaging from bespoke laboratory folder trees into an interoperable software ecosystem. This technical tutorial walks through the complete workflow for querying OpenNeuro datasets, understanding BIDS raw vs. derivatives hierarchies, running containerized quality control (MRIQC) and preprocessing (fMRIPrep), and extracting functional connectivity matrices with Nilearn.

Table of Contents

  1. 01.1. Anatomy of a BIDS Dataset: Raw vs. Derivatives & JSON Sidecars
  2. 02.2. Motion Denoising & Functional Connectome Extraction with Nilearn
  3. 03.Reproducible Python Starter Code
  4. 04.Governance & Reproducibility Checklist
SECTION 01

1. Anatomy of a BIDS Dataset: Raw vs. Derivatives & JSON Sidecars

A compliant BIDS dataset contains top-level metadata files—dataset_description.json, participants.tsv, and README—followed by subject folders (sub-01, sub-02) and optional longitudinal session folders (ses-baseline, ses-month12). Inside each session, data are segregated by modality: anat/ (T1w, T2w, FLAIR), func/ (bold.nii.gz and events.tsv), dwi/ (diffusion MRI with .bval/.bvec), and pet/ (dynamic PET with blood/radiotracer metadata). Every NIfTI volume is paired with a JSON sidecar inheriting parameters via the BIDS Inheritance Principle.
Key Practical Takeaways
  • Never overwrite raw BIDS files; store all preprocessed outputs under derivatives/<pipeline-name>/.
  • Inspect RepetitionTime (TR), PhaseEncodingDirection, and SliceTiming in the JSON sidecars before preprocessing.
  • Use DataLad or openneuro-py to fetch specific modalities without downloading terabytes of unused runs.
SECTION 02

2. Motion Denoising & Functional Connectome Extraction with Nilearn

Head micromovements during resting-state fMRI introduce spurious distance-dependent correlations, a major confounder when comparing movement-disorder or dementia cohorts against healthy controls. fMRIPrep outputs a comprehensive confounds_timeseries.tsv file for every run, containing 24 head-motion parameters, Framewise Displacement (FD), DVARS, and anatomical CompCor (aCompCor) components from white matter and CSF masks.

Python Example: Extracting Parcellated Functional Connectivity Matrix with Nilearn

Standard Python template ready for integration into local Jupyter notebooks or automated pipelines.

from nilearn import datasets
from nilearn.maskers import NiftiLabelsMasker
from nilearn.connectome import ConnectivityMeasure
import pandas as pd

# 1. Fetch Harvard-Oxford or Schaefer cortical parcellation atlas
atlas = datasets.fetch_atlas_harvard_oxford("cort-maxprob-thr25-2mm")
masker = NiftiLabelsMasker(labels_img=atlas.maps, standardize="zscore_sample", low_pass=0.1, high_pass=0.01, t_r=2.0)

# 2. Load fMRIPrep motion & physiological confounds
confounds_df = pd.read_csv("sub-01_task-rest_desc-confounds_timeseries.tsv", sep="\t")
confound_cols = ["trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z", "csf", "white_matter"]
clean_confounds = confounds_df[confound_cols].fillna(0).values

# 3. Extract denoised ROI time series and compute Pearson correlation matrix
time_series = masker.fit_transform("sub-01_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz", confounds=clean_confounds)
correlation_measure = ConnectivityMeasure(kind="correlation")
connectome_matrix = correlation_measure.fit_transform([time_series])[0]
print("Functional Connectome Shape:", connectome_matrix.shape)

Research Governance & Reproducibility Checklist

  • Run bids-validator prior to launching preprocessing containers.
  • Report mean Framewise Displacement (FD) per group and exclude subjects with mean FD > 0.5 mm.
  • Use zscore_sample standardization in Nilearn to prevent variance leakage.

Key Biomarkers & Standards Referenced in This Guide

View Full Glossary
BIDS
Brain Imaging Data Structure (BIDS Specification)

Community ISO-aligned standard for organizing and describing neuroimaging (MRI, fMRI, dMRI, PET) and neurophysiological (EEG, MEG, iEEG) datasets.

Read entry
fMRI
Functional Magnetic Resonance Imaging (BOLD fMRI)

Non-invasive neuroimaging modality measuring blood-oxygen-level-dependent (BOLD) hemodynamic signals to map brain network activity and functional connectivity.

Read entry
PET
Positron Emission Tomography (Amyloid / Tau / FDG / SV2A PET)

Molecular neuroimaging technique using radiolabeled tracers to quantify in vivo protein pathology (amyloid plaques, tau tangles), glucose metabolism, or synaptic density.

Read entry
DTI
Diffusion Tensor Imaging & Tractography (dMRI / NODDI)

MRI technique measuring anisotropic water diffusion along white matter tracts to quantify axonal integrity, demyelination, and structural connectomes.

Read entry
EEG
Electroencephalography & Intracranial EEG (EEG / iEEG / LFP)

High-temporal-resolution recording of postsynaptic cortical electrical potentials and neural oscillations (delta, theta, alpha, beta, gamma bands).

Read entry

Live Open Datasets & Papers Matching This Guide

Explore all matching resources
OpenNeuroAlzheimer's & DementiaOpen Dataset
Commercial Use Allowed - CC0 Public Domain

OpenNeuro ds004504: Multimodal MRI & PET Repository for Early Alzheimer’s Disease and Mild Cognitive Impairment (BIDS)

An exceptional multimodal neuroimaging repository providing 3T structural MRI, resting-state fMRI, and [18F]Florbetapir Amyloid-PET scans from 180 subjects formatted strictly to BIDS standard. This open dataset serves as a benchmark resource for deep learning and diagnostic biomarker discovery in early Alzheimer's and MCI.

AI Summary
fMRIT1w MRIdMRIPET#BIDS#fMRI#Structural MRI#Diffusion MRISample Size: 180 Subjects (450+ Sessions)
May 10, 2026
Neuroimaging Open Data Consortium
Visit SourceDOIData
View Details
OpenNeuroParkinson's & MovementOpen Dataset
Commercial Use Allowed - CC0 Public Domain

OpenNeuro ds003505: Dopaminergic Striato-Cortical Circuit Connectivity in Parkinson’s Disease during Motor Execution

This open-access 3T fMRI dataset evaluates striato-cortical circuit connectivity across 72 Parkinsonian patients and controls under levodopa ON vs. OFF states. Complete with behavioral logs, it offers foundational data for modeling dopaminergic network dynamics in motor execution.

AI Summary
Task fMRIResting fMRIBehavioral logs#BIDS#Task fMRI#Levodopa#Basal GangliaSample Size: 72 Subjects
Mar 12, 2026
Brain Connectivity Initiative
Visit SourceDOIData
View Details
OpenNeuroBroad CNS / NeuroimagingOpen Dataset
Commercial Use Allowed - CC0 Public Domain

OpenNeuro ds008898: sample dataset for odor- and speech-evoked fMRI experiment at 7 Tesla

BIDS neuroimaging dataset containing MRI scans from 1 Subjects. Freely available for computational neuroscience.

Abstract / Summary
MRI#OpenNeuro#BIDS#MRISample Size: 1 Subjects
Oct 5, 2026
Toshiki Okumura +2
Visit SourceDOIData
View Details
bioRxiv (Neuroscience)Broad CNS / NeuroimagingPreprint
Academic / Non-Commercial - cc_by_nc_nd

Aligning transformer circuit mechanisms to neural representations in relational reasoning

Relational reasoning, the capacity to understand how elements relate to one another, is a defining feature of human intelligence, yet its computational basis remains unclear. Here, we combined human neuroimaging (7T fMRI) with artificial neural network modeling to identify circuit-level analogues of...

Abstract / Summary
Preprint ArticleOpen Science#bioRxiv Preprint#neuroscience
Oct 7, 2026
Hearne, L. J. +3
Visit SourceDOIData
View Details
medRxiv (Neurology)ALS & Motor NeuronPreprint
Commercial Use Allowed - cc_by

Differential task-related fMRI effects of a single dose of guanfacine and lisdexamfetamine in youth with ADHD: a randomised, double-blind, placebo-controlled crossover study

BackgroundStimulant and non-stimulant medications increase fronto-striato-thalamic activation in youth with Attention-Deficit/Hyperactivity Disorder (ADHD). However, comparative effects of the more recently licensed stimulant lisdexamfetamine and non-stimulant guanfacine on functional magnetic reson...

Abstract / Summary
Clinical NeurologyPreprint Article#medRxiv Clinical#Clinical Neurology#psychiatry and clinical psychology#ALS
Oct 2, 2026
El Masri, S. +4
Visit SourceDOIData
View Details
bioRxiv (Neuroscience)ALS & Motor NeuronPreprint
Commercial Use Allowed - cc_by

A cascade of attentional and default mode network dynamics following the resolution of perceptual ambiguity

The neural mechanisms underlying spontaneous perceptual switches during bistable perception, particularly the dynamic interplay between large-scale brain networks, remain incompletely understood. Here, using functional magnetic resonance imaging (fMRI) in six participants and a bistable kinetic dept...

Abstract / Summary
Preprint ArticleOpen Science#bioRxiv Preprint#neuroscience#ALS
Oct 1, 2026
Ponzi, A. +2
Visit SourceDOIData
View Details

More Research Playbooks & Tutorials

Disease Research Playbook

Alzheimer's Disease (AD) Open Data Guide: Integrating Neuroimaging (BIDS), Plasma Biomarkers & Multi-Omics

12 min read
Disease Research Playbook

Parkinson's Disease (PD) Open Data Guide: Alpha-Synuclein Assays, Basal Ganglia LFP & Cohort Harmonization

11 min read
Disease Research Playbook

ALS & Motor Neuron Disease Open Data Guide: TDP-43 Cryptic Exons, NfL Trajectories & ENCALS Models

11 min read