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.1.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.1-py3-none-any.whl (157.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: augmentrum-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8963723f7c8b13eccd3478bd32fa0fbb190a184fd5059696d5897c3638be10a7
MD5 1a74d09e2d1a8d79212f7e0f09196ce8
BLAKE2b-256 544f4490bc7e24928db4e0216cdcff18fc5d115b8625ea78a9065520f87d2b8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: augmentrum-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 985511e42b81f3f90bc7164711a13886896091ef26dcd9065d13280e1fe40eb3
MD5 9faa80c71c46ff4be9afeae6eaeacb7d
BLAKE2b-256 4ac8f1a6c7f6e101c16905b4a43315e6e6a43c9d5b21b04c3327d8b92671913e

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