mrd-python 2.0.0__py3-none-any.whl

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.
mrd/types.py ADDED
@@ -0,0 +1,1840 @@
1
+ # This file was generated by the "yardl" tool. DO NOT EDIT.
2
+
3
+ # pyright: reportUnusedImport=false
4
+ # pyright: reportUnknownArgumentType=false
5
+ # pyright: reportUnknownMemberType=false
6
+ # pyright: reportUnknownVariableType=false
7
+
8
+ import datetime
9
+ import enum
10
+ import types
11
+ import typing
12
+
13
+ import numpy as np
14
+ import numpy.typing as npt
15
+
16
+ from . import yardl_types as yardl
17
+ from . import _dtypes
18
+
19
+
20
+ Y = typing.TypeVar("Y")
21
+ Y_NP = typing.TypeVar("Y_NP", bound=np.generic)
22
+ T = typing.TypeVar("T")
23
+ T_NP = typing.TypeVar("T_NP", bound=np.generic)
24
+
25
+
26
+ class AcquisitionFlags(enum.IntFlag):
27
+ FIRST_IN_ENCODE_STEP_1 = 1
28
+ LAST_IN_ENCODE_STEP_1 = 2
29
+ FIRST_IN_ENCODE_STEP_2 = 4
30
+ LAST_IN_ENCODE_STEP_2 = 8
31
+ FIRST_IN_AVERAGE = 16
32
+ LAST_IN_AVERAGE = 32
33
+ FIRST_IN_SLICE = 64
34
+ LAST_IN_SLICE = 128
35
+ FIRST_IN_CONTRAST = 256
36
+ LAST_IN_CONTRAST = 512
37
+ FIRST_IN_PHASE = 1024
38
+ LAST_IN_PHASE = 2048
39
+ FIRST_IN_REPETITION = 4096
40
+ LAST_IN_REPETITION = 8192
41
+ FIRST_IN_SET = 16384
42
+ LAST_IN_SET = 32768
43
+ FIRST_IN_SEGMENT = 65536
44
+ LAST_IN_SEGMENT = 131072
45
+ IS_NOISE_MEASUREMENT = 262144
46
+ IS_PARALLEL_CALIBRATION = 524288
47
+ IS_PARALLEL_CALIBRATION_AND_IMAGING = 1048576
48
+ IS_REVERSE = 2097152
49
+ IS_NAVIGATION_DATA = 4194304
50
+ IS_PHASECORR_DATA = 8388608
51
+ LAST_IN_MEASUREMENT = 16777216
52
+ IS_HPFEEDBACK_DATA = 33554432
53
+ IS_DUMMYSCAN_DATA = 67108864
54
+ IS_RTFEEDBACK_DATA = 134217728
55
+ IS_SURFACECOILCORRECTIONSCAN_DATA = 268435456
56
+ IS_PHASE_STABILIZATION_REFERENCE = 536870912
57
+ IS_PHASE_STABILIZATION = 1073741824
58
+
59
+ def __eq__(self, other: object) -> bool:
60
+ return isinstance(other, AcquisitionFlags) and self.value == other.value
61
+
62
+ def __hash__(self) -> int:
63
+ return hash(self.value)
64
+
65
+ __str__ = enum.Flag.__str__ # type: ignore
66
+
67
+ class EncodingCounters:
68
+ kspace_encode_step_1: typing.Optional[yardl.UInt32]
69
+ """Phase encoding line"""
70
+
71
+ kspace_encode_step_2: typing.Optional[yardl.UInt32]
72
+ """Partition encoding"""
73
+
74
+ average: typing.Optional[yardl.UInt32]
75
+ """Signal average"""
76
+
77
+ slice: typing.Optional[yardl.UInt32]
78
+ """Slice number (multi-slice 2D)"""
79
+
80
+ contrast: typing.Optional[yardl.UInt32]
81
+ """Echo number in multi-echo"""
82
+
83
+ phase: typing.Optional[yardl.UInt32]
84
+ """Cardiac phase"""
85
+
86
+ repetition: typing.Optional[yardl.UInt32]
87
+ """Counter in repeated/dynamic acquisitions"""
88
+
89
+ set: typing.Optional[yardl.UInt32]
90
+ """Sets of different preparation, e.g. flow encoding, diffusion weighting"""
91
+
92
+ segment: typing.Optional[yardl.UInt32]
93
+ """Counter for segmented acquisitions"""
94
+
95
+ user: list[yardl.UInt32]
96
+ """User-defined counters"""
97
+
98
+
99
+ def __init__(self, *,
100
+ kspace_encode_step_1: typing.Optional[yardl.UInt32] = None,
101
+ kspace_encode_step_2: typing.Optional[yardl.UInt32] = None,
102
+ average: typing.Optional[yardl.UInt32] = None,
103
+ slice: typing.Optional[yardl.UInt32] = None,
104
+ contrast: typing.Optional[yardl.UInt32] = None,
105
+ phase: typing.Optional[yardl.UInt32] = None,
106
+ repetition: typing.Optional[yardl.UInt32] = None,
107
+ set: typing.Optional[yardl.UInt32] = None,
108
+ segment: typing.Optional[yardl.UInt32] = None,
109
+ user: typing.Optional[list[yardl.UInt32]] = None,
110
+ ):
111
+ self.kspace_encode_step_1 = kspace_encode_step_1
112
+ self.kspace_encode_step_2 = kspace_encode_step_2
113
+ self.average = average
114
+ self.slice = slice
115
+ self.contrast = contrast
116
+ self.phase = phase
117
+ self.repetition = repetition
118
+ self.set = set
119
+ self.segment = segment
120
+ self.user = user if user is not None else []
121
+
122
+ def __eq__(self, other: object) -> bool:
123
+ return (
124
+ isinstance(other, EncodingCounters)
125
+ and self.kspace_encode_step_1 == other.kspace_encode_step_1
126
+ and self.kspace_encode_step_2 == other.kspace_encode_step_2
127
+ and self.average == other.average
128
+ and self.slice == other.slice
129
+ and self.contrast == other.contrast
130
+ and self.phase == other.phase
131
+ and self.repetition == other.repetition
132
+ and self.set == other.set
133
+ and self.segment == other.segment
134
+ and self.user == other.user
135
+ )
136
+
137
+ def __str__(self) -> str:
138
+ return f"EncodingCounters(kspaceEncodeStep1={self.kspace_encode_step_1}, kspaceEncodeStep2={self.kspace_encode_step_2}, average={self.average}, slice={self.slice}, contrast={self.contrast}, phase={self.phase}, repetition={self.repetition}, set={self.set}, segment={self.segment}, user={self.user})"
139
+
140
+ def __repr__(self) -> str:
141
+ return f"EncodingCounters(kspaceEncodeStep1={repr(self.kspace_encode_step_1)}, kspaceEncodeStep2={repr(self.kspace_encode_step_2)}, average={repr(self.average)}, slice={repr(self.slice)}, contrast={repr(self.contrast)}, phase={repr(self.phase)}, repetition={repr(self.repetition)}, set={repr(self.set)}, segment={repr(self.segment)}, user={repr(self.user)})"
142
+
143
+
144
+ AcquisitionData = npt.NDArray[np.complex64]
145
+
146
+ TrajectoryData = npt.NDArray[np.float32]
147
+
148
+ class Acquisition:
149
+ flags: AcquisitionFlags
150
+ """A bit mask of common attributes applicable to individual acquisition"""
151
+
152
+ idx: EncodingCounters
153
+ """Encoding loop counters"""
154
+
155
+ measurement_uid: yardl.UInt32
156
+ """Unique ID corresponding to the readout"""
157
+
158
+ scan_counter: typing.Optional[yardl.UInt32]
159
+ """Zero-indexed incrementing counter for readouts"""
160
+
161
+ acquisition_time_stamp: typing.Optional[yardl.UInt32]
162
+ """Clock time stamp (e.g. milliseconds since midnight)"""
163
+
164
+ physiology_time_stamp: list[yardl.UInt32]
165
+ """Time stamps relative to physiological triggering"""
166
+
167
+ channel_order: list[yardl.UInt32]
168
+ """Channel numbers"""
169
+
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
+
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
+
180
+ center_sample: typing.Optional[yardl.UInt32]
181
+ """Index of the readout sample corresponing to k-space center (zero indexed)"""
182
+
183
+ encoding_space_ref: typing.Optional[yardl.UInt32]
184
+ """Indexed reference to the encoding spaces enumerated in the MRD Header"""
185
+
186
+ sample_time_us: typing.Optional[yardl.Float32]
187
+ """Readout bandwidth, as time between samples in microseconds"""
188
+
189
+ position: npt.NDArray[np.float32]
190
+ """Center of the excited volume, in LPS coordinates relative to isocenter in millimeters"""
191
+
192
+ read_dir: npt.NDArray[np.float32]
193
+ """Directional cosine of readout/frequency encoding"""
194
+
195
+ phase_dir: npt.NDArray[np.float32]
196
+ """Directional cosine of phase encoding (2D)"""
197
+
198
+ slice_dir: npt.NDArray[np.float32]
199
+ """Directional cosine of slice normal, i.e. cross-product of read_dir and phase_dir"""
200
+
201
+ patient_table_position: npt.NDArray[np.float32]
202
+ """Offset position of the patient table, in LPS coordinates"""
203
+
204
+ user_int: list[yardl.Int32]
205
+ """User-defined integer parameters"""
206
+
207
+ user_float: list[yardl.Float32]
208
+ """User-defined float parameters"""
209
+
210
+ data: AcquisitionData
211
+ """Raw k-space samples array"""
212
+
213
+ trajectory: TrajectoryData
214
+ """Trajectory array"""
215
+
216
+
217
+ def __init__(self, *,
218
+ flags: AcquisitionFlags = AcquisitionFlags(0),
219
+ idx: typing.Optional[EncodingCounters] = None,
220
+ measurement_uid: yardl.UInt32 = 0,
221
+ scan_counter: typing.Optional[yardl.UInt32] = None,
222
+ acquisition_time_stamp: typing.Optional[yardl.UInt32] = None,
223
+ physiology_time_stamp: typing.Optional[list[yardl.UInt32]] = None,
224
+ channel_order: typing.Optional[list[yardl.UInt32]] = None,
225
+ discard_pre: typing.Optional[yardl.UInt32] = None,
226
+ discard_post: typing.Optional[yardl.UInt32] = None,
227
+ center_sample: typing.Optional[yardl.UInt32] = None,
228
+ encoding_space_ref: typing.Optional[yardl.UInt32] = None,
229
+ sample_time_us: typing.Optional[yardl.Float32] = None,
230
+ position: typing.Optional[npt.NDArray[np.float32]] = None,
231
+ read_dir: typing.Optional[npt.NDArray[np.float32]] = None,
232
+ phase_dir: typing.Optional[npt.NDArray[np.float32]] = None,
233
+ slice_dir: typing.Optional[npt.NDArray[np.float32]] = None,
234
+ patient_table_position: typing.Optional[npt.NDArray[np.float32]] = None,
235
+ user_int: typing.Optional[list[yardl.Int32]] = None,
236
+ user_float: typing.Optional[list[yardl.Float32]] = None,
237
+ data: typing.Optional[AcquisitionData] = None,
238
+ trajectory: typing.Optional[TrajectoryData] = None,
239
+ ):
240
+ self.flags = flags
241
+ self.idx = idx if idx is not None else EncodingCounters()
242
+ self.measurement_uid = measurement_uid
243
+ self.scan_counter = scan_counter
244
+ self.acquisition_time_stamp = acquisition_time_stamp
245
+ self.physiology_time_stamp = physiology_time_stamp if physiology_time_stamp is not None else []
246
+ self.channel_order = channel_order if channel_order is not None else []
247
+ self.discard_pre = discard_pre
248
+ self.discard_post = discard_post
249
+ self.center_sample = center_sample
250
+ self.encoding_space_ref = encoding_space_ref
251
+ self.sample_time_us = sample_time_us
252
+ self.position = position if position is not None else np.zeros((3,), dtype=np.dtype(np.float32))
253
+ self.read_dir = read_dir if read_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
254
+ self.phase_dir = phase_dir if phase_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
255
+ self.slice_dir = slice_dir if slice_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
256
+ self.patient_table_position = patient_table_position if patient_table_position is not None else np.zeros((3,), dtype=np.dtype(np.float32))
257
+ self.user_int = user_int if user_int is not None else []
258
+ self.user_float = user_float if user_float is not None else []
259
+ self.data = data if data is not None else np.zeros((0, 0), dtype=np.dtype(np.complex64))
260
+ self.trajectory = trajectory if trajectory is not None else np.zeros((0, 0), dtype=np.dtype(np.float32))
261
+
262
+ def coils(self) -> yardl.Size:
263
+ return self.data.shape[0]
264
+
265
+ def samples(self) -> yardl.Size:
266
+ return self.data.shape[1]
267
+
268
+ def active_channels(self) -> yardl.Size:
269
+ return len(self.channel_order)
270
+
271
+ def trajectory_dimensions(self) -> yardl.Size:
272
+ return self.trajectory.shape[0]
273
+
274
+ def trajectory_samples(self) -> yardl.Size:
275
+ return self.trajectory.shape[1]
276
+
277
+ def __eq__(self, other: object) -> bool:
278
+ return (
279
+ isinstance(other, Acquisition)
280
+ and self.flags == other.flags
281
+ and self.idx == other.idx
282
+ and self.measurement_uid == other.measurement_uid
283
+ and self.scan_counter == other.scan_counter
284
+ and self.acquisition_time_stamp == other.acquisition_time_stamp
285
+ and self.physiology_time_stamp == other.physiology_time_stamp
286
+ and self.channel_order == other.channel_order
287
+ and self.discard_pre == other.discard_pre
288
+ and self.discard_post == other.discard_post
289
+ and self.center_sample == other.center_sample
290
+ and self.encoding_space_ref == other.encoding_space_ref
291
+ and self.sample_time_us == other.sample_time_us
292
+ and yardl.structural_equal(self.position, other.position)
293
+ and yardl.structural_equal(self.read_dir, other.read_dir)
294
+ and yardl.structural_equal(self.phase_dir, other.phase_dir)
295
+ and yardl.structural_equal(self.slice_dir, other.slice_dir)
296
+ and yardl.structural_equal(self.patient_table_position, other.patient_table_position)
297
+ and self.user_int == other.user_int
298
+ and self.user_float == other.user_float
299
+ and yardl.structural_equal(self.data, other.data)
300
+ and yardl.structural_equal(self.trajectory, other.trajectory)
301
+ )
302
+
303
+ def __str__(self) -> str:
304
+ return f"Acquisition(flags={self.flags}, idx={self.idx}, measurementUid={self.measurement_uid}, scanCounter={self.scan_counter}, acquisitionTimeStamp={self.acquisition_time_stamp}, physiologyTimeStamp={self.physiology_time_stamp}, channelOrder={self.channel_order}, discardPre={self.discard_pre}, discardPost={self.discard_post}, centerSample={self.center_sample}, encodingSpaceRef={self.encoding_space_ref}, sampleTimeUs={self.sample_time_us}, position={self.position}, readDir={self.read_dir}, phaseDir={self.phase_dir}, sliceDir={self.slice_dir}, patientTablePosition={self.patient_table_position}, userInt={self.user_int}, userFloat={self.user_float}, data={self.data}, trajectory={self.trajectory})"
305
+
306
+ def __repr__(self) -> str:
307
+ return f"Acquisition(flags={repr(self.flags)}, idx={repr(self.idx)}, measurementUid={repr(self.measurement_uid)}, scanCounter={repr(self.scan_counter)}, acquisitionTimeStamp={repr(self.acquisition_time_stamp)}, physiologyTimeStamp={repr(self.physiology_time_stamp)}, channelOrder={repr(self.channel_order)}, discardPre={repr(self.discard_pre)}, discardPost={repr(self.discard_post)}, centerSample={repr(self.center_sample)}, encodingSpaceRef={repr(self.encoding_space_ref)}, sampleTimeUs={repr(self.sample_time_us)}, position={repr(self.position)}, readDir={repr(self.read_dir)}, phaseDir={repr(self.phase_dir)}, sliceDir={repr(self.slice_dir)}, patientTablePosition={repr(self.patient_table_position)}, userInt={repr(self.user_int)}, userFloat={repr(self.user_float)}, data={repr(self.data)}, trajectory={repr(self.trajectory)})"
308
+
309
+
310
+ class PatientGender(yardl.OutOfRangeEnum):
311
+ M = 0
312
+ F = 1
313
+ O = 2
314
+
315
+ class SubjectInformationType:
316
+ patient_name: typing.Optional[str]
317
+ patient_weight_kg: typing.Optional[yardl.Float32]
318
+ patient_height_m: typing.Optional[yardl.Float32]
319
+ patient_id: typing.Optional[str]
320
+ patient_birthdate: typing.Optional[datetime.date]
321
+ patient_gender: typing.Optional[PatientGender]
322
+
323
+ def __init__(self, *,
324
+ patient_name: typing.Optional[str] = None,
325
+ patient_weight_kg: typing.Optional[yardl.Float32] = None,
326
+ patient_height_m: typing.Optional[yardl.Float32] = None,
327
+ patient_id: typing.Optional[str] = None,
328
+ patient_birthdate: typing.Optional[datetime.date] = None,
329
+ patient_gender: typing.Optional[PatientGender] = None,
330
+ ):
331
+ self.patient_name = patient_name
332
+ self.patient_weight_kg = patient_weight_kg
333
+ self.patient_height_m = patient_height_m
334
+ self.patient_id = patient_id
335
+ self.patient_birthdate = patient_birthdate
336
+ self.patient_gender = patient_gender
337
+
338
+ def __eq__(self, other: object) -> bool:
339
+ return (
340
+ isinstance(other, SubjectInformationType)
341
+ and self.patient_name == other.patient_name
342
+ and self.patient_weight_kg == other.patient_weight_kg
343
+ and self.patient_height_m == other.patient_height_m
344
+ and self.patient_id == other.patient_id
345
+ and self.patient_birthdate == other.patient_birthdate
346
+ and self.patient_gender == other.patient_gender
347
+ )
348
+
349
+ def __str__(self) -> str:
350
+ return f"SubjectInformationType(patientName={self.patient_name}, patientWeightKg={self.patient_weight_kg}, patientHeightM={self.patient_height_m}, patientID={self.patient_id}, patientBirthdate={self.patient_birthdate}, patientGender={self.patient_gender})"
351
+
352
+ def __repr__(self) -> str:
353
+ return f"SubjectInformationType(patientName={repr(self.patient_name)}, patientWeightKg={repr(self.patient_weight_kg)}, patientHeightM={repr(self.patient_height_m)}, patientID={repr(self.patient_id)}, patientBirthdate={repr(self.patient_birthdate)}, patientGender={repr(self.patient_gender)})"
354
+
355
+
356
+ class StudyInformationType:
357
+ study_date: typing.Optional[datetime.date]
358
+ study_time: typing.Optional[yardl.Time]
359
+ study_id: typing.Optional[str]
360
+ accession_number: typing.Optional[yardl.Int64]
361
+ referring_physician_name: typing.Optional[str]
362
+ study_description: typing.Optional[str]
363
+ study_instance_uid: typing.Optional[str]
364
+ body_part_examined: typing.Optional[str]
365
+
366
+ def __init__(self, *,
367
+ study_date: typing.Optional[datetime.date] = None,
368
+ study_time: typing.Optional[yardl.Time] = None,
369
+ study_id: typing.Optional[str] = None,
370
+ accession_number: typing.Optional[yardl.Int64] = None,
371
+ referring_physician_name: typing.Optional[str] = None,
372
+ study_description: typing.Optional[str] = None,
373
+ study_instance_uid: typing.Optional[str] = None,
374
+ body_part_examined: typing.Optional[str] = None,
375
+ ):
376
+ self.study_date = study_date
377
+ self.study_time = study_time
378
+ self.study_id = study_id
379
+ self.accession_number = accession_number
380
+ self.referring_physician_name = referring_physician_name
381
+ self.study_description = study_description
382
+ self.study_instance_uid = study_instance_uid
383
+ self.body_part_examined = body_part_examined
384
+
385
+ def __eq__(self, other: object) -> bool:
386
+ return (
387
+ isinstance(other, StudyInformationType)
388
+ and self.study_date == other.study_date
389
+ and self.study_time == other.study_time
390
+ and self.study_id == other.study_id
391
+ and self.accession_number == other.accession_number
392
+ and self.referring_physician_name == other.referring_physician_name
393
+ and self.study_description == other.study_description
394
+ and self.study_instance_uid == other.study_instance_uid
395
+ and self.body_part_examined == other.body_part_examined
396
+ )
397
+
398
+ def __str__(self) -> str:
399
+ return f"StudyInformationType(studyDate={self.study_date}, studyTime={self.study_time}, studyID={self.study_id}, accessionNumber={self.accession_number}, referringPhysicianName={self.referring_physician_name}, studyDescription={self.study_description}, studyInstanceUID={self.study_instance_uid}, bodyPartExamined={self.body_part_examined})"
400
+
401
+ def __repr__(self) -> str:
402
+ return f"StudyInformationType(studyDate={repr(self.study_date)}, studyTime={repr(self.study_time)}, studyID={repr(self.study_id)}, accessionNumber={repr(self.accession_number)}, referringPhysicianName={repr(self.referring_physician_name)}, studyDescription={repr(self.study_description)}, studyInstanceUID={repr(self.study_instance_uid)}, bodyPartExamined={repr(self.body_part_examined)})"
403
+
404
+
405
+ class PatientPosition(yardl.OutOfRangeEnum):
406
+ H_FP = 0
407
+ H_FS = 1
408
+ H_FDR = 2
409
+ H_FDL = 3
410
+ F_FP = 4
411
+ F_FS = 5
412
+ F_FDR = 6
413
+ F_FDL = 7
414
+
415
+ class ThreeDimensionalFloat:
416
+ x: yardl.Float32
417
+ y: yardl.Float32
418
+ z: yardl.Float32
419
+
420
+ def __init__(self, *,
421
+ x: yardl.Float32 = 0.0,
422
+ y: yardl.Float32 = 0.0,
423
+ z: yardl.Float32 = 0.0,
424
+ ):
425
+ self.x = x
426
+ self.y = y
427
+ self.z = z
428
+
429
+ def __eq__(self, other: object) -> bool:
430
+ return (
431
+ isinstance(other, ThreeDimensionalFloat)
432
+ and self.x == other.x
433
+ and self.y == other.y
434
+ and self.z == other.z
435
+ )
436
+
437
+ def __str__(self) -> str:
438
+ return f"ThreeDimensionalFloat(x={self.x}, y={self.y}, z={self.z})"
439
+
440
+ def __repr__(self) -> str:
441
+ return f"ThreeDimensionalFloat(x={repr(self.x)}, y={repr(self.y)}, z={repr(self.z)})"
442
+
443
+
444
+ class MeasurementDependencyType:
445
+ dependency_type: str
446
+ measurement_id: str
447
+
448
+ def __init__(self, *,
449
+ dependency_type: str = "",
450
+ measurement_id: str = "",
451
+ ):
452
+ self.dependency_type = dependency_type
453
+ self.measurement_id = measurement_id
454
+
455
+ def __eq__(self, other: object) -> bool:
456
+ return (
457
+ isinstance(other, MeasurementDependencyType)
458
+ and self.dependency_type == other.dependency_type
459
+ and self.measurement_id == other.measurement_id
460
+ )
461
+
462
+ def __str__(self) -> str:
463
+ return f"MeasurementDependencyType(dependencyType={self.dependency_type}, measurementID={self.measurement_id})"
464
+
465
+ def __repr__(self) -> str:
466
+ return f"MeasurementDependencyType(dependencyType={repr(self.dependency_type)}, measurementID={repr(self.measurement_id)})"
467
+
468
+
469
+ class ReferencedImageSequenceType:
470
+ referenced_sop_instance_uid: list[str]
471
+
472
+ def __init__(self, *,
473
+ referenced_sop_instance_uid: typing.Optional[list[str]] = None,
474
+ ):
475
+ self.referenced_sop_instance_uid = referenced_sop_instance_uid if referenced_sop_instance_uid is not None else []
476
+
477
+ def __eq__(self, other: object) -> bool:
478
+ return (
479
+ isinstance(other, ReferencedImageSequenceType)
480
+ and self.referenced_sop_instance_uid == other.referenced_sop_instance_uid
481
+ )
482
+
483
+ def __str__(self) -> str:
484
+ return f"ReferencedImageSequenceType(referencedSOPInstanceUID={self.referenced_sop_instance_uid})"
485
+
486
+ def __repr__(self) -> str:
487
+ return f"ReferencedImageSequenceType(referencedSOPInstanceUID={repr(self.referenced_sop_instance_uid)})"
488
+
489
+
490
+ class MeasurementInformationType:
491
+ measurement_id: typing.Optional[str]
492
+ series_date: typing.Optional[datetime.date]
493
+ series_time: typing.Optional[yardl.Time]
494
+ patient_position: PatientPosition
495
+ relative_table_position: typing.Optional[ThreeDimensionalFloat]
496
+ initial_series_number: typing.Optional[yardl.Int64]
497
+ protocol_name: typing.Optional[str]
498
+ sequence_name: typing.Optional[str]
499
+ series_description: typing.Optional[str]
500
+ measurement_dependency: list[MeasurementDependencyType]
501
+ series_instance_uid_root: typing.Optional[str]
502
+ frame_of_reference_uid: typing.Optional[str]
503
+ referenced_image_sequence: typing.Optional[ReferencedImageSequenceType]
504
+
505
+ def __init__(self, *,
506
+ measurement_id: typing.Optional[str] = None,
507
+ series_date: typing.Optional[datetime.date] = None,
508
+ series_time: typing.Optional[yardl.Time] = None,
509
+ patient_position: PatientPosition = PatientPosition.H_FP,
510
+ relative_table_position: typing.Optional[ThreeDimensionalFloat] = None,
511
+ initial_series_number: typing.Optional[yardl.Int64] = None,
512
+ protocol_name: typing.Optional[str] = None,
513
+ sequence_name: typing.Optional[str] = None,
514
+ series_description: typing.Optional[str] = None,
515
+ measurement_dependency: typing.Optional[list[MeasurementDependencyType]] = None,
516
+ series_instance_uid_root: typing.Optional[str] = None,
517
+ frame_of_reference_uid: typing.Optional[str] = None,
518
+ referenced_image_sequence: typing.Optional[ReferencedImageSequenceType] = None,
519
+ ):
520
+ self.measurement_id = measurement_id
521
+ self.series_date = series_date
522
+ self.series_time = series_time
523
+ self.patient_position = patient_position
524
+ self.relative_table_position = relative_table_position
525
+ self.initial_series_number = initial_series_number
526
+ self.protocol_name = protocol_name
527
+ self.sequence_name = sequence_name
528
+ self.series_description = series_description
529
+ self.measurement_dependency = measurement_dependency if measurement_dependency is not None else []
530
+ self.series_instance_uid_root = series_instance_uid_root
531
+ self.frame_of_reference_uid = frame_of_reference_uid
532
+ self.referenced_image_sequence = referenced_image_sequence
533
+
534
+ def __eq__(self, other: object) -> bool:
535
+ return (
536
+ isinstance(other, MeasurementInformationType)
537
+ and self.measurement_id == other.measurement_id
538
+ and self.series_date == other.series_date
539
+ and self.series_time == other.series_time
540
+ and self.patient_position == other.patient_position
541
+ and self.relative_table_position == other.relative_table_position
542
+ and self.initial_series_number == other.initial_series_number
543
+ and self.protocol_name == other.protocol_name
544
+ and self.sequence_name == other.sequence_name
545
+ and self.series_description == other.series_description
546
+ and self.measurement_dependency == other.measurement_dependency
547
+ and self.series_instance_uid_root == other.series_instance_uid_root
548
+ and self.frame_of_reference_uid == other.frame_of_reference_uid
549
+ and self.referenced_image_sequence == other.referenced_image_sequence
550
+ )
551
+
552
+ def __str__(self) -> str:
553
+ return f"MeasurementInformationType(measurementID={self.measurement_id}, seriesDate={self.series_date}, seriesTime={self.series_time}, patientPosition={self.patient_position}, relativeTablePosition={self.relative_table_position}, initialSeriesNumber={self.initial_series_number}, protocolName={self.protocol_name}, sequenceName={self.sequence_name}, seriesDescription={self.series_description}, measurementDependency={self.measurement_dependency}, seriesInstanceUIDRoot={self.series_instance_uid_root}, frameOfReferenceUID={self.frame_of_reference_uid}, referencedImageSequence={self.referenced_image_sequence})"
554
+
555
+ def __repr__(self) -> str:
556
+ return f"MeasurementInformationType(measurementID={repr(self.measurement_id)}, seriesDate={repr(self.series_date)}, seriesTime={repr(self.series_time)}, patientPosition={repr(self.patient_position)}, relativeTablePosition={repr(self.relative_table_position)}, initialSeriesNumber={repr(self.initial_series_number)}, protocolName={repr(self.protocol_name)}, sequenceName={repr(self.sequence_name)}, seriesDescription={repr(self.series_description)}, measurementDependency={repr(self.measurement_dependency)}, seriesInstanceUIDRoot={repr(self.series_instance_uid_root)}, frameOfReferenceUID={repr(self.frame_of_reference_uid)}, referencedImageSequence={repr(self.referenced_image_sequence)})"
557
+
558
+
559
+ class CoilLabelType:
560
+ coil_number: yardl.UInt32
561
+ coil_name: str
562
+
563
+ def __init__(self, *,
564
+ coil_number: yardl.UInt32 = 0,
565
+ coil_name: str = "",
566
+ ):
567
+ self.coil_number = coil_number
568
+ self.coil_name = coil_name
569
+
570
+ def __eq__(self, other: object) -> bool:
571
+ return (
572
+ isinstance(other, CoilLabelType)
573
+ and self.coil_number == other.coil_number
574
+ and self.coil_name == other.coil_name
575
+ )
576
+
577
+ def __str__(self) -> str:
578
+ return f"CoilLabelType(coilNumber={self.coil_number}, coilName={self.coil_name})"
579
+
580
+ def __repr__(self) -> str:
581
+ return f"CoilLabelType(coilNumber={repr(self.coil_number)}, coilName={repr(self.coil_name)})"
582
+
583
+
584
+ class AcquisitionSystemInformationType:
585
+ system_vendor: typing.Optional[str]
586
+ system_model: typing.Optional[str]
587
+ system_field_strength_t: typing.Optional[yardl.Float32]
588
+ relative_receiver_noise_bandwidth: typing.Optional[yardl.Float32]
589
+ receiver_channels: typing.Optional[yardl.UInt32]
590
+ coil_label: list[CoilLabelType]
591
+ institution_name: typing.Optional[str]
592
+ station_name: typing.Optional[str]
593
+ device_id: typing.Optional[str]
594
+ device_serial_number: typing.Optional[str]
595
+
596
+ def __init__(self, *,
597
+ system_vendor: typing.Optional[str] = None,
598
+ system_model: typing.Optional[str] = None,
599
+ system_field_strength_t: typing.Optional[yardl.Float32] = None,
600
+ relative_receiver_noise_bandwidth: typing.Optional[yardl.Float32] = None,
601
+ receiver_channels: typing.Optional[yardl.UInt32] = None,
602
+ coil_label: typing.Optional[list[CoilLabelType]] = None,
603
+ institution_name: typing.Optional[str] = None,
604
+ station_name: typing.Optional[str] = None,
605
+ device_id: typing.Optional[str] = None,
606
+ device_serial_number: typing.Optional[str] = None,
607
+ ):
608
+ self.system_vendor = system_vendor
609
+ self.system_model = system_model
610
+ self.system_field_strength_t = system_field_strength_t
611
+ self.relative_receiver_noise_bandwidth = relative_receiver_noise_bandwidth
612
+ self.receiver_channels = receiver_channels
613
+ self.coil_label = coil_label if coil_label is not None else []
614
+ self.institution_name = institution_name
615
+ self.station_name = station_name
616
+ self.device_id = device_id
617
+ self.device_serial_number = device_serial_number
618
+
619
+ def __eq__(self, other: object) -> bool:
620
+ return (
621
+ isinstance(other, AcquisitionSystemInformationType)
622
+ and self.system_vendor == other.system_vendor
623
+ and self.system_model == other.system_model
624
+ and self.system_field_strength_t == other.system_field_strength_t
625
+ and self.relative_receiver_noise_bandwidth == other.relative_receiver_noise_bandwidth
626
+ and self.receiver_channels == other.receiver_channels
627
+ and self.coil_label == other.coil_label
628
+ and self.institution_name == other.institution_name
629
+ and self.station_name == other.station_name
630
+ and self.device_id == other.device_id
631
+ and self.device_serial_number == other.device_serial_number
632
+ )
633
+
634
+ def __str__(self) -> str:
635
+ return f"AcquisitionSystemInformationType(systemVendor={self.system_vendor}, systemModel={self.system_model}, systemFieldStrengthT={self.system_field_strength_t}, relativeReceiverNoiseBandwidth={self.relative_receiver_noise_bandwidth}, receiverChannels={self.receiver_channels}, coilLabel={self.coil_label}, institutionName={self.institution_name}, stationName={self.station_name}, deviceID={self.device_id}, deviceSerialNumber={self.device_serial_number})"
636
+
637
+ def __repr__(self) -> str:
638
+ return f"AcquisitionSystemInformationType(systemVendor={repr(self.system_vendor)}, systemModel={repr(self.system_model)}, systemFieldStrengthT={repr(self.system_field_strength_t)}, relativeReceiverNoiseBandwidth={repr(self.relative_receiver_noise_bandwidth)}, receiverChannels={repr(self.receiver_channels)}, coilLabel={repr(self.coil_label)}, institutionName={repr(self.institution_name)}, stationName={repr(self.station_name)}, deviceID={repr(self.device_id)}, deviceSerialNumber={repr(self.device_serial_number)})"
639
+
640
+
641
+ class ExperimentalConditionsType:
642
+ h1resonance_frequency_hz: yardl.Int64
643
+
644
+ def __init__(self, *,
645
+ h1resonance_frequency_hz: yardl.Int64 = 0,
646
+ ):
647
+ self.h1resonance_frequency_hz = h1resonance_frequency_hz
648
+
649
+ def __eq__(self, other: object) -> bool:
650
+ return (
651
+ isinstance(other, ExperimentalConditionsType)
652
+ and self.h1resonance_frequency_hz == other.h1resonance_frequency_hz
653
+ )
654
+
655
+ def __str__(self) -> str:
656
+ return f"ExperimentalConditionsType(h1resonanceFrequencyHz={self.h1resonance_frequency_hz})"
657
+
658
+ def __repr__(self) -> str:
659
+ return f"ExperimentalConditionsType(h1resonanceFrequencyHz={repr(self.h1resonance_frequency_hz)})"
660
+
661
+
662
+ class MatrixSizeType:
663
+ x: yardl.UInt32
664
+ y: yardl.UInt32
665
+ z: yardl.UInt32
666
+
667
+ def __init__(self, *,
668
+ x: yardl.UInt32 = 0,
669
+ y: yardl.UInt32 = 0,
670
+ z: yardl.UInt32 = 0,
671
+ ):
672
+ self.x = x
673
+ self.y = y
674
+ self.z = z
675
+
676
+ def __eq__(self, other: object) -> bool:
677
+ return (
678
+ isinstance(other, MatrixSizeType)
679
+ and self.x == other.x
680
+ and self.y == other.y
681
+ and self.z == other.z
682
+ )
683
+
684
+ def __str__(self) -> str:
685
+ return f"MatrixSizeType(x={self.x}, y={self.y}, z={self.z})"
686
+
687
+ def __repr__(self) -> str:
688
+ return f"MatrixSizeType(x={repr(self.x)}, y={repr(self.y)}, z={repr(self.z)})"
689
+
690
+
691
+ class FieldOfViewMm:
692
+ x: yardl.Float32
693
+ y: yardl.Float32
694
+ z: yardl.Float32
695
+
696
+ def __init__(self, *,
697
+ x: yardl.Float32 = 0.0,
698
+ y: yardl.Float32 = 0.0,
699
+ z: yardl.Float32 = 0.0,
700
+ ):
701
+ self.x = x
702
+ self.y = y
703
+ self.z = z
704
+
705
+ def __eq__(self, other: object) -> bool:
706
+ return (
707
+ isinstance(other, FieldOfViewMm)
708
+ and self.x == other.x
709
+ and self.y == other.y
710
+ and self.z == other.z
711
+ )
712
+
713
+ def __str__(self) -> str:
714
+ return f"FieldOfViewMm(x={self.x}, y={self.y}, z={self.z})"
715
+
716
+ def __repr__(self) -> str:
717
+ return f"FieldOfViewMm(x={repr(self.x)}, y={repr(self.y)}, z={repr(self.z)})"
718
+
719
+
720
+ class EncodingSpaceType:
721
+ matrix_size: MatrixSizeType
722
+ field_of_view_mm: FieldOfViewMm
723
+
724
+ def __init__(self, *,
725
+ matrix_size: typing.Optional[MatrixSizeType] = None,
726
+ field_of_view_mm: typing.Optional[FieldOfViewMm] = None,
727
+ ):
728
+ self.matrix_size = matrix_size if matrix_size is not None else MatrixSizeType()
729
+ self.field_of_view_mm = field_of_view_mm if field_of_view_mm is not None else FieldOfViewMm()
730
+
731
+ def __eq__(self, other: object) -> bool:
732
+ return (
733
+ isinstance(other, EncodingSpaceType)
734
+ and self.matrix_size == other.matrix_size
735
+ and self.field_of_view_mm == other.field_of_view_mm
736
+ )
737
+
738
+ def __str__(self) -> str:
739
+ return f"EncodingSpaceType(matrixSize={self.matrix_size}, fieldOfViewMm={self.field_of_view_mm})"
740
+
741
+ def __repr__(self) -> str:
742
+ return f"EncodingSpaceType(matrixSize={repr(self.matrix_size)}, fieldOfViewMm={repr(self.field_of_view_mm)})"
743
+
744
+
745
+ class LimitType:
746
+ minimum: yardl.UInt32
747
+ maximum: yardl.UInt32
748
+ center: yardl.UInt32
749
+
750
+ def __init__(self, *,
751
+ minimum: yardl.UInt32 = 0,
752
+ maximum: yardl.UInt32 = 0,
753
+ center: yardl.UInt32 = 0,
754
+ ):
755
+ self.minimum = minimum
756
+ self.maximum = maximum
757
+ self.center = center
758
+
759
+ def __eq__(self, other: object) -> bool:
760
+ return (
761
+ isinstance(other, LimitType)
762
+ and self.minimum == other.minimum
763
+ and self.maximum == other.maximum
764
+ and self.center == other.center
765
+ )
766
+
767
+ def __str__(self) -> str:
768
+ return f"LimitType(minimum={self.minimum}, maximum={self.maximum}, center={self.center})"
769
+
770
+ def __repr__(self) -> str:
771
+ return f"LimitType(minimum={repr(self.minimum)}, maximum={repr(self.maximum)}, center={repr(self.center)})"
772
+
773
+
774
+ class EncodingLimitsType:
775
+ kspace_encoding_step_0: typing.Optional[LimitType]
776
+ kspace_encoding_step_1: typing.Optional[LimitType]
777
+ kspace_encoding_step_2: typing.Optional[LimitType]
778
+ average: typing.Optional[LimitType]
779
+ slice: typing.Optional[LimitType]
780
+ contrast: typing.Optional[LimitType]
781
+ phase: typing.Optional[LimitType]
782
+ repetition: typing.Optional[LimitType]
783
+ set: typing.Optional[LimitType]
784
+ segment: typing.Optional[LimitType]
785
+ user_0: typing.Optional[LimitType]
786
+ user_1: typing.Optional[LimitType]
787
+ user_2: typing.Optional[LimitType]
788
+ user_3: typing.Optional[LimitType]
789
+ user_4: typing.Optional[LimitType]
790
+ user_5: typing.Optional[LimitType]
791
+ user_6: typing.Optional[LimitType]
792
+ user_7: typing.Optional[LimitType]
793
+
794
+ def __init__(self, *,
795
+ kspace_encoding_step_0: typing.Optional[LimitType] = None,
796
+ kspace_encoding_step_1: typing.Optional[LimitType] = None,
797
+ kspace_encoding_step_2: typing.Optional[LimitType] = None,
798
+ average: typing.Optional[LimitType] = None,
799
+ slice: typing.Optional[LimitType] = None,
800
+ contrast: typing.Optional[LimitType] = None,
801
+ phase: typing.Optional[LimitType] = None,
802
+ repetition: typing.Optional[LimitType] = None,
803
+ set: typing.Optional[LimitType] = None,
804
+ segment: typing.Optional[LimitType] = None,
805
+ user_0: typing.Optional[LimitType] = None,
806
+ user_1: typing.Optional[LimitType] = None,
807
+ user_2: typing.Optional[LimitType] = None,
808
+ user_3: typing.Optional[LimitType] = None,
809
+ user_4: typing.Optional[LimitType] = None,
810
+ user_5: typing.Optional[LimitType] = None,
811
+ user_6: typing.Optional[LimitType] = None,
812
+ user_7: typing.Optional[LimitType] = None,
813
+ ):
814
+ self.kspace_encoding_step_0 = kspace_encoding_step_0
815
+ self.kspace_encoding_step_1 = kspace_encoding_step_1
816
+ self.kspace_encoding_step_2 = kspace_encoding_step_2
817
+ self.average = average
818
+ self.slice = slice
819
+ self.contrast = contrast
820
+ self.phase = phase
821
+ self.repetition = repetition
822
+ self.set = set
823
+ self.segment = segment
824
+ self.user_0 = user_0
825
+ self.user_1 = user_1
826
+ self.user_2 = user_2
827
+ self.user_3 = user_3
828
+ self.user_4 = user_4
829
+ self.user_5 = user_5
830
+ self.user_6 = user_6
831
+ self.user_7 = user_7
832
+
833
+ def __eq__(self, other: object) -> bool:
834
+ return (
835
+ isinstance(other, EncodingLimitsType)
836
+ and self.kspace_encoding_step_0 == other.kspace_encoding_step_0
837
+ and self.kspace_encoding_step_1 == other.kspace_encoding_step_1
838
+ and self.kspace_encoding_step_2 == other.kspace_encoding_step_2
839
+ and self.average == other.average
840
+ and self.slice == other.slice
841
+ and self.contrast == other.contrast
842
+ and self.phase == other.phase
843
+ and self.repetition == other.repetition
844
+ and self.set == other.set
845
+ and self.segment == other.segment
846
+ and self.user_0 == other.user_0
847
+ and self.user_1 == other.user_1
848
+ and self.user_2 == other.user_2
849
+ and self.user_3 == other.user_3
850
+ and self.user_4 == other.user_4
851
+ and self.user_5 == other.user_5
852
+ and self.user_6 == other.user_6
853
+ and self.user_7 == other.user_7
854
+ )
855
+
856
+ def __str__(self) -> str:
857
+ return f"EncodingLimitsType(kspaceEncodingStep0={self.kspace_encoding_step_0}, kspaceEncodingStep1={self.kspace_encoding_step_1}, kspaceEncodingStep2={self.kspace_encoding_step_2}, average={self.average}, slice={self.slice}, contrast={self.contrast}, phase={self.phase}, repetition={self.repetition}, set={self.set}, segment={self.segment}, user0={self.user_0}, user1={self.user_1}, user2={self.user_2}, user3={self.user_3}, user4={self.user_4}, user5={self.user_5}, user6={self.user_6}, user7={self.user_7})"
858
+
859
+ def __repr__(self) -> str:
860
+ return f"EncodingLimitsType(kspaceEncodingStep0={repr(self.kspace_encoding_step_0)}, kspaceEncodingStep1={repr(self.kspace_encoding_step_1)}, kspaceEncodingStep2={repr(self.kspace_encoding_step_2)}, average={repr(self.average)}, slice={repr(self.slice)}, contrast={repr(self.contrast)}, phase={repr(self.phase)}, repetition={repr(self.repetition)}, set={repr(self.set)}, segment={repr(self.segment)}, user0={repr(self.user_0)}, user1={repr(self.user_1)}, user2={repr(self.user_2)}, user3={repr(self.user_3)}, user4={repr(self.user_4)}, user5={repr(self.user_5)}, user6={repr(self.user_6)}, user7={repr(self.user_7)})"
861
+
862
+
863
+ class Trajectory(yardl.OutOfRangeEnum):
864
+ CARTESIAN = 0
865
+ EPI = 1
866
+ RADIAL = 2
867
+ GOLDENANGLE = 3
868
+ SPIRAL = 4
869
+ OTHER = 5
870
+
871
+ class UserParameterLongType:
872
+ name: str
873
+ value: yardl.Int64
874
+
875
+ def __init__(self, *,
876
+ name: str = "",
877
+ value: yardl.Int64 = 0,
878
+ ):
879
+ self.name = name
880
+ self.value = value
881
+
882
+ def __eq__(self, other: object) -> bool:
883
+ return (
884
+ isinstance(other, UserParameterLongType)
885
+ and self.name == other.name
886
+ and self.value == other.value
887
+ )
888
+
889
+ def __str__(self) -> str:
890
+ return f"UserParameterLongType(name={self.name}, value={self.value})"
891
+
892
+ def __repr__(self) -> str:
893
+ return f"UserParameterLongType(name={repr(self.name)}, value={repr(self.value)})"
894
+
895
+
896
+ class UserParameterDoubleType:
897
+ name: str
898
+ value: yardl.Float64
899
+
900
+ def __init__(self, *,
901
+ name: str = "",
902
+ value: yardl.Float64 = 0.0,
903
+ ):
904
+ self.name = name
905
+ self.value = value
906
+
907
+ def __eq__(self, other: object) -> bool:
908
+ return (
909
+ isinstance(other, UserParameterDoubleType)
910
+ and self.name == other.name
911
+ and self.value == other.value
912
+ )
913
+
914
+ def __str__(self) -> str:
915
+ return f"UserParameterDoubleType(name={self.name}, value={self.value})"
916
+
917
+ def __repr__(self) -> str:
918
+ return f"UserParameterDoubleType(name={repr(self.name)}, value={repr(self.value)})"
919
+
920
+
921
+ class UserParameterStringType:
922
+ name: str
923
+ value: str
924
+
925
+ def __init__(self, *,
926
+ name: str = "",
927
+ value: str = "",
928
+ ):
929
+ self.name = name
930
+ self.value = value
931
+
932
+ def __eq__(self, other: object) -> bool:
933
+ return (
934
+ isinstance(other, UserParameterStringType)
935
+ and self.name == other.name
936
+ and self.value == other.value
937
+ )
938
+
939
+ def __str__(self) -> str:
940
+ return f"UserParameterStringType(name={self.name}, value={self.value})"
941
+
942
+ def __repr__(self) -> str:
943
+ return f"UserParameterStringType(name={repr(self.name)}, value={repr(self.value)})"
944
+
945
+
946
+ class TrajectoryDescriptionType:
947
+ identifier: str
948
+ user_parameter_long: list[UserParameterLongType]
949
+ user_parameter_double: list[UserParameterDoubleType]
950
+ user_parameter_string: list[UserParameterStringType]
951
+ comment: typing.Optional[str]
952
+
953
+ def __init__(self, *,
954
+ identifier: str = "",
955
+ user_parameter_long: typing.Optional[list[UserParameterLongType]] = None,
956
+ user_parameter_double: typing.Optional[list[UserParameterDoubleType]] = None,
957
+ user_parameter_string: typing.Optional[list[UserParameterStringType]] = None,
958
+ comment: typing.Optional[str] = None,
959
+ ):
960
+ self.identifier = identifier
961
+ self.user_parameter_long = user_parameter_long if user_parameter_long is not None else []
962
+ self.user_parameter_double = user_parameter_double if user_parameter_double is not None else []
963
+ self.user_parameter_string = user_parameter_string if user_parameter_string is not None else []
964
+ self.comment = comment
965
+
966
+ def __eq__(self, other: object) -> bool:
967
+ return (
968
+ isinstance(other, TrajectoryDescriptionType)
969
+ and self.identifier == other.identifier
970
+ and self.user_parameter_long == other.user_parameter_long
971
+ and self.user_parameter_double == other.user_parameter_double
972
+ and self.user_parameter_string == other.user_parameter_string
973
+ and self.comment == other.comment
974
+ )
975
+
976
+ def __str__(self) -> str:
977
+ return f"TrajectoryDescriptionType(identifier={self.identifier}, userParameterLong={self.user_parameter_long}, userParameterDouble={self.user_parameter_double}, userParameterString={self.user_parameter_string}, comment={self.comment})"
978
+
979
+ def __repr__(self) -> str:
980
+ return f"TrajectoryDescriptionType(identifier={repr(self.identifier)}, userParameterLong={repr(self.user_parameter_long)}, userParameterDouble={repr(self.user_parameter_double)}, userParameterString={repr(self.user_parameter_string)}, comment={repr(self.comment)})"
981
+
982
+
983
+ class AccelerationFactorType:
984
+ kspace_encoding_step_1: yardl.UInt32
985
+ kspace_encoding_step_2: yardl.UInt32
986
+
987
+ def __init__(self, *,
988
+ kspace_encoding_step_1: yardl.UInt32 = 0,
989
+ kspace_encoding_step_2: yardl.UInt32 = 0,
990
+ ):
991
+ self.kspace_encoding_step_1 = kspace_encoding_step_1
992
+ self.kspace_encoding_step_2 = kspace_encoding_step_2
993
+
994
+ def __eq__(self, other: object) -> bool:
995
+ return (
996
+ isinstance(other, AccelerationFactorType)
997
+ and self.kspace_encoding_step_1 == other.kspace_encoding_step_1
998
+ and self.kspace_encoding_step_2 == other.kspace_encoding_step_2
999
+ )
1000
+
1001
+ def __str__(self) -> str:
1002
+ return f"AccelerationFactorType(kspaceEncodingStep1={self.kspace_encoding_step_1}, kspaceEncodingStep2={self.kspace_encoding_step_2})"
1003
+
1004
+ def __repr__(self) -> str:
1005
+ return f"AccelerationFactorType(kspaceEncodingStep1={repr(self.kspace_encoding_step_1)}, kspaceEncodingStep2={repr(self.kspace_encoding_step_2)})"
1006
+
1007
+
1008
+ class CalibrationMode(yardl.OutOfRangeEnum):
1009
+ EMBEDDED = 0
1010
+ INTERLEAVED = 1
1011
+ SEPARATE = 2
1012
+ EXTERNAL = 3
1013
+ OTHER = 4
1014
+
1015
+ class InterleavingDimension(yardl.OutOfRangeEnum):
1016
+ PHASE = 0
1017
+ REPETITION = 1
1018
+ CONTRAST = 2
1019
+ AVERAGE = 3
1020
+ OTHER = 4
1021
+
1022
+ class MultibandSpacingType:
1023
+ d_z: list[yardl.Float32]
1024
+
1025
+ def __init__(self, *,
1026
+ d_z: typing.Optional[list[yardl.Float32]] = None,
1027
+ ):
1028
+ self.d_z = d_z if d_z is not None else []
1029
+
1030
+ def __eq__(self, other: object) -> bool:
1031
+ return (
1032
+ isinstance(other, MultibandSpacingType)
1033
+ and self.d_z == other.d_z
1034
+ )
1035
+
1036
+ def __str__(self) -> str:
1037
+ return f"MultibandSpacingType(dZ={self.d_z})"
1038
+
1039
+ def __repr__(self) -> str:
1040
+ return f"MultibandSpacingType(dZ={repr(self.d_z)})"
1041
+
1042
+
1043
+ class Calibration(yardl.OutOfRangeEnum):
1044
+ SEPARABLE_2D = 0
1045
+ FULL_3D = 1
1046
+ OTHER = 2
1047
+
1048
+ class MultibandType:
1049
+ spacing: list[MultibandSpacingType]
1050
+ delta_kz: yardl.Float32
1051
+ multiband_factor: yardl.UInt32
1052
+ calibration: Calibration
1053
+ calibration_encoding: yardl.UInt64
1054
+
1055
+ def __init__(self, *,
1056
+ spacing: typing.Optional[list[MultibandSpacingType]] = None,
1057
+ delta_kz: yardl.Float32 = 0.0,
1058
+ multiband_factor: yardl.UInt32 = 0,
1059
+ calibration: Calibration = Calibration.SEPARABLE_2D,
1060
+ calibration_encoding: yardl.UInt64 = 0,
1061
+ ):
1062
+ self.spacing = spacing if spacing is not None else []
1063
+ self.delta_kz = delta_kz
1064
+ self.multiband_factor = multiband_factor
1065
+ self.calibration = calibration
1066
+ self.calibration_encoding = calibration_encoding
1067
+
1068
+ def __eq__(self, other: object) -> bool:
1069
+ return (
1070
+ isinstance(other, MultibandType)
1071
+ and self.spacing == other.spacing
1072
+ and self.delta_kz == other.delta_kz
1073
+ and self.multiband_factor == other.multiband_factor
1074
+ and self.calibration == other.calibration
1075
+ and self.calibration_encoding == other.calibration_encoding
1076
+ )
1077
+
1078
+ def __str__(self) -> str:
1079
+ return f"MultibandType(spacing={self.spacing}, deltaKz={self.delta_kz}, multibandFactor={self.multiband_factor}, calibration={self.calibration}, calibrationEncoding={self.calibration_encoding})"
1080
+
1081
+ def __repr__(self) -> str:
1082
+ return f"MultibandType(spacing={repr(self.spacing)}, deltaKz={repr(self.delta_kz)}, multibandFactor={repr(self.multiband_factor)}, calibration={repr(self.calibration)}, calibrationEncoding={repr(self.calibration_encoding)})"
1083
+
1084
+
1085
+ class ParallelImagingType:
1086
+ acceleration_factor: AccelerationFactorType
1087
+ calibration_mode: typing.Optional[CalibrationMode]
1088
+ interleaving_dimension: typing.Optional[InterleavingDimension]
1089
+ multiband: typing.Optional[MultibandType]
1090
+
1091
+ def __init__(self, *,
1092
+ acceleration_factor: typing.Optional[AccelerationFactorType] = None,
1093
+ calibration_mode: typing.Optional[CalibrationMode] = None,
1094
+ interleaving_dimension: typing.Optional[InterleavingDimension] = None,
1095
+ multiband: typing.Optional[MultibandType] = None,
1096
+ ):
1097
+ self.acceleration_factor = acceleration_factor if acceleration_factor is not None else AccelerationFactorType()
1098
+ self.calibration_mode = calibration_mode
1099
+ self.interleaving_dimension = interleaving_dimension
1100
+ self.multiband = multiband
1101
+
1102
+ def __eq__(self, other: object) -> bool:
1103
+ return (
1104
+ isinstance(other, ParallelImagingType)
1105
+ and self.acceleration_factor == other.acceleration_factor
1106
+ and self.calibration_mode == other.calibration_mode
1107
+ and self.interleaving_dimension == other.interleaving_dimension
1108
+ and self.multiband == other.multiband
1109
+ )
1110
+
1111
+ def __str__(self) -> str:
1112
+ return f"ParallelImagingType(accelerationFactor={self.acceleration_factor}, calibrationMode={self.calibration_mode}, interleavingDimension={self.interleaving_dimension}, multiband={self.multiband})"
1113
+
1114
+ def __repr__(self) -> str:
1115
+ return f"ParallelImagingType(accelerationFactor={repr(self.acceleration_factor)}, calibrationMode={repr(self.calibration_mode)}, interleavingDimension={repr(self.interleaving_dimension)}, multiband={repr(self.multiband)})"
1116
+
1117
+
1118
+ class EncodingType:
1119
+ encoded_space: EncodingSpaceType
1120
+ recon_space: EncodingSpaceType
1121
+ encoding_limits: EncodingLimitsType
1122
+ trajectory: Trajectory
1123
+ trajectory_description: typing.Optional[TrajectoryDescriptionType]
1124
+ parallel_imaging: typing.Optional[ParallelImagingType]
1125
+ echo_train_length: typing.Optional[yardl.Int64]
1126
+
1127
+ def __init__(self, *,
1128
+ encoded_space: typing.Optional[EncodingSpaceType] = None,
1129
+ recon_space: typing.Optional[EncodingSpaceType] = None,
1130
+ encoding_limits: typing.Optional[EncodingLimitsType] = None,
1131
+ trajectory: Trajectory = Trajectory.CARTESIAN,
1132
+ trajectory_description: typing.Optional[TrajectoryDescriptionType] = None,
1133
+ parallel_imaging: typing.Optional[ParallelImagingType] = None,
1134
+ echo_train_length: typing.Optional[yardl.Int64] = None,
1135
+ ):
1136
+ self.encoded_space = encoded_space if encoded_space is not None else EncodingSpaceType()
1137
+ self.recon_space = recon_space if recon_space is not None else EncodingSpaceType()
1138
+ self.encoding_limits = encoding_limits if encoding_limits is not None else EncodingLimitsType()
1139
+ self.trajectory = trajectory
1140
+ self.trajectory_description = trajectory_description
1141
+ self.parallel_imaging = parallel_imaging
1142
+ self.echo_train_length = echo_train_length
1143
+
1144
+ def __eq__(self, other: object) -> bool:
1145
+ return (
1146
+ isinstance(other, EncodingType)
1147
+ and self.encoded_space == other.encoded_space
1148
+ and self.recon_space == other.recon_space
1149
+ and self.encoding_limits == other.encoding_limits
1150
+ and self.trajectory == other.trajectory
1151
+ and self.trajectory_description == other.trajectory_description
1152
+ and self.parallel_imaging == other.parallel_imaging
1153
+ and self.echo_train_length == other.echo_train_length
1154
+ )
1155
+
1156
+ def __str__(self) -> str:
1157
+ return f"EncodingType(encodedSpace={self.encoded_space}, reconSpace={self.recon_space}, encodingLimits={self.encoding_limits}, trajectory={self.trajectory}, trajectoryDescription={self.trajectory_description}, parallelImaging={self.parallel_imaging}, echoTrainLength={self.echo_train_length})"
1158
+
1159
+ def __repr__(self) -> str:
1160
+ return f"EncodingType(encodedSpace={repr(self.encoded_space)}, reconSpace={repr(self.recon_space)}, encodingLimits={repr(self.encoding_limits)}, trajectory={repr(self.trajectory)}, trajectoryDescription={repr(self.trajectory_description)}, parallelImaging={repr(self.parallel_imaging)}, echoTrainLength={repr(self.echo_train_length)})"
1161
+
1162
+
1163
+ class DiffusionDimension(yardl.OutOfRangeEnum):
1164
+ AVERAGE = 0
1165
+ CONTRAST = 1
1166
+ PHASE = 2
1167
+ REPETITION = 3
1168
+ SET = 4
1169
+ SEGMENT = 5
1170
+ USER_0 = 6
1171
+ USER_1 = 7
1172
+ USER_2 = 8
1173
+ USER_3 = 9
1174
+ USER_4 = 10
1175
+ USER_5 = 11
1176
+ USER_6 = 12
1177
+ USER_7 = 13
1178
+
1179
+ class GradientDirectionType:
1180
+ rl: yardl.Float32
1181
+ ap: yardl.Float32
1182
+ fh: yardl.Float32
1183
+
1184
+ def __init__(self, *,
1185
+ rl: yardl.Float32 = 0.0,
1186
+ ap: yardl.Float32 = 0.0,
1187
+ fh: yardl.Float32 = 0.0,
1188
+ ):
1189
+ self.rl = rl
1190
+ self.ap = ap
1191
+ self.fh = fh
1192
+
1193
+ def __eq__(self, other: object) -> bool:
1194
+ return (
1195
+ isinstance(other, GradientDirectionType)
1196
+ and self.rl == other.rl
1197
+ and self.ap == other.ap
1198
+ and self.fh == other.fh
1199
+ )
1200
+
1201
+ def __str__(self) -> str:
1202
+ return f"GradientDirectionType(rl={self.rl}, ap={self.ap}, fh={self.fh})"
1203
+
1204
+ def __repr__(self) -> str:
1205
+ return f"GradientDirectionType(rl={repr(self.rl)}, ap={repr(self.ap)}, fh={repr(self.fh)})"
1206
+
1207
+
1208
+ class DiffusionType:
1209
+ gradient_direction: GradientDirectionType
1210
+ bvalue: yardl.Float32
1211
+
1212
+ def __init__(self, *,
1213
+ gradient_direction: typing.Optional[GradientDirectionType] = None,
1214
+ bvalue: yardl.Float32 = 0.0,
1215
+ ):
1216
+ self.gradient_direction = gradient_direction if gradient_direction is not None else GradientDirectionType()
1217
+ self.bvalue = bvalue
1218
+
1219
+ def __eq__(self, other: object) -> bool:
1220
+ return (
1221
+ isinstance(other, DiffusionType)
1222
+ and self.gradient_direction == other.gradient_direction
1223
+ and self.bvalue == other.bvalue
1224
+ )
1225
+
1226
+ def __str__(self) -> str:
1227
+ return f"DiffusionType(gradientDirection={self.gradient_direction}, bvalue={self.bvalue})"
1228
+
1229
+ def __repr__(self) -> str:
1230
+ return f"DiffusionType(gradientDirection={repr(self.gradient_direction)}, bvalue={repr(self.bvalue)})"
1231
+
1232
+
1233
+ class SequenceParametersType:
1234
+ t_r: list[yardl.Float32]
1235
+ t_e: list[yardl.Float32]
1236
+ t_i: list[yardl.Float32]
1237
+ flip_angle_deg: list[yardl.Float32]
1238
+ sequence_type: typing.Optional[str]
1239
+ echo_spacing: list[yardl.Float32]
1240
+ diffusion_dimension: typing.Optional[DiffusionDimension]
1241
+ diffusion: list[DiffusionType]
1242
+ diffusion_scheme: typing.Optional[str]
1243
+
1244
+ def __init__(self, *,
1245
+ t_r: typing.Optional[list[yardl.Float32]] = None,
1246
+ t_e: typing.Optional[list[yardl.Float32]] = None,
1247
+ t_i: typing.Optional[list[yardl.Float32]] = None,
1248
+ flip_angle_deg: typing.Optional[list[yardl.Float32]] = None,
1249
+ sequence_type: typing.Optional[str] = None,
1250
+ echo_spacing: typing.Optional[list[yardl.Float32]] = None,
1251
+ diffusion_dimension: typing.Optional[DiffusionDimension] = None,
1252
+ diffusion: typing.Optional[list[DiffusionType]] = None,
1253
+ diffusion_scheme: typing.Optional[str] = None,
1254
+ ):
1255
+ self.t_r = t_r if t_r is not None else []
1256
+ self.t_e = t_e if t_e is not None else []
1257
+ self.t_i = t_i if t_i is not None else []
1258
+ self.flip_angle_deg = flip_angle_deg if flip_angle_deg is not None else []
1259
+ self.sequence_type = sequence_type
1260
+ self.echo_spacing = echo_spacing if echo_spacing is not None else []
1261
+ self.diffusion_dimension = diffusion_dimension
1262
+ self.diffusion = diffusion if diffusion is not None else []
1263
+ self.diffusion_scheme = diffusion_scheme
1264
+
1265
+ def __eq__(self, other: object) -> bool:
1266
+ return (
1267
+ isinstance(other, SequenceParametersType)
1268
+ and self.t_r == other.t_r
1269
+ and self.t_e == other.t_e
1270
+ and self.t_i == other.t_i
1271
+ and self.flip_angle_deg == other.flip_angle_deg
1272
+ and self.sequence_type == other.sequence_type
1273
+ and self.echo_spacing == other.echo_spacing
1274
+ and self.diffusion_dimension == other.diffusion_dimension
1275
+ and self.diffusion == other.diffusion
1276
+ and self.diffusion_scheme == other.diffusion_scheme
1277
+ )
1278
+
1279
+ def __str__(self) -> str:
1280
+ return f"SequenceParametersType(tR={self.t_r}, tE={self.t_e}, tI={self.t_i}, flipAngleDeg={self.flip_angle_deg}, sequenceType={self.sequence_type}, echoSpacing={self.echo_spacing}, diffusionDimension={self.diffusion_dimension}, diffusion={self.diffusion}, diffusionScheme={self.diffusion_scheme})"
1281
+
1282
+ def __repr__(self) -> str:
1283
+ return f"SequenceParametersType(tR={repr(self.t_r)}, tE={repr(self.t_e)}, tI={repr(self.t_i)}, flipAngleDeg={repr(self.flip_angle_deg)}, sequenceType={repr(self.sequence_type)}, echoSpacing={repr(self.echo_spacing)}, diffusionDimension={repr(self.diffusion_dimension)}, diffusion={repr(self.diffusion)}, diffusionScheme={repr(self.diffusion_scheme)})"
1284
+
1285
+
1286
+ class UserParameterBase64Type:
1287
+ name: str
1288
+ value: str
1289
+
1290
+ def __init__(self, *,
1291
+ name: str = "",
1292
+ value: str = "",
1293
+ ):
1294
+ self.name = name
1295
+ self.value = value
1296
+
1297
+ def __eq__(self, other: object) -> bool:
1298
+ return (
1299
+ isinstance(other, UserParameterBase64Type)
1300
+ and self.name == other.name
1301
+ and self.value == other.value
1302
+ )
1303
+
1304
+ def __str__(self) -> str:
1305
+ return f"UserParameterBase64Type(name={self.name}, value={self.value})"
1306
+
1307
+ def __repr__(self) -> str:
1308
+ return f"UserParameterBase64Type(name={repr(self.name)}, value={repr(self.value)})"
1309
+
1310
+
1311
+ class UserParametersType:
1312
+ user_parameter_long: list[UserParameterLongType]
1313
+ user_parameter_double: list[UserParameterDoubleType]
1314
+ user_parameter_string: list[UserParameterStringType]
1315
+ user_parameter_base64: list[UserParameterBase64Type]
1316
+
1317
+ def __init__(self, *,
1318
+ user_parameter_long: typing.Optional[list[UserParameterLongType]] = None,
1319
+ user_parameter_double: typing.Optional[list[UserParameterDoubleType]] = None,
1320
+ user_parameter_string: typing.Optional[list[UserParameterStringType]] = None,
1321
+ user_parameter_base64: typing.Optional[list[UserParameterBase64Type]] = None,
1322
+ ):
1323
+ self.user_parameter_long = user_parameter_long if user_parameter_long is not None else []
1324
+ self.user_parameter_double = user_parameter_double if user_parameter_double is not None else []
1325
+ self.user_parameter_string = user_parameter_string if user_parameter_string is not None else []
1326
+ self.user_parameter_base64 = user_parameter_base64 if user_parameter_base64 is not None else []
1327
+
1328
+ def __eq__(self, other: object) -> bool:
1329
+ return (
1330
+ isinstance(other, UserParametersType)
1331
+ and self.user_parameter_long == other.user_parameter_long
1332
+ and self.user_parameter_double == other.user_parameter_double
1333
+ and self.user_parameter_string == other.user_parameter_string
1334
+ and self.user_parameter_base64 == other.user_parameter_base64
1335
+ )
1336
+
1337
+ def __str__(self) -> str:
1338
+ return f"UserParametersType(userParameterLong={self.user_parameter_long}, userParameterDouble={self.user_parameter_double}, userParameterString={self.user_parameter_string}, userParameterBase64={self.user_parameter_base64})"
1339
+
1340
+ def __repr__(self) -> str:
1341
+ return f"UserParametersType(userParameterLong={repr(self.user_parameter_long)}, userParameterDouble={repr(self.user_parameter_double)}, userParameterString={repr(self.user_parameter_string)}, userParameterBase64={repr(self.user_parameter_base64)})"
1342
+
1343
+
1344
+ class WaveformType(yardl.OutOfRangeEnum):
1345
+ ECG = 0
1346
+ PULSE = 1
1347
+ RESPIRATORY = 2
1348
+ TRIGGER = 3
1349
+ GRADIENTWAVEFORM = 4
1350
+ OTHER = 5
1351
+
1352
+ class WaveformInformationType:
1353
+ waveform_name: str
1354
+ waveform_type: WaveformType
1355
+ user_parameters: UserParametersType
1356
+
1357
+ def __init__(self, *,
1358
+ waveform_name: str = "",
1359
+ waveform_type: WaveformType = WaveformType.ECG,
1360
+ user_parameters: typing.Optional[UserParametersType] = None,
1361
+ ):
1362
+ self.waveform_name = waveform_name
1363
+ self.waveform_type = waveform_type
1364
+ self.user_parameters = user_parameters if user_parameters is not None else UserParametersType()
1365
+
1366
+ def __eq__(self, other: object) -> bool:
1367
+ return (
1368
+ isinstance(other, WaveformInformationType)
1369
+ and self.waveform_name == other.waveform_name
1370
+ and self.waveform_type == other.waveform_type
1371
+ and self.user_parameters == other.user_parameters
1372
+ )
1373
+
1374
+ def __str__(self) -> str:
1375
+ return f"WaveformInformationType(waveformName={self.waveform_name}, waveformType={self.waveform_type}, userParameters={self.user_parameters})"
1376
+
1377
+ def __repr__(self) -> str:
1378
+ return f"WaveformInformationType(waveformName={repr(self.waveform_name)}, waveformType={repr(self.waveform_type)}, userParameters={repr(self.user_parameters)})"
1379
+
1380
+
1381
+ class Header:
1382
+ version: typing.Optional[yardl.Int64]
1383
+ subject_information: typing.Optional[SubjectInformationType]
1384
+ study_information: typing.Optional[StudyInformationType]
1385
+ measurement_information: typing.Optional[MeasurementInformationType]
1386
+ acquisition_system_information: typing.Optional[AcquisitionSystemInformationType]
1387
+ experimental_conditions: ExperimentalConditionsType
1388
+ encoding: list[EncodingType]
1389
+ sequence_parameters: typing.Optional[SequenceParametersType]
1390
+ user_parameters: typing.Optional[UserParametersType]
1391
+ waveform_information: list[WaveformInformationType]
1392
+
1393
+ def __init__(self, *,
1394
+ version: typing.Optional[yardl.Int64] = None,
1395
+ subject_information: typing.Optional[SubjectInformationType] = None,
1396
+ study_information: typing.Optional[StudyInformationType] = None,
1397
+ measurement_information: typing.Optional[MeasurementInformationType] = None,
1398
+ acquisition_system_information: typing.Optional[AcquisitionSystemInformationType] = None,
1399
+ experimental_conditions: typing.Optional[ExperimentalConditionsType] = None,
1400
+ encoding: typing.Optional[list[EncodingType]] = None,
1401
+ sequence_parameters: typing.Optional[SequenceParametersType] = None,
1402
+ user_parameters: typing.Optional[UserParametersType] = None,
1403
+ waveform_information: typing.Optional[list[WaveformInformationType]] = None,
1404
+ ):
1405
+ self.version = version
1406
+ self.subject_information = subject_information
1407
+ self.study_information = study_information
1408
+ self.measurement_information = measurement_information
1409
+ self.acquisition_system_information = acquisition_system_information
1410
+ self.experimental_conditions = experimental_conditions if experimental_conditions is not None else ExperimentalConditionsType()
1411
+ self.encoding = encoding if encoding is not None else []
1412
+ self.sequence_parameters = sequence_parameters
1413
+ self.user_parameters = user_parameters
1414
+ self.waveform_information = waveform_information if waveform_information is not None else []
1415
+
1416
+ def __eq__(self, other: object) -> bool:
1417
+ return (
1418
+ isinstance(other, Header)
1419
+ and self.version == other.version
1420
+ and self.subject_information == other.subject_information
1421
+ and self.study_information == other.study_information
1422
+ and self.measurement_information == other.measurement_information
1423
+ and self.acquisition_system_information == other.acquisition_system_information
1424
+ and self.experimental_conditions == other.experimental_conditions
1425
+ and self.encoding == other.encoding
1426
+ and self.sequence_parameters == other.sequence_parameters
1427
+ and self.user_parameters == other.user_parameters
1428
+ and self.waveform_information == other.waveform_information
1429
+ )
1430
+
1431
+ def __str__(self) -> str:
1432
+ return f"Header(version={self.version}, subjectInformation={self.subject_information}, studyInformation={self.study_information}, measurementInformation={self.measurement_information}, acquisitionSystemInformation={self.acquisition_system_information}, experimentalConditions={self.experimental_conditions}, encoding={self.encoding}, sequenceParameters={self.sequence_parameters}, userParameters={self.user_parameters}, waveformInformation={self.waveform_information})"
1433
+
1434
+ def __repr__(self) -> str:
1435
+ return f"Header(version={repr(self.version)}, subjectInformation={repr(self.subject_information)}, studyInformation={repr(self.study_information)}, measurementInformation={repr(self.measurement_information)}, acquisitionSystemInformation={repr(self.acquisition_system_information)}, experimentalConditions={repr(self.experimental_conditions)}, encoding={repr(self.encoding)}, sequenceParameters={repr(self.sequence_parameters)}, userParameters={repr(self.user_parameters)}, waveformInformation={repr(self.waveform_information)})"
1436
+
1437
+
1438
+ class ImageFlags(enum.IntFlag):
1439
+ IS_NAVIGATION_DATA = 1
1440
+ FIRST_IN_AVERAGE = 16
1441
+ LAST_IN_AVERAGE = 32
1442
+ FIRST_IN_SLICE = 64
1443
+ LAST_IN_SLICE = 128
1444
+ FIRST_IN_CONTRAST = 256
1445
+ LAST_IN_CONTRAST = 512
1446
+ FIRST_IN_PHASE = 1024
1447
+ LAST_IN_PHASE = 2048
1448
+ FIRST_IN_REPETITION = 4096
1449
+ LAST_IN_REPETITION = 8192
1450
+ FIRST_IN_SET = 16384
1451
+ LAST_IN_SET = 32768
1452
+
1453
+ def __eq__(self, other: object) -> bool:
1454
+ return isinstance(other, ImageFlags) and self.value == other.value
1455
+
1456
+ def __hash__(self) -> int:
1457
+ return hash(self.value)
1458
+
1459
+ __str__ = enum.Flag.__str__ # type: ignore
1460
+
1461
+ class ImageType(yardl.OutOfRangeEnum):
1462
+ MAGNITUDE = 1
1463
+ PHASE = 2
1464
+ REAL = 3
1465
+ IMAG = 4
1466
+ COMPLEX = 5
1467
+
1468
+ ImageData = npt.NDArray[Y_NP]
1469
+
1470
+ class ImageMetaData:
1471
+ name: str
1472
+ value: str
1473
+
1474
+ def __init__(self, *,
1475
+ name: str = "",
1476
+ value: str = "",
1477
+ ):
1478
+ self.name = name
1479
+ self.value = value
1480
+
1481
+ def __eq__(self, other: object) -> bool:
1482
+ return (
1483
+ isinstance(other, ImageMetaData)
1484
+ and self.name == other.name
1485
+ and self.value == other.value
1486
+ )
1487
+
1488
+ def __str__(self) -> str:
1489
+ return f"ImageMetaData(name={self.name}, value={self.value})"
1490
+
1491
+ def __repr__(self) -> str:
1492
+ return f"ImageMetaData(name={repr(self.name)}, value={repr(self.value)})"
1493
+
1494
+
1495
+ class Image(typing.Generic[T_NP]):
1496
+ flags: ImageFlags
1497
+ """A bit mask of common attributes applicable to individual images"""
1498
+
1499
+ measurement_uid: yardl.UInt32
1500
+ """Unique ID corresponding to the image"""
1501
+
1502
+ field_of_view: npt.NDArray[np.float32]
1503
+ """Physical size (in mm) in each of the 3 dimensions in the image"""
1504
+
1505
+ position: npt.NDArray[np.float32]
1506
+ """Center of the excited volume, in LPS coordinates relative to isocenter in millimeters"""
1507
+
1508
+ col_dir: npt.NDArray[np.float32]
1509
+ """Directional cosine of readout/frequency encoding"""
1510
+
1511
+ line_dir: npt.NDArray[np.float32]
1512
+ """Directional cosine of phase encoding (2D)"""
1513
+
1514
+ slice_dir: npt.NDArray[np.float32]
1515
+ """Directional cosine of 3D phase encoding direction"""
1516
+
1517
+ patient_table_position: npt.NDArray[np.float32]
1518
+ """Offset position of the patient table, in LPS coordinates"""
1519
+
1520
+ average: typing.Optional[yardl.UInt32]
1521
+ """Signal average"""
1522
+
1523
+ slice: typing.Optional[yardl.UInt32]
1524
+ """Slice number (multi-slice 2D)"""
1525
+
1526
+ contrast: typing.Optional[yardl.UInt32]
1527
+ """Echo number in multi-echo"""
1528
+
1529
+ phase: typing.Optional[yardl.UInt32]
1530
+ """Cardiac phase"""
1531
+
1532
+ repetition: typing.Optional[yardl.UInt32]
1533
+ """Counter in repeated/dynamic acquisitions"""
1534
+
1535
+ set: typing.Optional[yardl.UInt32]
1536
+ """Sets of different preparation, e.g. flow encoding, diffusion weighting"""
1537
+
1538
+ acquisition_time_stamp: typing.Optional[yardl.UInt32]
1539
+ """Clock time stamp (e.g. milliseconds since midnight)"""
1540
+
1541
+ physiology_time_stamp: list[yardl.UInt32]
1542
+ """Time stamps relative to physiological triggering, e.g. ECG, pulse oximetry, respiratory"""
1543
+
1544
+ image_type: ImageType
1545
+ """Interpretation type of the image"""
1546
+
1547
+ image_index: typing.Optional[yardl.UInt32]
1548
+ """Image index number within a series of images, corresponding to DICOM InstanceNumber (0020,0013)"""
1549
+
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
+
1553
+ user_int: list[yardl.Int32]
1554
+ """User-defined int parameters"""
1555
+
1556
+ user_float: list[yardl.Float32]
1557
+ """User-defined float parameters"""
1558
+
1559
+ data: ImageData[T_NP]
1560
+ """Image data array"""
1561
+
1562
+ meta: dict[str, list[str]]
1563
+ """Meta attributes"""
1564
+
1565
+
1566
+ def __init__(self, *,
1567
+ flags: ImageFlags = ImageFlags(0),
1568
+ measurement_uid: yardl.UInt32 = 0,
1569
+ field_of_view: typing.Optional[npt.NDArray[np.float32]] = None,
1570
+ position: typing.Optional[npt.NDArray[np.float32]] = None,
1571
+ col_dir: typing.Optional[npt.NDArray[np.float32]] = None,
1572
+ line_dir: typing.Optional[npt.NDArray[np.float32]] = None,
1573
+ slice_dir: typing.Optional[npt.NDArray[np.float32]] = None,
1574
+ patient_table_position: typing.Optional[npt.NDArray[np.float32]] = None,
1575
+ average: typing.Optional[yardl.UInt32] = None,
1576
+ slice: typing.Optional[yardl.UInt32] = None,
1577
+ contrast: typing.Optional[yardl.UInt32] = None,
1578
+ phase: typing.Optional[yardl.UInt32] = None,
1579
+ repetition: typing.Optional[yardl.UInt32] = None,
1580
+ set: typing.Optional[yardl.UInt32] = None,
1581
+ acquisition_time_stamp: typing.Optional[yardl.UInt32] = None,
1582
+ physiology_time_stamp: typing.Optional[list[yardl.UInt32]] = None,
1583
+ image_type: ImageType,
1584
+ image_index: typing.Optional[yardl.UInt32] = None,
1585
+ image_series_index: typing.Optional[yardl.UInt32] = None,
1586
+ user_int: typing.Optional[list[yardl.Int32]] = None,
1587
+ user_float: typing.Optional[list[yardl.Float32]] = None,
1588
+ data: ImageData[T_NP],
1589
+ meta: typing.Optional[dict[str, list[str]]] = None,
1590
+ ):
1591
+ self.flags = flags
1592
+ self.measurement_uid = measurement_uid
1593
+ self.field_of_view = field_of_view if field_of_view is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1594
+ self.position = position if position is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1595
+ self.col_dir = col_dir if col_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1596
+ self.line_dir = line_dir if line_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1597
+ self.slice_dir = slice_dir if slice_dir is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1598
+ self.patient_table_position = patient_table_position if patient_table_position is not None else np.zeros((3,), dtype=np.dtype(np.float32))
1599
+ self.average = average
1600
+ self.slice = slice
1601
+ self.contrast = contrast
1602
+ self.phase = phase
1603
+ self.repetition = repetition
1604
+ self.set = set
1605
+ self.acquisition_time_stamp = acquisition_time_stamp
1606
+ self.physiology_time_stamp = physiology_time_stamp if physiology_time_stamp is not None else []
1607
+ self.image_type = image_type
1608
+ self.image_index = image_index
1609
+ self.image_series_index = image_series_index
1610
+ self.user_int = user_int if user_int is not None else []
1611
+ self.user_float = user_float if user_float is not None else []
1612
+ self.data = data
1613
+ self.meta = meta if meta is not None else {}
1614
+
1615
+ def channels(self) -> yardl.Size:
1616
+ return self.data.shape[0]
1617
+
1618
+ def slices(self) -> yardl.Size:
1619
+ return self.data.shape[1]
1620
+
1621
+ def rows(self) -> yardl.Size:
1622
+ return self.data.shape[2]
1623
+
1624
+ def cols(self) -> yardl.Size:
1625
+ return self.data.shape[3]
1626
+
1627
+ def __eq__(self, other: object) -> bool:
1628
+ return (
1629
+ isinstance(other, Image)
1630
+ and self.flags == other.flags
1631
+ and self.measurement_uid == other.measurement_uid
1632
+ and yardl.structural_equal(self.field_of_view, other.field_of_view)
1633
+ and yardl.structural_equal(self.position, other.position)
1634
+ and yardl.structural_equal(self.col_dir, other.col_dir)
1635
+ and yardl.structural_equal(self.line_dir, other.line_dir)
1636
+ and yardl.structural_equal(self.slice_dir, other.slice_dir)
1637
+ and yardl.structural_equal(self.patient_table_position, other.patient_table_position)
1638
+ and self.average == other.average
1639
+ and self.slice == other.slice
1640
+ and self.contrast == other.contrast
1641
+ and self.phase == other.phase
1642
+ and self.repetition == other.repetition
1643
+ and self.set == other.set
1644
+ and self.acquisition_time_stamp == other.acquisition_time_stamp
1645
+ and self.physiology_time_stamp == other.physiology_time_stamp
1646
+ and self.image_type == other.image_type
1647
+ and self.image_index == other.image_index
1648
+ and self.image_series_index == other.image_series_index
1649
+ and self.user_int == other.user_int
1650
+ and self.user_float == other.user_float
1651
+ and yardl.structural_equal(self.data, other.data)
1652
+ and self.meta == other.meta
1653
+ )
1654
+
1655
+ def __str__(self) -> str:
1656
+ return f"Image(flags={self.flags}, measurementUid={self.measurement_uid}, fieldOfView={self.field_of_view}, position={self.position}, colDir={self.col_dir}, lineDir={self.line_dir}, sliceDir={self.slice_dir}, patientTablePosition={self.patient_table_position}, average={self.average}, slice={self.slice}, contrast={self.contrast}, phase={self.phase}, repetition={self.repetition}, set={self.set}, acquisitionTimeStamp={self.acquisition_time_stamp}, physiologyTimeStamp={self.physiology_time_stamp}, imageType={self.image_type}, imageIndex={self.image_index}, imageSeriesIndex={self.image_series_index}, userInt={self.user_int}, userFloat={self.user_float}, data={self.data}, meta={self.meta})"
1657
+
1658
+ def __repr__(self) -> str:
1659
+ return f"Image(flags={repr(self.flags)}, measurementUid={repr(self.measurement_uid)}, fieldOfView={repr(self.field_of_view)}, position={repr(self.position)}, colDir={repr(self.col_dir)}, lineDir={repr(self.line_dir)}, sliceDir={repr(self.slice_dir)}, patientTablePosition={repr(self.patient_table_position)}, average={repr(self.average)}, slice={repr(self.slice)}, contrast={repr(self.contrast)}, phase={repr(self.phase)}, repetition={repr(self.repetition)}, set={repr(self.set)}, acquisitionTimeStamp={repr(self.acquisition_time_stamp)}, physiologyTimeStamp={repr(self.physiology_time_stamp)}, imageType={repr(self.image_type)}, imageIndex={repr(self.image_index)}, imageSeriesIndex={repr(self.image_series_index)}, userInt={repr(self.user_int)}, userFloat={repr(self.user_float)}, data={repr(self.data)}, meta={repr(self.meta)})"
1660
+
1661
+
1662
+ WaveformSamples = npt.NDArray[T_NP]
1663
+
1664
+ class Waveform(typing.Generic[T_NP]):
1665
+ flags: yardl.UInt64
1666
+ """Bit field of flags. Currently unused"""
1667
+
1668
+ measurement_uid: yardl.UInt32
1669
+ """Unique ID for this measurement"""
1670
+
1671
+ scan_counter: yardl.UInt32
1672
+ """Number of the acquisition after this waveform"""
1673
+
1674
+ time_stamp: yardl.UInt32
1675
+ """Starting timestamp of this waveform"""
1676
+
1677
+ sample_time_us: yardl.Float32
1678
+ """Time between samples in microseconds"""
1679
+
1680
+ waveform_id: yardl.UInt32
1681
+ """ID matching the waveform in the MRD header"""
1682
+
1683
+ data: WaveformSamples[T_NP]
1684
+ """Waveform sample array"""
1685
+
1686
+
1687
+ def __init__(self, *,
1688
+ flags: yardl.UInt64 = 0,
1689
+ measurement_uid: yardl.UInt32 = 0,
1690
+ scan_counter: yardl.UInt32 = 0,
1691
+ time_stamp: yardl.UInt32 = 0,
1692
+ sample_time_us: yardl.Float32 = 0.0,
1693
+ waveform_id: yardl.UInt32 = 0,
1694
+ data: WaveformSamples[T_NP],
1695
+ ):
1696
+ self.flags = flags
1697
+ self.measurement_uid = measurement_uid
1698
+ self.scan_counter = scan_counter
1699
+ self.time_stamp = time_stamp
1700
+ self.sample_time_us = sample_time_us
1701
+ self.waveform_id = waveform_id
1702
+ self.data = data
1703
+
1704
+ def channels(self) -> yardl.Size:
1705
+ return self.data.shape[0]
1706
+
1707
+ def number_of_samples(self) -> yardl.Size:
1708
+ return self.data.shape[1]
1709
+
1710
+ def __eq__(self, other: object) -> bool:
1711
+ return (
1712
+ isinstance(other, Waveform)
1713
+ and self.flags == other.flags
1714
+ and self.measurement_uid == other.measurement_uid
1715
+ and self.scan_counter == other.scan_counter
1716
+ and self.time_stamp == other.time_stamp
1717
+ and self.sample_time_us == other.sample_time_us
1718
+ and self.waveform_id == other.waveform_id
1719
+ and yardl.structural_equal(self.data, other.data)
1720
+ )
1721
+
1722
+ def __str__(self) -> str:
1723
+ return f"Waveform(flags={self.flags}, measurementUid={self.measurement_uid}, scanCounter={self.scan_counter}, timeStamp={self.time_stamp}, sampleTimeUs={self.sample_time_us}, waveformId={self.waveform_id}, data={self.data})"
1724
+
1725
+ def __repr__(self) -> str:
1726
+ return f"Waveform(flags={repr(self.flags)}, measurementUid={repr(self.measurement_uid)}, scanCounter={repr(self.scan_counter)}, timeStamp={repr(self.time_stamp)}, sampleTimeUs={repr(self.sample_time_us)}, waveformId={repr(self.waveform_id)}, data={repr(self.data)})"
1727
+
1728
+
1729
+ WaveformUint32 = Waveform[np.uint32]
1730
+
1731
+ ImageUint16 = Image[np.uint16]
1732
+
1733
+ ImageInt16 = Image[np.int16]
1734
+
1735
+ ImageUint = Image[np.uint32]
1736
+
1737
+ ImageInt = Image[np.int32]
1738
+
1739
+ ImageFloat = Image[np.float32]
1740
+
1741
+ ImageDouble = Image[np.float64]
1742
+
1743
+ ImageComplexFloat = Image[np.complex64]
1744
+
1745
+ ImageComplexDouble = Image[np.complex128]
1746
+
1747
+ _T = typing.TypeVar('_T')
1748
+
1749
+ class StreamItem:
1750
+ Acquisition: typing.ClassVar[type["StreamItemUnionCase[Acquisition]"]]
1751
+ WaveformUint32: typing.ClassVar[type["StreamItemUnionCase[WaveformUint32]"]]
1752
+ ImageUint16: typing.ClassVar[type["StreamItemUnionCase[ImageUint16]"]]
1753
+ ImageInt16: typing.ClassVar[type["StreamItemUnionCase[ImageInt16]"]]
1754
+ ImageUint: typing.ClassVar[type["StreamItemUnionCase[ImageUint]"]]
1755
+ ImageInt: typing.ClassVar[type["StreamItemUnionCase[ImageInt]"]]
1756
+ ImageFloat: typing.ClassVar[type["StreamItemUnionCase[ImageFloat]"]]
1757
+ ImageDouble: typing.ClassVar[type["StreamItemUnionCase[ImageDouble]"]]
1758
+ ImageComplexFloat: typing.ClassVar[type["StreamItemUnionCase[ImageComplexFloat]"]]
1759
+ ImageComplexDouble: typing.ClassVar[type["StreamItemUnionCase[ImageComplexDouble]"]]
1760
+
1761
+ class StreamItemUnionCase(StreamItem, yardl.UnionCase[_T]):
1762
+ pass
1763
+
1764
+ StreamItem.Acquisition = type("StreamItem.Acquisition", (StreamItemUnionCase,), {"index": 0, "tag": "Acquisition"})
1765
+ StreamItem.WaveformUint32 = type("StreamItem.WaveformUint32", (StreamItemUnionCase,), {"index": 1, "tag": "WaveformUint32"})
1766
+ StreamItem.ImageUint16 = type("StreamItem.ImageUint16", (StreamItemUnionCase,), {"index": 2, "tag": "ImageUint16"})
1767
+ StreamItem.ImageInt16 = type("StreamItem.ImageInt16", (StreamItemUnionCase,), {"index": 3, "tag": "ImageInt16"})
1768
+ StreamItem.ImageUint = type("StreamItem.ImageUint", (StreamItemUnionCase,), {"index": 4, "tag": "ImageUint"})
1769
+ StreamItem.ImageInt = type("StreamItem.ImageInt", (StreamItemUnionCase,), {"index": 5, "tag": "ImageInt"})
1770
+ StreamItem.ImageFloat = type("StreamItem.ImageFloat", (StreamItemUnionCase,), {"index": 6, "tag": "ImageFloat"})
1771
+ StreamItem.ImageDouble = type("StreamItem.ImageDouble", (StreamItemUnionCase,), {"index": 7, "tag": "ImageDouble"})
1772
+ StreamItem.ImageComplexFloat = type("StreamItem.ImageComplexFloat", (StreamItemUnionCase,), {"index": 8, "tag": "ImageComplexFloat"})
1773
+ StreamItem.ImageComplexDouble = type("StreamItem.ImageComplexDouble", (StreamItemUnionCase,), {"index": 9, "tag": "ImageComplexDouble"})
1774
+ del StreamItemUnionCase
1775
+
1776
+ def _mk_get_dtype():
1777
+ dtype_map: dict[typing.Union[type, types.GenericAlias], typing.Union[np.dtype[typing.Any], typing.Callable[[tuple[type, ...]], np.dtype[typing.Any]]]] = {}
1778
+ get_dtype = _dtypes.make_get_dtype_func(dtype_map)
1779
+
1780
+ dtype_map.setdefault(AcquisitionFlags, np.dtype(np.uint64))
1781
+ dtype_map.setdefault(EncodingCounters, np.dtype([('kspace_encode_step_1', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('kspace_encode_step_2', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('average', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('slice', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('contrast', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('phase', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('repetition', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('set', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('segment', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('user', np.dtype(np.object_))], align=True))
1782
+ dtype_map.setdefault(Acquisition, np.dtype([('flags', get_dtype(AcquisitionFlags)), ('idx', get_dtype(EncodingCounters)), ('measurement_uid', np.dtype(np.uint32)), ('scan_counter', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('acquisition_time_stamp', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('physiology_time_stamp', np.dtype(np.object_)), ('channel_order', np.dtype(np.object_)), ('discard_pre', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('discard_post', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('center_sample', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('encoding_space_ref', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('sample_time_us', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.float32))], align=True)), ('position', np.dtype(np.float32), (3,)), ('read_dir', np.dtype(np.float32), (3,)), ('phase_dir', np.dtype(np.float32), (3,)), ('slice_dir', np.dtype(np.float32), (3,)), ('patient_table_position', np.dtype(np.float32), (3,)), ('user_int', np.dtype(np.object_)), ('user_float', np.dtype(np.object_)), ('data', np.dtype(np.object_)), ('trajectory', np.dtype(np.object_))], align=True))
1783
+ dtype_map.setdefault(PatientGender, np.dtype(np.int32))
1784
+ dtype_map.setdefault(SubjectInformationType, np.dtype([('patient_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('patient_weight_kg', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.float32))], align=True)), ('patient_height_m', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.float32))], align=True)), ('patient_id', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('patient_birthdate', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.datetime64))], align=True)), ('patient_gender', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(PatientGender))], align=True))], align=True))
1785
+ dtype_map.setdefault(StudyInformationType, np.dtype([('study_date', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.datetime64))], align=True)), ('study_time', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.timedelta64))], align=True)), ('study_id', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('accession_number', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.int64))], align=True)), ('referring_physician_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('study_description', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('study_instance_uid', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('body_part_examined', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True))], align=True))
1786
+ dtype_map.setdefault(PatientPosition, np.dtype(np.int32))
1787
+ dtype_map.setdefault(ThreeDimensionalFloat, np.dtype([('x', np.dtype(np.float32)), ('y', np.dtype(np.float32)), ('z', np.dtype(np.float32))], align=True))
1788
+ dtype_map.setdefault(MeasurementDependencyType, np.dtype([('dependency_type', np.dtype(np.object_)), ('measurement_id', np.dtype(np.object_))], align=True))
1789
+ dtype_map.setdefault(ReferencedImageSequenceType, np.dtype([('referenced_sop_instance_uid', np.dtype(np.object_))], align=True))
1790
+ dtype_map.setdefault(MeasurementInformationType, np.dtype([('measurement_id', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('series_date', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.datetime64))], align=True)), ('series_time', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.timedelta64))], align=True)), ('patient_position', get_dtype(PatientPosition)), ('relative_table_position', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(ThreeDimensionalFloat))], align=True)), ('initial_series_number', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.int64))], align=True)), ('protocol_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('sequence_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('series_description', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('measurement_dependency', np.dtype(np.object_)), ('series_instance_uid_root', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('frame_of_reference_uid', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('referenced_image_sequence', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(ReferencedImageSequenceType))], align=True))], align=True))
1791
+ dtype_map.setdefault(CoilLabelType, np.dtype([('coil_number', np.dtype(np.uint32)), ('coil_name', np.dtype(np.object_))], align=True))
1792
+ dtype_map.setdefault(AcquisitionSystemInformationType, np.dtype([('system_vendor', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('system_model', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('system_field_strength_t', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.float32))], align=True)), ('relative_receiver_noise_bandwidth', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.float32))], align=True)), ('receiver_channels', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('coil_label', np.dtype(np.object_)), ('institution_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('station_name', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('device_id', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('device_serial_number', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True))], align=True))
1793
+ dtype_map.setdefault(ExperimentalConditionsType, np.dtype([('h1resonance_frequency_hz', np.dtype(np.int64))], align=True))
1794
+ dtype_map.setdefault(MatrixSizeType, np.dtype([('x', np.dtype(np.uint32)), ('y', np.dtype(np.uint32)), ('z', np.dtype(np.uint32))], align=True))
1795
+ dtype_map.setdefault(FieldOfViewMm, np.dtype([('x', np.dtype(np.float32)), ('y', np.dtype(np.float32)), ('z', np.dtype(np.float32))], align=True))
1796
+ dtype_map.setdefault(EncodingSpaceType, np.dtype([('matrix_size', get_dtype(MatrixSizeType)), ('field_of_view_mm', get_dtype(FieldOfViewMm))], align=True))
1797
+ dtype_map.setdefault(LimitType, np.dtype([('minimum', np.dtype(np.uint32)), ('maximum', np.dtype(np.uint32)), ('center', np.dtype(np.uint32))], align=True))
1798
+ dtype_map.setdefault(EncodingLimitsType, np.dtype([('kspace_encoding_step_0', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('kspace_encoding_step_1', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('kspace_encoding_step_2', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('average', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('slice', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('contrast', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('phase', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('repetition', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('set', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('segment', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_0', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_1', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_2', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_3', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_4', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_5', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_6', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True)), ('user_7', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(LimitType))], align=True))], align=True))
1799
+ dtype_map.setdefault(Trajectory, np.dtype(np.int32))
1800
+ dtype_map.setdefault(UserParameterLongType, np.dtype([('name', np.dtype(np.object_)), ('value', np.dtype(np.int64))], align=True))
1801
+ dtype_map.setdefault(UserParameterDoubleType, np.dtype([('name', np.dtype(np.object_)), ('value', np.dtype(np.float64))], align=True))
1802
+ dtype_map.setdefault(UserParameterStringType, np.dtype([('name', np.dtype(np.object_)), ('value', np.dtype(np.object_))], align=True))
1803
+ dtype_map.setdefault(TrajectoryDescriptionType, np.dtype([('identifier', np.dtype(np.object_)), ('user_parameter_long', np.dtype(np.object_)), ('user_parameter_double', np.dtype(np.object_)), ('user_parameter_string', np.dtype(np.object_)), ('comment', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True))], align=True))
1804
+ dtype_map.setdefault(AccelerationFactorType, np.dtype([('kspace_encoding_step_1', np.dtype(np.uint32)), ('kspace_encoding_step_2', np.dtype(np.uint32))], align=True))
1805
+ dtype_map.setdefault(CalibrationMode, np.dtype(np.int32))
1806
+ dtype_map.setdefault(InterleavingDimension, np.dtype(np.int32))
1807
+ dtype_map.setdefault(MultibandSpacingType, np.dtype([('d_z', np.dtype(np.object_))], align=True))
1808
+ dtype_map.setdefault(Calibration, np.dtype(np.int32))
1809
+ dtype_map.setdefault(MultibandType, np.dtype([('spacing', np.dtype(np.object_)), ('delta_kz', np.dtype(np.float32)), ('multiband_factor', np.dtype(np.uint32)), ('calibration', get_dtype(Calibration)), ('calibration_encoding', np.dtype(np.uint64))], align=True))
1810
+ dtype_map.setdefault(ParallelImagingType, np.dtype([('acceleration_factor', get_dtype(AccelerationFactorType)), ('calibration_mode', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(CalibrationMode))], align=True)), ('interleaving_dimension', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(InterleavingDimension))], align=True)), ('multiband', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(MultibandType))], align=True))], align=True))
1811
+ dtype_map.setdefault(EncodingType, np.dtype([('encoded_space', get_dtype(EncodingSpaceType)), ('recon_space', get_dtype(EncodingSpaceType)), ('encoding_limits', get_dtype(EncodingLimitsType)), ('trajectory', get_dtype(Trajectory)), ('trajectory_description', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(TrajectoryDescriptionType))], align=True)), ('parallel_imaging', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(ParallelImagingType))], align=True)), ('echo_train_length', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.int64))], align=True))], align=True))
1812
+ dtype_map.setdefault(DiffusionDimension, np.dtype(np.int32))
1813
+ dtype_map.setdefault(GradientDirectionType, np.dtype([('rl', np.dtype(np.float32)), ('ap', np.dtype(np.float32)), ('fh', np.dtype(np.float32))], align=True))
1814
+ dtype_map.setdefault(DiffusionType, np.dtype([('gradient_direction', get_dtype(GradientDirectionType)), ('bvalue', np.dtype(np.float32))], align=True))
1815
+ dtype_map.setdefault(SequenceParametersType, np.dtype([('t_r', np.dtype(np.object_)), ('t_e', np.dtype(np.object_)), ('t_i', np.dtype(np.object_)), ('flip_angle_deg', np.dtype(np.object_)), ('sequence_type', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True)), ('echo_spacing', np.dtype(np.object_)), ('diffusion_dimension', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(DiffusionDimension))], align=True)), ('diffusion', np.dtype(np.object_)), ('diffusion_scheme', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.object_))], align=True))], align=True))
1816
+ dtype_map.setdefault(UserParameterBase64Type, np.dtype([('name', np.dtype(np.object_)), ('value', np.dtype(np.object_))], align=True))
1817
+ dtype_map.setdefault(UserParametersType, np.dtype([('user_parameter_long', np.dtype(np.object_)), ('user_parameter_double', np.dtype(np.object_)), ('user_parameter_string', np.dtype(np.object_)), ('user_parameter_base64', np.dtype(np.object_))], align=True))
1818
+ dtype_map.setdefault(WaveformType, np.dtype(np.int32))
1819
+ dtype_map.setdefault(WaveformInformationType, np.dtype([('waveform_name', np.dtype(np.object_)), ('waveform_type', get_dtype(WaveformType)), ('user_parameters', get_dtype(UserParametersType))], align=True))
1820
+ dtype_map.setdefault(Header, np.dtype([('version', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.int64))], align=True)), ('subject_information', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(SubjectInformationType))], align=True)), ('study_information', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(StudyInformationType))], align=True)), ('measurement_information', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(MeasurementInformationType))], align=True)), ('acquisition_system_information', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(AcquisitionSystemInformationType))], align=True)), ('experimental_conditions', get_dtype(ExperimentalConditionsType)), ('encoding', np.dtype(np.object_)), ('sequence_parameters', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(SequenceParametersType))], align=True)), ('user_parameters', np.dtype([('has_value', np.dtype(np.bool_)), ('value', get_dtype(UserParametersType))], align=True)), ('waveform_information', np.dtype(np.object_))], align=True))
1821
+ dtype_map.setdefault(ImageFlags, np.dtype(np.uint64))
1822
+ dtype_map.setdefault(ImageType, np.dtype(np.int32))
1823
+ dtype_map.setdefault(ImageMetaData, np.dtype([('name', np.dtype(np.object_)), ('value', np.dtype(np.object_))], align=True))
1824
+ dtype_map.setdefault(Image, lambda type_args: np.dtype([('flags', get_dtype(ImageFlags)), ('measurement_uid', np.dtype(np.uint32)), ('field_of_view', np.dtype(np.float32), (3,)), ('position', np.dtype(np.float32), (3,)), ('col_dir', np.dtype(np.float32), (3,)), ('line_dir', np.dtype(np.float32), (3,)), ('slice_dir', np.dtype(np.float32), (3,)), ('patient_table_position', np.dtype(np.float32), (3,)), ('average', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('slice', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('contrast', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('phase', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('repetition', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('set', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('acquisition_time_stamp', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('physiology_time_stamp', np.dtype(np.object_)), ('image_type', get_dtype(ImageType)), ('image_index', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('image_series_index', np.dtype([('has_value', np.dtype(np.bool_)), ('value', np.dtype(np.uint32))], align=True)), ('user_int', np.dtype(np.object_)), ('user_float', np.dtype(np.object_)), ('data', np.dtype(np.object_)), ('meta', np.dtype(np.object_))], align=True))
1825
+ dtype_map.setdefault(Waveform, lambda type_args: np.dtype([('flags', np.dtype(np.uint64)), ('measurement_uid', np.dtype(np.uint32)), ('scan_counter', np.dtype(np.uint32)), ('time_stamp', np.dtype(np.uint32)), ('sample_time_us', np.dtype(np.float32)), ('waveform_id', np.dtype(np.uint32)), ('data', np.dtype(np.object_))], align=True))
1826
+ dtype_map.setdefault(WaveformUint32, get_dtype(types.GenericAlias(Waveform, (yardl.UInt32,))))
1827
+ dtype_map.setdefault(ImageUint16, get_dtype(types.GenericAlias(Image, (yardl.UInt16,))))
1828
+ dtype_map.setdefault(ImageInt16, get_dtype(types.GenericAlias(Image, (yardl.Int16,))))
1829
+ dtype_map.setdefault(ImageUint, get_dtype(types.GenericAlias(Image, (yardl.UInt32,))))
1830
+ dtype_map.setdefault(ImageInt, get_dtype(types.GenericAlias(Image, (yardl.Int32,))))
1831
+ dtype_map.setdefault(ImageFloat, get_dtype(types.GenericAlias(Image, (yardl.Float32,))))
1832
+ dtype_map.setdefault(ImageDouble, get_dtype(types.GenericAlias(Image, (yardl.Float64,))))
1833
+ dtype_map.setdefault(ImageComplexFloat, get_dtype(types.GenericAlias(Image, (yardl.ComplexFloat,))))
1834
+ dtype_map.setdefault(ImageComplexDouble, get_dtype(types.GenericAlias(Image, (yardl.ComplexDouble,))))
1835
+ dtype_map.setdefault(StreamItem, np.dtype(np.object_))
1836
+
1837
+ return get_dtype
1838
+
1839
+ get_dtype = _mk_get_dtype()
1840
+