augmentrum 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. augmentrum-0.0.1/LICENSE +202 -0
  2. augmentrum-0.0.1/MANIFEST.in +10 -0
  3. augmentrum-0.0.1/PKG-INFO +189 -0
  4. augmentrum-0.0.1/README.md +137 -0
  5. augmentrum-0.0.1/assets/figures/logo.png +0 -0
  6. augmentrum-0.0.1/assets/figures/overview.png +0 -0
  7. augmentrum-0.0.1/augmentrum/__init__.py +23 -0
  8. augmentrum-0.0.1/augmentrum/augmentation/__init__.py +32 -0
  9. augmentrum-0.0.1/augmentrum/augmentation/amplitude_scaling.py +170 -0
  10. augmentrum-0.0.1/augmentrum/augmentation/apodization.py +275 -0
  11. augmentrum-0.0.1/augmentrum/augmentation/artificial_peaks.py +334 -0
  12. augmentrum-0.0.1/augmentrum/augmentation/baseline_augmentation.py +544 -0
  13. augmentrum-0.0.1/augmentrum/augmentation/eddy_current.py +278 -0
  14. augmentrum-0.0.1/augmentrum/augmentation/gaussian_noise.py +211 -0
  15. augmentrum-0.0.1/augmentrum/augmentation/line_broadening.py +179 -0
  16. augmentrum-0.0.1/augmentrum/augmentation/phase_frequency.py +259 -0
  17. augmentrum-0.0.1/augmentrum/augmentation/residual_water.py +264 -0
  18. augmentrum-0.0.1/augmentrum/augmentation/spatial_augmentations.py +859 -0
  19. augmentrum-0.0.1/augmentrum/augmentation/spurious_echoes.py +378 -0
  20. augmentrum-0.0.1/augmentrum/augmentation/zero_fill.py +163 -0
  21. augmentrum-0.0.1/augmentrum/core/__init__.py +10 -0
  22. augmentrum-0.0.1/augmentrum/core/augmentrum.py +1172 -0
  23. augmentrum-0.0.1/augmentrum/core/base_module.py +423 -0
  24. augmentrum-0.0.1/augmentrum/core/dataset_utils.py +417 -0
  25. augmentrum-0.0.1/augmentrum/core/nifti_mrs_plus.py +1079 -0
  26. augmentrum-0.0.1/augmentrum/core/pipeline.py +358 -0
  27. augmentrum-0.0.1/augmentrum/dataset/brainbeats.py +537 -0
  28. augmentrum-0.0.1/augmentrum/dataset/cows.py +302 -0
  29. augmentrum-0.0.1/augmentrum/dataset/fmrsinpain.py +208 -0
  30. augmentrum-0.0.1/augmentrum/processing/bicubic_interpolator.py +296 -0
  31. augmentrum-0.0.1/augmentrum/processing/nifti_raw_processor.py +389 -0
  32. augmentrum-0.0.1/augmentrum/processing/tricubic_interpolator.py +293 -0
  33. augmentrum-0.0.1/augmentrum/processing/utils.py +414 -0
  34. augmentrum-0.0.1/augmentrum/resources/__init__.py +14 -0
  35. augmentrum-0.0.1/augmentrum/resources/scans/__init__.py +0 -0
  36. augmentrum-0.0.1/augmentrum/sampling/coil_average_sampler.py +274 -0
  37. augmentrum-0.0.1/augmentrum/sampling/kspace_reconstructor.py +275 -0
  38. augmentrum-0.0.1/augmentrum/sampling/kspace_sampling.py +2562 -0
  39. augmentrum-0.0.1/augmentrum/sampling/subject_splitter.py +131 -0
  40. augmentrum-0.0.1/augmentrum/utils/__init__.py +10 -0
  41. augmentrum-0.0.1/augmentrum/utils/philips.py +90 -0
  42. augmentrum-0.0.1/augmentrum/utils/plotting.py +651 -0
  43. augmentrum-0.0.1/augmentrum/utils/tensor_ops.py +203 -0
  44. augmentrum-0.0.1/augmentrum.egg-info/PKG-INFO +189 -0
  45. augmentrum-0.0.1/augmentrum.egg-info/SOURCES.txt +49 -0
  46. augmentrum-0.0.1/augmentrum.egg-info/dependency_links.txt +1 -0
  47. augmentrum-0.0.1/augmentrum.egg-info/requires.txt +31 -0
  48. augmentrum-0.0.1/augmentrum.egg-info/top_level.txt +1 -0
  49. augmentrum-0.0.1/pyproject.toml +111 -0
  50. augmentrum-0.0.1/setup.cfg +4 -0
  51. augmentrum-0.0.1/tests/test_readme_table.py +490 -0
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Support. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 J. T. LaMaster, J. P. Merkofer, K. C. Igwe
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,10 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include augmentrum *.py
4
+ recursive-include augmentrum/resources/scans *
5
+ recursive-include assets/figures *.png *.jpg *.svg
6
+ recursive-exclude * __pycache__
7
+ recursive-exclude * *.pyc
8
+ recursive-exclude * *.pyo
9
+ recursive-exclude * .DS_Store
10
+ prune data
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: augmentrum
3
+ Version: 0.0.1
4
+ Summary: A Data Augmentation Package for MR Spectroscopy
5
+ Author-email: "John T. LaMaster" <jlamaste@gmail.com>, "Julian P. Merkofer" <j.p.merkofer@tue.nl>, "Kay C. Igwe" <kci2104@columbia.edu>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/julianmer/Augmentrum
8
+ Project-URL: Documentation, https://github.com/julianmer/Augmentrum#readme
9
+ Project-URL: Repository, https://github.com/julianmer/Augmentrum
10
+ Project-URL: Bug Tracker, https://github.com/julianmer/Augmentrum/issues
11
+ Keywords: MRS,spectroscopy,data augmentation,medical imaging,machine learning
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
20
+ Classifier: Topic :: Scientific/Engineering :: Physics
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy>=1.21.0
25
+ Requires-Dist: scipy>=1.7.0
26
+ Requires-Dist: torch>=1.10.0
27
+ Requires-Dist: fsl-mrs>=2.1.0
28
+ Requires-Dist: nifti-mrs>=0.1.0
29
+ Requires-Dist: spec2nii>=0.6.0
30
+ Requires-Dist: torchkbnufft>=1.3.0
31
+ Requires-Dist: tqdm>=4.62.0
32
+ Requires-Dist: matplotlib>=3.4.0
33
+ Requires-Dist: shutup>=0.2.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
37
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
38
+ Requires-Dist: black>=22.0.0; extra == "dev"
39
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
40
+ Requires-Dist: mypy>=0.950; extra == "dev"
41
+ Provides-Extra: jax
42
+ Requires-Dist: jax>=0.4.0; extra == "jax"
43
+ Requires-Dist: jaxlib>=0.4.0; extra == "jax"
44
+ Provides-Extra: keras
45
+ Requires-Dist: keras>=3.0.0; extra == "keras"
46
+ Provides-Extra: all
47
+ Requires-Dist: tensorflow>=2.8.0; extra == "all"
48
+ Requires-Dist: keras>=3.0.0; extra == "all"
49
+ Requires-Dist: jax>=0.4.0; extra == "all"
50
+ Requires-Dist: jaxlib>=0.4.0; extra == "all"
51
+ Dynamic: license-file
52
+
53
+ <div align="center">
54
+ <img src="assets/figures/logo.png" alt="Augmentrum Logo" width="100" style="margin-bottom: -10px;"/>
55
+ <h1 style="margin-top: 5px; margin-bottom: 5px;">Augmentrum</h1>
56
+ <p style="margin-top: 0px;"><em>A Data Augmentation Package for MR Spectroscopy</em></p>
57
+
58
+ [![PyPI version](https://badge.fury.io/py/augmentrum.svg)](https://badge.fury.io/py/augmentrum)
59
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/)
60
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
61
+ [![ISMRM 2026](https://img.shields.io/badge/ISMRM-Abstract%20%2305685-lightgrey.svg)](https://submissions.mirasmart.com/ISMRM2026/Itinerary/PresentationDetail.aspx?evdid=1450)
62
+ </div>
63
+
64
+ ---
65
+
66
+ ## Overview
67
+ **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.
68
+
69
+ <div align="center">
70
+ <img src="assets/figures/overview.png" alt="Augmentrum Pipeline Overview" width="800"/>
71
+ </div>
72
+
73
+ 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.
74
+
75
+ 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.
76
+
77
+ > **Note:** Augmentrum is currently in **alpha development**. It is an active research framework and may undergo changes as modules and interfaces evolve.
78
+
79
+ ---
80
+
81
+ ## Features
82
+ - Modular augmentation across time, frequency, and k-space domains
83
+ - Physically valid transformations for realistic variability
84
+ - Native NIfTI-MRS I/O and metadata tracking
85
+ - Customizable pipelines with user-defined parameters
86
+ - On-the-fly augmentation for machine learning workflows
87
+
88
+ ---
89
+
90
+ ## Installation
91
+ ```bash
92
+ pip install augmentrum
93
+ ```
94
+ or from source:
95
+ ```bash
96
+ git clone https://github.com/julianmer/Augmentrum.git
97
+ cd Augmentrum
98
+ pip install -e .
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Quick Start
104
+ ```python
105
+ from augmentrum import Augmentrum
106
+
107
+ data # list of NIfTI-MRS files
108
+ water # list of corresponding water reference files (optional)
109
+
110
+ # initialize Augmentrum with data and optional water references
111
+ augmenter = Augmentrum(
112
+ data=data,
113
+ water=water,
114
+
115
+ # custom pipeline example
116
+ pipeline = [
117
+ 'coil_sampling',
118
+ 'average_sampling',
119
+ 'processing',
120
+ 'line_broadening',
121
+ 'baseline',
122
+ 'noise',
123
+ ],
124
+
125
+ # general settings
126
+ batch_size=16,
127
+ backend='pytorch', # or 'tensorflow', 'keras', 'jax', 'numpy'
128
+ )
129
+
130
+ # get a dataloader for PyTorch with on-the-fly augmentation
131
+ train_data = augmenter.dataloader()
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Module Reference & Backend Support
137
+
138
+ Every module is called as `module(nifti_plus, water)`. When a backend is not
139
+ natively supported, the base class automatically routes the call through the
140
+ NIfTI-list path and returns the result in the original backend format —
141
+ no manual conversion needed.
142
+
143
+ | Module | Modes / Methods | NIfTI | NumPy | PyTorch | TensorFlow | JAX | Keras |
144
+ |:---|:--------------------------------------------------------|:-----:|:---:|:---:|:---:|:---:|:---:|
145
+ | `AmplitudeScaling` | uniform, normal | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
146
+ | `Apodization` | exponential, truncate | ✓ | ✓† | ✓† | ✓† | ✓† | ✓† |
147
+ | `ArtificialPeaks` | Lorentzian, Gaussian, Voigt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
148
+ | `BaselineAugmentation` | random_walk, bspline, polynomial | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
149
+ | `CoilAverageSampler` | random, deterministic | ✓ | ~ | ~ | ~ | ~ | ~ |
150
+ | `EddyCurrent` | synthetic, water | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
151
+ | `FrequencyShift` | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
152
+ | `GaussianNoise` | sigma, sigma_frac, snr, snr_db | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
153
+ | `KspaceReconstructor` | NUFFT + density compensation | — | — | ✓ | — | — | — |
154
+ | `LineBroadening` | lorentzian, gaussian, voigt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
155
+ | `NIfTI_RawProcessor` | coil combination, alignment, averaging, ECC, phase/freq | ✓ | ~ | ~ | ~ | ~ | ~ |
156
+ | `PhaseShift` | zero_order, first_order | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
157
+ | `ResidualWater` | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
158
+ | `SpatialAugmentations` | 2-D / 3-D affine, flip, zoom, shear | ✓ ‡ | ✓ ‡ | ✓ | ~ | ~ | ~ |
159
+ | `SpuriousEchoes` | replica, hybrid | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
160
+ | `ZeroFill` | pad FID to target length | ✓ | ✓† | ✓† | ✓† | ✓† | ✓† |
161
+
162
+ **✓** native — data tensor stays in the target framework throughout.
163
+ **~** 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.
164
+ **—** not supported / not applicable.
165
+
166
+ > **†** `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`.
167
+
168
+ > **‡** `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 (~).
169
+
170
+
171
+ ---
172
+
173
+ ## Contact
174
+
175
+ For questions, issues, or collaborations:
176
+
177
+ - **GitHub Issues**: [github.com/julianmer/Augmentrum/issues](https://github.com/julianmer/Augmentrum/issues)
178
+ - **Email**: jlamaste@gmail.com, j.p.merkofer@tue.nl, kci2104@columbia.edu
179
+
180
+ ---
181
+
182
+ ## Citation
183
+ 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.
184
+
185
+ ---
186
+
187
+ <div align="center">
188
+ <sub>Built with ❤️ for the MRS community</sub>
189
+ </div>
@@ -0,0 +1,137 @@
1
+ <div align="center">
2
+ <img src="assets/figures/logo.png" alt="Augmentrum Logo" width="100" style="margin-bottom: -10px;"/>
3
+ <h1 style="margin-top: 5px; margin-bottom: 5px;">Augmentrum</h1>
4
+ <p style="margin-top: 0px;"><em>A Data Augmentation Package for MR Spectroscopy</em></p>
5
+
6
+ [![PyPI version](https://badge.fury.io/py/augmentrum.svg)](https://badge.fury.io/py/augmentrum)
7
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/)
8
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
9
+ [![ISMRM 2026](https://img.shields.io/badge/ISMRM-Abstract%20%2305685-lightgrey.svg)](https://submissions.mirasmart.com/ISMRM2026/Itinerary/PresentationDetail.aspx?evdid=1450)
10
+ </div>
11
+
12
+ ---
13
+
14
+ ## Overview
15
+ **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.
16
+
17
+ <div align="center">
18
+ <img src="assets/figures/overview.png" alt="Augmentrum Pipeline Overview" width="800"/>
19
+ </div>
20
+
21
+ 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.
22
+
23
+ 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.
24
+
25
+ > **Note:** Augmentrum is currently in **alpha development**. It is an active research framework and may undergo changes as modules and interfaces evolve.
26
+
27
+ ---
28
+
29
+ ## Features
30
+ - Modular augmentation across time, frequency, and k-space domains
31
+ - Physically valid transformations for realistic variability
32
+ - Native NIfTI-MRS I/O and metadata tracking
33
+ - Customizable pipelines with user-defined parameters
34
+ - On-the-fly augmentation for machine learning workflows
35
+
36
+ ---
37
+
38
+ ## Installation
39
+ ```bash
40
+ pip install augmentrum
41
+ ```
42
+ or from source:
43
+ ```bash
44
+ git clone https://github.com/julianmer/Augmentrum.git
45
+ cd Augmentrum
46
+ pip install -e .
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Quick Start
52
+ ```python
53
+ from augmentrum import Augmentrum
54
+
55
+ data # list of NIfTI-MRS files
56
+ water # list of corresponding water reference files (optional)
57
+
58
+ # initialize Augmentrum with data and optional water references
59
+ augmenter = Augmentrum(
60
+ data=data,
61
+ water=water,
62
+
63
+ # custom pipeline example
64
+ pipeline = [
65
+ 'coil_sampling',
66
+ 'average_sampling',
67
+ 'processing',
68
+ 'line_broadening',
69
+ 'baseline',
70
+ 'noise',
71
+ ],
72
+
73
+ # general settings
74
+ batch_size=16,
75
+ backend='pytorch', # or 'tensorflow', 'keras', 'jax', 'numpy'
76
+ )
77
+
78
+ # get a dataloader for PyTorch with on-the-fly augmentation
79
+ train_data = augmenter.dataloader()
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Module Reference & Backend Support
85
+
86
+ Every module is called as `module(nifti_plus, water)`. When a backend is not
87
+ natively supported, the base class automatically routes the call through the
88
+ NIfTI-list path and returns the result in the original backend format —
89
+ no manual conversion needed.
90
+
91
+ | Module | Modes / Methods | NIfTI | NumPy | PyTorch | TensorFlow | JAX | Keras |
92
+ |:---|:--------------------------------------------------------|:-----:|:---:|:---:|:---:|:---:|:---:|
93
+ | `AmplitudeScaling` | uniform, normal | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
94
+ | `Apodization` | exponential, truncate | ✓ | ✓† | ✓† | ✓† | ✓† | ✓† |
95
+ | `ArtificialPeaks` | Lorentzian, Gaussian, Voigt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
96
+ | `BaselineAugmentation` | random_walk, bspline, polynomial | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
97
+ | `CoilAverageSampler` | random, deterministic | ✓ | ~ | ~ | ~ | ~ | ~ |
98
+ | `EddyCurrent` | synthetic, water | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
99
+ | `FrequencyShift` | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
100
+ | `GaussianNoise` | sigma, sigma_frac, snr, snr_db | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
101
+ | `KspaceReconstructor` | NUFFT + density compensation | — | — | ✓ | — | — | — |
102
+ | `LineBroadening` | lorentzian, gaussian, voigt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
103
+ | `NIfTI_RawProcessor` | coil combination, alignment, averaging, ECC, phase/freq | ✓ | ~ | ~ | ~ | ~ | ~ |
104
+ | `PhaseShift` | zero_order, first_order | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
105
+ | `ResidualWater` | — | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
106
+ | `SpatialAugmentations` | 2-D / 3-D affine, flip, zoom, shear | ✓ ‡ | ✓ ‡ | ✓ | ~ | ~ | ~ |
107
+ | `SpuriousEchoes` | replica, hybrid | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
108
+ | `ZeroFill` | pad FID to target length | ✓ | ✓† | ✓† | ✓† | ✓† | ✓† |
109
+
110
+ **✓** native — data tensor stays in the target framework throughout.
111
+ **~** 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.
112
+ **—** not supported / not applicable.
113
+
114
+ > **†** `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`.
115
+
116
+ > **‡** `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 (~).
117
+
118
+
119
+ ---
120
+
121
+ ## Contact
122
+
123
+ For questions, issues, or collaborations:
124
+
125
+ - **GitHub Issues**: [github.com/julianmer/Augmentrum/issues](https://github.com/julianmer/Augmentrum/issues)
126
+ - **Email**: jlamaste@gmail.com, j.p.merkofer@tue.nl, kci2104@columbia.edu
127
+
128
+ ---
129
+
130
+ ## Citation
131
+ 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.
132
+
133
+ ---
134
+
135
+ <div align="center">
136
+ <sub>Built with ❤️ for the MRS community</sub>
137
+ </div>
Binary file
@@ -0,0 +1,23 @@
1
+ """
2
+ Augmentrum - A Data Augmentation Package for MR Spectroscopy
3
+
4
+ A modular Python framework designed to help researchers with limited in-vivo MRS data
5
+ create diverse, physically consistent datasets through flexible augmentation.
6
+ """
7
+
8
+ __version__ = "0.0.1"
9
+ __author__ = "John T. LaMaster, Julian P. Merkofer, Kay C. Igwe"
10
+ __email__ = "j.p.merkofer@tue.nl"
11
+
12
+ # Main API
13
+ from augmentrum.core import Augmentrum, NIfTI_MRS_Plus, Backend, BaseModule, AugmentationPipeline
14
+
15
+ __all__ = [
16
+ "__version__",
17
+ "Augmentrum",
18
+ "NIfTI_MRS_Plus",
19
+ "Backend",
20
+ "BaseModule",
21
+ "AugmentationPipeline",
22
+ ]
23
+
@@ -0,0 +1,32 @@
1
+ """
2
+ Augmentation modules for MRS data.
3
+ """
4
+
5
+ from augmentrum.augmentation.gaussian_noise import GaussianNoise
6
+ from augmentrum.augmentation.line_broadening import LineBroadening
7
+ from augmentrum.augmentation.baseline_augmentation import BaselineAugmentation
8
+ from augmentrum.augmentation.residual_water import ResidualWater
9
+ from augmentrum.augmentation.spurious_echoes import SpuriousEchoes
10
+ from augmentrum.augmentation.artificial_peaks import ArtificialPeaks
11
+ from augmentrum.augmentation.eddy_current import EddyCurrent
12
+ from augmentrum.augmentation.apodization import Apodization
13
+ from augmentrum.augmentation.phase_frequency import PhaseShift, FrequencyShift
14
+ from augmentrum.augmentation.amplitude_scaling import AmplitudeScaling
15
+ from augmentrum.augmentation.spatial_augmentations import SpatialAugmentations
16
+ from augmentrum.augmentation.zero_fill import ZeroFill
17
+
18
+ __all__ = [
19
+ 'GaussianNoise',
20
+ 'LineBroadening',
21
+ 'BaselineAugmentation',
22
+ 'ResidualWater',
23
+ 'SpuriousEchoes',
24
+ 'ArtificialPeaks',
25
+ 'EddyCurrent',
26
+ 'Apodization',
27
+ 'PhaseShift',
28
+ 'FrequencyShift',
29
+ 'AmplitudeScaling',
30
+ 'SpatialAugmentations',
31
+ 'ZeroFill',
32
+ ]