[ismrmrd] 10/177: More additions to the C++ classes.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit 666d8e8bb32a41302c110c3d65b7e3f1d94f8c4d
Author: Souheil Inati <souheil.inati at nih.gov>
Date:   Tue Jul 22 21:49:24 2014 -0400

    More additions to the C++ classes.
---
 ismrmrd.cpp | 290 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 ismrmrd.h   | 102 +++++++++++----------
 ismrmrd.hpp |  54 +++++------
 3 files changed, 326 insertions(+), 120 deletions(-)

diff --git a/ismrmrd.cpp b/ismrmrd.cpp
index 10083a4..f22a014 100644
--- a/ismrmrd.cpp
+++ b/ismrmrd.cpp
@@ -13,57 +13,98 @@ AcquisitionHeader::AcquisitionHeader() {
 const uint16_t &AcquisitionHeader::version() {
     return head_.version;
 };
+
 const uint64_t &AcquisitionHeader::flags() {
     return head_.flags;
 };
+
 uint32_t &AcquisitionHeader::measurement_uid() {
     return head_.measurement_uid;
 };
+
 uint32_t &AcquisitionHeader::scan_counter() {
     return head_.scan_counter;
 };
+
 uint32_t &AcquisitionHeader::acquisition_time_stamp() {
     return head_.acquisition_time_stamp;
 };
-uint32_t (&AcquisitionHeader::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] { return head_.physiology_time_stamp; };
+
+uint32_t (&AcquisitionHeader::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] {
+    return head_.physiology_time_stamp;
+};
+
 uint16_t &AcquisitionHeader::number_of_samples() {
     return head_.number_of_samples;
 };
+
 uint16_t &AcquisitionHeader::available_channels() {
     return head_.available_channels;
 };
+
 uint16_t &AcquisitionHeader::active_channels() {
     return head_.active_channels;
 };
-const uint64_t (&AcquisitionHeader::channel_mask()) [ISMRMRD_CHANNEL_MASKS] { return head_.channel_mask; };
+
+const uint64_t (&AcquisitionHeader::channel_mask()) [ISMRMRD_CHANNEL_MASKS] { 
+    return head_.channel_mask;
+};
+
 uint16_t &AcquisitionHeader::discard_pre() {
     return head_.discard_pre;
 };
+
 uint16_t &AcquisitionHeader::discard_post() {
     return head_.discard_post;
 };
+
 uint16_t &AcquisitionHeader::center_sample() {
     return head_.center_sample;
 };
+
 uint16_t &AcquisitionHeader::encoding_space_ref() {
     return head_.encoding_space_ref;
 };
+
 uint16_t &AcquisitionHeader::trajectory_dimensions() {
     return head_.trajectory_dimensions;
 };
+
 float &AcquisitionHeader::sample_time_us() {
     return head_.sample_time_us;
 };
-float (&AcquisitionHeader::position()) [ISMRMRD_POSITION_LENGTH] { return head_.position; };
-float (&AcquisitionHeader::read_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.read_dir; };
-float (&AcquisitionHeader::phase_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.phase_dir; };
-float (&AcquisitionHeader::slice_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.slice_dir; };
-float (&AcquisitionHeader::patient_table_position()) [ISMRMRD_POSITION_LENGTH] { return head_.patient_table_position; };
+
+float (&AcquisitionHeader::position())[3] {
+    return head_.position;
+};
+
+float (&AcquisitionHeader::read_dir())[3] {
+    return head_.read_dir;
+};
+
+float (&AcquisitionHeader::phase_dir())[3] {
+    return head_.phase_dir;
+};
+
+float (&AcquisitionHeader::slice_dir())[3] {
+    return head_.slice_dir;
+};
+
+float (&AcquisitionHeader::patient_table_position())[3] {
+    return head_.patient_table_position;
+};
+
 ISMRMRD_EncodingCounters &AcquisitionHeader::idx() {
     return head_.idx;
 };
-int32_t (&AcquisitionHeader::user_int()) [ISMRMRD_USER_INTS] { return head_.user_int; };
-float (&AcquisitionHeader::user_float()) [ISMRMRD_USER_FLOATS] { return head_.user_float; };
+
+int32_t (&AcquisitionHeader::user_int()) [ISMRMRD_USER_INTS] { 
+    return head_.user_int;
+};
+
+float (&AcquisitionHeader::user_float()) [ISMRMRD_USER_FLOATS] {
+ return head_.user_float;
+};
 
 // Flag methods
 bool AcquisitionHeader::isFlagSet(const uint64_t val) {
@@ -95,23 +136,31 @@ Acquisition::Acquisition() {
 const uint16_t &Acquisition::version() {
     return acq_.head.version;
 };
+
 const uint64_t &Acquisition::flags() {
     return acq_.head.flags;
 };
+
 uint32_t &Acquisition::measurement_uid() {
     return acq_.head.measurement_uid;
 };
+
 uint32_t &Acquisition::scan_counter() {
     return acq_.head.scan_counter;
 };
+
 uint32_t &Acquisition::acquisition_time_stamp() {
     return acq_.head.acquisition_time_stamp;
 };
-uint32_t (&Acquisition::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] { return acq_.head.physiology_time_stamp; };
+
+uint32_t (&Acquisition::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] {
+    return acq_.head.physiology_time_stamp;
+};
 
 const uint16_t &Acquisition::number_of_samples() {
     return acq_.head.number_of_samples;
 };
+
 void Acquisition::number_of_samples(uint16_t num_samples) {
     acq_.head.number_of_samples = num_samples;
     ismrmrd_make_consistent_acquisition(&acq_);
@@ -124,39 +173,66 @@ uint16_t &Acquisition::available_channels() {
 const uint16_t &Acquisition::active_channels() {
     return acq_.head.active_channels;
 };
+
 void Acquisition::active_channels(uint16_t num_channels) {
     acq_.head.active_channels = num_channels;
     ismrmrd_make_consistent_acquisition(&acq_);
 };
 
-const uint64_t (&Acquisition::channel_mask()) [ISMRMRD_CHANNEL_MASKS] { return acq_.head.channel_mask; };
+const uint64_t (&Acquisition::channel_mask()) [ISMRMRD_CHANNEL_MASKS] {
+    return acq_.head.channel_mask;
+};
+
 uint16_t &Acquisition::discard_pre() {
     return acq_.head.discard_pre;
 };
+
 uint16_t &Acquisition::discard_post() {
     return acq_.head.discard_post;
 };
+
 uint16_t &Acquisition::center_sample() {
     return acq_.head.center_sample;
 };
+
 uint16_t &Acquisition::encoding_space_ref() {
     return acq_.head.encoding_space_ref;
 };
+
 uint16_t &Acquisition::trajectory_dimensions() {
     return acq_.head.trajectory_dimensions;
 };
+
 float &Acquisition::sample_time_us() {
     return acq_.head.sample_time_us;
 };
-float (&Acquisition::position()) [ISMRMRD_POSITION_LENGTH] { return acq_.head.position; };
-float (&Acquisition::read_dir()) [ISMRMRD_DIRECTION_LENGTH] { return acq_.head.read_dir; };
-float (&Acquisition::phase_dir()) [ISMRMRD_DIRECTION_LENGTH] { return acq_.head.phase_dir; };
-float (&Acquisition::slice_dir()) [ISMRMRD_DIRECTION_LENGTH] { return acq_.head.slice_dir; };
-float (&Acquisition::patient_table_position()) [ISMRMRD_POSITION_LENGTH] { return acq_.head.patient_table_position; };
+
+float (&Acquisition::position())[3] {
+    return acq_.head.position;
+};
+
+float (&Acquisition::read_dir())[3] {
+    return acq_.head.read_dir;
+};
+
+float (&Acquisition::phase_dir())[3] {
+    return acq_.head.phase_dir;
+};
+
+float (&Acquisition::slice_dir())[3] {
+    return acq_.head.slice_dir;
+};
+
+float (&Acquisition::patient_table_position())[3] {
+    return acq_.head.patient_table_position;
+};
+
 ISMRMRD_EncodingCounters &Acquisition::idx() {
     return acq_.head.idx;
 };
+
 int32_t (&Acquisition::user_int()) [ISMRMRD_USER_INTS] { return acq_.head.user_int; };
+
 float (&Acquisition::user_float()) [ISMRMRD_USER_FLOATS] { return acq_.head.user_float; };
 
 // Flag methods
@@ -191,62 +267,125 @@ const uint16_t &ImageHeader::version() {
 const uint16_t &ImageHeader::data_type() {
     return head_.data_type;
 };
-// TODO void ImageHeader::data_type(uint16_t dtype) { return head_.data_type; };
+void ImageHeader::data_type(uint16_t dtype) {
+    // TODO function to check if type is valid
+    head_.data_type = dtype;
+};
+
 const uint64_t &ImageHeader::flags() {
     return head_.flags;
 };
+
 uint32_t &ImageHeader::measurement_uid() {
     return head_.measurement_uid;
 };
-uint16_t (&ImageHeader::matrix_size())[3] {
+
+const uint16_t (&ImageHeader::matrix_size())[3] {
     return head_.matrix_size;
 };
-// TODO set matrix size
+
+void ImageHeader::matrix_size(const uint16_t msize[3]) {
+    head_.matrix_size[0] = msize[0];
+    if (msize[1] > 1) {
+        head_.matrix_size[1] = msize[1];
+    } else {
+        head_.matrix_size[1] = 1;
+    }
+    if (msize[2] > 0) {
+        head_.matrix_size[2] = msize[2];
+    } else {
+        head_.matrix_size[2] = 1;
+    }
+};
+
 float (&ImageHeader::field_of_view())[3] {
     return head_.field_of_view;
 };
-// TODO set field of view
-uint16_t &ImageHeader::channels() {
+
+const uint16_t &ImageHeader::channels() {
     return head_.channels;
 };
-float (&ImageHeader::position()) [ISMRMRD_POSITION_LENGTH] { return head_.position; };
-float (&ImageHeader::read_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.read_dir; };
-float (&ImageHeader::phase_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.phase_dir; };
-float (&ImageHeader::slice_dir()) [ISMRMRD_DIRECTION_LENGTH] { return head_.slice_dir; };
-float (&ImageHeader::patient_table_position()) [ISMRMRD_POSITION_LENGTH] { return head_.patient_table_position; };
+
+void ImageHeader::channels(const uint16_t num_channels) {
+    if (num_channels > 1) {
+        head_.channels = num_channels;
+    } else {
+        head_.channels = 1;
+    }
+};
+
+float (&ImageHeader::position())[3] {
+    return head_.position;
+};
+
+float (&ImageHeader::read_dir())[3] {
+    return head_.read_dir;
+};
+
+float (&ImageHeader::phase_dir())[3] {
+    return head_.phase_dir;
+};
+
+float (&ImageHeader::slice_dir())[3] {
+    return head_.slice_dir;
+};
+
+float (&ImageHeader::patient_table_position())[3] {
+    return head_.patient_table_position;
+};
+
 uint16_t &ImageHeader::average() {
     return head_.average;
 };
+
 uint16_t &ImageHeader::slice() {
     return head_.slice;
 };
+
 uint16_t &ImageHeader::contrast() {
     return head_.contrast;
 };
+
 uint16_t &ImageHeader::phase() {
     return head_.repetition;
 };
+
 uint16_t &ImageHeader::repetition() {
     return head_.repetition;
 };
+
 uint16_t &ImageHeader::set() {
     return head_.set;
 };
+
 uint32_t &ImageHeader::acquisition_time_stamp() {
     return head_.acquisition_time_stamp;
 };
-uint32_t (&ImageHeader::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] { return head_.physiology_time_stamp; };
+
+uint32_t (&ImageHeader::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] {
+    return head_.physiology_time_stamp;
+};
+
 uint16_t &ImageHeader::image_type() {
     return head_.image_type;
 };
+
 uint16_t &ImageHeader::image_index() {
     return head_.image_index;
 };
+
 uint16_t &ImageHeader::image_series_index() {
     return head_.image_series_index;
 };
-int32_t (&ImageHeader::user_int()) [ISMRMRD_USER_INTS] { return head_.user_int; };
-float (&ImageHeader::user_float()) [ISMRMRD_USER_FLOATS] { return head_.user_float; };
+
+int32_t (&ImageHeader::user_int()) [ISMRMRD_USER_INTS] { 
+    return head_.user_int;
+};
+
+float (&ImageHeader::user_float()) [ISMRMRD_USER_FLOATS] { 
+    return head_.user_float;
+};
+
 const uint32_t &ImageHeader::attribute_string_len() {
     return head_.attribute_string_len;
 };
@@ -281,66 +420,133 @@ Image::Image() {
 const uint16_t &Image::version() {
     return image_.head.version;
 };
+
 const uint16_t &Image::data_type() {
     return image_.head.data_type;
 };
-// TODO void Image::data_type(uint16_t dtype) { return image_.head.data_type; };
+
+void Image::data_type(uint16_t dtype) {
+    // TODO function to check if type is valid
+    image_.head.data_type = dtype;
+    ismrmrd_make_consistent_image(&image_);
+};
+
 const uint64_t &Image::flags() {
     return image_.head.flags;
 };
+
 uint32_t &Image::measurement_uid() {
     return image_.head.measurement_uid;
 };
+
 const uint16_t (&Image::matrix_size())[3] {
     return image_.head.matrix_size;
 };
-// TODO set matrix size
-const float (&Image::field_of_view())[3] {
+
+void Image::matrix_size(const uint16_t msize[3]) {
+    image_.head.matrix_size[0] = msize[0];
+    if (msize[1] > 1) {
+        image_.head.matrix_size[1] = msize[1];
+    } else {
+        image_.head.matrix_size[1] = 1;
+    }
+    if (msize[2] > 0) {
+        image_.head.matrix_size[2] = msize[2];
+    } else {
+        image_.head.matrix_size[2] = 1;
+    }
+    ismrmrd_make_consistent_image(&image_);
+};
+
+float (&Image::field_of_view())[3] {
     return image_.head.field_of_view;
 };
-// TODO set field of view
+
 const uint16_t &Image::channels() {
     return image_.head.channels;
 };
-// TODO set number of channels
-float (&Image::position()) [ISMRMRD_POSITION_LENGTH] { return image_.head.position; };
-float (&Image::read_dir()) [ISMRMRD_DIRECTION_LENGTH] { return image_.head.read_dir; };
-float (&Image::phase_dir()) [ISMRMRD_DIRECTION_LENGTH] { return image_.head.phase_dir; };
-float (&Image::slice_dir()) [ISMRMRD_DIRECTION_LENGTH] { return image_.head.slice_dir; };
-float (&Image::patient_table_position()) [ISMRMRD_POSITION_LENGTH] { return image_.head.patient_table_position; };
+
+void Image::channels(const uint16_t num_channels) {
+    if (num_channels > 1) {
+        image_.head.channels = num_channels;
+    } else {
+        image_.head.channels = 1;
+    }
+    ismrmrd_make_consistent_image(&image_);
+};
+
+float (&Image::position())[3] {
+    return image_.head.position;
+};
+
+float (&Image::read_dir())[3] {
+    return image_.head.read_dir;
+};
+
+float (&Image::phase_dir())[3] {
+    return image_.head.phase_dir;
+};
+
+float (&Image::slice_dir())[3] {
+    return image_.head.slice_dir;
+};
+
+float (&Image::patient_table_position())[3] {
+    return image_.head.patient_table_position;
+};
+
 uint16_t &Image::average() {
     return image_.head.average;
 };
+
 uint16_t &Image::slice() {
     return image_.head.slice;
 };
+
 uint16_t &Image::contrast() {
     return image_.head.contrast;
 };
+
 uint16_t &Image::phase() {
     return image_.head.repetition;
 };
+
 uint16_t &Image::repetition() {
     return image_.head.repetition;
 };
+
 uint16_t &Image::set() {
     return image_.head.set;
 };
+
 uint32_t &Image::acquisition_time_stamp() {
     return image_.head.acquisition_time_stamp;
 };
-uint32_t (&Image::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] { return image_.head.physiology_time_stamp; };
+
+uint32_t (&Image::physiology_time_stamp()) [ISMRMRD_PHYS_STAMPS] { 
+    return image_.head.physiology_time_stamp;
+};
+
 uint16_t &Image::image_type() {
     return image_.head.image_type;
 };
+
 uint16_t &Image::image_index() {
     return image_.head.image_index;
 };
+
 uint16_t &Image::image_series_index() {
     return image_.head.image_series_index;
 };
-int32_t (&Image::user_int()) [ISMRMRD_USER_INTS] { return image_.head.user_int; };
-float (&Image::user_float()) [ISMRMRD_USER_FLOATS] { return image_.head.user_float; };
+
+int32_t (&Image::user_int()) [ISMRMRD_USER_INTS] { 
+    return image_.head.user_int;
+};
+
+float (&Image::user_float()) [ISMRMRD_USER_FLOATS] {
+    return image_.head.user_float;
+};
+
 const uint32_t &Image::attribute_string_len() {
     return image_.head.attribute_string_len;
 };
diff --git a/ismrmrd.h b/ismrmrd.h
index 4a2cbb3..78ac603 100644
--- a/ismrmrd.h
+++ b/ismrmrd.h
@@ -50,8 +50,6 @@ extern "C" {
  */
 enum Constants {
     ISMRMRD_VERSION = 1,
-    ISMRMRD_POSITION_LENGTH = 3,
-    ISMRMRD_DIRECTION_LENGTH = 3,
     ISMRMRD_USER_INTS = 8,
     ISMRMRD_USER_FLOATS = 8,
     ISMRMRD_PHYS_STAMPS = 3,
@@ -162,30 +160,30 @@ typedef struct ISMRMRD_EncodingCounters {
    Header for each MR acquisition.
 */
 typedef struct ISMRMRD_AcquisitionHeader {
-    uint16_t version;                                      /**< First unsigned int indicates the version */
-    uint64_t flags;                                        /**< bit field with flags */
-    uint32_t measurement_uid;                              /**< Unique ID for the measurement */
-    uint32_t scan_counter;                                 /**< Current acquisition number in the measurement */
-    uint32_t acquisition_time_stamp;                       /**< Acquisition clock */
-    uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS];   /**< Physiology time stamps, e.g. ecg, breating, etc. */
-    uint16_t number_of_samples;                            /**< Number of samples acquired */
-    uint16_t available_channels;                           /**< Available coils */
-    uint16_t active_channels;                              /**< Active coils on current acquisiton */
-    uint64_t channel_mask[ISMRMRD_CHANNEL_MASKS];          /**< Mask to indicate which channels are active. Support for 1024 channels */
-    uint16_t discard_pre;                                  /**< Samples to be discarded at the beginning of  acquisition */
-    uint16_t discard_post;                                 /**< Samples to be discarded at the end of acquisition */
-    uint16_t center_sample;                                /**< Sample at the center of k-space */
-    uint16_t encoding_space_ref;                           /**< Reference to an encoding space, typically only one per acquisition */
-    uint16_t trajectory_dimensions;                        /**< Indicates the dimensionality of the trajectory vector (0 means no trajectory) */
-    float sample_time_us;                                  /**< Time between samples in micro seconds, sampling BW */
-    float position[ISMRMRD_POSITION_LENGTH];               /**< Three-dimensional spatial offsets from isocenter */
-    float read_dir[ISMRMRD_DIRECTION_LENGTH];              /**< Directional cosines of the readout/frequency encoding */
-    float phase_dir[ISMRMRD_DIRECTION_LENGTH];             /**< Directional cosines of the phase */
-    float slice_dir[ISMRMRD_DIRECTION_LENGTH];             /**< Directional cosines of the slice direction */
-    float patient_table_position[ISMRMRD_POSITION_LENGTH]; /**< Patient table off-center */
-    ISMRMRD_EncodingCounters idx;                          /**< Encoding loop counters, see above */
-    int32_t user_int[ISMRMRD_USER_INTS];                   /**< Free user parameters */
-    float user_float[ISMRMRD_USER_FLOATS];                 /**< Free user parameters */
+    uint16_t version;                                    /**< First unsigned int indicates the version */
+    uint64_t flags;                                      /**< bit field with flags */
+    uint32_t measurement_uid;                            /**< Unique ID for the measurement */
+    uint32_t scan_counter;                               /**< Current acquisition number in the measurement */
+    uint32_t acquisition_time_stamp;                     /**< Acquisition clock */
+    uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS]; /**< Physiology time stamps, e.g. ecg, breating, etc. */
+    uint16_t number_of_samples;                          /**< Number of samples acquired */
+    uint16_t available_channels;                         /**< Available coils */
+    uint16_t active_channels;                            /**< Active coils on current acquisiton */
+    uint64_t channel_mask[ISMRMRD_CHANNEL_MASKS];        /**< Mask to indicate which channels are active. Support for 1024 channels */
+    uint16_t discard_pre;                                /**< Samples to be discarded at the beginning of  acquisition */
+    uint16_t discard_post;                               /**< Samples to be discarded at the end of acquisition */
+    uint16_t center_sample;                              /**< Sample at the center of k-space */
+    uint16_t encoding_space_ref;                         /**< Reference to an encoding space, typically only one per acquisition */
+    uint16_t trajectory_dimensions;                      /**< Indicates the dimensionality of the trajectory vector (0 means no trajectory) */
+    float sample_time_us;                                /**< Time between samples in micro seconds, sampling BW */
+    float position[3];                                   /**< Three-dimensional spatial offsets from isocenter */
+    float read_dir[3];                                   /**< Directional cosines of the readout/frequency encoding */
+    float phase_dir[3];                                  /**< Directional cosines of the phase */
+    float slice_dir[3];                                  /**< Directional cosines of the slice direction */
+    float patient_table_position[3];                     /**< Patient table off-center */
+    ISMRMRD_EncodingCounters idx;                        /**< Encoding loop counters, see above */
+    int32_t user_int[ISMRMRD_USER_INTS];                 /**< Free user parameters */
+    float user_float[ISMRMRD_USER_FLOATS];               /**< Free user parameters */
 } ISMRMRD_AcquisitionHeader;
 
 /* Initialize an Acquisition Header */
@@ -215,32 +213,32 @@ size_t ismrmrd_size_of_acquisition_data(const ISMRMRD_Acquisition *acq);
  *  Header for each Image
  */
 typedef struct ISMRMRD_ImageHeader {
-    uint16_t version;                                      /**< First unsigned int indicates the version */
-    uint16_t data_type;                                    /**< e.g. unsigned short, float, complex float, etc. */
-    uint64_t flags;                                        /**< bit field with flags */
-    uint32_t measurement_uid;                              /**< Unique ID for the measurement  */
-    uint16_t matrix_size[3];                               /**< Pixels in the 3 spatial dimensions */
-    float field_of_view[3];                                /**< Size (in mm) of the 3 spatial dimensions */
-    uint16_t channels;                                     /**< Number of receive channels */
-    float position[ISMRMRD_POSITION_LENGTH];               /**< Three-dimensional spatial offsets from isocenter */
-    float read_dir[ISMRMRD_DIRECTION_LENGTH];              /**< Directional cosines of the readout/frequency encoding */
-    float phase_dir[ISMRMRD_DIRECTION_LENGTH];             /**< Directional cosines of the phase */
-    float slice_dir[ISMRMRD_DIRECTION_LENGTH];             /**< Directional cosines of the slice direction */
-    float patient_table_position[ISMRMRD_POSITION_LENGTH]; /**< Patient table off-center */
-    uint16_t average;                                      /**< e.g. signal average number */
-    uint16_t slice;                                        /**< e.g. imaging slice number */
-    uint16_t contrast;                                     /**< e.g. echo number in multi-echo */
-    uint16_t phase;                                        /**< e.g. cardiac phase number */
-    uint16_t repetition;                                   /**< e.g. dynamic number for dynamic scanning */
-    uint16_t set;                                          /**< e.g. flow encodning set */
-    uint32_t acquisition_time_stamp;                       /**< Acquisition clock */
-    uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS];   /**< Physiology time stamps, e.g. ecg, breathing, etc. */
-    uint16_t image_type;                                   /**< e.g. magnitude, phase, complex, real, imag, etc. */
-    uint16_t image_index;                                  /**< e.g. image number in series of images  */
-    uint16_t image_series_index;                           /**< e.g. series number */
-    int32_t user_int[ISMRMRD_USER_INTS];                   /**< Free user parameters */
-    float user_float[ISMRMRD_USER_FLOATS];                 /**< Free user parameters */
-    uint32_t attribute_string_len;                         /**< Length of attributes string */
+    uint16_t version;                                    /**< First unsigned int indicates the version */
+    uint16_t data_type;                                  /**< e.g. unsigned short, float, complex float, etc. */
+    uint64_t flags;                                      /**< bit field with flags */
+    uint32_t measurement_uid;                            /**< Unique ID for the measurement  */
+    uint16_t matrix_size[3];                             /**< Pixels in the 3 spatial dimensions */
+    float field_of_view[3];                              /**< Size (in mm) of the 3 spatial dimensions */
+    uint16_t channels;                                   /**< Number of receive channels */
+    float position[3];                                   /**< Three-dimensional spatial offsets from isocenter */
+    float read_dir[3];                                   /**< Directional cosines of the readout/frequency encoding */
+    float phase_dir[3];                                  /**< Directional cosines of the phase */
+    float slice_dir[3];                                  /**< Directional cosines of the slice direction */
+    float patient_table_position[3];                     /**< Patient table off-center */
+    uint16_t average;                                    /**< e.g. signal average number */
+    uint16_t slice;                                      /**< e.g. imaging slice number */
+    uint16_t contrast;                                   /**< e.g. echo number in multi-echo */
+    uint16_t phase;                                      /**< e.g. cardiac phase number */
+    uint16_t repetition;                                 /**< e.g. dynamic number for dynamic scanning */
+    uint16_t set;                                        /**< e.g. flow encodning set */
+    uint32_t acquisition_time_stamp;                     /**< Acquisition clock */
+    uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS]; /**< Physiology time stamps, e.g. ecg, breathing, etc. */
+    uint16_t image_type;                                 /**< e.g. magnitude, phase, complex, real, imag, etc. */
+    uint16_t image_index;                                /**< e.g. image number in series of images  */
+    uint16_t image_series_index;                         /**< e.g. series number */
+    int32_t user_int[ISMRMRD_USER_INTS];                 /**< Free user parameters */
+    float user_float[ISMRMRD_USER_FLOATS];               /**< Free user parameters */
+    uint32_t attribute_string_len;                       /**< Length of attributes string */
 } ISMRMRD_ImageHeader;
 
 void ismrmrd_init_image_header(ISMRMRD_ImageHeader *hdr);
diff --git a/ismrmrd.hpp b/ismrmrd.hpp
index 0fdd212..ce73635 100644
--- a/ismrmrd.hpp
+++ b/ismrmrd.hpp
@@ -31,11 +31,11 @@ public:
     uint16_t &encoding_space_ref();
     uint16_t &trajectory_dimensions();
     float &sample_time_us();
-    float (&position())[ISMRMRD_POSITION_LENGTH];
-    float (&read_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&phase_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&slice_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&patient_table_position())[ISMRMRD_POSITION_LENGTH];
+    float (&position())[3];
+    float (&read_dir())[3];
+    float (&phase_dir())[3];
+    float (&slice_dir())[3];
+    float (&patient_table_position())[3];
     ISMRMRD_EncodingCounters &idx();
     int32_t (&user_int())[ISMRMRD_USER_INTS];
     float (&user_float())[ISMRMRD_USER_FLOATS];
@@ -80,11 +80,11 @@ public:
     uint16_t &encoding_space_ref();
     uint16_t &trajectory_dimensions();
     float &sample_time_us();
-    float (&position())[ISMRMRD_POSITION_LENGTH];
-    float (&read_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&phase_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&slice_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&patient_table_position())[ISMRMRD_POSITION_LENGTH];
+    float (&position())[3];
+    float (&read_dir())[3];
+    float (&phase_dir())[3];
+    float (&slice_dir())[3];
+    float (&patient_table_position())[3];
     ISMRMRD_EncodingCounters &idx();
     int32_t (&user_int())[ISMRMRD_USER_INTS];
     float (&user_float())[ISMRMRD_USER_FLOATS];
@@ -119,14 +119,16 @@ public:
     void data_type(uint16_t dtype);
     const uint64_t &flags();
     uint32_t &measurement_uid();
-    uint16_t (&matrix_size())[3];
+    const uint16_t (&matrix_size())[3];
+    void matrix_size(const uint16_t msize[3]);
     float (&field_of_view())[3];
-    uint16_t &channels();
-    float (&position())[ISMRMRD_POSITION_LENGTH];
-    float (&read_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&phase_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&slice_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&patient_table_position())[ISMRMRD_POSITION_LENGTH];
+    const uint16_t &channels();
+    void channels(const uint16_t num_channels);
+    float (&position())[3];
+    float (&read_dir())[3];
+    float (&phase_dir())[3];
+    float (&slice_dir())[3];
+    float (&patient_table_position())[3];
     uint16_t &average();
     uint16_t &slice();
     uint16_t &contrast();
@@ -162,19 +164,19 @@ public:
     // Accessors and mutators
     const uint16_t &version();
     const uint16_t &data_type();
+    void data_type(uint16_t dtype);
     const uint64_t &flags();
     uint32_t &measurement_uid();
     const uint16_t (&matrix_size())[3];
-    // TODO set matrix size
-    const float (&field_of_view())[3];
-    // TODO set field of view
+    void matrix_size(const uint16_t msize[3]);
+    float (&field_of_view())[3];
     const uint16_t &channels();
-    void channels(uint16_t num_channels);
-    float (&position())[ISMRMRD_POSITION_LENGTH];
-    float (&read_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&phase_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&slice_dir())[ISMRMRD_DIRECTION_LENGTH];
-    float (&patient_table_position())[ISMRMRD_POSITION_LENGTH];
+    void channels(const uint16_t num_channels);
+    float (&position())[3];
+    float (&read_dir())[3];
+    float (&phase_dir())[3];
+    float (&slice_dir())[3];
+    float (&patient_table_position())[3];
     uint16_t &average();
     uint16_t &slice();
     uint16_t &contrast();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list