Skip to main content

MRSIPrep: A Robust Preprocessing Pipeline for Whole-Brain MRSI Data

version e2e full pipeline codecov docs Codacy Badge test dataset doi docker pypi license

About

MRSIPrep is a magnetic resonance spectroscopic imaging (MRSI) data preprocessing pipeline that is designed to provide an easily accessible, robust interface requiring minimal user input, while providing easily interpretable and comprehensive quality-control reporting. It performs basic processing steps (registration to anatomical and template space, tissue segmentation, partial-volume correction, atlas projection, etc.) on already quantified whole-brain MRSI maps, providing outputs that can be easily submitted to a variety of group-level analyses, including voxel-based analysis, regional statistics, and metabolic connectivity.

Full documentation, installation, and usage instructions are on Read the Docs.

MRSIPrep pipeline schematic

Design Principles

MRSIPrep was designed according to four main principles:

  • Reproducibility — distributed as open-source software, executed in containerized environments to minimize differences across computing platforms.
  • Modularity — each processing stage is an independent module, so users can enable, disable, or replace specific steps according to their acquisition protocol and scientific question.
  • Transparency — automated quality-control reports summarize spatial registration, metabolite coverage, voxel-level quality metrics, tissue composition, and atlas projection, including the acquisition's MRSinMRS sequence parameters (required at derivatives/mrsi-orig/mrsinmrs.json or selected with --mrsinmrs-file) and a citation section. Published-study parameter sets can be reproduced with --config-preset <name> (see --list-presets), which also credits the source publication in the report.
  • Analysis agnosticism — MRSIPrep does not impose a specific downstream analysis; it generates standardized derivatives usable for voxelwise analyses, regional analyses, metabolic connectomics, gradient mapping, or machine-learning workflows.

See Read the Docs for the full workflow architecture and quality-control framework.

Repository Structure

The mrsiprep/ package is organized by processing stage, matching the pipeline's modular design:

mrsiprep/
├── cli/            Command-line entry point and argument parsing
├── config/         Default parameters, literature T1/T2 values, nucleus and template definitions
├── connectivity/   Metabolic connectivity matrix construction and export
├── interfaces/     Wrappers around external tools (ANTs, FSL, Chimera/FreeSurfer, BIDS import)
├── io/             BIDS discovery, MRSinMRS parsing, derivative I/O, input validation
├── mrsi/           MRSI-specific operations: masking, resampling, spike filtering, T1 correction, orientation
├── parcellation/   Atlas registration, SynthSeg/Chimera parcellation, region labeling
├── qc/             Quality-control metrics (e.g. ventricle detection)
├── registration/   MRSI-to-T1w and T1w-to-template registration backends and transforms
├── reports/        HTML QC report generation
├── tissue/         Tissue segmentation and partial-volume fraction computation
├── utils/          Shared helpers: logging, provenance tracking, image utilities
└── workflows/      Nipype workflow graphs tying the stages above into the full pipeline

