ISMRMRD: dataset.h Source File

ISMRMRD ISMRM Raw Data Format

Loading...
Searching...
No Matches
dataset.h
Go to the documentation of this file.
1/* ISMRMRD Data Set */
2
6
7#pragma once
8#ifndef ISMRMRD_DATASET_H
9#define ISMRMRD_DATASET_H
10
11#include "ismrmrd/ismrmrd.h"
12#include "ismrmrd/waveform.h"
13#include <hdf5.h>
14
15#ifdef __cplusplus
16#include <string>
17namespace ISMRMRD {
18extern "C" {
19#endif
20
30 typedef struct ISMRMRD_Dataset {
31 char *filename;
32 char *groupname;
33 hid_t fileid;
34 hid_t transfer_properties;
35} ISMRMRD_Dataset;
36
41EXPORTISMRMRD int ismrmrd_init_dataset(ISMRMRD_Dataset *dset, const char *filename, const char *groupname);
42
47EXPORTISMRMRD int ismrmrd_open_dataset(ISMRMRD_Dataset *dset, const bool create_if_needed);
48
53EXPORTISMRMRD int ismrmrd_close_dataset(ISMRMRD_Dataset *dset);
54
61EXPORTISMRMRD int ismrmrd_write_header(const ISMRMRD_Dataset *dset, const char *xmlstring);
62
69EXPORTISMRMRD char * ismrmrd_read_header(const ISMRMRD_Dataset *dset);
70
76EXPORTISMRMRD int ismrmrd_append_acquisition(const ISMRMRD_Dataset *dset, const ISMRMRD_Acquisition *acq);
77
81EXPORTISMRMRD int ismrmrd_read_acquisition(const ISMRMRD_Dataset *dset, uint32_t index, ISMRMRD_Acquisition *acq);
82
86EXPORTISMRMRD uint32_t ismrmrd_get_number_of_acquisitions(const ISMRMRD_Dataset *dset);
87
93EXPORTISMRMRD int ismrmrd_append_waveform(const ISMRMRD_Dataset *dset, const ISMRMRD_Waveform *wav);
94
98EXPORTISMRMRD int ismrmrd_read_waveform(const ISMRMRD_Dataset *dset, uint32_t index, ISMRMRD_Waveform* wav);
99
103EXPORTISMRMRD uint32_t ismrmrd_get_number_of_waveforms(const ISMRMRD_Dataset *dset);
117EXPORTISMRMRD int ismrmrd_append_image(const ISMRMRD_Dataset *dset, const char *varname,
118 const ISMRMRD_Image *im);
119
124EXPORTISMRMRD int ismrmrd_read_image(const ISMRMRD_Dataset *dset, const char *varname,
125 const uint32_t index, ISMRMRD_Image *im);
126
130EXPORTISMRMRD uint32_t ismrmrd_get_number_of_images(const ISMRMRD_Dataset *dset, const char *varname);
131
143EXPORTISMRMRD int ismrmrd_append_array(const ISMRMRD_Dataset *dset, const char *varname,
144 const ISMRMRD_NDArray *arr);
145
149EXPORTISMRMRD int ismrmrd_read_array(const ISMRMRD_Dataset *dataset, const char *varname,
150 const uint32_t index, ISMRMRD_NDArray *arr);
151
155EXPORTISMRMRD uint32_t ismrmrd_get_number_of_arrays(const ISMRMRD_Dataset *dset, const char *varname);
156
157
158#ifdef __cplusplus
159} /* extern "C" */
160
161// ISMRMRD Dataset C++ Interface
162 class EXPORTISMRMRD Dataset {
163public:
164 // Constructor and destructor
165 Dataset(const char* filename, const char* groupname, bool create_file_if_needed = true);
166 ~Dataset();
167
168 // Methods
169 // XML Header
170 void writeHeader(const std::string &xmlstring);
171 void readHeader(std::string& xmlstring);
172 // Acquisitions
173 void appendAcquisition(const Acquisition &acq);
174 void readAcquisition(uint32_t index, Acquisition &acq);
175 uint32_t getNumberOfAcquisitions();
176 // Images
177 template <typename T> void appendImage(const std::string &var, const Image<T> &im);
178 void appendImage(const std::string &var, const ISMRMRD_Image *im);
179 template <typename T> void readImage(const std::string &var, uint32_t index, Image<T> &im);
180 uint32_t getNumberOfImages(const std::string &var);
181 // NDArrays
182 template <typename T> void appendNDArray(const std::string &var, const NDArray<T> &arr);
183 void appendNDArray(const std::string &var, const ISMRMRD_NDArray *arr);
184 template <typename T> void readNDArray(const std::string &var, uint32_t index, NDArray<T> &arr);
185 uint32_t getNumberOfNDArrays(const std::string &var);
186
187 //Waveforms
188 void appendWaveform(const Waveform &wav);
189 void readWaveform(uint32_t index, Waveform & wav);
190 uint32_t getNumberOfWaveforms();
191protected:
192 ISMRMRD_Dataset dset_;
193};
194
195} /* ISMRMRD namespace */
196#endif
197
198#endif /* ISMRMRD_DATASET_H */
ISMRMRD::Acquisition
MR Acquisition type.
Definition ismrmrd.h:605
ISMRMRD::Image
MR Image type.
Definition ismrmrd.h:772
ISMRMRD::NDArray
N-Dimensional array type.
Definition ismrmrd.h:934
ISMRMRD::ISMRMRD_Image
struct ISMRMRD::ISMRMRD_Image ISMRMRD_Image
ismrmrd.h
ISMRMRD::ISMRMRD_Dataset
Definition dataset.h:30
ISMRMRD::ISMRMRD_Image
Definition ismrmrd.h:420
ISMRMRD::ISMRMRD_NDArray
Definition ismrmrd.h:447
ISMRMRD::Waveform
Definition waveform.h:96