MNutils 1.2.0__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.
- mnutils-1.2.0/LICENSE +28 -0
- mnutils-1.2.0/PKG-INFO +161 -0
- mnutils-1.2.0/README.md +121 -0
- mnutils-1.2.0/pyproject.toml +133 -0
- mnutils-1.2.0/pyproject.toml.orig +124 -0
- mnutils-1.2.0/src/mnutils/GEExam.py +495 -0
- mnutils-1.2.0/src/mnutils/GESeries.py +1578 -0
- mnutils-1.2.0/src/mnutils/__init__.py +54 -0
- mnutils-1.2.0/src/mnutils/_scripts.py +177 -0
- mnutils-1.2.0/src/mnutils/fitting/AMARES.py +831 -0
- mnutils-1.2.0/src/mnutils/fitting/__init__.py +5 -0
- mnutils-1.2.0/src/mnutils/matlab/__init__.py +13 -0
- mnutils-1.2.0/src/mnutils/matlab/setup_matlab.py +116 -0
- mnutils-1.2.0/src/mnutils/plotting/__init__.py +38 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/__init__.py +5 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/_html.py +34 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/_shared/__init__.py +50 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/_shared/dom.js +124 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/_shared/theme.css +140 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/image_grid.css +202 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/image_grid.js +212 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/image_grid.py +86 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/mrsi_inspector.css +376 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/mrsi_inspector.js +681 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/mrsi_inspector.py +70 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/slice_viewer.css +38 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/slice_viewer.js +41 -0
- mnutils-1.2.0/src/mnutils/plotting/_widgets/slice_viewer.py +35 -0
- mnutils-1.2.0/src/mnutils/plotting/images.py +1399 -0
- mnutils-1.2.0/src/mnutils/plotting/saving.py +138 -0
- mnutils-1.2.0/src/mnutils/plotting/spectra.py +357 -0
- mnutils-1.2.0/src/mnutils/py.typed +0 -0
- mnutils-1.2.0/src/mnutils/testing/__init__.py +3 -0
- mnutils-1.2.0/src/mnutils/testing/_spectra.py +338 -0
- mnutils-1.2.0/src/mnutils/testing/synthetic.py +373 -0
- mnutils-1.2.0/src/mnutils/utils/__init__.py +25 -0
- mnutils-1.2.0/src/mnutils/utils/data_loaders.py +218 -0
- mnutils-1.2.0/src/mnutils/utils/file_helpers.py +708 -0
- mnutils-1.2.0/src/mnutils/utils/images.py +202 -0
- mnutils-1.2.0/src/mnutils/utils/nifti.py +379 -0
- mnutils-1.2.0/src/mnutils/utils/spectra.py +149 -0
mnutils-1.2.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026, Sebastian Bauer
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
mnutils-1.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MNutils
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Utility functions for multinuclear MR data processing
|
|
5
|
+
Keywords: mri,mrs,xarray,spectroscopy,nmr
|
|
6
|
+
Author: Sebastian Bauer
|
|
7
|
+
Author-email: Sebastian Bauer <28663646+bastigw@users.noreply.github.com>
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
15
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Framework :: Jupyter
|
|
18
|
+
Requires-Dist: dcm2niiw>=0.1.5
|
|
19
|
+
Requires-Dist: ipython>=8.0
|
|
20
|
+
Requires-Dist: loguru>=0.7.3
|
|
21
|
+
Requires-Dist: mat73
|
|
22
|
+
Requires-Dist: matplotlib>=3.10.7
|
|
23
|
+
Requires-Dist: nibabel>=5.3.2
|
|
24
|
+
Requires-Dist: nmrglue>=0.11
|
|
25
|
+
Requires-Dist: pillow>=12.3.0
|
|
26
|
+
Requires-Dist: scipy>=1.15.3
|
|
27
|
+
Requires-Dist: seaborn>=0.13.2
|
|
28
|
+
Requires-Dist: xmris[fitting]
|
|
29
|
+
Requires-Dist: matlabengine==25.1.* ; extra == '2025a'
|
|
30
|
+
Requires-Dist: hd-bet>=2.0.1 ; extra == 'bet'
|
|
31
|
+
Requires-Dist: torch>=2.10.0 ; extra == 'bet'
|
|
32
|
+
Requires-Python: >=3.12
|
|
33
|
+
Project-URL: Homepage, https://github.com/bastigw/mnutils
|
|
34
|
+
Project-URL: Documentation, https://bastigw.github.io/mnutils/
|
|
35
|
+
Project-URL: Repository, https://github.com/bastigw/mnutils
|
|
36
|
+
Project-URL: Issues, https://github.com/bastigw/mnutils/issues
|
|
37
|
+
Provides-Extra: 2025a
|
|
38
|
+
Provides-Extra: bet
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<picture>
|
|
43
|
+
<source media="(prefers-color-scheme: dark)"
|
|
44
|
+
srcset="docs/assets/logo/mnutils-banner-dark.svg">
|
|
45
|
+
<img src="docs/assets/logo/mnutils-banner-light.svg" alt="MNUtils" width="420">
|
|
46
|
+
</picture>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
[](https://github.com/bastigw/mnutils/actions/workflows/ci-fast.yml)
|
|
50
|
+
[](https://bastigw.github.io/mnutils/)
|
|
51
|
+
[](LICENSE)
|
|
52
|
+
|
|
53
|
+
MNUtils is a collection of utility functions for working with multi-nuclear MR data from our GE
|
|
54
|
+
scanners.
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- **Data loading** — read GE raw/reconstructed data via `GEExam`/`GESeries`.
|
|
59
|
+
- **NIfTI/DICOM conversion** — convert scanner output to NIfTI.
|
|
60
|
+
- **Plotting** — spectral and slice plotting utilities.
|
|
61
|
+
- **Spectral fitting** — AMARES fitting delegated to [`xmris`](https://github.com/andrewendlinger/xmris)
|
|
62
|
+
(`xmris[fitting]`, which wraps pyAMARES).
|
|
63
|
+
|
|
64
|
+
See the [documentation](https://bastigw.github.io/mnutils/) for the full basics, data model,
|
|
65
|
+
plotting, fitting, NIfTI, and MATLAB-bridge guides.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
uv add git+https://github.com/bastigw/mnutils.git
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Optional extras:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv add "mnutils[bet] @ git+https://github.com/bastigw/mnutils.git" # brain extraction (hd-bet, torch)
|
|
77
|
+
uv add "mnutils[2025a] @ git+https://github.com/bastigw/mnutils.git" # MATLAB Engine pinned to MATLAB 2025a
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`2025a` pins `matlabengine==25.1.*`. If your local MATLAB install is a different version, install
|
|
81
|
+
the matching `matlabengine` release yourself instead (see [MATLAB Engine
|
|
82
|
+
Dependency](#matlab-engine-dependency) below) — there's no way to pin one version project-wide
|
|
83
|
+
across contributors' machines.
|
|
84
|
+
|
|
85
|
+
## Usage
|
|
86
|
+
|
|
87
|
+
The main entry point is `ExamBase`: point it at a GE exam's data folder and it classifies every
|
|
88
|
+
series for you — no need to know in advance which folder is an anatomical scan and which is a
|
|
89
|
+
spectrum.
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from mnutils.GEExam import ExamBase
|
|
93
|
+
|
|
94
|
+
exam = ExamBase("data/HeVo-11") # prints an overview of every series it found
|
|
95
|
+
|
|
96
|
+
exam.exam_overview.head() # same overview as a DataFrame
|
|
97
|
+
exam.series_dict[6] # the GESeries subclass ExamBase picked for series 6 — nothing loaded yet
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Load the series you actually need and analyse it — everything about it (spectrum, header fields,
|
|
101
|
+
scan time) lives on the returned object:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
exam.load_series(6)
|
|
105
|
+
mrs = exam[6]
|
|
106
|
+
|
|
107
|
+
print(mrs.protocol_name, mrs.spec.dims, mrs.spec.shape)
|
|
108
|
+
avg = mrs.avg_spec # average over repetitions
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`load_series` also takes a list, and `load_all` loads everything `ExamBase` classified. If you
|
|
112
|
+
already know a series's type, construct it directly (e.g. `MRSSeries(DATA_FOLDER, 6)`) and skip
|
|
113
|
+
the exam-level overview entirely.
|
|
114
|
+
|
|
115
|
+
From there, spectral fitting is handled by [**xmris**](https://github.com/andrewendlinger/xmris)
|
|
116
|
+
— MNUtils deliberately doesn't reimplement fitting, it wraps xmris's AMARES implementation
|
|
117
|
+
(itself built on pyAMARES) so a series's spectrum can go straight into a fit:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv add "xmris[fitting]"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
See the [fitting docs](https://bastigw.github.io/mnutils/fitting/) for the full workflow, and the
|
|
124
|
+
[loading data](https://bastigw.github.io/mnutils/basics/loading_data/) and
|
|
125
|
+
[GEExam](https://bastigw.github.io/mnutils/data-model/geexam/) tutorials for more on exams and
|
|
126
|
+
series. Need a raw `.mat` file's path directly instead of a loaded object?
|
|
127
|
+
`mnutils.utils.file_helpers.get_mat_data_from_series(base_folder, series_id)` returns it.
|
|
128
|
+
|
|
129
|
+
## Requirements
|
|
130
|
+
|
|
131
|
+
- Python 3.12+
|
|
132
|
+
|
|
133
|
+
## MATLAB Engine Dependency
|
|
134
|
+
|
|
135
|
+
To use MNUtils, you need to install the MATLAB Engine for Python. The version of the MATLAB Engine
|
|
136
|
+
you require depends on your local MATLAB version. Ensure you install the correct version that
|
|
137
|
+
matches your MATLAB installation.
|
|
138
|
+
|
|
139
|
+
You can find the appropriate MATLAB Engine version for your setup here: [MATLAB Engine for
|
|
140
|
+
Python](https://pypi.org/project/matlabengine/#history).
|
|
141
|
+
|
|
142
|
+
To install the MATLAB Engine in your project, use the following command, replacing `<version>`
|
|
143
|
+
with the correct version for your MATLAB:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
uv add "matlabengine==<version>"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) and the [contributor docs](docs/contribute/) for setup,
|
|
152
|
+
tests, docs, and lint workflow.
|
|
153
|
+
|
|
154
|
+
## Contributions and Suggestions
|
|
155
|
+
|
|
156
|
+
I'm very open to suggestions and improvements! If you have ideas or want to share your own
|
|
157
|
+
utilities, feel free to reach out or submit a pull request.
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
BSD-3-Clause — see [`LICENSE`](LICENSE).
|
mnutils-1.2.0/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)"
|
|
4
|
+
srcset="docs/assets/logo/mnutils-banner-dark.svg">
|
|
5
|
+
<img src="docs/assets/logo/mnutils-banner-light.svg" alt="MNUtils" width="420">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
[](https://github.com/bastigw/mnutils/actions/workflows/ci-fast.yml)
|
|
10
|
+
[](https://bastigw.github.io/mnutils/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
13
|
+
MNUtils is a collection of utility functions for working with multi-nuclear MR data from our GE
|
|
14
|
+
scanners.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Data loading** — read GE raw/reconstructed data via `GEExam`/`GESeries`.
|
|
19
|
+
- **NIfTI/DICOM conversion** — convert scanner output to NIfTI.
|
|
20
|
+
- **Plotting** — spectral and slice plotting utilities.
|
|
21
|
+
- **Spectral fitting** — AMARES fitting delegated to [`xmris`](https://github.com/andrewendlinger/xmris)
|
|
22
|
+
(`xmris[fitting]`, which wraps pyAMARES).
|
|
23
|
+
|
|
24
|
+
See the [documentation](https://bastigw.github.io/mnutils/) for the full basics, data model,
|
|
25
|
+
plotting, fitting, NIfTI, and MATLAB-bridge guides.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
uv add git+https://github.com/bastigw/mnutils.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Optional extras:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv add "mnutils[bet] @ git+https://github.com/bastigw/mnutils.git" # brain extraction (hd-bet, torch)
|
|
37
|
+
uv add "mnutils[2025a] @ git+https://github.com/bastigw/mnutils.git" # MATLAB Engine pinned to MATLAB 2025a
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`2025a` pins `matlabengine==25.1.*`. If your local MATLAB install is a different version, install
|
|
41
|
+
the matching `matlabengine` release yourself instead (see [MATLAB Engine
|
|
42
|
+
Dependency](#matlab-engine-dependency) below) — there's no way to pin one version project-wide
|
|
43
|
+
across contributors' machines.
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
The main entry point is `ExamBase`: point it at a GE exam's data folder and it classifies every
|
|
48
|
+
series for you — no need to know in advance which folder is an anatomical scan and which is a
|
|
49
|
+
spectrum.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from mnutils.GEExam import ExamBase
|
|
53
|
+
|
|
54
|
+
exam = ExamBase("data/HeVo-11") # prints an overview of every series it found
|
|
55
|
+
|
|
56
|
+
exam.exam_overview.head() # same overview as a DataFrame
|
|
57
|
+
exam.series_dict[6] # the GESeries subclass ExamBase picked for series 6 — nothing loaded yet
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Load the series you actually need and analyse it — everything about it (spectrum, header fields,
|
|
61
|
+
scan time) lives on the returned object:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
exam.load_series(6)
|
|
65
|
+
mrs = exam[6]
|
|
66
|
+
|
|
67
|
+
print(mrs.protocol_name, mrs.spec.dims, mrs.spec.shape)
|
|
68
|
+
avg = mrs.avg_spec # average over repetitions
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`load_series` also takes a list, and `load_all` loads everything `ExamBase` classified. If you
|
|
72
|
+
already know a series's type, construct it directly (e.g. `MRSSeries(DATA_FOLDER, 6)`) and skip
|
|
73
|
+
the exam-level overview entirely.
|
|
74
|
+
|
|
75
|
+
From there, spectral fitting is handled by [**xmris**](https://github.com/andrewendlinger/xmris)
|
|
76
|
+
— MNUtils deliberately doesn't reimplement fitting, it wraps xmris's AMARES implementation
|
|
77
|
+
(itself built on pyAMARES) so a series's spectrum can go straight into a fit:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv add "xmris[fitting]"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
See the [fitting docs](https://bastigw.github.io/mnutils/fitting/) for the full workflow, and the
|
|
84
|
+
[loading data](https://bastigw.github.io/mnutils/basics/loading_data/) and
|
|
85
|
+
[GEExam](https://bastigw.github.io/mnutils/data-model/geexam/) tutorials for more on exams and
|
|
86
|
+
series. Need a raw `.mat` file's path directly instead of a loaded object?
|
|
87
|
+
`mnutils.utils.file_helpers.get_mat_data_from_series(base_folder, series_id)` returns it.
|
|
88
|
+
|
|
89
|
+
## Requirements
|
|
90
|
+
|
|
91
|
+
- Python 3.12+
|
|
92
|
+
|
|
93
|
+
## MATLAB Engine Dependency
|
|
94
|
+
|
|
95
|
+
To use MNUtils, you need to install the MATLAB Engine for Python. The version of the MATLAB Engine
|
|
96
|
+
you require depends on your local MATLAB version. Ensure you install the correct version that
|
|
97
|
+
matches your MATLAB installation.
|
|
98
|
+
|
|
99
|
+
You can find the appropriate MATLAB Engine version for your setup here: [MATLAB Engine for
|
|
100
|
+
Python](https://pypi.org/project/matlabengine/#history).
|
|
101
|
+
|
|
102
|
+
To install the MATLAB Engine in your project, use the following command, replacing `<version>`
|
|
103
|
+
with the correct version for your MATLAB:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
uv add "matlabengine==<version>"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) and the [contributor docs](docs/contribute/) for setup,
|
|
112
|
+
tests, docs, and lint workflow.
|
|
113
|
+
|
|
114
|
+
## Contributions and Suggestions
|
|
115
|
+
|
|
116
|
+
I'm very open to suggestions and improvements! If you have ideas or want to share your own
|
|
117
|
+
utilities, feel free to reach out or submit a pull request.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
BSD-3-Clause — see [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "MNutils"
|
|
3
|
+
version = "1.2.0"
|
|
4
|
+
description = "Utility functions for multinuclear MR data processing"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
keywords = [
|
|
9
|
+
"mri",
|
|
10
|
+
"mrs",
|
|
11
|
+
"xarray",
|
|
12
|
+
"spectroscopy",
|
|
13
|
+
"nmr",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
21
|
+
"License :: OSI Approved :: BSD License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Framework :: Jupyter",
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.12"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"dcm2niiw>=0.1.5",
|
|
28
|
+
"ipython>=8.0",
|
|
29
|
+
"loguru>=0.7.3",
|
|
30
|
+
"mat73",
|
|
31
|
+
"matplotlib>=3.10.7",
|
|
32
|
+
"nibabel>=5.3.2",
|
|
33
|
+
"nmrglue>=0.11",
|
|
34
|
+
"pillow>=12.3.0",
|
|
35
|
+
"scipy>=1.15.3",
|
|
36
|
+
"seaborn>=0.13.2",
|
|
37
|
+
"xmris[fitting]",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[[project.authors]]
|
|
41
|
+
name = "Sebastian Bauer"
|
|
42
|
+
email = "28663646+bastigw@users.noreply.github.com"
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/bastigw/mnutils"
|
|
46
|
+
Documentation = "https://bastigw.github.io/mnutils/"
|
|
47
|
+
Repository = "https://github.com/bastigw/mnutils"
|
|
48
|
+
Issues = "https://github.com/bastigw/mnutils/issues"
|
|
49
|
+
|
|
50
|
+
[project.optional-dependencies]
|
|
51
|
+
2025a = ["matlabengine==25.1.*"]
|
|
52
|
+
bet = [
|
|
53
|
+
"hd-bet>=2.0.1",
|
|
54
|
+
"torch>=2.10.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
docs-mnutils-api = "mnutils._scripts:docs_api"
|
|
59
|
+
docs-mnutils-notebooks = "mnutils._scripts:docs_notebooks"
|
|
60
|
+
docs-mnutils = "mnutils._scripts:docs_all"
|
|
61
|
+
test-mnutils-gen = "mnutils._scripts:generate_test_notebooks"
|
|
62
|
+
test-mnutils = "mnutils._scripts:run_tests"
|
|
63
|
+
|
|
64
|
+
[build-system]
|
|
65
|
+
requires = ["uv_build>=0.8.13,<0.13.0"]
|
|
66
|
+
build-backend = "uv_build"
|
|
67
|
+
|
|
68
|
+
[dependency-groups]
|
|
69
|
+
dev = [
|
|
70
|
+
"ipykernel>=7.1.0",
|
|
71
|
+
"ipywidgets>=8.1.7",
|
|
72
|
+
"nbmake>=1.5.5",
|
|
73
|
+
"pytest>=8.4.1",
|
|
74
|
+
"ruff>=0.9.0",
|
|
75
|
+
"mystmd>=1.3.0",
|
|
76
|
+
"quartodoc>=0.11.1",
|
|
77
|
+
"griffe<0.40.0",
|
|
78
|
+
"jupyter-server>=2.17.0",
|
|
79
|
+
"jupytext>=1.19.1",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
addopts = "--capture=no --nbmake"
|
|
84
|
+
testpaths = ["tests"]
|
|
85
|
+
|
|
86
|
+
[tool.uv.sources.mat73]
|
|
87
|
+
git = "https://github.com/skjerns/mat7.3"
|
|
88
|
+
|
|
89
|
+
[tool.uv.sources.xmris]
|
|
90
|
+
git = "https://github.com/andrewendlinger/xmris.git"
|
|
91
|
+
|
|
92
|
+
[tool.uv.build-backend]
|
|
93
|
+
source-exclude = [".ruff_cache/**"]
|
|
94
|
+
wheel-exclude = [".ruff_cache/**"]
|
|
95
|
+
|
|
96
|
+
[tool.ruff]
|
|
97
|
+
line-length = 100
|
|
98
|
+
target-version = "py312"
|
|
99
|
+
|
|
100
|
+
[tool.ruff.lint]
|
|
101
|
+
select = [
|
|
102
|
+
"E",
|
|
103
|
+
"F",
|
|
104
|
+
"I",
|
|
105
|
+
"NPY",
|
|
106
|
+
"D",
|
|
107
|
+
"UP",
|
|
108
|
+
]
|
|
109
|
+
ignore = [
|
|
110
|
+
"D100",
|
|
111
|
+
"D104",
|
|
112
|
+
"D401",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[tool.ruff.lint.pydocstyle]
|
|
116
|
+
convention = "numpy"
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.per-file-ignores]
|
|
119
|
+
"docs/**/*.py" = [
|
|
120
|
+
"E501",
|
|
121
|
+
"F401",
|
|
122
|
+
"E402",
|
|
123
|
+
]
|
|
124
|
+
"docs/**/*.ipynb" = [
|
|
125
|
+
"E501",
|
|
126
|
+
"F401",
|
|
127
|
+
"E402",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[tool.jupytext]
|
|
131
|
+
formats = "ipynb,md:myst"
|
|
132
|
+
notebook_metadata_filter = "-all, kernelspec.name, kernelspec.language, kernelspec.display_name, jupytext.text_representation.extension, jupytext.text_representation.format_name"
|
|
133
|
+
cell_metadata_filter = "-all, tags, name"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "MNutils"
|
|
3
|
+
version = "1.2.0"
|
|
4
|
+
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "Sebastian Bauer", email = "28663646+bastigw@users.noreply.github.com"}
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
description = "Utility functions for multinuclear MR data processing"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "BSD-3-Clause"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
|
|
14
|
+
keywords = ["mri", "mrs", "xarray", "spectroscopy", "nmr"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
21
|
+
"License :: OSI Approved :: BSD License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Framework :: Jupyter",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
requires-python = ">=3.12"
|
|
27
|
+
|
|
28
|
+
dependencies = [
|
|
29
|
+
"dcm2niiw>=0.1.5",
|
|
30
|
+
"ipython>=8.0",
|
|
31
|
+
"loguru>=0.7.3",
|
|
32
|
+
"mat73",
|
|
33
|
+
"matplotlib>=3.10.7",
|
|
34
|
+
"nibabel>=5.3.2",
|
|
35
|
+
"nmrglue>=0.11",
|
|
36
|
+
"pillow>=12.3.0",
|
|
37
|
+
"scipy>=1.15.3",
|
|
38
|
+
"seaborn>=0.13.2",
|
|
39
|
+
"xmris[fitting]",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/bastigw/mnutils"
|
|
44
|
+
Documentation = "https://bastigw.github.io/mnutils/"
|
|
45
|
+
Repository = "https://github.com/bastigw/mnutils"
|
|
46
|
+
Issues = "https://github.com/bastigw/mnutils/issues"
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
2025a = ["matlabengine==25.1.*"]
|
|
50
|
+
bet = ["hd-bet>=2.0.1", "torch>=2.10.0"]
|
|
51
|
+
|
|
52
|
+
[project.scripts]
|
|
53
|
+
docs-mnutils-api = "mnutils._scripts:docs_api" # Regenerate quartodoc API stubs
|
|
54
|
+
docs-mnutils-notebooks = "mnutils._scripts:docs_notebooks" # Serve tutorials — blocking
|
|
55
|
+
docs-mnutils = "mnutils._scripts:docs_all" # API refs, then serve site — blocking
|
|
56
|
+
test-mnutils-gen = "mnutils._scripts:generate_test_notebooks" # docs/*.md -> tests/autogen_notebooks/*.ipynb
|
|
57
|
+
test-mnutils = "mnutils._scripts:run_tests" # test-gen, then run the full pytest suite
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["uv_build>=0.8.13,<0.13.0"]
|
|
61
|
+
build-backend = "uv_build"
|
|
62
|
+
|
|
63
|
+
[dependency-groups]
|
|
64
|
+
dev = [
|
|
65
|
+
# --- Notebooks ---
|
|
66
|
+
"ipykernel>=7.1.0",
|
|
67
|
+
"ipywidgets>=8.1.7",
|
|
68
|
+
# --- Testing ---
|
|
69
|
+
"nbmake>=1.5.5",
|
|
70
|
+
"pytest>=8.4.1",
|
|
71
|
+
# --- Code Quality ---
|
|
72
|
+
"ruff>=0.9.0",
|
|
73
|
+
# --- Documentation (MyST) ---
|
|
74
|
+
"mystmd>=1.3.0", # Python MyST CLI for docs building
|
|
75
|
+
"quartodoc>=0.11.1", # Converts code docstrings to markdown
|
|
76
|
+
"griffe<0.40.0", # Explicit pin to fix quartodoc parsing bug
|
|
77
|
+
"jupyter-server>=2.17.0", # Required for rendering docs
|
|
78
|
+
"jupytext>=1.19.1",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
addopts = "--capture=no --nbmake"
|
|
83
|
+
testpaths = ["tests"]
|
|
84
|
+
|
|
85
|
+
# [tool.uv]
|
|
86
|
+
# config-settings = { editable_mode = "compat" }
|
|
87
|
+
|
|
88
|
+
[tool.uv.sources]
|
|
89
|
+
mat73 = { git = "https://github.com/skjerns/mat7.3" }
|
|
90
|
+
xmris = { git = "https://github.com/andrewendlinger/xmris.git" }
|
|
91
|
+
# xmris = { path = "../xmris", editable = true }
|
|
92
|
+
|
|
93
|
+
[tool.uv.build-backend]
|
|
94
|
+
source-exclude = [".ruff_cache/**"]
|
|
95
|
+
wheel-exclude = [".ruff_cache/**"]
|
|
96
|
+
|
|
97
|
+
# --- Ruff (Linter) ---
|
|
98
|
+
[tool.ruff]
|
|
99
|
+
line-length = 100
|
|
100
|
+
target-version = "py312"
|
|
101
|
+
|
|
102
|
+
[tool.ruff.lint]
|
|
103
|
+
select = ["E", "F", "I", "NPY", "D", "UP"] # Errors, Failures, Isort, NumPy, Docstrings, Upgrade
|
|
104
|
+
ignore = ["D100", "D104", "D401"] # Ignore missing docstring in public module/package
|
|
105
|
+
|
|
106
|
+
[tool.ruff.lint.pydocstyle]
|
|
107
|
+
convention = "numpy"
|
|
108
|
+
|
|
109
|
+
[tool.ruff.lint.per-file-ignores]
|
|
110
|
+
# Ignore line length, unused imports, and import positions in notebooks/scripts
|
|
111
|
+
"docs/**/*.py" = ["E501", "F401", "E402"]
|
|
112
|
+
"docs/**/*.ipynb" = ["E501", "F401", "E402"]
|
|
113
|
+
|
|
114
|
+
# --- Jupytext ---
|
|
115
|
+
# Two-way syncing between Jupyter Notebooks (.ipynb) and Markdown (.md) for docs pages.
|
|
116
|
+
# Edit in .md (git-friendly) or .ipynb (interactive), but only ever commit .md files.
|
|
117
|
+
[tool.jupytext]
|
|
118
|
+
formats = "ipynb,md:myst"
|
|
119
|
+
|
|
120
|
+
# Include display_name to prevent notebook validation errors
|
|
121
|
+
notebook_metadata_filter = "-all, kernelspec.name, kernelspec.language, kernelspec.display_name, jupytext.text_representation.extension, jupytext.text_representation.format_name"
|
|
122
|
+
|
|
123
|
+
# Cell Metadata: strip execution counts/IDs, keep 'tags' (MyST directives) and 'name'.
|
|
124
|
+
cell_metadata_filter = "-all, tags, name"
|