Loading...
Searching...
No Matches
waveform.h
//
// Created by dch on 26/02/18.
//
// clang-format off
#ifndef ISMRMRD_WAVEFORM_H
#define ISMRMRD_WAVEFORM_H
#if __cplusplus > 199711L
#include <type_traits>
#endif
#include "export.h"
#ifdef __cplusplus
#include "cpp98.h"
#include <cstddef>
#include <stdint.h>
namespace ISMRMRD {
extern "C" {
#else
#include <stdint.h>
#endif
// Note: This header does not use 2-byte packing like the rest of the ISMRMRD
typedef struct ISMRMRD_WaveformHeader
{
uint16_t version;
uint16_t pad1;
uint32_t pad2;
uint64_t flags;
uint32_t measurement_uid;
uint32_t scan_counter;
uint32_t time_stamp;
uint16_t number_of_samples;
uint16_t channels;
float sample_time_us;
uint16_t waveform_id;
} ISMRMRD_WaveformHeader;
#if __cplusplus > 199711L // Static assert requires C++11
// Check size and offsets of WaveformHeader
static_assert(sizeof(ISMRMRD_WaveformHeader) == 40, "ISMRMRD_WaveformHeader is not 40 bytes");
static_assert(offsetof(ISMRMRD_WaveformHeader, version) == 0, "ISMRMRD WaveformHeader version offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, flags) == 8, "ISMRMRD WaveformHeader flags offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, measurement_uid) == 16, "ISMRMRD WaveformHeader measurement_uid offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, scan_counter) == 20, "ISMRMRD WaveformHeader scan_counter offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, time_stamp) == 24, "ISMRMRD WaveformHeader time_stamp offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, number_of_samples) == 28, "ISMRMRD WaveformHeader number_of_samples offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, channels) == 30, "ISMRMRD WaveformHeader channels offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, sample_time_us) == 32, "ISMRMRD WaveformHeader sample_time_us offset is not correct");
static_assert(offsetof(ISMRMRD_WaveformHeader, waveform_id) == 36, "ISMRMRD WaveformHeader waveform_id offset is not correct");
#endif
typedef struct ISMRMRD_Waveform
{
ISMRMRD_WaveformHeader head;
uint32_t *data;
} ISMRMRD_Waveform;
EXPORTISMRMRD int ismrmrd_make_consistent_waveform(ISMRMRD_Waveform* wav);
EXPORTISMRMRD int ismrmrd_size_of_waveform_data(const ISMRMRD_Waveform* wav);
EXPORTISMRMRD ISMRMRD_Waveform* ismrmrd_create_waveform();
EXPORTISMRMRD int ismrmrd_free_waveform(ISMRMRD_Waveform*);
EXPORTISMRMRD int ismrmrd_init_waveform(ISMRMRD_Waveform*);
EXPORTISMRMRD int ismrmrd_init_waveformheader(ISMRMRD_WaveformHeader* header);
EXPORTISMRMRD int ismrmrd_copy_waveform(ISMRMRD_Waveform* dest, const ISMRMRD_Waveform* src);
#ifdef __cplusplus
}
struct EXPORTISMRMRD WaveformHeader : public ISMRMRD_WaveformHeader {
// Flag methods
bool isFlagSet(const uint64_t val);
void setFlag(const uint64_t val);
void clearFlag(const uint64_t val);
void clearAllFlags();
};
#if __cplusplus > 199711L // Static assert and is_standard_layout requires C++11
// check size of WaveformHeader
static_assert(sizeof(WaveformHeader) == sizeof(ISMRMRD_WaveformHeader), "WaveformHeader is not the same size as ISMRMRD_WaveformHeader");
static_assert(std::is_standard_layout<WaveformHeader>::value, "WaveformHeader is not a standard layout type");
#endif
struct EXPORTISMRMRD Waveform : public ISMRMRD_Waveform {
Waveform();
Waveform(const Waveform &other);
#if __cplusplus > 199711L
Waveform(Waveform&& other);
#endif
Waveform(uint16_t number_of_samples, uint16_t available_channels);
~Waveform();
Waveform & operator=(const Waveform &other);
#if __cplusplus > 199711L
Waveform & operator=(Waveform &&other);
#endif
uint32_t* begin_data();
uint32_t* end_data();
const uint32_t* begin_data() const;
const uint32_t* end_data() const;
size_t size() const;
};
}
#endif
#endif //ISMRMRD_WAVEFORM_H_H
ISMRMRD::ISMRMRD_WaveformHeader
Definition waveform.h:27
ISMRMRD::ISMRMRD_WaveformHeader::scan_counter
uint32_t scan_counter
Definition waveform.h:36
ISMRMRD::ISMRMRD_WaveformHeader::flags
uint64_t flags
Definition waveform.h:32
ISMRMRD::ISMRMRD_WaveformHeader::number_of_samples
uint16_t number_of_samples
Definition waveform.h:40
ISMRMRD::ISMRMRD_WaveformHeader::time_stamp
uint32_t time_stamp
Definition waveform.h:38
ISMRMRD::ISMRMRD_WaveformHeader::pad2
uint32_t pad2
Definition waveform.h:30
ISMRMRD::ISMRMRD_WaveformHeader::channels
uint16_t channels
Definition waveform.h:42
ISMRMRD::ISMRMRD_WaveformHeader::sample_time_us
float sample_time_us
Definition waveform.h:44
ISMRMRD::ISMRMRD_WaveformHeader::measurement_uid
uint32_t measurement_uid
Definition waveform.h:34
ISMRMRD::ISMRMRD_WaveformHeader::waveform_id
uint16_t waveform_id
Definition waveform.h:46
ISMRMRD::ISMRMRD_Waveform
Definition waveform.h:66
ISMRMRD::WaveformHeader
Definition waveform.h:82