Other top-level directories: docs/ (Read the Docs source), docker/ (image build scripts, see docker/README.md), wrapper/ (the mrsiprep-docker PyPI package, a dependency-free Python wrapper that runs the Docker image using normal BIDS App syntax), tests/ (unit and integration tests), experiments/ (benchmark and validation scripts used to produce the manuscript's results, not part of the installed package), and examples/ (runnable usage examples referenced from the docs).

Test Dataset

A small, public, synthetic MRSI dataset — SynthMRSI-Project — is available for anyone to download and run through MRSIPrep themselves, without needing access to real MRSI acquisitions. It pairs real T1w anatomical images (subsetted from two CC0 OpenNeuro datasets) with model-synthesized MRSI signal and empirical CRLB/SNR/FWHM quality maps, following MRSIPrep's own raw-MRSI-input convention.

  • Published on Zenodo: 10.5281/zenodo.21477047 (CC0)
  • Full download and usage instructions: PUBLIC_DATASET.md
  • Used as the fixture for this repo's automated end-to-end pipeline test (see the "e2e full pipeline" badge above)

SynthMRSI-Project is never modified after publication — its Zenodo record is fixed and citable. A separate, unpublished internal dataset, SynthMRSI-VBA-Project, is used instead for voxel-based-analysis validation work (region-based abnormality injection, ANTs-vs-FSL registration-backend comparison via randomise). It shares the same T1w subjects as SynthMRSI-Project but is generated independently with --inject-abnormal, so it can carry deliberately-injected ground-truth abnormalities without touching the published, immutable dataset. See synthMRSI/SYNTHMRSI_PROJECT.md for the full generation and validation commands.

Use Cases

Code derived from this pipeline has been used in the following peer-reviewed publications:

  • Lucchetti, F., et al. (2025). Constructing the human brain metabolic connectome with MR spectroscopic imaging reveals cerebral biochemical organization. Nature Communications, 16. doi:10.1038/s41467-025-66124-w
  • Céléreau, E., et al. (2026). High-resolution whole-brain magnetic resonance spectroscopic imaging in youth at risk for psychosis. Imaging Neuroscience, 4. doi:10.1162/imag.a.1276
  • Céléreau, E., et al. (2026). Sex differences in brain metabolism assessed with whole-brain magnetic resonance spectroscopic imaging. bioRxiv, 2026-06. doi:10.64898/2026.06.30.735476

How to Cite

If you use MRSIPrep in your research, please cite:

Lucchetti, F., Céléreau, E., Jenni, R., Ledoux, J.-B., Eliez, S., Delavari, F., Hagmann, P., Alemán-Gómez, Y., Klauser, A., & Klauser, P. (2026). MRSIPrep: A Standardized Post-Quantification Framework for Preprocessing Whole-Brain Magnetic Resonance Spectroscopic Imaging. bioRxiv. doi:10.64898/2026.09.11.750896

@article{lucchetti2026mrsiprep,
  title={MRSIPrep: A Standardized Post-Quantification Framework for Preprocessing Whole-Brain Magnetic Resonance Spectroscopic Imaging},
  author={Lucchetti, Federico and Celereau, Edgar and Jenni, Raoul and Ledoux, Jean-Baptiste and Eliez, Stephan and Delavari, Farnaz and Hagmann, Patric and Aleman-Gomez, Yasser and Klauser, Antoine and Klauser, Paul},
  journal={bioRxiv},
  pages={2026--09},
  year={2026},
  publisher={Cold Spring Harbor Laboratory}
}

License

MRSIPrep is distributed under the CHUV academic non-commercial research license; see LICENSE for the full text.

Attribution

Substantial implementation logic is cropped and refactored by Federico Lucchetti and Edgar Céléreau. The original license is included in LICENSE.

Acknowledgments

MRSIPrep builds on the work of the ANTs, FreeSurfer, FSL, PETPVC, Chimera, and TemplateFlow projects.

Metadata

Release files for mrsiprep 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mrsiprep 2.1.0
File Size Uploaded Provenance Actions
mrsiprep-2.1.0.tar.gz 7.4 MB Without provenance Details for mrsiprep-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mrsiprep 2.1.0
File Interpreter ABI Platform Actions
mrsiprep-2.1.0-py3-none-any.whl Python 3 none any Details for mrsiprep-2.1.0-py3-none-any.whl

Total release size: 14.6 MB

Release files / mrsiprep-2.1.0.tar.gz

Download URL mrsiprep-2.1.0.tar.gz
Size 7.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f71d3d7b46f45091ed8d74539ced7f375665f29255025c78b8eef4af02d55f78
BLAKE2b-256 checksum
How to use checksums
8ca399bdb8b26b3bae3741085c4a2b1df596b729fe90088820d6cc7314d73ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / mrsiprep-2.1.0-py3-none-any.whl

Download URL mrsiprep-2.1.0-py3-none-any.whl
Size 7.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e20e440d141e553e5357c808b9d94cacd09a47bc58ea5379609ba2986cb2cbe0
BLAKE2b-256 checksum
How to use checksums
1c42e8df19fa0dc8e2574228b047f291c2e96926b6551da0908e6440becc3db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for mrsiprep 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page