neuroresp Documentation
neuroresp extracts breathing waveforms, breath timing, and physiological nuisance regressors from neuroimaging and respiratory data. You can run it on raw 4D fMRI volumes, six-parameter head motion logs, pneumatic belts, direct airway recordings (spirometry, pneumotachography, or nasal cannulas), chest ECG channels, or MEG head-position coils. Each command relies on signal physics and physiology without external training datasets. The recovered signals differ in what they measure: average rate, within-cycle phase, relative depth and rare deep breaths require separate validity checks. See the measurement limits before choosing a tracker for these quantities.
Public neuroimaging cohorts often lack usable belt traces. Some datasets omit respiratory hardware altogether, while others include abdominal belts that saturate at their upper digital limit during deep breaths or come loose partway through a scan. neuroresp writes a shared set of BIDS physiology streams (*_physio.tsv.gz), waveform tables (respiration.csv), breath cycle tables (breaths.tsv), and confound matrices across belts, fMRI, and ECG so downstream quality control and denoising scripts use one format.
Selecting a workflow
Choose the command matching your recording format. For synthetic coupled recordings with known breath timing and lung mechanics, see the sister package phrenic.
For how breathing shifts fMRI images and inflates framewise displacement, try the interactive respiratory motion explainer.
| Available data | Command | What it recovers |
|---|---|---|
Multi-echo multiband fMRI (MB ≥ 2) |
neuroresp extract on Echo 1, then neuroresp denoise | Sub-TR phase-encoding shift from Echo 1 (TE ≈ 10–14 ms), projected orthogonal to rejected tedana ICA components |
Single-echo multiband fMRI (MB ≥ 2) |
neuroresp extract, then neuroresp denoise | Phase-encoding displacement at 5–25 Hz, resolving breathing above the 1 / (2·TR) volume Nyquist limit |
Single-band fMRI (MB = 1) |
neuroresp extract (interleaved_2pass or whole_volume) |
Two observations per TR on odd/even interleaved schedules, or one observation per volume |
Fast TR motion logs (TR ≤ 0.8 s) |
neuroresp motion | Breath timing from phase-encoding translation, filtered framewise displacement, and opposite-polarity separation |
| Hardware respiratory belt | neuroresp belt and neuroresp fuse | Rail saturation and loose strap masks, clean breath cycles, and hybrid cycle tables bridged with MRI breaths |
| Spirometer, pneumotachograph, or nasal cannula | neuroresp airflow | Active inspiratory and expiratory edges, relative pauses, motor shape, calibrated ventilation, and a volume proxy for denoising |
| MEG or EEG with chest ECG | neuroresp meg | 4 Hz waveform and rate from QRS shape and heart rate, with modulation and polarity QC |
| Raw MEG with head-position coils (Elekta cHPI or CTF HLC) | neuroresp meg --source chpi | Continuous 4 Hz breathing trace from nodding and front-to-back head motion, with optional ECG sign orientation |
Guide structure
- Installation covers Python setup, optional
MNEandAFNIsupport, and raw BIDS file requirements. - Scientific Approach explains the magnetic susceptibility physics, multiband slice registration, multi-echo
T2*dynamics, subspace projection, and cardiac physiology. - Method Comparisons and Measurement Limits compares
neurorespwith hardware belts, volume motion, phase unwrapping, BOLD neural networks, and peripheral physiology packages, and states which quantities remain uncalibrated. - Research Applications describes workflows for multi-echo connectivity, beltless neuroimaging, motion censoring, hybrid belt repair, peripheral physiology, and breath-hold reactivity.
- Usage gives command and Python examples for
fMRIPrep,tedana,nilearn,MNE, and Slurm clusters. - Tutorials provides five runnable Quarto walkthroughs covering belts and airflow, fMRI extraction and fusion, multi-echo denoising and FD decensoring, ECG/MEG head-coil tracking, and waveform rescue.
- Outputs and Quality Control defines every generated file, column, JSON field, and quality flag.
- FAQ covers volume trimming, inhalation sign conventions, slow predictor choices, and single-band scans.
License
neuroresp is released under the MIT License.