mrd-python 2.0.0rc2__tar.gz → 2.0.0rc4__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 (25) hide show
  1. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/PKG-INFO +1 -1
  2. mrd_python-2.0.0rc4/mrd/tools/minimal_example.py +27 -0
  3. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/types.py +126 -0
  4. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd_python.egg-info/PKG-INFO +1 -1
  5. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd_python.egg-info/SOURCES.txt +1 -0
  6. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/README.md +0 -0
  7. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/__init__.py +0 -0
  8. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/_binary.py +0 -0
  9. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/_dtypes.py +0 -0
  10. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/_ndjson.py +0 -0
  11. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/binary.py +0 -0
  12. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/ndjson.py +0 -0
  13. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/protocols.py +0 -0
  14. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/tools/export_png_images.py +0 -0
  15. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/tools/phantom.py +0 -0
  16. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/tools/simulation.py +0 -0
  17. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/tools/stream_recon.py +0 -0
  18. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/tools/transform.py +0 -0
  19. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd/yardl_types.py +0 -0
  20. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd_python.egg-info/dependency_links.txt +0 -0
  21. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd_python.egg-info/requires.txt +0 -0
  22. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/mrd_python.egg-info/top_level.txt +0 -0
  23. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/pyproject.toml +0 -0
  24. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/setup.cfg +0 -0
  25. {mrd_python-2.0.0rc2 → mrd_python-2.0.0rc4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mrd-python
3
- Version: 2.0.0rc2
3
+ Version: 2.0.0rc4
4
4
  Summary: Library and tools for working with data in the ISMRM Raw Data (MRD) format.
5
5
  Project-URL: Homepage, https://ismrmrd.github.io/mrd
6
6
  Project-URL: Documentation, https://ismrmrd.github.io/mrd
@@ -0,0 +1,27 @@
1
+ import mrd
2
+
3
+ # Produce Acquisitions via a Python generator - simulating a stream
4
+ def generate_data():
5
+ nreps = 2
6
+ for _ in range(nreps):
7
+ acq = mrd.Acquisition()
8
+ # Populate Acquisition
9
+ # ...
10
+ yield mrd.StreamItem.Acquisition(acq)
11
+
12
+
13
+ header = mrd.Header()
14
+ # Populate Header
15
+ # ...
16
+
17
+ with mrd.BinaryMrdWriter("test.bin") as w:
18
+ w.write_header(header)
19
+ w.write_data(generate_data())
20
+
21
+ with mrd.BinaryMrdReader("test.bin") as r:
22
+ header = r.read_header()
23
+ data_stream = r.read_data()
24
+ for item in data_stream:
25
+ # Process StreamItem (Acquisition, Image, or Waveform)
26
+ # ...
27
+ pass
@@ -66,15 +66,35 @@ class AcquisitionFlags(enum.IntFlag):
66
66
 
67
67
  class EncodingCounters:
68
68
  kspace_encode_step_1: typing.Optional[yardl.UInt32]
69
+ """Phase encoding line"""
70
+
69
71
  kspace_encode_step_2: typing.Optional[yardl.UInt32]
72
+ """Partition encoding"""
73
+
70
74
  average: typing.Optional[yardl.UInt32]
75
+ """Signal average"""
76
+
71
77
  slice: typing.Optional[yardl.UInt32]
78
+ """Slice number (multi-slice 2D)"""
79
+
72
80
  contrast: typing.Optional[yardl.UInt32]
81
+ """Echo number in multi-echo"""
82
+
73
83
  phase: typing.Optional[yardl.UInt32]
84
+ """Cardiac phase"""
85
+
74
86
  repetition: typing.Optional[yardl.UInt32]
87
+ """Counter in repeated/dynamic acquisitions"""
88
+
75
89
  set: typing.Optional[yardl.UInt32]
90
+ """Sets of different preparation, e.g. flow encoding, diffusion weighting"""
91
+
76
92
  segment: typing.Optional[yardl.UInt32]
93
+ """Counter for segmented acquisitions"""
94
+
77
95
  user: list[yardl.UInt32]
96
+ """User-defined counters"""
97
+
78
98
 
79
99
  def __init__(self, *,
80
100
  kspace_encode_step_1: typing.Optional[yardl.UInt32] = None,
@@ -127,26 +147,72 @@ TrajectoryData = npt.NDArray[np.float32]
127
147
 
128
148
  class Acquisition:
129
149
  flags: AcquisitionFlags
150
+ """A bit mask of common attributes applicable to individual acquisition"""
151
+
130
152
  idx: EncodingCounters
153
+ """Encoding loop counters"""
154
+
131
155
  measurement_uid: yardl.UInt32
156
+ """Unique ID corresponding to the readout"""
157
+
132
158
  scan_counter: typing.Optional[yardl.UInt32]
159
+ """Zero-indexed incrementing counter for readouts"""
160
+
133
161
  acquisition_time_stamp: typing.Optional[yardl.UInt32]
162
+ """Clock time stamp (e.g. milliseconds since midnight)"""
163
+
134
164
  physiology_time_stamp: list[yardl.UInt32]
165
+ """Time stamps relative to physiological triggering"""
166
+
135
167
  channel_order: list[yardl.UInt32]
168
+ """Channel numbers"""
169
+
136
170
  discard_pre: typing.Optional[yardl.UInt32]
171
+ """Number of readout samples to be discarded at the beginning
172
+ (e.g. if the ADC is active during gradient events)
173
+ """
174
+
137
175
  discard_post: typing.Optional[yardl.UInt32]
176
+ """Number of readout samples to be discarded at the end
177
+ (e.g. if the ADC is active during gradient events)
178
+ """
179
+
138
180
  center_sample: typing.Optional[yardl.UInt32]
181
+ """Index of the readout sample corresponing to k-space center (zero indexed)"""
182
+
139
183
  encoding_space_ref: typing.Optional[yardl.UInt32]
184
+ """Indexed reference to the encoding spaces enumerated in the MRD Header"""
185
+
140
186
  sample_time_us: typing.Optional[yardl.Float32]
187
+ """Readout bandwidth, as time between samples in microseconds"""
188
+
141
189
  position: npt.NDArray[np.float32]
190
+ """Center of the excited volume, in LPS coordinates relative to isocenter in millimeters"""
191
+
142
192
  read_dir: npt.NDArray[np.float32]
193
+ """Directional cosine of readout/frequency encoding"""
194
+
143
195
  phase_dir: npt.NDArray[np.float32]
196
+ """Directional cosine of phase encoding (2D)"""
197
+
144
198
  slice_dir: npt.NDArray[np.float32]
199
+ """Directional cosine of slice normal, i.e. cross-product of read_dir and phase_dir"""
200
+
145
201
  patient_table_position: npt.NDArray[np.float32]
202
+ """Offset position of the patient table, in LPS coordinates"""
203
+
146
204
  user_int: list[yardl.Int32]
205
+ """User-defined integer parameters"""
206
+
147
207
  user_float: list[yardl.Float32]
208
+ """User-defined float parameters"""
209
+
148
210
  data: AcquisitionData
211
+ """Raw k-space samples array"""
212
+
149
213
  trajectory: TrajectoryData
214
+ """Trajectory array"""
215
+
150
216
 
151
217
  def __init__(self, *,
152
218
  flags: AcquisitionFlags = AcquisitionFlags(0),
@@ -1428,28 +1494,74 @@ class ImageMetaData:
1428
1494
 
1429
1495
  class Image(typing.Generic[T_NP]):
1430
1496
  flags: ImageFlags
1497
+ """A bit mask of common attributes applicable to individual images"""
1498
+
1431
1499
  measurement_uid: yardl.UInt32
1500
+ """Unique ID corresponding to the image"""
1501
+
1432
1502
  field_of_view: npt.NDArray[np.float32]
1503
+ """Physical size (in mm) in each of the 3 dimensions in the image"""
1504
+
1433
1505
  position: npt.NDArray[np.float32]
1506
+ """Center of the excited volume, in LPS coordinates relative to isocenter in millimeters"""
1507
+
1434
1508
  col_dir: npt.NDArray[np.float32]
1509
+ """Directional cosine of readout/frequency encoding"""
1510
+
1435
1511
  line_dir: npt.NDArray[np.float32]
1512
+ """Directional cosine of phase encoding (2D)"""
1513
+
1436
1514
  slice_dir: npt.NDArray[np.float32]
1515
+ """Directional cosine of 3D phase encoding direction"""
1516
+
1437
1517
  patient_table_position: npt.NDArray[np.float32]
1518
+ """Offset position of the patient table, in LPS coordinates"""
1519
+
1438
1520
  average: typing.Optional[yardl.UInt32]
1521
+ """Signal average"""
1522
+
1439
1523
  slice: typing.Optional[yardl.UInt32]
1524
+ """Slice number (multi-slice 2D)"""
1525
+
1440
1526
  contrast: typing.Optional[yardl.UInt32]
1527
+ """Echo number in multi-echo"""
1528
+
1441
1529
  phase: typing.Optional[yardl.UInt32]
1530
+ """Cardiac phase"""
1531
+
1442
1532
  repetition: typing.Optional[yardl.UInt32]
1533
+ """Counter in repeated/dynamic acquisitions"""
1534
+
1443
1535
  set: typing.Optional[yardl.UInt32]
1536
+ """Sets of different preparation, e.g. flow encoding, diffusion weighting"""
1537
+
1444
1538
  acquisition_time_stamp: typing.Optional[yardl.UInt32]
1539
+ """Clock time stamp (e.g. milliseconds since midnight)"""
1540
+
1445
1541
  physiology_time_stamp: list[yardl.UInt32]
1542
+ """Time stamps relative to physiological triggering, e.g. ECG, pulse oximetry, respiratory"""
1543
+
1446
1544
  image_type: ImageType
1545
+ """Interpretation type of the image"""
1546
+
1447
1547
  image_index: typing.Optional[yardl.UInt32]
1548
+ """Image index number within a series of images, corresponding to DICOM InstanceNumber (0020,0013)"""
1549
+
1448
1550
  image_series_index: typing.Optional[yardl.UInt32]
1551
+ """Series index, used to separate images into different series, corresponding to DICOM SeriesNumber (0020,0011)"""
1552
+
1449
1553
  user_int: list[yardl.Int32]
1554
+ """User-defined int parameters"""
1555
+
1450
1556
  user_float: list[yardl.Float32]
1557
+ """User-defined float parameters"""
1558
+
1451
1559
  data: ImageData[T_NP]
1560
+ """Image data array"""
1561
+
1452
1562
  meta: dict[str, list[str]]
1563
+ """Meta attributes"""
1564
+
1453
1565
 
1454
1566
  def __init__(self, *,
1455
1567
  flags: ImageFlags = ImageFlags(0),
@@ -1551,12 +1663,26 @@ WaveformSamples = npt.NDArray[T_NP]
1551
1663
 
1552
1664
  class Waveform(typing.Generic[T_NP]):
1553
1665
  flags: yardl.UInt64
1666
+ """Bit field of flags. Currently unused"""
1667
+
1554
1668
  measurement_uid: yardl.UInt32
1669
+ """Unique ID for this measurement"""
1670
+
1555
1671
  scan_counter: yardl.UInt32
1672
+ """Number of the acquisition after this waveform"""
1673
+
1556
1674
  time_stamp: yardl.UInt32
1675
+ """Starting timestamp of this waveform"""
1676
+
1557
1677
  sample_time_us: yardl.Float32
1678
+ """Time between samples in microseconds"""
1679
+
1558
1680
  waveform_id: yardl.UInt32
1681
+ """ID matching the waveform in the MRD header"""
1682
+
1559
1683
  data: WaveformSamples[T_NP]
1684
+ """Waveform sample array"""
1685
+
1560
1686
 
1561
1687
  def __init__(self, *,
1562
1688
  flags: yardl.UInt64 = 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mrd-python
3
- Version: 2.0.0rc2
3
+ Version: 2.0.0rc4
4
4
  Summary: Library and tools for working with data in the ISMRM Raw Data (MRD) format.
5
5
  Project-URL: Homepage, https://ismrmrd.github.io/mrd
6
6
  Project-URL: Documentation, https://ismrmrd.github.io/mrd
@@ -11,6 +11,7 @@ mrd/protocols.py
11
11
  mrd/types.py
12
12
  mrd/yardl_types.py
13
13
  mrd/tools/export_png_images.py
14
+ mrd/tools/minimal_example.py
14
15
  mrd/tools/phantom.py
15
16
  mrd/tools/simulation.py
16
17
  mrd/tools/stream_recon.py
File without changes
File without changes
File without changes