brukerapi 0.2.6__tar.gz → 0.4.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.
- brukerapi-0.4.0/PKG-INFO +210 -0
- brukerapi-0.4.0/README.rst +188 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/cli.py +1 -1
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_2dseq_core.json +30 -2
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_2dseq_custom.json +15 -3
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_fid_core.json +113 -10
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_fid_custom.json +3 -3
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_rawdata_core.json +10 -19
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_traj_core.json +7 -2
- brukerapi-0.4.0/brukerapi/config/properties_traj_custom.json +38 -0
- brukerapi-0.4.0/brukerapi/data.py +7 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/dataset.py +443 -49
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/exceptions.py +17 -17
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/folders.py +36 -25
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/jcampdx.py +179 -113
- brukerapi-0.4.0/brukerapi/schemas.py +1127 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/splitters.py +16 -12
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/utils.py +5 -9
- brukerapi-0.4.0/brukerapi.egg-info/PKG-INFO +210 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/SOURCES.txt +3 -1
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/requires.txt +1 -1
- {brukerapi-0.2.6 → brukerapi-0.4.0}/pyproject.toml +3 -2
- brukerapi-0.4.0/test/test_dataset.py +1127 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/test/test_exceptions.py +24 -1
- brukerapi-0.4.0/test/test_folders.py +148 -0
- brukerapi-0.4.0/test/test_jcampdx.py +366 -0
- brukerapi-0.4.0/test/test_property_configs.py +176 -0
- brukerapi-0.4.0/test/test_random_access.py +41 -0
- brukerapi-0.4.0/test/test_rawdata.py +102 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/test/test_split.py +23 -1
- {brukerapi-0.2.6 → brukerapi-0.4.0}/test/test_trajectory.py +11 -0
- brukerapi-0.4.0/test/test_utils.py +22 -0
- brukerapi-0.2.6/PKG-INFO +0 -243
- brukerapi-0.2.6/README.rst +0 -221
- brukerapi-0.2.6/brukerapi/config/properties_traj_custom.json +0 -3
- brukerapi-0.2.6/brukerapi/data.py +0 -7
- brukerapi-0.2.6/brukerapi/schemas.py +0 -653
- brukerapi-0.2.6/brukerapi.egg-info/PKG-INFO +0 -243
- brukerapi-0.2.6/test/test_dataset.py +0 -72
- brukerapi-0.2.6/test/test_folders.py +0 -34
- brukerapi-0.2.6/test/test_jcampdx.py +0 -42
- brukerapi-0.2.6/test/test_property_configs.py +0 -62
- brukerapi-0.2.6/test/test_random_access.py +0 -42
- {brukerapi-0.2.6 → brukerapi-0.4.0}/LICENSE +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/MANIFEST.in +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/__init__.py +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/config/properties_rawdata_custom.json +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi/mergers.py +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/dependency_links.txt +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/entry_points.txt +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/not-zip-safe +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/brukerapi.egg-info/top_level.txt +0 -0
- {brukerapi-0.2.6 → brukerapi-0.4.0}/setup.cfg +0 -0
brukerapi-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brukerapi
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Bruker API
|
|
5
|
+
Author-email: Tomas Psorn <tomaspsorn@isibrno.cz>, Jiri Vitous <vitous@isibrno.cz>
|
|
6
|
+
Maintainer-email: Jiri Vitous <vitous@isibrno.cz>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/isi-nmr/brukerapi-python
|
|
9
|
+
Project-URL: Download, https://github.com/isi-nmr/brukerapi-python/releases/latest
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/x-rst
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: numpy<2; python_version < "3.9"
|
|
14
|
+
Requires-Dist: numpy>=1.26.0; python_version >= "3.9"
|
|
15
|
+
Requires-Dist: pyyaml
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest; extra == "dev"
|
|
18
|
+
Requires-Dist: zenodo_get; extra == "dev"
|
|
19
|
+
Requires-Dist: ruff==0.16.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
brukerapi-python
|
|
24
|
+
======================
|
|
25
|
+
|
|
26
|
+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3831320.svg
|
|
27
|
+
:target: https://doi.org/10.5281/zenodo.3831320
|
|
28
|
+
|
|
29
|
+
.. image:: https://github.com/isi-nmr/brukerapi-python/workflows/CI/badge.svg
|
|
30
|
+
:target: https://doi.org/10.5281/zenodo.3831320
|
|
31
|
+
|
|
32
|
+
.. image:: https://readthedocs.org/projects/bruker-api/badge/?version=latest
|
|
33
|
+
:target: https://bruker-api.readthedocs.io/en/latest/?badge=latest
|
|
34
|
+
:alt: Documentation Status
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
A Python package providing I/O interface for Bruker data sets.
|
|
38
|
+
|
|
39
|
+
tl;dr
|
|
40
|
+
========
|
|
41
|
+
|
|
42
|
+
Install using pip:
|
|
43
|
+
|
|
44
|
+
.. code-block:: shell
|
|
45
|
+
|
|
46
|
+
pip install brukerapi
|
|
47
|
+
|
|
48
|
+
Load any **data set**:
|
|
49
|
+
|
|
50
|
+
.. code-block:: python
|
|
51
|
+
|
|
52
|
+
from brukerapi.dataset import Dataset
|
|
53
|
+
dataset = Dataset('{path}/2dseq') # also supports fid, fid_proc.64, traj, and rawdata.jobN
|
|
54
|
+
dataset.data # access data array
|
|
55
|
+
dataset.get_value('VisuCoreSize') # get a parameter value
|
|
56
|
+
|
|
57
|
+
Raw acquisitions and k-space
|
|
58
|
+
==============================
|
|
59
|
+
|
|
60
|
+
Raw Bruker acquisitions have format-dependent historical ``.data`` semantics.
|
|
61
|
+
For explicit code, use the representation that matches the task:
|
|
62
|
+
|
|
63
|
+
.. code-block:: python
|
|
64
|
+
|
|
65
|
+
fid = Dataset('{path}/fid')
|
|
66
|
+
fid.raw # decoded (sample, shot, receiver) acquisitions
|
|
67
|
+
fid.kspace # ordered FID k-space
|
|
68
|
+
|
|
69
|
+
job = Dataset('{path}/rawdata.job0')
|
|
70
|
+
job.raw # decoded (sample, shot, receiver) acquisitions
|
|
71
|
+
job.kspace # ordered Cartesian PV360 k-space, when metadata proves the layout
|
|
72
|
+
job.to_kspace(bart=True) # optional 16-axis BART layout
|
|
73
|
+
|
|
74
|
+
``Dataset.data`` remains backward compatible: FIDs expose their historical
|
|
75
|
+
ordered k-space view, whereas PV360 ``rawdata.jobN`` exposes its historical
|
|
76
|
+
decoded stream and emits a ``FutureWarning``. ``.kspace`` is not a
|
|
77
|
+
reconstruction API; EPI and non-Cartesian jobs require acquisition-specific
|
|
78
|
+
handling.
|
|
79
|
+
|
|
80
|
+
Frame-group metadata
|
|
81
|
+
====================
|
|
82
|
+
|
|
83
|
+
For 2dseq data, ``frame_group_values`` aligns values named by
|
|
84
|
+
``VisuGroupDepVals`` to the corresponding array axes. Returned arrays use
|
|
85
|
+
singleton dimensions where needed and therefore broadcast directly against
|
|
86
|
+
``dataset.data``:
|
|
87
|
+
|
|
88
|
+
.. code-block:: python
|
|
89
|
+
|
|
90
|
+
echoes = dataset.frame_group_values['VisuAcqEchoTime']
|
|
91
|
+
b_matrices = dataset.frame_group_values['VisuAcqDiffusionBMatrix']
|
|
92
|
+
|
|
93
|
+
``metadata`` provides normalized, grouped access to parsed subject, study,
|
|
94
|
+
series, equipment, and acquisition fields:
|
|
95
|
+
|
|
96
|
+
.. code-block:: python
|
|
97
|
+
|
|
98
|
+
dataset.metadata['visu_study']['uid']
|
|
99
|
+
dataset.metadata['visu_acq']['sequence_name']
|
|
100
|
+
dataset.metadata['subject']['id']
|
|
101
|
+
|
|
102
|
+
Load an entire **study**:
|
|
103
|
+
|
|
104
|
+
.. code-block:: python
|
|
105
|
+
|
|
106
|
+
from brukerapi.folders import Study
|
|
107
|
+
study = Study('{path_to_study_folder}')
|
|
108
|
+
dataset = study.get_dataset(exp_id='1', proc_id='1')
|
|
109
|
+
|
|
110
|
+
dataset.data # Study loads datasets by default
|
|
111
|
+
|
|
112
|
+
Load a parametric file:
|
|
113
|
+
|
|
114
|
+
.. code-block:: python
|
|
115
|
+
|
|
116
|
+
from brukerapi.jcampdx import JCAMPDX
|
|
117
|
+
|
|
118
|
+
parameters = JCAMPDX('path_to_scan/method')
|
|
119
|
+
|
|
120
|
+
TR = parameters.params["PVM_RepetitionTime"].value
|
|
121
|
+
TR = parameters.get_value("PVM_RepetitionTime")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
Features
|
|
128
|
+
========
|
|
129
|
+
|
|
130
|
+
* **I/O** interface for **fid** data sets
|
|
131
|
+
* **I/O** interface for **2dseq** data sets
|
|
132
|
+
* **I/O** interface for **rawdata** data sets
|
|
133
|
+
* **Random access** for **fid** and **2dseq** data sets
|
|
134
|
+
* **Split** operation implemented over **2dseq** data sets
|
|
135
|
+
* **Filter** operation implemented over Bruker **folders** (allowing you to work with a subset of your study only)
|
|
136
|
+
* ParaVision 5.1, 6.0.1, 7.0.0, and 360 metadata and binary-layout support
|
|
137
|
+
* Metadata-based fallback inference for custom Cartesian, EPI, radial/UTE, spiral, ZTE, CSI, and spectroscopy sequences
|
|
138
|
+
|
|
139
|
+
Examples
|
|
140
|
+
========
|
|
141
|
+
|
|
142
|
+
* How to `read <examples/read_fid.ipynb>`_ a Bruker fid, 2dseq, or rawdata file
|
|
143
|
+
* How to `split slice packages <examples/split_sp_demo.ipynb>`_ of a 2dseq data set
|
|
144
|
+
* How to `split FG_ECHO <examples/split_fg_echo_demo.ipynb>`_ of a 2dseq data set
|
|
145
|
+
* How to `split FG_ISA <examples/examples/split_fg_isa_demo.ipynb>`_ of a 2dseq data set
|
|
146
|
+
|
|
147
|
+
Documentation
|
|
148
|
+
==============
|
|
149
|
+
|
|
150
|
+
Online `documentation <https://bruker-api.readthedocs.io/en/latest/>`_ of the API is available at Read The Docs.
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
Install
|
|
154
|
+
=======
|
|
155
|
+
Using pip:
|
|
156
|
+
|
|
157
|
+
.. code-block:: shell
|
|
158
|
+
|
|
159
|
+
pip install brukerapi
|
|
160
|
+
|
|
161
|
+
From source:
|
|
162
|
+
|
|
163
|
+
.. code-block:: shell
|
|
164
|
+
|
|
165
|
+
git clone https://github.com/isi-nmr/brukerapi-python.git
|
|
166
|
+
cd brukerapi-python
|
|
167
|
+
python -m pip install -e .[dev]
|
|
168
|
+
|
|
169
|
+
Testing
|
|
170
|
+
========
|
|
171
|
+
To ensure reliability, every commit to this repository is tested against the following, publicly available
|
|
172
|
+
data sets:
|
|
173
|
+
|
|
174
|
+
* `BrukerAPI test data set (Bruker ParaVision v5.1) <https://doi.org/10.5281/zenodo.3899268>`_
|
|
175
|
+
* `BrukerAPI test data set (Bruker ParaVision v6.0.1) <https://doi.org/10.5281/zenodo.3894651>`_
|
|
176
|
+
* BrukerAPI test data set for ParaVision v7.0.0 (Zenodo DOI collection ``10.5281/zenodo.4522220``)
|
|
177
|
+
* `PV360 standard data <https://github.com/cecilyen/PV360_StdData>`_
|
|
178
|
+
|
|
179
|
+
The corpus download is opt-in for local runs:
|
|
180
|
+
|
|
181
|
+
.. code-block:: shell
|
|
182
|
+
|
|
183
|
+
python -m pytest test --download_test_data
|
|
184
|
+
|
|
185
|
+
Without that flag, pytest uses any corpus already present under ``test/test_data`` and
|
|
186
|
+
skips unavailable collections.
|
|
187
|
+
|
|
188
|
+
File format reference
|
|
189
|
+
=====================
|
|
190
|
+
|
|
191
|
+
`Bruker ParaVision Raw Data Format
|
|
192
|
+
<https://github.com/gdevenyi/brkraw-legacy/blob/main/FILE_FORMAT.md>`_ is the source of truth
|
|
193
|
+
for file-format parsing, binary layouts, dataset typing, and metadata-driven acquisition
|
|
194
|
+
scheme inference in this project.
|
|
195
|
+
|
|
196
|
+
Compatibility
|
|
197
|
+
=============
|
|
198
|
+
|
|
199
|
+
Tested releases are ParaVision 5.1, 6.0.1, 7.0.0, and PV360 3.x. Supported
|
|
200
|
+
primary binaries are ``fid``, ``fid_proc.64``, ``2dseq``, ``traj``,
|
|
201
|
+
``rawdata.jobN``, and ``rawdata.Navigator``. Known ``fid.spiral``,
|
|
202
|
+
``fid.navFid``, and ``fid.orig`` files are exposed as auxiliary subdatasets of
|
|
203
|
+
their parent ``fid``; they are not accepted as standalone primary datasets.
|
|
204
|
+
TopSpin/NMR ``ser`` is intentionally unsupported.
|
|
205
|
+
|
|
206
|
+
Known pulse-program names use dedicated layouts. For custom sequences the
|
|
207
|
+
reader also infers common acquisition families from metadata; callers can pass
|
|
208
|
+
``scheme_id=`` when inference is ambiguous. Rawdata is returned as complex
|
|
209
|
+
ordered samples, not as reconstructed k-space. See the compatibility page in
|
|
210
|
+
the documentation for behavior and current reconstruction limitations.
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
brukerapi-python
|
|
2
|
+
======================
|
|
3
|
+
|
|
4
|
+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3831320.svg
|
|
5
|
+
:target: https://doi.org/10.5281/zenodo.3831320
|
|
6
|
+
|
|
7
|
+
.. image:: https://github.com/isi-nmr/brukerapi-python/workflows/CI/badge.svg
|
|
8
|
+
:target: https://doi.org/10.5281/zenodo.3831320
|
|
9
|
+
|
|
10
|
+
.. image:: https://readthedocs.org/projects/bruker-api/badge/?version=latest
|
|
11
|
+
:target: https://bruker-api.readthedocs.io/en/latest/?badge=latest
|
|
12
|
+
:alt: Documentation Status
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
A Python package providing I/O interface for Bruker data sets.
|
|
16
|
+
|
|
17
|
+
tl;dr
|
|
18
|
+
========
|
|
19
|
+
|
|
20
|
+
Install using pip:
|
|
21
|
+
|
|
22
|
+
.. code-block:: shell
|
|
23
|
+
|
|
24
|
+
pip install brukerapi
|
|
25
|
+
|
|
26
|
+
Load any **data set**:
|
|
27
|
+
|
|
28
|
+
.. code-block:: python
|
|
29
|
+
|
|
30
|
+
from brukerapi.dataset import Dataset
|
|
31
|
+
dataset = Dataset('{path}/2dseq') # also supports fid, fid_proc.64, traj, and rawdata.jobN
|
|
32
|
+
dataset.data # access data array
|
|
33
|
+
dataset.get_value('VisuCoreSize') # get a parameter value
|
|
34
|
+
|
|
35
|
+
Raw acquisitions and k-space
|
|
36
|
+
==============================
|
|
37
|
+
|
|
38
|
+
Raw Bruker acquisitions have format-dependent historical ``.data`` semantics.
|
|
39
|
+
For explicit code, use the representation that matches the task:
|
|
40
|
+
|
|
41
|
+
.. code-block:: python
|
|
42
|
+
|
|
43
|
+
fid = Dataset('{path}/fid')
|
|
44
|
+
fid.raw # decoded (sample, shot, receiver) acquisitions
|
|
45
|
+
fid.kspace # ordered FID k-space
|
|
46
|
+
|
|
47
|
+
job = Dataset('{path}/rawdata.job0')
|
|
48
|
+
job.raw # decoded (sample, shot, receiver) acquisitions
|
|
49
|
+
job.kspace # ordered Cartesian PV360 k-space, when metadata proves the layout
|
|
50
|
+
job.to_kspace(bart=True) # optional 16-axis BART layout
|
|
51
|
+
|
|
52
|
+
``Dataset.data`` remains backward compatible: FIDs expose their historical
|
|
53
|
+
ordered k-space view, whereas PV360 ``rawdata.jobN`` exposes its historical
|
|
54
|
+
decoded stream and emits a ``FutureWarning``. ``.kspace`` is not a
|
|
55
|
+
reconstruction API; EPI and non-Cartesian jobs require acquisition-specific
|
|
56
|
+
handling.
|
|
57
|
+
|
|
58
|
+
Frame-group metadata
|
|
59
|
+
====================
|
|
60
|
+
|
|
61
|
+
For 2dseq data, ``frame_group_values`` aligns values named by
|
|
62
|
+
``VisuGroupDepVals`` to the corresponding array axes. Returned arrays use
|
|
63
|
+
singleton dimensions where needed and therefore broadcast directly against
|
|
64
|
+
``dataset.data``:
|
|
65
|
+
|
|
66
|
+
.. code-block:: python
|
|
67
|
+
|
|
68
|
+
echoes = dataset.frame_group_values['VisuAcqEchoTime']
|
|
69
|
+
b_matrices = dataset.frame_group_values['VisuAcqDiffusionBMatrix']
|
|
70
|
+
|
|
71
|
+
``metadata`` provides normalized, grouped access to parsed subject, study,
|
|
72
|
+
series, equipment, and acquisition fields:
|
|
73
|
+
|
|
74
|
+
.. code-block:: python
|
|
75
|
+
|
|
76
|
+
dataset.metadata['visu_study']['uid']
|
|
77
|
+
dataset.metadata['visu_acq']['sequence_name']
|
|
78
|
+
dataset.metadata['subject']['id']
|
|
79
|
+
|
|
80
|
+
Load an entire **study**:
|
|
81
|
+
|
|
82
|
+
.. code-block:: python
|
|
83
|
+
|
|
84
|
+
from brukerapi.folders import Study
|
|
85
|
+
study = Study('{path_to_study_folder}')
|
|
86
|
+
dataset = study.get_dataset(exp_id='1', proc_id='1')
|
|
87
|
+
|
|
88
|
+
dataset.data # Study loads datasets by default
|
|
89
|
+
|
|
90
|
+
Load a parametric file:
|
|
91
|
+
|
|
92
|
+
.. code-block:: python
|
|
93
|
+
|
|
94
|
+
from brukerapi.jcampdx import JCAMPDX
|
|
95
|
+
|
|
96
|
+
parameters = JCAMPDX('path_to_scan/method')
|
|
97
|
+
|
|
98
|
+
TR = parameters.params["PVM_RepetitionTime"].value
|
|
99
|
+
TR = parameters.get_value("PVM_RepetitionTime")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
Features
|
|
106
|
+
========
|
|
107
|
+
|
|
108
|
+
* **I/O** interface for **fid** data sets
|
|
109
|
+
* **I/O** interface for **2dseq** data sets
|
|
110
|
+
* **I/O** interface for **rawdata** data sets
|
|
111
|
+
* **Random access** for **fid** and **2dseq** data sets
|
|
112
|
+
* **Split** operation implemented over **2dseq** data sets
|
|
113
|
+
* **Filter** operation implemented over Bruker **folders** (allowing you to work with a subset of your study only)
|
|
114
|
+
* ParaVision 5.1, 6.0.1, 7.0.0, and 360 metadata and binary-layout support
|
|
115
|
+
* Metadata-based fallback inference for custom Cartesian, EPI, radial/UTE, spiral, ZTE, CSI, and spectroscopy sequences
|
|
116
|
+
|
|
117
|
+
Examples
|
|
118
|
+
========
|
|
119
|
+
|
|
120
|
+
* How to `read <examples/read_fid.ipynb>`_ a Bruker fid, 2dseq, or rawdata file
|
|
121
|
+
* How to `split slice packages <examples/split_sp_demo.ipynb>`_ of a 2dseq data set
|
|
122
|
+
* How to `split FG_ECHO <examples/split_fg_echo_demo.ipynb>`_ of a 2dseq data set
|
|
123
|
+
* How to `split FG_ISA <examples/examples/split_fg_isa_demo.ipynb>`_ of a 2dseq data set
|
|
124
|
+
|
|
125
|
+
Documentation
|
|
126
|
+
==============
|
|
127
|
+
|
|
128
|
+
Online `documentation <https://bruker-api.readthedocs.io/en/latest/>`_ of the API is available at Read The Docs.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
Install
|
|
132
|
+
=======
|
|
133
|
+
Using pip:
|
|
134
|
+
|
|
135
|
+
.. code-block:: shell
|
|
136
|
+
|
|
137
|
+
pip install brukerapi
|
|
138
|
+
|
|
139
|
+
From source:
|
|
140
|
+
|
|
141
|
+
.. code-block:: shell
|
|
142
|
+
|
|
143
|
+
git clone https://github.com/isi-nmr/brukerapi-python.git
|
|
144
|
+
cd brukerapi-python
|
|
145
|
+
python -m pip install -e .[dev]
|
|
146
|
+
|
|
147
|
+
Testing
|
|
148
|
+
========
|
|
149
|
+
To ensure reliability, every commit to this repository is tested against the following, publicly available
|
|
150
|
+
data sets:
|
|
151
|
+
|
|
152
|
+
* `BrukerAPI test data set (Bruker ParaVision v5.1) <https://doi.org/10.5281/zenodo.3899268>`_
|
|
153
|
+
* `BrukerAPI test data set (Bruker ParaVision v6.0.1) <https://doi.org/10.5281/zenodo.3894651>`_
|
|
154
|
+
* BrukerAPI test data set for ParaVision v7.0.0 (Zenodo DOI collection ``10.5281/zenodo.4522220``)
|
|
155
|
+
* `PV360 standard data <https://github.com/cecilyen/PV360_StdData>`_
|
|
156
|
+
|
|
157
|
+
The corpus download is opt-in for local runs:
|
|
158
|
+
|
|
159
|
+
.. code-block:: shell
|
|
160
|
+
|
|
161
|
+
python -m pytest test --download_test_data
|
|
162
|
+
|
|
163
|
+
Without that flag, pytest uses any corpus already present under ``test/test_data`` and
|
|
164
|
+
skips unavailable collections.
|
|
165
|
+
|
|
166
|
+
File format reference
|
|
167
|
+
=====================
|
|
168
|
+
|
|
169
|
+
`Bruker ParaVision Raw Data Format
|
|
170
|
+
<https://github.com/gdevenyi/brkraw-legacy/blob/main/FILE_FORMAT.md>`_ is the source of truth
|
|
171
|
+
for file-format parsing, binary layouts, dataset typing, and metadata-driven acquisition
|
|
172
|
+
scheme inference in this project.
|
|
173
|
+
|
|
174
|
+
Compatibility
|
|
175
|
+
=============
|
|
176
|
+
|
|
177
|
+
Tested releases are ParaVision 5.1, 6.0.1, 7.0.0, and PV360 3.x. Supported
|
|
178
|
+
primary binaries are ``fid``, ``fid_proc.64``, ``2dseq``, ``traj``,
|
|
179
|
+
``rawdata.jobN``, and ``rawdata.Navigator``. Known ``fid.spiral``,
|
|
180
|
+
``fid.navFid``, and ``fid.orig`` files are exposed as auxiliary subdatasets of
|
|
181
|
+
their parent ``fid``; they are not accepted as standalone primary datasets.
|
|
182
|
+
TopSpin/NMR ``ser`` is intentionally unsupported.
|
|
183
|
+
|
|
184
|
+
Known pulse-program names use dedicated layouts. For custom sequences the
|
|
185
|
+
reader also infers common acquisition families from metadata; callers can pass
|
|
186
|
+
``scheme_id=`` when inference is ambiguous. Rawdata is returned as complex
|
|
187
|
+
ordered samples, not as reconstructed k-space. See the compatibility page in
|
|
188
|
+
the documentation for behavior and current reconstruction limitations.
|
|
@@ -141,7 +141,7 @@ def report(args):
|
|
|
141
141
|
elif output is None:
|
|
142
142
|
Dataset(input, add_parameters=["subject"]).report(props=args.props, verbose=args.verbose)
|
|
143
143
|
# dataset to folder, or dataset to file
|
|
144
|
-
|
|
144
|
+
else:
|
|
145
145
|
Dataset(input, add_parameters=["subject"]).report(path=output, props=args.props, verbose=args.verbose)
|
|
146
146
|
|
|
147
147
|
|
|
@@ -61,6 +61,14 @@
|
|
|
61
61
|
["#VisuCoreWordType",["_8BIT_UNSGN_INT"]],
|
|
62
62
|
["#VisuCoreByteOrder",["bigEndian"]]
|
|
63
63
|
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"cmd": "np.dtype({'_32BIT_SGN_INT':'int32','_16BIT_SGN_INT':'int16','_32BIT_FLOAT':'float32','_8BIT_UNSGN_INT':'uint8'}[#RECO_wordtype]).newbyteorder('<' if #RECO_byte_order=='littleEndian' else '>')",
|
|
67
|
+
"conditions": ["#RECO_wordtype in ['_32BIT_SGN_INT','_16BIT_SGN_INT','_32BIT_FLOAT','_8BIT_UNSGN_INT']", "#RECO_byte_order in ['littleEndian','bigEndian']"]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"cmd": "np.dtype({'ip_int':'int32','ip_short':'int16','ip_float':'float32'}[#DATTYPE]).newbyteorder('<')",
|
|
71
|
+
"conditions": ["#DATTYPE in ['ip_int','ip_short','ip_float']"]
|
|
64
72
|
}
|
|
65
73
|
],
|
|
66
74
|
"shape_frames": [
|
|
@@ -108,12 +116,24 @@
|
|
|
108
116
|
{
|
|
109
117
|
"cmd": "#VisuCoreSize.tuple",
|
|
110
118
|
"conditions": []
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"cmd": "#RECO_size.tuple",
|
|
122
|
+
"conditions": []
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"cmd": "tuple(size for size in (int(#IM_SIX), int(#IM_SIY), int(#IM_SIZ)) if size > 1)",
|
|
126
|
+
"conditions": []
|
|
111
127
|
}
|
|
112
128
|
],
|
|
113
129
|
"encoded_dim": [
|
|
114
130
|
{
|
|
115
131
|
"cmd": "len(#VisuCoreSize.tuple)",
|
|
116
132
|
"conditions": []
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"cmd": "len(@shape_block)",
|
|
136
|
+
"conditions": []
|
|
117
137
|
}
|
|
118
138
|
],
|
|
119
139
|
"shape_storage":[
|
|
@@ -143,12 +163,20 @@
|
|
|
143
163
|
{
|
|
144
164
|
"cmd": "#VisuCoreDataSlope.array",
|
|
145
165
|
"conditions": []
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"cmd": "#RECO_map_slope.array",
|
|
169
|
+
"conditions": []
|
|
146
170
|
}
|
|
147
171
|
],
|
|
148
172
|
"offset": [
|
|
149
173
|
{
|
|
150
174
|
"cmd": "#VisuCoreDataOffs.array",
|
|
151
175
|
"conditions": []
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"cmd": "#RECO_map_offset.array",
|
|
179
|
+
"conditions": []
|
|
152
180
|
}
|
|
153
181
|
],
|
|
154
182
|
"dim_type": [
|
|
@@ -165,8 +193,8 @@
|
|
|
165
193
|
"conditions": ["@is_single_slice==False"]
|
|
166
194
|
},
|
|
167
195
|
{
|
|
168
|
-
"cmd": "#VisuCoreDimDesc.list",
|
|
196
|
+
"cmd": "#VisuCoreDimDesc.list + ['frame']",
|
|
169
197
|
"conditions": ["@is_single_slice==False"]
|
|
170
198
|
}
|
|
171
199
|
]
|
|
172
|
-
}
|
|
200
|
+
}
|
|
@@ -130,6 +130,18 @@
|
|
|
130
130
|
"#VisuCorePosition.size[0]==1",
|
|
131
131
|
"#VisuCoreDim==2"]
|
|
132
132
|
},
|
|
133
|
+
{
|
|
134
|
+
"cmd": "np.array([#VisuCoreExtent[0] / #VisuCoreSize[0], #VisuCoreExtent[1] / #VisuCoreSize[1], np.linalg.norm(#VisuCorePosition[1,:] - #VisuCorePosition[0,:])])",
|
|
135
|
+
"conditions": [
|
|
136
|
+
"#VisuCorePosition.size[0]>1",
|
|
137
|
+
"#VisuCoreDim==2"]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"cmd": "np.array([#VisuCoreExtent[0] / #VisuCoreSize[0], #VisuCoreExtent[1] / #VisuCoreSize[1], #VisuCoreFrameThickness])",
|
|
141
|
+
"conditions": [
|
|
142
|
+
"#VisuCorePosition.size[0]==1",
|
|
143
|
+
"#VisuCoreDim==2"]
|
|
144
|
+
},
|
|
133
145
|
{
|
|
134
146
|
"cmd": "np.array([#VisuCoreExtent[0] / #VisuCoreSize[0], #VisuCoreExtent[1] / #VisuCoreSize[1], #VisuCoreExtent[2] / #VisuCoreSize[2]])",
|
|
135
147
|
"conditions": [
|
|
@@ -253,13 +265,13 @@
|
|
|
253
265
|
{
|
|
254
266
|
"cmd": "datetime.datetime.strptime(#VisuStudyDate[1:-1], '%X %d %b %Y')",
|
|
255
267
|
"conditions": [
|
|
256
|
-
"#
|
|
268
|
+
"'T' not in #VisuStudyDate"
|
|
257
269
|
]
|
|
258
270
|
},
|
|
259
271
|
{
|
|
260
272
|
"cmd": "datetime.datetime.strptime(#VisuStudyDate[1:-1], '%Y-%m-%dT%X,%f%z')",
|
|
261
273
|
"conditions": [
|
|
262
|
-
"#
|
|
274
|
+
"'T' in #VisuStudyDate"
|
|
263
275
|
]
|
|
264
276
|
}
|
|
265
277
|
],
|
|
@@ -274,4 +286,4 @@
|
|
|
274
286
|
"comment": "default value"
|
|
275
287
|
}
|
|
276
288
|
]
|
|
277
|
-
}
|
|
289
|
+
}
|