ISMRMRD
ISMRM Raw Data Format
Toggle main menu visibility
Loading...
Searching...
No Matches
ismrmrd-1.14.2
include
ismrmrd
waveform.h
1
//
2
// Created by dch on 26/02/18.
3
//
4
5
// clang-format off
6
7
#ifndef ISMRMRD_WAVEFORM_H
8
#define ISMRMRD_WAVEFORM_H
9
10
#if __cplusplus > 199711L
11
#include <type_traits>
12
#endif
13
14
#include "export.h"
15
#ifdef __cplusplus
16
#include "cpp98.h"
17
#include <cstddef>
18
#include <stdint.h>
19
namespace
ISMRMRD {
20
extern
"C"
{
21
#else
22
#include <stdint.h>
23
#endif
24
25
// Note: This header does not use 2-byte packing like the rest of the ISMRMRD
26
typedef
struct
ISMRMRD_WaveformHeader
27
{
28
uint16_t
version
;
30
uint64_t
flags
;
32
uint32_t
measurement_uid
;
34
uint32_t
scan_counter
;
36
uint32_t
time_stamp
;
38
uint16_t
number_of_samples
;
40
uint16_t
channels
;
42
float
sample_time_us
;
44
uint16_t
waveform_id
;
46
}
ISMRMRD_WaveformHeader
;
47
48
49
#if __cplusplus > 199711L
// Static assert requires C++11
50
// Check size and offsets of WaveformHeader
51
static_assert
(
sizeof
(
ISMRMRD_WaveformHeader
) == 40,
"ISMRMRD_WaveformHeader is not 40 bytes"
);
52
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, version) == 0,
"ISMRMRD WaveformHeader version offset is not correct"
);
53
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, flags) == 8,
"ISMRMRD WaveformHeader flags offset is not correct"
);
54
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, measurement_uid) == 16,
"ISMRMRD WaveformHeader measurement_uid offset is not correct"
);
55
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, scan_counter) == 20,
"ISMRMRD WaveformHeader scan_counter offset is not correct"
);
56
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, time_stamp) == 24,
"ISMRMRD WaveformHeader time_stamp offset is not correct"
);
57
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, number_of_samples) == 28,
"ISMRMRD WaveformHeader number_of_samples offset is not correct"
);
58
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, channels) == 30,
"ISMRMRD WaveformHeader channels offset is not correct"
);
59
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, sample_time_us) == 32,
"ISMRMRD WaveformHeader sample_time_us offset is not correct"
);
60
static_assert
(offsetof(
ISMRMRD_WaveformHeader
, waveform_id) == 36,
"ISMRMRD WaveformHeader waveform_id offset is not correct"
);
61
#endif
62
63
typedef
struct
ISMRMRD_Waveform
64
{
65
ISMRMRD_WaveformHeader
head;
66
uint32_t *data;
67
}
ISMRMRD_Waveform
;
68
69
70
EXPORTISMRMRD
int
ismrmrd_make_consistent_waveform(
ISMRMRD_Waveform
* wav);
71
EXPORTISMRMRD
int
ismrmrd_size_of_waveform_data(
const
ISMRMRD_Waveform
* wav);
72
EXPORTISMRMRD
ISMRMRD_Waveform
* ismrmrd_create_waveform();
73
EXPORTISMRMRD
int
ismrmrd_free_waveform(
ISMRMRD_Waveform
*);
74
EXPORTISMRMRD
int
ismrmrd_init_waveform(
ISMRMRD_Waveform
*);
75
EXPORTISMRMRD
int
ismrmrd_init_waveformheader(
ISMRMRD_WaveformHeader
* header);
76
EXPORTISMRMRD
int
ismrmrd_copy_waveform(
ISMRMRD_Waveform
* dest,
const
ISMRMRD_Waveform
* src);
77
78
#ifdef __cplusplus
79
}
80
struct
EXPORTISMRMRD
WaveformHeader
:
public
ISMRMRD_WaveformHeader
{
81
82
// Flag methods
83
bool
isFlagSet(
const
uint64_t val);
84
void
setFlag(
const
uint64_t val);
85
void
clearFlag(
const
uint64_t val);
86
void
clearAllFlags();
87
88
};
89
90
#if __cplusplus > 199711L
// Static assert and is_standard_layout requires C++11
91
// check size of WaveformHeader
92
static_assert
(
sizeof
(
WaveformHeader
) ==
sizeof
(
ISMRMRD_WaveformHeader
),
"WaveformHeader is not the same size as ISMRMRD_WaveformHeader"
);
93
static_assert
(std::is_standard_layout<WaveformHeader>::value,
"WaveformHeader is not a standard layout type"
);
94
#endif
95
96
struct
EXPORTISMRMRD Waveform :
public
ISMRMRD_Waveform
{
97
Waveform();
98
Waveform(
const
Waveform &other);
99
#if __cplusplus > 199711L
100
Waveform(Waveform&& other);
101
#endif
102
Waveform(uint16_t number_of_samples, uint16_t available_channels);
103
~Waveform();
104
Waveform & operator=(
const
Waveform &other);
105
#if __cplusplus > 199711L
106
Waveform & operator=(Waveform &&other);
107
#endif
108
uint32_t* begin_data();
109
uint32_t* end_data();
110
const
uint32_t* begin_data()
const
;
111
const
uint32_t* end_data()
const
;
112
size_t
size()
const
;
113
};
114
}
115
116
117
#endif
118
#endif
//ISMRMRD_WAVEFORM_H_H
ISMRMRD::ISMRMRD_WaveformHeader
Definition
waveform.h:27
ISMRMRD::ISMRMRD_WaveformHeader::scan_counter
uint32_t scan_counter
Definition
waveform.h:34
ISMRMRD::ISMRMRD_WaveformHeader::flags
uint64_t flags
Definition
waveform.h:30
ISMRMRD::ISMRMRD_WaveformHeader::number_of_samples
uint16_t number_of_samples
Definition
waveform.h:38
ISMRMRD::ISMRMRD_WaveformHeader::time_stamp
uint32_t time_stamp
Definition
waveform.h:36
ISMRMRD::ISMRMRD_WaveformHeader::channels
uint16_t channels
Definition
waveform.h:40
ISMRMRD::ISMRMRD_WaveformHeader::version
uint16_t version
Definition
waveform.h:28
ISMRMRD::ISMRMRD_WaveformHeader::sample_time_us
float sample_time_us
Definition
waveform.h:42
ISMRMRD::ISMRMRD_WaveformHeader::measurement_uid
uint32_t measurement_uid
Definition
waveform.h:32
ISMRMRD::ISMRMRD_WaveformHeader::waveform_id
uint16_t waveform_id
Definition
waveform.h:44
ISMRMRD::ISMRMRD_Waveform
Definition
waveform.h:64
ISMRMRD::WaveformHeader
Definition
waveform.h:80
Generated on
for ISMRMRD by
1.17.0