class: cover .cover-band[ .lockup[] .eyebrow[WG3 Training School · Madrid 2026] # Processing functional magnetic resonance images with [*fMRIPrep*](https://fmriprep.org/en/stable/) .who[Lea Waller · 02.10.2026] .mosaic[] ] .cover-side[ [ www.indos-costaction.eu/wg3-ts2026-waller](https://www.indos-costaction.eu/wg3-ts2026-waller/) ] .cover-logos[  ] --- layout: true .perma-sidebar[ [](https://creativecommons.org/licenses/by/4.0/) .sidebar-text[INDoS WG3 Training School · Processing fMRI with *fMRIPrep* (02.10.2026)] ] --- ## WiFi .cards.wifi[ .card.turquoise[ ### eventos-csic Password given on site ] .card.orange[ ### M30-00A7 Password given on site ] .card.gray[ ### eduroam Please don't use due to congestion ] ] --- ## About me .about-photo[  .gray-text[Lea Waller (she/her)] [GitHub](https://github.com/HippocampusGirl) · [ORCID](https://orcid.org/0000-0002-3239-6957) [lea@fmri.science](mailto:lea@fmri.science) ] .cards[ .card.turquoise[ .kicker[PhD · 2020-2027] ### Meta-analyses for fMRI in psychiatry Developing tools for collaborative meta-analyses, in use at 81 universities in 22 countries .gray-text[Bernstein Center for Computational Neuroscience, Berlin, Germany] .logo[] ] .card.orange[ .kicker[Postdoc · Now] ### NeuroAI for early detection of Alzheimer's disease Representational alignment between human brain measurements and deep neural networks .gray-text[[SIMEXP](https://simexp.github.io) lab] .gray-text[Université de Montréal, Canada] .logo[] ] ] --- class: agenda ## Agenda | Time | Session | | :- | :- | | 09:00-09:30 | .theory[Theory] From fMRI Preprocessing to *fMRIPrep* | | 09:30-10:30 | .practical[Practical] *fMRIPrep* setup | | 10:30-11:00 | .theory[Theory] Quality control | | 11:00-11:30 | .practical[Practical] fMRI Open QC Project | | 11:30-12:00 | .theory[Theory] Functional connectivity | | 12:00-13:00 | .practical[Practical] Brain age | ### Learning goals .cards.learning-goals[ .card.turquoise[ Understand what *fMRIPrep* does ] .card.orange[ Assess the quality of its outputs ] .card.lavender[ Explore how denoising changes results ] ] --- class: center, middle # .theory[Theory] # From fMRI Preprocessing to *fMRIPrep* --- ## Why do data require preprocessing? All analyses require consistent and accurate **spatiotemporal location** - **Within runs:** head motion, slice timing - **Within individuals:** coregistration between runs and with anatomy, susceptibility distortion - **Across subjects:** spatial normalization .source[Chris Markiewicz & Oscar Esteban, [fMRIPrep Bootcamp Geneva 2024](https://www.nipreps.org/presentations/2024-fMRIPrep-Bootcamp-Geneva/day1-01-fmriprep-primer/)] --- ## Anatomical and functional images .cards[ .card.turquoise[ ### T1-weighted .slice[] Brain anatomy with clear gray/white matter contrast ] .card.orange[ ### T2\*-weighted .slice[] Sensitive to changes in deoxyhemoglobin: the basis of the BOLD signal, an indirect measure of neural activity ] ] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- ## BOLD is an indirect measurement .hanoi[ .card.navy[ We measure a **BOLD** response ] .card.navy[ Hydrogen spins **dephase** more slowly ] .card.orange[ **Deoxyhemoglobin** is washed out ] .card.orange[ **Blood flow** and oxygen delivery increase ] .card.turquoise[ **Metabolic** activity in neurons and astrocytes ] .card.turquoise[ **Signaling** in groups of neurons ] .card.lavender[ **Mental** process ] ] .source[Jim Coan, PSYC 5559 Social relationships: Neuroscience, evolution and ecology, University of Virginia, 2014] .source[[Logothetis & Wandell, 2004](https://www.annualreviews.org/content/journals/10.1146/annurev.physiol.66.082602.092845)] --- ## Hemodynamic response function .main.hrf[] .source[[GLMsingle](https://github.com/cvnlab/GLMsingle) HRF library] .source[[Glover, 1999](https://doi.org/10.1006/nimg.1998.0419)] --- ## Task-based fMRI .card.lavender.stimuli[ ### A multi-subject, multi-modal human neuroimaging dataset .stimulus-pair[ .figure[ .caption[Face] ] .gray-text[versus] .figure[ .caption[Scrambled face] ] ] ] .glm[  .step.in[ *Y* = *Xβ* ] .in[  ] ] .source[sub-01 run-01 of [ds000117](https://openneuro.org/datasets/ds000117)] .source[Waller et al. 2023] --- name: functional-connectivity ## Functional connectivity .flow.connectivity[ .step[ Atlas ] .step.in[ Time series ] .step.in[ Connectivity matrix ] ] .source[sub-10159 of [ds000030](https://openneuro.org/datasets/ds000030)] .source[[Schaefer et al., 2018](https://doi.org/10.1093/cercor/bhx179)] --- class: middle
.label[fMRI scan] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- .step.in[ ### Slice timing ] .panel[ - Most fMRI acquisitions measure slice by slice - Slices are sampled at different times - Slice timing interpolates each volume as if it was acquired all at once - Should be applied before motion correction, because motion correction changes which anatomical location each voxel corresponds to ] --- class: middle
.label[After slice timing correction] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- .step.in[ ### Head motion correction ] .panel[ - Participants move their head involuntarily - The same voxel location then maps to different anatomical locations in different volumes - Head motion correction aligns all volumes to a common spatial reference - Estimates three translations (*x*, *y*, *z*) and three rotations (roll, pitch, yaw) for each volume - These parameters are kept as confounds for later denoising ] --- class: middle
.label[After head motion correction] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- class: middle .main[] .label[Relatively undistorted T1w sMRI scan] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- class: middle .main[] .label[Before susceptibility distortion correction] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- class: middle
.label[After susceptibility distortion correction] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] clear --- .step.in[ ### Susceptibility distortion correction (SDC) ] .panel[ - Air-tissue boundaries (sinuses, ear canals) distort the local B
0
field - EPI images are stretched and compressed along the phase-encoding direction - Information is lost in compressed regions - Estimate a map of the B
0
field to derive how far each voxel was displaced ] --- .step.in[ ### Standard space ] .panel[ - Brains differ in size, shape and position - Normalization maps every participant to a common brain template - In standard space, voxels correspond across participants - The BOLD reference is co-registered to the T1w image, and the T1w image to the template ] --- class: middle .main[] .label[MNI152NLin2009cAsym template] .source[[Fonov et al., 2011](https://doi.org/10.1016/j.neuroimage.2010.07.033)] .source[[TemplateFlow](https://www.templateflow.org)] --- class: middle
.label[BOLD in standard space] .source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- .step.in[ ### Denoising ] .panel[ - Motion correction leaves lingering motion effects in the signal - Physiological signals like breathing and heartbeat, as well as scanner drift - *fMRIPrep* generates **confound time series**, but does not remove them - Choose a denoising strategy and regress the confound time series out ] --- ## Denoising improves task signal .card.lavender.stimuli[ ### A multi-subject, multi-modal human neuroimaging dataset .stimulus-pair[ .figure[ .caption[Face] ] .gray-text[versus] .figure[ .caption[Scrambled face] ] ] ] .cards[   ] .source[sub-01 run-01 of [ds000117](https://openneuro.org/datasets/ds000117)] .source[[Waller et al., 2022](https://doi.org/10.1002/hbm.25829)] --- ## Summary .flow[.step[Slice timing] .step.in.spatial[Head motion correction] .step.in.spatial[Susceptibility distortion correction] .step.in.spatial[Standard space] .step.in[Denoising]] --- ## *fMRIPrep*: fit & transform
.source[Oscar Esteban, [Preprocessing & pipelines, ESMRMB 2025](https://www.nipreps.org/presentations/2025-esmrmb/)] --- ## *fMRIPrep* is minimal preprocessing - Agnostic to downstream analysis: no analysis-specific steps - Does not regress out confounds or apply smoothing - Cross-sectional: assumes a participant's anatomy does not change between sessions - Designed for the common case (80/20 principle) .source[Chris Markiewicz & Oscar Esteban, [fMRIPrep Bootcamp Geneva 2024](https://www.nipreps.org/presentations/2024-fMRIPrep-Bootcamp-Geneva/day1-01-fmriprep-primer/)] --- ## Visual reports
.source[NDARINVXP963GZ5 of the [Transdiagnostic Connectome Project](https://openneuro.org/datasets/ds005237)] --- class: middle .center[ # .practical[Practical] # *fMRIPrep* setup ] 1. Open Neurodesk Play 2. Once Jupyter Lab opens, click the Terminal button in the center of the top row 3. Download the notebook with the command ```bash datalad install https://github.com/indos-costaction/wg3-ts2026-waller ``` 4. Navigate to the new directory `wg3-ts2026-waller` in the files browser on the left 5. Open the notebook `practical-1-fmriprep-setup.ipynb` by double-clicking it 6. Follow the notebook --- class: middle .center[ # .theory[Theory] # Quality control ] --- ## Why quality control needs a protocol .cards[ .card.turquoise[ More than 200 sites across the ENIGMA consortium run the same analysis on their own data ] .card.orange[ Sites usually share results, not images, so each site checks the quality of its own scans ] ] .map[ .card.turquoise[ Shared protocol ]  .card.lavender[ Pooling ] ] .cards[ .card.turquoise[ **Quality ratings need to be consistent across raters and sites** ] ] .source[[github.com/HALFpipe/HALFpipe](https://github.com/HALFpipe/HALFpipe)] .source[[Waller et al., 2022](https://doi.org/10.1002/hbm.25829)] --- ## *HALFpipe* .cards.steps[ .card.turquoise[ .kicker[ Step 1 ] Data input and configuration ] .card.orange[ .kicker[ Step 2 ] Preprocessing using *fMRIPrep* ] .card.lavender[ .kicker[ Step 3 ] Connectivity matrices and statistical maps ] .card.purple[ .kicker[ Step 4 ] Visual quality control ] .card.gray.ui[ Terminal-based user interface ] .card.gray.ui[ Browser-based user interface ] ] .source[[github.com/HALFpipe/HALFpipe](https://github.com/HALFpipe/HALFpipe)] .source[[Waller et al., 2022](https://doi.org/10.1002/hbm.25829)] --- ## T1w skull stripping .qc-definition[**Skull stripping:** identify brain tissue in the T1-weighted anatomical image and exclude skull and other non-brain tissue.] .cards.qc[ .figure.card.turquoise[ .caption[The mask outline follows the edge of the brain]  ] .figure.card.red.bad[ .caption[The mask outline misses brain or includes non-brain tissue]  ] ] .source[fMRI Open QC Project] .source[[HALFpipe quality control protocol](https://fmri.science/halfpipe/quality-control.html)] --- ## T1w spatial normalization .qc-definition[**Spatial normalization:** map each participant’s anatomy to a shared template so corresponding structures align.] .cards.qc[ .figure.card.turquoise[ .caption[Template outlines match the structures of the T1w image]  ] .figure.card.red.bad[ .caption[Template and T1w image are misaligned]  ] ] .source[[HALFpipe quality control protocol](https://fmri.science/halfpipe/quality-control.html)] --- ## EPI tSNR .qc-definition[**EPI:** echo-planar imaging, the acquisition used here for BOLD. **tSNR:** temporal signal-to-noise ratio — each voxel’s mean signal over time divided by its temporal standard deviation.] .cards.qc[ .figure.card.turquoise[ .caption[Symmetric signal without drop-out or stripes]  ] .figure.card.red.bad[ .caption[Stripe artifacts in the sagittal and coronal views]  ] ] .source[[HALFpipe quality control protocol](https://fmri.science/halfpipe/quality-control.html)] --- ## EPI confounds .qc-definition[**FD (framewise displacement):** estimated head movement between consecutive volumes. **DVARS:** root mean square of the voxelwise signal changes between consecutive volumes. **Carpet plot:** voxel signals over time, stacked as rows.] .cards.qc[ .figure.card.turquoise[ .caption[No large changes in the carpet plot, low motion]  ] .figure.card.red.bad[ .caption[Sudden changes that match motion spikes]  ] ] .source[[HALFpipe quality control protocol](https://fmri.science/halfpipe/quality-control.html)] --- ## EPI spatial normalization .qc-definition[**EPI spatial normalization:** align the functional image to a shared template via the participant’s anatomical image.] .cards.qc[ .figure.card.turquoise[ .caption[Template outlines match the structures of the EPI image]  ] .figure.card.red.bad[ .caption[The EPI image is corrupted and does not match the template]  ] ] .source[[HALFpipe quality control protocol](https://fmri.science/halfpipe/quality-control.html)] --- class: middle .center[ # .practical[Practical] # fMRI Open QC Project ] 1. Navigate to https://www.indos-costaction.eu/wg3-ts2026-waller/practical-2-quality-control/ 2. Complete the ratings in the web-app based on the [quality control protocol](https://fmri.science/halfpipe/quality-control.html) 3. Click the .menu-icon[] icon to open the menu and select *Export* 4. Submit your file to https://forms.gle/77FgaRyTxUfYtef66 --- class: middle .center[ # .theory[Theory] # Functional connectivity ] --- template: functional-connectivity --- ## Analytical variability has a large impact on task-based fMRI results .analytical-variability[] .source[[Botvinik-Nezer et al., 2020](https://doi.org/10.1038/s41586-020-2314-9), Figure 2a] --- ## Does this apply to functional connectivity? .paper-title[] .source[[Wang et al., 2024](https://doi.org/10.1371/journal.pcbi.1011942)] --- ## Yes, same problem .connectome-comparison[] .source[[Wang et al., 2024](https://doi.org/10.1371/journal.pcbi.1011942), Figure 4] --- ## Best denoising strategy is dataset-dependent .denoising-ranking[] .source[Lea Waller, [Neuroimaging Statistics Workshop 2026](https://sites.google.com/view/nsw2026/program)] --- class: brain-age ## Brain age in Alzheimer's disease .side-by-side[   ]
.cards.age-flow[ .card.turquoise[ ### Functional connectivity features ] .card.orange[ ### Train a machine-learning model ] .card.lavender[ ### Predict ages on target dataset ] .card.purple[ ### Difference used as a biomarker ] ] .source[[Gonneaud et al., 2021](https://doi.org/10.1038/s41467-021-25492-9), Figure 1d] --- class: middle .center[ # .practical[Practical] # Brain age ] 1. Open the notebook `practical-3-age-prediction.ipynb` by double-clicking it 2. Follow the notebook 3. Submit your checkpoint to https://forms.gle/DEJQo6u1HnTu1iVv5 --- ## Beyond individual pipelines .main.maturity-model[] .source[[Johnson et al., 2024](https://doi.org/10.48550/arXiv.2401.00077)] --- class: closing ## Thank you ### Learning goals .cards.learning-goals[ .card.turquoise[ ### Understand what *fMRIPrep* does Aligned images and confounds are the starting point for downstream analysis ] .card.orange[ ### Assess the quality of its outputs Use a shared QC protocol and document your decisions ] .card.lavender[ ### Explore how denoising changes results Evaluate models with different analytical choices on unseen participants ] ] [lea@fmri.science](mailto:lea@fmri.science) --- ## We're hiring .cards[ .card.turquoise[ .kicker[Junior Software Developer] ### Open-Source Neuroimaging Infrastructure Scale *HALFpipe* and contribute to *Nilearn* and *fMRIPrep* Python · CI/CD · open science .gray-text[CHU Sainte-Justine, Montréal · 1 year, renewable] ] .card.orange[ .kicker[Postdoctoral Fellow] ### ENIGMA Global Transdiagnostic rs-fMRI Harmonize resting-state fMRI across 35,000+ participants and eight disorders .gray-text[CHU Sainte-Justine, Montréal · 1–3 years] ] ] .center[Apply at [enigma.ini.usc.edu/about-2/careers](https://enigma.ini.usc.edu/about-2/careers/)]