Loading...
Searching...
No Matches
dataset.h
Go to the documentation of this file.
/* ISMRMRD Data Set */
#pragma once
#ifndef ISMRMRD_DATASET_H
#define ISMRMRD_DATASET_H
#include "ismrmrd/ismrmrd.h"
#include "ismrmrd/waveform.h"
#include <hdf5.h>
#ifdef __cplusplus
#include <string>
namespace ISMRMRD {
extern "C" {
#endif
typedef struct ISMRMRD_Dataset {
char *filename;
char *groupname;
hid_t fileid;
hid_t transfer_properties;
} ISMRMRD_Dataset;
EXPORTISMRMRD int ismrmrd_init_dataset(ISMRMRD_Dataset *dset, const char *filename, const char *groupname);
EXPORTISMRMRD int ismrmrd_open_dataset(ISMRMRD_Dataset *dset, const bool create_if_needed);
EXPORTISMRMRD int ismrmrd_close_dataset(ISMRMRD_Dataset *dset);
EXPORTISMRMRD int ismrmrd_write_header(const ISMRMRD_Dataset *dset, const char *xmlstring);
EXPORTISMRMRD char * ismrmrd_read_header(const ISMRMRD_Dataset *dset);
EXPORTISMRMRD int ismrmrd_append_acquisition(const ISMRMRD_Dataset *dset, const ISMRMRD_Acquisition *acq);
EXPORTISMRMRD int ismrmrd_read_acquisition(const ISMRMRD_Dataset *dset, uint32_t index, ISMRMRD_Acquisition *acq);
EXPORTISMRMRD uint32_t ismrmrd_get_number_of_acquisitions(const ISMRMRD_Dataset *dset);
EXPORTISMRMRD int ismrmrd_append_waveform(const ISMRMRD_Dataset *dset, const ISMRMRD_Waveform *wav);
EXPORTISMRMRD int ismrmrd_read_waveform(const ISMRMRD_Dataset *dset, uint32_t index, ISMRMRD_Waveform* wav);
EXPORTISMRMRD uint32_t ismrmrd_get_number_of_waveforms(const ISMRMRD_Dataset *dset);
EXPORTISMRMRD int ismrmrd_append_image(const ISMRMRD_Dataset *dset, const char *varname,
const ISMRMRD_Image *im);
EXPORTISMRMRD int ismrmrd_read_image(const ISMRMRD_Dataset *dset, const char *varname,
const uint32_t index, ISMRMRD_Image *im);
EXPORTISMRMRD uint32_t ismrmrd_get_number_of_images(const ISMRMRD_Dataset *dset, const char *varname);
EXPORTISMRMRD int ismrmrd_append_array(const ISMRMRD_Dataset *dset, const char *varname,
const ISMRMRD_NDArray *arr);
EXPORTISMRMRD int ismrmrd_read_array(const ISMRMRD_Dataset *dataset, const char *varname,
const uint32_t index, ISMRMRD_NDArray *arr);
EXPORTISMRMRD uint32_t ismrmrd_get_number_of_arrays(const ISMRMRD_Dataset *dset, const char *varname);
#ifdef __cplusplus
} /* extern "C" */
// ISMRMRD Dataset C++ Interface
class EXPORTISMRMRD Dataset {
public:
// Constructor and destructor
Dataset(const char* filename, const char* groupname, bool create_file_if_needed = true);
~Dataset();
// Methods
// XML Header
void writeHeader(const std::string &xmlstring);
void readHeader(std::string& xmlstring);
// Acquisitions
void appendAcquisition(const Acquisition &acq);
void readAcquisition(uint32_t index, Acquisition &acq);
uint32_t getNumberOfAcquisitions();
// Images
template <typename T> void appendImage(const std::string &var, const Image<T> &im);
void appendImage(const std::string &var, const ISMRMRD_Image *im);
template <typename T> void readImage(const std::string &var, uint32_t index, Image<T> &im);
uint32_t getNumberOfImages(const std::string &var);
// NDArrays
template <typename T> void appendNDArray(const std::string &var, const NDArray<T> &arr);
void appendNDArray(const std::string &var, const ISMRMRD_NDArray *arr);
template <typename T> void readNDArray(const std::string &var, uint32_t index, NDArray<T> &arr);
uint32_t getNumberOfNDArrays(const std::string &var);
//Waveforms
void appendWaveform(const Waveform &wav);
void readWaveform(uint32_t index, Waveform & wav);
uint32_t getNumberOfWaveforms();
protected:
ISMRMRD_Dataset dset_;
};
} /* ISMRMRD namespace */
#endif
#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:98