# Physiological Waveforms
Physiological monitoring data such as electrocardiograms, pulse oximetry, or external triggering may accompany MR acquisitions. These physiological data are stored in MRD as a combination of a fixed [WaveformHeader](WaveformHeader) and the [raw physiological waveforms](WaveformData).
(WaveformHeader)=
## WaveformHeader
The WaveformHeader contains metadata associated with a set of waveform data and has the following fields:
| Field | Description | Type | Offset |
| -- | -- | -- | -- |
| version | Version number | uint16_t | 0 bytes |
| flags | Bit field with flags | uint64_t | 8 bytes (not 2!) |
| measurement_uid | Unique ID for this measurement | uint32_t | 16 bytes |
| scan_counter | Number of the acquisition after this waveform | uint32_t | 20 bytes |
| time_stamp | Starting timestamp of this waveform | uint32_t | 24 bytes |
| number_of_samples | Number of samples acquired | uint16_t | 28 bytes |
| channels | Active channels | uint16_t | 30 bytes |
| sample_time_us | Time between samples in microseconds | float | 32 bytes |
| waveform_id | [ID matching types specified in XML header](WaveformIDs) | uint16_t | 36 bytes |
| | **Total** | **40 bytes (2 bytes padding at the end!)** | |
A reference implementation for serialization/deserialization of the WaveformHeader can be found in [serialization.cpp](../libsrc/serialization.cpp).
(WaveformIDs)=
### Waveform IDs
The ``waveform_id`` field in the WaveformHeader describes the type of physiological data stored. The following ID numbers are standardized:
| Value | Name |
| -- | -- |
| 0 | ECG |
| 1 | Pulse Oximetry |
| 2 | Respiratory |
| 3 | External Waveform 1 |
| 4 | External Waveform 2 |
For each type of ``waveform_id`` included in the dataset, a corresponding ``WaveformInformation`` entry is found in the MRD header to describe the data interpretation. For example:
```xml
| Channel 1 | Channel 2 | ... | Channel n | ||||||
| w1 | ... | wn | w1 | ... | wn | w1 | ... | wn | |