Skip to main content

A Data Augmentation Package for MR Spectroscopy

Project description

Augmentrum Logo

Augmentrum

A Data Augmentation Package for MR Spectroscopy

PyPI version Python License ISMRM 2026


Overview

Augmentrum is a modular Python framework designed to help researchers with limited in-vivo MRS data create diverse, physically consistent datasets through flexible augmentation. It supports k-space resampling, coil and average sampling, signal-level perturbations, and synthetic artifact generation, expanding both synthetic and in-vivo data in a realistic and controlled manner.

Augmentrum Pipeline Overview

Built for data-driven MRS applications, Augmentrum streamlines the integration of data augmentation into existing workflows. It operates on the NIfTI-MRS standard, making it compatible with any acquisition format. Simply load your data as NIfTI (using spec2nii if needed) and apply either predefined augmentation settings or build a custom pipeline by combining modules. Each augmentation can be parameterized or used with default ranges to populate a dense and diverse dataset environment.

From MRSI reconstruction and acquisition variability to spectral perturbations and artifact synthesis, Augmentrum handles it all in a modular, flexible, and easy-to-use structure. Dataloaders allow on-the-fly augmentation for deep learning backends such as PyTorch, TensorFlow, Keras, and JAX, enabling robust training beyond static datasets.

Note: Augmentrum is currently in alpha development. It is an active research framework and may undergo changes as modules and interfaces evolve.


Features

  • Modular augmentation across time, frequency, and k-space domains
  • Physically valid transformations for realistic variability
  • Native NIfTI-MRS I/O and metadata tracking
  • Customizable pipelines with user-defined parameters
  • On-the-fly augmentation for machine learning workflows

Installation

pip install augmentrum

or from source:

git clone https://github.com/julianmer/Augmentrum.git
cd Augmentrum
pip install -e .

Quick Start

from augmentrum import Augmentrum

data   # list of NIfTI-MRS files
water   # list of corresponding water reference files (optional)

# initialize Augmentrum with data and optional water references
augmenter = Augmentrum(
    data=data, 
    water=water, 
    
    # custom pipeline example
    pipeline = [
        'coil_sampling',
        'average_sampling',
        'processing',
        'line_broadening',
        'baseline',
        'noise',
    ],
    
    # general settings
    batch_size=16,
    backend='pytorch',  # or 'tensorflow', 'keras', 'jax', 'numpy'
)

# get a dataloader for PyTorch with on-the-fly augmentation
train_data = augmenter.dataloader()

Module Reference & Backend Support

Every module is called as module(nifti_plus, water). When a backend is not natively supported, the base class automatically routes the call through the NIfTI-list path and returns the result in the original backend format — no manual conversion needed.

Module Modes / Methods NIfTI NumPy PyTorch TensorFlow JAX Keras
AmplitudeScaling uniform, normal
Apodization exponential, truncate ✓† ✓† ✓† ✓† ✓†
ArtificialPeaks Lorentzian, Gaussian, Voigt
BaselineAugmentation random_walk, bspline, polynomial
CoilAverageSampler random, deterministic ~ ~ ~ ~ ~
EddyCurrent synthetic, water
FrequencyShift
GaussianNoise sigma, sigma_frac, snr, snr_db
KspaceReconstructor NUFFT + density compensation
LineBroadening lorentzian, gaussian, voigt
NIfTI_RawProcessor coil combination, alignment, averaging, ECC, phase/freq ~ ~ ~ ~ ~
PhaseShift zero_order, first_order
ResidualWater
SpatialAugmentations 2-D / 3-D affine, flip, zoom, shear ✓ ‡ ✓ ‡ ~ ~ ~
SpuriousEchoes replica, hybrid
ZeroFill pad FID to target length ✓† ✓† ✓† ✓† ✓†

native — data tensor stays in the target framework throughout.
~ automatic — the base class routes the call through the NIfTI-list path; the result is returned in the original backend format. Functional, but not natively differentiable.
not supported / not applicable.

Apodization[truncate] and ZeroFill both change N_PTS. Because target_pts / n_pts is a module-level scalar, the same length is applied uniformly to every batch member — the output is still a uniform tensor. On non-NIfTI backends the base class detects the shape change, rebuilds each NIfTI_MRS object at the new length, and emits a RuntimeWarning.

SpatialAugmentations uses F.grid_sample (PyTorch) internally; NIfTI-list and NumPy inputs are converted to PyTorch for processing and converted back. TensorFlow, JAX, and Keras are handled by the base-class automatic routing (~).


Contact

For questions, issues, or collaborations:


Citation

J. T. LaMaster, J. P. Merkofer, K. C. Igwe, "Augmentrum: A Data Augmentation Package for MR Spectroscopy", International Society for Magnetic Resonance in Medicine (ISMRM), Abstract #05685, Cape Town, South Africa, 2026.


Built with ❤️ for the MRS community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

augmentrum-0.0.2.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

augmentrum-0.0.2-py3-none-any.whl (157.0 kB view details)

Uploaded Python 3

File details

Details for the file augmentrum-0.0.2.tar.gz.

File metadata

  • Download URL: augmentrum-0.0.2.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for augmentrum-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8eb9e8b33e41f0b0ab024549c575aea6d09ea5e0bdb2b7884ff44894994c06b6
MD5 e2e7743afd9ba304da5043689f5d0a0b
BLAKE2b-256 720067399b9642a8f92cdd0cb96b1a0348c22bfe1e0bc63217a8d80eb1fee3dd

See more details on using hashes here.

File details

Details for the file augmentrum-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: augmentrum-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 157.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for augmentrum-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d39500c262255e54dd6f9fc8bd02640d9249ca4632bb3c621abb5377c6612108
MD5 17526395fd4a6899e5fd59e535d82211
BLAKE2b-256 76da5620b57e7b520f55985cdcc4ce69921874997f79c4fc82e36f916f4d8a67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page