Debian Codegraph @

doc/mrd_raw_data.md

raw
1 # Raw Acquisition Data
2 Raw k-space data is stored in MRD format as individual readout acquisitions. Each readout contains the complex raw data for all channels, a fixed AcquisitionHeader, and optionally corresponding k-space trajectory information. Most datasets will be comprised of many acquisitions, each stored indvidiually with its own [AcquisitionHeader](AcquisitionHeader), optional [trajectory](Trajectory), and [raw data](RawData).
3
4 (AcquisitionHeader)=
5 ## AcquisitionHeader
6 An MRD AcquisitionHeader accompanies each readout containing metadata common to most data. It is of a fixed size and thus fields cannot be added, removed, or otherwise repurposed. It contains the following information:
7 | Field | Description | Type | Offset |
8 | -- | -- | -- | -- |
9 | version | Major version number (currently 1) | uint16 | 0 bytes |
10 | flags | A bit mask of common attributes applicable to individual acquisition readouts | uint64 | 2 bytes |
11 | measurement_uid | Unique ID corresponding to the readout | uint32 | 10 bytes |
12 | scan_counter | Zero-indexed incrementing counter for readouts | uint32 | 14 bytes |
13 | acquisition_time_stamp | Clock time stamp (e.g. milliseconds since midnight) | uint32 | 18 bytes |
14 | physiology_time_stamp | Time stamps relative to physiological triggering, e.g. ECG, pulse oximetry, respiratory. Multiplicity defined by ISMRMRD_PHYS_STAMPS (currently 3) | uint32 (x3) | 22 bytes |
15 | number_of_samples | Number of digitized readout samples | uint16 | 34 bytes |
16 | available_channels | Number of possible receiver coils (channels) | uint16 | 36 bytes |
17 | active_channels | Number of active receiver coils | uint16 | 38 bytes |
18 | channel_mask | Bit mask indicating active coils (64\*16 = 1024 bits) | uint64 (x16) | 40 bytes |
19 | discard_pre | Number of readout samples to be discarded at the beginning (e.g. if the ADC is active during gradient events) | uint16 | 168 bytes |
20 | discard_post | Number of readout samples to be discarded at the end (e.g. if the ADC is active during gradient events) | uint16 | 170 bytes |
21 | center_sample | Index of the readout sample corresponing to k-space center (zero indexed) | uint16 | 172 bytes |
22 | encoding_space_ref | Indexed reference to the encoding spaces enumerated in the MRD (xml) header | uint16 | 174 bytes |
23 | trajectory_dimensions | Dimensionality of the k-space trajectory vector (e.g. 2 for 2D radial (k<sub>x</sub>, k<sub>y</sub>), 0 for no trajectory data) | uint16 | 176 bytes |
24 | sample_time_us | Readout bandwidth, as time between samples in microseconds | float (32 bit) | 178 bytes |
25 | position | Center of the excited volume, in (left, posterior, superior) (LPS) coordinates relative to isocenter in millimeters | float (32 bit) (x3) | 182 bytes |
26 | read_dir | Directional cosine of readout/frequency encoding | float (32 bit) (x3) | 194 bytes |
27 | phase_dir | Directional cosine of phase encoding (2D) | float (32 bit) (x3) | 206 bytes |
28 | slice_dir | Directional cosine of slice normal, i.e. cross-product of read_dir and phase_dir | float (32 bit) (x3) | 218 bytes |
29 | patient_table_position | Offset position of the patient table, in LPS coordinates | float (32 bit) (x3) | 230 bytes |
30 | idx | Encoding loop counters, as defined [below](EncodingCounters) | uint16 (x17) | 242 bytes |
31 | user_int | User-defined integer parameters, multiplicity defined by ISMRMRD_USER_INTS (currently 8) | int32 (x8) | 276 bytes |
32 | user_float | User-defined float parameters, multiplicity defined by ISMRMRD_USER_FLOATS (currently 8) | float (32 bit) (x8) | 308 bytes |
33 | | **Total** | **340 bytes** | |
34
35 A reference implementation for serialization/deserialization of the AcquisitionHeader can be found in [serialization.cpp](../libsrc/serialization.cpp).
36
37 (EncodingCounters)=
38 ### MRD EncodingCounters
39 MR acquisitions often loop through a set of counters (e.g. phase encodes) in a complete experiment. The following encoding counters are referred to by the ``idx`` field in the AcquisitionHeader.
40
41 | Field | Format | Description | Type | Offset |
42 | -- | -- | -- | -- | -- |
43 | kspace_encode_step_1 | uint16 | Phase encoding line | uint16 | 0 bytes |
44 | kspace_encode_step_2 | uint16 | Partition encoding | uint16 | 2 bytes |
45 | average | uint16 | Signal average | uint16 | 4 bytes |
46 | slice | uint16 | Slice number (multi-slice 2D) | uint16 | 6 bytes |
47 | contrast | uint16 | Echo number in multi-echo | uint16 | 8 bytes |
48 | phase | uint16 | Cardiac phase | uint16 | 10 bytes |
49 | repetition | uint16 | Counter in repeated/dynamic acquisitions | uint16 | 12 bytes |
50 | set | uint16 | Sets of different preparation, e.g. flow encoding, diffusion weighting | uint16 | 14 bytes |
51 | segment | uint16 | Counter for segmented acquisitions | uint16 | 16 bytes |
52 | user | uint16 (x8) | User defined counters, multiplicity defined by ISMRMRD_USER_INTS (currently 8) | uint16 (x8) | 18 bytes |
53 | | | **Total** | **34 bytes** | |
54
55 A reference implementation for serialization/deserialization of the EncodingCounters can be found in [serialization.cpp](../libsrc/serialization.cpp).
56
57 ### MRD AcquisitionFlags
58 The ``flags`` field in the AcquisitionHeader is a 64 bit mask that can be used to indicate specific attributes of the corresponding readout. One usage of these flags is to trigger the processing of data when a condition is met, e.g. the last readout for the current slice. The following flags are defined in the ``ISMRMRD_AcquisitionFlags`` enum of [ismrmrd.h](../include/ismrmrd/ismrmrd.h):
59 ```
60 ISMRMRD_ACQ_FIRST_IN_ENCODE_STEP1 = 1,
61 ISMRMRD_ACQ_LAST_IN_ENCODE_STEP1 = 2,
62 ISMRMRD_ACQ_FIRST_IN_ENCODE_STEP2 = 3,
63 ISMRMRD_ACQ_LAST_IN_ENCODE_STEP2 = 4,
64 ISMRMRD_ACQ_FIRST_IN_AVERAGE = 5,
65 ISMRMRD_ACQ_LAST_IN_AVERAGE = 6,
66 ISMRMRD_ACQ_FIRST_IN_SLICE = 7,
67 ISMRMRD_ACQ_LAST_IN_SLICE = 8,
68 ISMRMRD_ACQ_FIRST_IN_CONTRAST = 9,
69 ISMRMRD_ACQ_LAST_IN_CONTRAST = 10,
70 ISMRMRD_ACQ_FIRST_IN_PHASE = 11,
71 ISMRMRD_ACQ_LAST_IN_PHASE = 12,
72 ISMRMRD_ACQ_FIRST_IN_REPETITION = 13,
73 ISMRMRD_ACQ_LAST_IN_REPETITION = 14,
74 ISMRMRD_ACQ_FIRST_IN_SET = 15,
75 ISMRMRD_ACQ_LAST_IN_SET = 16,
76 ISMRMRD_ACQ_FIRST_IN_SEGMENT = 17,
77 ISMRMRD_ACQ_LAST_IN_SEGMENT = 18,
78 ISMRMRD_ACQ_IS_NOISE_MEASUREMENT = 19,
79 ISMRMRD_ACQ_IS_PARALLEL_CALIBRATION = 20,
80 ISMRMRD_ACQ_IS_PARALLEL_CALIBRATION_AND_IMAGING = 21,
81 ISMRMRD_ACQ_IS_REVERSE = 22,
82 ISMRMRD_ACQ_IS_NAVIGATION_DATA = 23,
83 ISMRMRD_ACQ_IS_PHASECORR_DATA = 24,
84 ISMRMRD_ACQ_LAST_IN_MEASUREMENT = 25,
85 ISMRMRD_ACQ_IS_HPFEEDBACK_DATA = 26,
86 ISMRMRD_ACQ_IS_DUMMYSCAN_DATA = 27,
87 ISMRMRD_ACQ_IS_RTFEEDBACK_DATA = 28,
88 ISMRMRD_ACQ_IS_SURFACECOILCORRECTIONSCAN_DATA = 29,
89 ISMRMRD_ACQ_COMPRESSION1 = 53,
90 ISMRMRD_ACQ_COMPRESSION2 = 54,
91 ISMRMRD_ACQ_COMPRESSION3 = 55,
92 ISMRMRD_ACQ_COMPRESSION4 = 56,
93 ISMRMRD_ACQ_USER1 = 57,
94 ISMRMRD_ACQ_USER2 = 58,
95 ISMRMRD_ACQ_USER3 = 59,
96 ISMRMRD_ACQ_USER4 = 60,
97 ISMRMRD_ACQ_USER5 = 61,
98 ISMRMRD_ACQ_USER6 = 62,
99 ISMRMRD_ACQ_USER7 = 63,
100 ISMRMRD_ACQ_USER8 = 64
101 ```
102 (Trajectory)=
103 ## k-space Trajectory
104 <style>
105 .smalltable td {
106 font-size: 80%;
107 border-collapse: collapse;
108 border-spacing: 0;
109 border-width: 0;
110 padding: 3px;
111 border: 1px solid lightgray
112 }
113 </style>
114
115 k-space trajectory information is optionally included with each readout, with dimensionality specified by the ``trajectory_dimensions`` field in the AcquisitionHeader. Common values are ``2`` for 2D radial (k<sub>x</sub>, k<sub>y</sub>), ``3`` for 3D radial (k<sub>x</sub>, k<sub>y</sub>, k<sub>z</sub>). Trajectory information is omitted if ``trajectory_dimensions`` is set to ``0``.
116
117 Trajectory data is organized by looping through the dimensions first then the samples:
118 - For 2D trajectory data:
119 <table class="smalltable">
120 <tr>
121 <td style="text-align: center" colspan="2">Sample 1</td>
122 <td style="text-align: center" colspan="2">Sample 2</td>
123 <td style="text-align: center" rowspan="2">...</td>
124 <td style="text-align: center" colspan="2">Sample n</td>
125 </tr>
126 <tr>
127 <td style="text-align: center">k<sub>x</sub></td>
128 <td style="text-align: center">k<sub>y</sub></td>
129 <td style="text-align: center">k<sub>x</sub></td>
130 <td style="text-align: center">k<sub>y</sub></td>
131 <td style="text-align: center">k<sub>x</sub></td>
132 <td style="text-align: center">k<sub>y</sub></td>
133 </tr>
134 </table>
135
136 - For 3D trajectory data:
137 <table class="smalltable">
138 <tr>
139 <td style="text-align: center" colspan="3">Sample 1</td>
140 <td style="text-align: center" colspan="3">Sample 2</td>
141 <td style="text-align: center" rowspan="2">...</td>
142 <td style="text-align: center" colspan="3">Sample n</td>
143 </tr>
144 <tr>
145 <td style="text-align: center">k<sub>x</sub></td>
146 <td style="text-align: center">k<sub>y</sub></td>
147 <td style="text-align: center">k<sub>z</sub></td>
148 <td style="text-align: center">k<sub>x</sub></td>
149 <td style="text-align: center">k<sub>y</sub></td>
150 <td style="text-align: center">k<sub>z</sub></td>
151 <td style="text-align: center">k<sub>x</sub></td>
152 <td style="text-align: center">k<sub>y</sub></td>
153 <td style="text-align: center">k<sub>z</sub></td>
154 </tr>
155 </table>
156
157 (RawData)=
158 ## Raw Data
159 MR acquisition raw data are stored as complex valued floats. Data from all receiver channels are included in a single readout object. Data is organized by looping through real/imaginary data, samples, then channels:
160
161 <table class="smalltable">
162 <tr>
163 <td style="text-align: center" colspan="6">Channel 1</td>
164 <td style="text-align: center" colspan="6">Channel 2</td>
165 <td style="text-align: center" rowspan="3">...</td>
166 <td style="text-align: center" colspan="6">Channel n</td>
167 </tr>
168 <tr>
169 <td style="text-align: center" colspan="2">Sample 1</td>
170 <td style="text-align: center" colspan="2">...</td>
171 <td style="text-align: center" colspan="2">Sample n</td>
172 <td style="text-align: center" colspan="2">Sample 1</td>
173 <td style="text-align: center" colspan="2">...</td>
174 <td style="text-align: center" colspan="2">Sample n</td>
175 <td style="text-align: center" colspan="2">Sample 1</td>
176 <td style="text-align: center" colspan="2">...</td>
177 <td style="text-align: center" colspan="2">Sample n</td>
178 </tr>
179 <tr>
180 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
181 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
182 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
183 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
184 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
185 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
186 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
187 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
188 <td style="text-align: center">Re</td> <td style="text-align: center">Im</td>
189 </tr>
190 </table>