Message Types
ID 1: MRD_MESSAGE_CONFIG_FILE
ID |
Config File Name |
---|---|
2 bytes |
1024 bytes |
unsigned short |
char |
This message type is used to send the file name of a configuration file (local on the server file system) to be used during reconstruction. The file name must not exceed 1023 characters and is formatted as a null-terminated, UTF-8 encoded char string.
ID 2: MRD_MESSAGE_CONFIG_TEXT
ID |
Length |
Config Text |
---|---|---|
2 bytes |
4 bytes |
length * 1 byte |
unsigned short |
uint32_t |
char |
Alternatively, the text contents of a configuration file can be sent directly via the data stream. The length is sent as an uint32_t. Configuration text is sent as a UTF-8 encoded char string.
In addition to specifying a configuration “preset” to be executed on the server, it is often desirable to modify specific parameters of the configuration, such as filter strength or the toggling of intermediate outputs for debugging purposes. While individual parameters are specific to a given pipeline and server, the format of this configuration is standardized to enable interoperable communications between various clients and servers.
ID 3: MRD_MESSAGE_HEADER
ID |
Length |
XML Header Text |
---|---|---|
2 bytes |
4 bytes |
length * 1 byte |
unsigned short |
uint32_t |
char |
Metadata for MRD datasets are stored in a flexible XML formatted MRD header. The header length is sent as an uint32_t and the text is sent as a UTF-8 encoded char string.
ID 4: MRD_MESSAGE_CLOSE
ID |
---|
2 bytes |
unsigned short |
This message type consists only of an ID with no following data. It is used to indicate that all data related to an acquisition/reconstruction has been sent. The client will send this message after sending the last data (raw, image, or waveform) message. The server will also send this message after sending the last data (raw, image, or waveform) message back to the client.
ID 5: MRD_MESSAGE_TEXT
ID |
Length |
Text |
---|---|---|
2 bytes |
4 bytes |
length * 1 byte |
unsigned short |
uint32_t |
char |
Informational (logging) text can be sent using this message type, typically from the reconstruction side to the acquisition/client side. The length of message text is sent as an uint32_t while the text is sent as a UTF-8 encoded char string. These messages are optional and their timing is not guaranteed.
ID 1008: MRD_MESSAGE_ACQUISITION
ID |
Fixed Raw Data Header |
Trajectory |
Raw Data |
---|---|---|---|
2 bytes |
340 bytes |
number_of_samples * trajectory_dimensions * 4 bytes |
number_of_channels * number_of_samples * 8 bytes |
unsigned short |
mixed |
float |
float |
This message type is used to send raw (k-space) acquisition data. A separate message is sent for each readout. A fixed AcquisitionHeader contains metadata such as encoding loop counters. Three fields of the data header must be parsed in order to read the rest of the message:
trajectory_dimensions: defines the number of dimensions in the k-space trajectory data component. For 2D acquisitions (kx, ky), this is set to 2, while for 3D acquisitions (kx, ky, kz), this is set to 3. If set to 0, the trajectory component is omitted.
number_of_samples: number of readout samples.
active_channels: number of channels for which raw data is acquired.
Trajectory data is organized by looping through the dimensions first then the samples:
For 2D trajectory data:
Sample 1 Sample 2 ... Sample n kx ky kx ky kx ky For 3D trajectory data:
Sample 1 Sample 2 ... Sample n kx ky kz kx ky kz kx ky kz
Raw data is organized by looping through real/imaginary data, samples, then channels:
Channel 1 | Channel 2 | ... | Channel n | |||||||||||||||
Sample 1 | ... | Sample n | Sample 1 | ... | Sample n | Sample 1 | ... | Sample n | ||||||||||
Re | Im | Re | Im | Re | Im | Re | Im | Re | Im | Re | Im | Re | Im | Re | Im | Re | Im |
ID 1022: MRD_MESSAGE_IMAGE
ID |
Fixed Image Header |
Attribute Length |
Attribute Data |
Image Data |
---|---|---|---|---|
2 bytes |
198 bytes |
8 bytes |
length * 1 byte |
matrix_size[0] * matrix_size[1] * matrix_size[2] * channels * sizeof(data_type) |
unsigned short |
mixed |
uint_64 |
char |
data_type |
Image data is sent using this message type. The fixed image header contains metadata including fields such as the ImageType (magnitude, phase, etc.) and indices such as slice and repetition number. It is defined by the ImageHeader struct. Within this header, there are 3 fields that must be interpreted to parse the rest of the message:
matrix_size: This 3 element array indicates the size of each dimension of the image data.
channels: This value indicates the number of (receive) channels for which image data is sent
data_type: This value is an MRD_DataTypes enum that indicates the type of data sent. The following types are supported:
Value
Name
Type
Size
1
MRD_USHORT
uint16_t
2 bytes
2
MRD_SHORT
int16_t
2 bytes
3
MRD_UINT
uint32_t
4 bytes
4
MRD_INT
int32_t
4 bytes
5
MRD_FLOAT
float
4 bytes
6
MRD_DOUBLE
double
8 bytes
7
MRD_CXFLOAT
complex float
2 * 4 bytes
8
MRD_CXDOUBLE
complex double
2 * 8 bytes
Attributes are used to declare additional image metadata that is not present in the fixed image header. In general, this data is sent as a UTF-8 encoded char string (not null-terminated), with the length sent first as an uint_64 (not uint_32!). These are interpreted as an XML formatted set of image MetaAttributes.
Image data is organized by looping through matrix_size[0]
, matrix_size[1]
, matrix_size[2]
, then channels
. For example, 2D image data would be formatted as:
Channel 1 | ... | Channel n | ||||||||||||||||
y1 | ... | yn | y1 | ... | yn | |||||||||||||
x1 | ... | xn | x1 | ... | xn | x1 | ... | xn | x1 | ... | xn | x1 | ... | xn | x1 | ... | xn |
ID 1026: MRD_MESSAGE_WAVEFORM
ID |
Fixed Waveform Header |
Waveform Data |
---|---|---|
2 bytes |
40 bytes |
channels * number of samples * bytes |
unsigned short |
mixed |
uint32_t |
This message type is used to send arbitrary waveform data (e.g. physio signals, gradient waveforms, etc.). The fixed waveform data header contains metadata as defined by the WaveformHeader.
The channels
and number_of_samples
members fields must be parsed in order to read the rest of the message. Waveform data is sent as an uint32_t array, ordered by looping through samples and then through channels:
Channel 1 | Channel 2 | ... | Channel n | ||||||
w1 | ... | wn | w1 | ... | wn | w1 | ... | wn |