[ismrmrd] 93/281: Erased all traces of quaternions. Replaced with 3 direction cosines.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.
commit 0c660f89afdf124825a9be6a4cad41afd5ea7a23
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date: Mon Mar 4 12:50:37 2013 -0500
Erased all traces of quaternions. Replaced with 3 direction cosines.
---
README.html | 170 +++++++++++++++++++-----------------
doc/README.rst | 16 ++--
ismrmrd.h | 114 +++++++++++++++++-------
ismrmrd_hdf5_datatypes.h | 28 ++++--
matlab/+ismrmrd/AcquisitionHeader.m | 28 ++++--
matlab/+ismrmrd/ImageHeader.m | 26 ++++--
matlab/+ismrmrd/hdf5_datatypes.m | 28 ++++--
7 files changed, 267 insertions(+), 143 deletions(-)
diff --git a/README.html b/README.html
index 3551600..609eba1 100644
--- a/README.html
+++ b/README.html
@@ -3,13 +3,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.9.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.10: http://docutils.sourceforge.net/" />
<title>ISMRM Raw Data Format (ISMRMRD)</title>
<style type="text/css">
/*
:Author: David Goodger (goodger at python.org)
-:Id: $Id: html4css1.css 7434 2012-05-11 21:06:27Z milde $
+:Id: $Id: html4css1.css 7514 2012-09-14 14:27:12Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
@@ -77,7 +77,7 @@ div.tip p.admonition-title {
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
+div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
@@ -253,13 +253,14 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
-pre.code .ln { /* line numbers */
- color: grey;
-}
-
-.code {
- background-color: #eeeeee
-}
+pre.code .ln { color: grey; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
@@ -634,44 +635,46 @@ msbuild .\ISMRMRD.sln /p:Configuration=Release
<pre class="literal-block">
struct 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[3]; /**< 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[16]; /**< 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 quaternion[4]; /**< Angulation of acquisition */
- float patient_table_position[3]; /**< Patient table off-center */
- EncodingCounters idx; /**< Encoding loop counters, see above */
- int32_t user_int[8]; /**< Free user parameters */
- float user_float[8]; /**< 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[ISMRMRD_POSITION_LENGTH]; /**< Three-dimensional spatial offsets from isocenter */
+ float readout_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the readout/frequency encoding */
+ float phase_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the phase */
+ float slice_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the slice direction */
+ float patient_table_position[ISMRMRD_POSITION_LENGTH]; /**< Patient table off-center */
+ 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 */
};
</pre>
<p>Where EncodingCounters are defined as:</p>
<pre class="literal-block">
struct EncodingCounters {
- uint16_t kspace_encode_step_1; /**< e.g. phase encoding line number */
- uint16_t kspace_encode_step_2; /**< e.g. partition encodning number */
- 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 */
- uint16_t segment; /**< e.g. segment number for segmented acquisition */
- uint16_t user[8]; /**< Free user parameters */
+ uint16_t kspace_encode_step_1; /**< e.g. phase encoding line number */
+ uint16_t kspace_encode_step_2; /**< e.g. partition encodning number */
+ 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 */
+ uint16_t segment; /**< e.g. segment number for segmented acquisition */
+ uint16_t user[ISMRMRD_USER_INTS]; /**< Free user parameters */
};
</pre>
@@ -701,29 +704,31 @@ float* data_; //Actual data, elements = head_.number_of_samples*head_
<pre class="literal-block">
struct ImageHeader
{
- 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 */
- 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 quaternion[4]; /**< Angulation of acquisition */
- 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[3]; /**< Physiology time stamps, e.g. ecg, breating, etc. */
- uint16_t image_data_type; /**< e.g. unsigned short, float, complex float, 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[8]; /**< Free user parameters */
- float user_float[8]; /**< 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 */
+ 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 readout_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the readout/frequency encoding */
+ float phase_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the phase */
+ float slice_cosines[ISMRMRD_DIRCOSINES_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, breating, etc. */
+ uint16_t image_data_type; /**< e.g. unsigned short, float, complex float, 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 */
};
</pre>
@@ -772,7 +777,9 @@ data: {1x1281 cell}
trajectory_dimensions: [1x1281 uint16]
sample_time_us: [1x1281 single]
position: [3x1281 single]
- quaternion: [4x1281 single]
+ readout_cosines: [3x1281 single]
+ phase_cosines: [3x1281 single]
+ slice_cosines: [3x1281 single]
patient_table_position: [3x1281 single]
idx: [1x1 struct]
user_int: [8x1281 int32]
@@ -929,13 +936,10 @@ int main(int argc, char** argv)
//Let's append the data to the file
ISMRMRD::Acquisition acq;
- acq.data_ = new float[readout*2];
- if (!acq.data_) {
- std::cout << "Error allocating memory for the acquisition" << std::endl;
- }
-
for (unsigned int i = 0; i < phase_encoding_lines; i++) {
- acq.head_.flags = 0;
+ acq.setFlags(0);
+ //acq.head_.flags = 0;
+
//Set some flags
if (i == 0) {
acq.setFlag(ISMRMRD::FlagBit(ISMRMRD::ACQ_FIRST_IN_SLICE));
@@ -943,13 +947,13 @@ int main(int argc, char** argv)
if (i == (phase_encoding_lines-1)) {
acq.setFlag(ISMRMRD::FlagBit(ISMRMRD::ACQ_LAST_IN_SLICE));
}
- acq.head_.idx.kspace_encode_step_1 = i;
- acq.head_.active_channels = 1;
- acq.head_.available_channels = 1;
- acq.head_.number_of_samples = readout;
- acq.head_.center_sample = (readout>>1);
- acq.head_.sample_time_us = 5.0;
- memcpy(acq.data_,&img_test->data_[i*readout],sizeof(float)*readout*2);
+ acq.getIdx().kspace_encode_step_1 = i;
+ acq.setActiveChannels(1);
+ acq.setAvailableChannels(1);
+ acq.setNumberOfSamples(readout);
+ acq.setCenterSample(readout>>1);
+ acq.setSampleTimeUs(5.0);
+ memcpy(&acq[0],&img_test->data_[i*readout],sizeof(float)*readout*2);
d.appendAcquisition(&acq);
}
@@ -1046,12 +1050,14 @@ int main(int argc, char** argv)
return -1;
}
+
//Allocate a buffer for the data
ISMRMRD::NDArrayContainer< std::complex<float> > buffer;
buffer.dimensions_.push_back(e_space.matrixSize().x());
buffer.dimensions_.push_back(e_space.matrixSize().y());
- buffer.data_.resize(e_space.matrixSize().x()*e_space.matrixSize().y(), std::complex<float>(0.0,0.0));
+ buffer.resize(e_space.matrixSize().x()*e_space.matrixSize().y(), std::complex<float>(0.0,0.0));
+
//Now loop through and copy data
unsigned int number_of_acquisitions = d.getNumberOfAcquisitions();
for (unsigned int i = 0; i < number_of_acquisitions; i++) {
@@ -1060,8 +1066,8 @@ int main(int argc, char** argv)
//Copy data, we should probably be more careful here and do more tests....
//We are not considering multiple channels here.
- unsigned int offset = acq->head_.idx.kspace_encode_step_1*buffer.dimensions_[0];
- memcpy(&buffer.data_[offset],acq->data_,sizeof(float)*2*buffer.dimensions_[0]);
+ unsigned int offset = acq->getIdx().kspace_encode_step_1*buffer.dimensions_[0];
+ memcpy(&buffer[offset],&acq->getData()[0],sizeof(float)*2*buffer.dimensions_[0]);
}
//Let's FFT the k-space to image
diff --git a/doc/README.rst b/doc/README.rst
index eb4922f..fcd29cc 100644
--- a/doc/README.rst
+++ b/doc/README.rst
@@ -230,15 +230,15 @@ Each raw data acquisition is preceded by the following fixed layout structure:
.. include:: ../ismrmrd.h
:literal:
- :start-line: 125
- :end-line: 150
+ :start-line: 133
+ :end-line: 160
Where EncodingCounters are defined as:
.. include:: ../ismrmrd.h
:literal:
- :start-line: 109
- :end-line: 121
+ :start-line: 117
+ :end-line: 129
The interpretation of some of these fields may vary from sequence to sequence, i.e. for a Cartesian sequence, ``kspace_encode_step_1`` would be the phase encoding step, for a spiral sequence where phase encoding direction does not make sense, it would be the spiral interleave number. The ``encoding_space_ref`` enables the user to tie an acquisition to a specific encoding space (see above) in case there are multiple, e.g. in situations where a calibration scan may be integrated in the acq [...]
@@ -271,8 +271,8 @@ As mentioned above, the ISMRMRD format also suggests a way to store reconstructe
.. include:: ../ismrmrd.h
:literal:
- :start-line: 293
- :end-line: 319
+ :start-line: 196
+ :end-line: 224
In a similar fashion to the raw data acquisition data, the intention is to store a header followed by the image data. Since image data can be in several different format (e.g. float, complex, etc.), the memory layout is less well defined but can be described as::
@@ -322,7 +322,9 @@ The ISMRM Raw Data format is stored in HDF5 format. Details on this format can b
trajectory_dimensions: [1x1281 uint16]
sample_time_us: [1x1281 single]
position: [3x1281 single]
- quaternion: [4x1281 single]
+ readout_cosines: [3x1281 single]
+ phase_cosines: [3x1281 single]
+ slice_cosines: [3x1281 single]
patient_table_position: [3x1281 single]
idx: [1x1 struct]
user_int: [8x1281 int32]
diff --git a/ismrmrd.h b/ismrmrd.h
index 86e3c72..15938be 100644
--- a/ismrmrd.h
+++ b/ismrmrd.h
@@ -40,7 +40,7 @@ typedef unsigned __int64 uint64_t;
#define ISMRMRD_VERSION 1
#define ISMRMRD_POSITION_LENGTH 3
-#define ISMRMRD_QUATERNION_LENGTH 4
+#define ISMRMRD_DIRCOSINES_LENGTH 3
#define ISMRMRD_USER_INTS 8
#define ISMRMRD_USER_FLOATS 8
#define ISMRMRD_PHYS_STAMPS 8
@@ -150,13 +150,13 @@ struct AcquisitionHeader
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 quaternion[ISMRMRD_QUATERNION_LENGTH]; /**< Angulation of acquisition */
+ float readout_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the readout/frequency encoding */
+ float phase_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the phase */
+ float slice_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the slice direction */
float patient_table_position[ISMRMRD_POSITION_LENGTH]; /**< Patient table off-center */
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 */
-
-
};
enum ImageDataType
@@ -203,7 +203,9 @@ struct ImageHeader
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 quaternion[ISMRMRD_QUATERNION_LENGTH]; /**< Angulation of acquisition */
+ float readout_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the readout/frequency encoding */
+ float phase_cosines[ISMRMRD_DIRCOSINES_LENGTH]; /**< Directional cosines of the phase */
+ float slice_cosines[ISMRMRD_DIRCOSINES_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 */
@@ -531,19 +533,44 @@ public:
}
}
-
- const float getQuaternion(unsigned int index) const {
- if (index < ISMRMRD_QUATERNION_LENGTH) {
- return head_.quaternion[index];
- }
- return 0;
- }
-
- void setQuaternion(unsigned int index, float value) {
- if (index < ISMRMRD_QUATERNION_LENGTH) {
- head_.quaternion[index] = value;
- }
- }
+ const float getReadoutCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.readout_cosines[index];
+ }
+ return 0;
+ }
+
+ void setReadoutCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.readout_cosines[index] = value;
+ }
+ }
+
+ const float getPhaseCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.phase_cosines[index];
+ }
+ return 0;
+ }
+
+ void setPhaseCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.phase_cosines[index] = value;
+ }
+ }
+
+ const float getSliceCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.slice_cosines[index];
+ }
+ return 0;
+ }
+
+ void setSliceCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.slice_cosines[index] = value;
+ }
+ }
uint16_t getPhase() const {
return head_.phase;
@@ -891,19 +918,44 @@ public:
}
}
-
- const float getQuaternion(unsigned int index) const {
- if (index < ISMRMRD_QUATERNION_LENGTH) {
- return head_.quaternion[index];
- }
- return 0;
- }
-
- void setQuaternion(unsigned int index, float value) {
- if (index < ISMRMRD_QUATERNION_LENGTH) {
- head_.quaternion[index] = value;
- }
- }
+ const float getReadoutCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.readout_cosines[index];
+ }
+ return 0;
+ }
+
+ void setReadoutCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.readout_cosines[index] = value;
+ }
+ }
+
+ const float getPhaseCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.phase_cosines[index];
+ }
+ return 0;
+ }
+
+ void setPhaseCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.phase_cosines[index] = value;
+ }
+ }
+
+ const float getSliceCosine(unsigned int index) const {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ return head_.slice_cosines[index];
+ }
+ return 0;
+ }
+
+ void setSliceCosine(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRCOSINES_LENGTH) {
+ head_.slice_cosines[index] = value;
+ }
+ }
float getSampleTimeUs() const {
return head_.sample_time_us;
diff --git a/ismrmrd_hdf5_datatypes.h b/ismrmrd_hdf5_datatypes.h
index c802135..a28cdef 100644
--- a/ismrmrd_hdf5_datatypes.h
+++ b/ismrmrd_hdf5_datatypes.h
@@ -118,9 +118,17 @@ template <> inline boost::shared_ptr<DataType> getIsmrmrdHDF5Type<AcquisitionHea
boost::shared_ptr<DataType> position_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
ret->insertMember( "position", HOFFSET(AcquisitionHeader, position), *position_array_type);
- dims[0] = 4;
- boost::shared_ptr<DataType> quaterion_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
- ret->insertMember( "quaternion", HOFFSET(AcquisitionHeader, quaternion), *quaterion_array_type);
+ dims[0] = 3;
+ boost::shared_ptr<DataType> readout_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "readout_cosines", HOFFSET(AcquisitionHeader, readout_cosines), *readout_cosines_array_type);
+
+ dims[0] = 3;
+ boost::shared_ptr<DataType> phase_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "phase_cosines", HOFFSET(AcquisitionHeader, phase_cosines), *phase_cosines_array_type);
+
+ dims[0] = 3;
+ boost::shared_ptr<DataType> slice_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "slice_cosines", HOFFSET(AcquisitionHeader, slice_cosines), *slice_cosines_array_type);
dims[0] = 3;
boost::shared_ptr<DataType> table_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
@@ -211,9 +219,17 @@ template <> inline boost::shared_ptr<DataType> getIsmrmrdHDF5Type<ImageHeader>()
boost::shared_ptr<DataType> position_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
ret->insertMember( "position", HOFFSET(ImageHeader, position), *position_array_type);
- dims[0] = 4;
- boost::shared_ptr<DataType> quaterion_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
- ret->insertMember( "quaternion", HOFFSET(ImageHeader, quaternion), *quaterion_array_type);
+ dims[0] = 3;
+ boost::shared_ptr<DataType> readout_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "readout_cosines", HOFFSET(ImageHeader, readout_cosines), *readout_cosines_array_type);
+
+ dims[0] = 3;
+ boost::shared_ptr<DataType> phase_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "phase_cosines", HOFFSET(ImageHeader, phase_cosines), *phase_cosines_array_type);
+
+ dims[0] = 3;
+ boost::shared_ptr<DataType> slice_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "slice_cosines", HOFFSET(ImageHeader, slice_cosines), *slice_cosines_array_type);
dims[0] = 3;
boost::shared_ptr<DataType> table_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
diff --git a/matlab/+ismrmrd/AcquisitionHeader.m b/matlab/+ismrmrd/AcquisitionHeader.m
index f333c74..4f80bf9 100644
--- a/matlab/+ismrmrd/AcquisitionHeader.m
+++ b/matlab/+ismrmrd/AcquisitionHeader.m
@@ -18,7 +18,9 @@ classdef AcquisitionHeader
trajectory_dimensions = uint16(0); % Indicates the dimensionality of the trajectory vector (0 means no trajectory) %
sample_time_us = single(0); % Time between samples in micro seconds, sampling BW %
position = zeros(3,1,'single'); % Three-dimensional spatial offsets from isocenter %
- quaternion = zeros(4,1,'single'); % Angulation of acquisition %
+ readout_cosines = zeros(3,1,'single'); % Directional cosines of the readout/frequency encoding %
+ phase_cosines = zeros(3,1,'single'); % Directional cosines of the phase encoding %
+ slice_cosines = zeros(3,1,'single'); % Directional cosines of the slice %
patient_table_position = zeros(3,1, 'single'); % Patient table off-center %
idx = ismrmrd.EncodingCounters; % Encoding loop counters, see above %
user_int = zeros(8,1,'int32'); % Free user parameters %
@@ -104,11 +106,25 @@ classdef AcquisitionHeader
obj.position = single(v);
end
- function obj = set.quaternion(obj,v)
- if (length(v)~=4)
- error('AcquisitionHeader.quaternion must have 4 elements')
+ function obj = set.readout_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.readout_cosines must have 3 elements')
+ end
+ obj.readout_cosines = single(v);
+ end
+
+ function obj = set.phase_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.phase_cosines must have 3 elements')
+ end
+ obj.phase_cosines = single(v);
+ end
+
+ function obj = set.slice_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.slice_cosines must have 3 elements')
end
- obj.quaternion = single(v);
+ obj.slice_cosines = single(v);
end
function obj = set.patient_table_position(obj,v)
@@ -147,4 +163,4 @@ classdef AcquisitionHeader
end
-end
\ No newline at end of file
+end
diff --git a/matlab/+ismrmrd/ImageHeader.m b/matlab/+ismrmrd/ImageHeader.m
index 6d1558e..8786cb8 100644
--- a/matlab/+ismrmrd/ImageHeader.m
+++ b/matlab/+ismrmrd/ImageHeader.m
@@ -8,7 +8,9 @@ classdef ImageHeader
field_of_view = zeros(3,1,'single'); % Size (in mm) of the 3 spatial dimensions %
channels = uint16(0); % Number of receive channels %
position = zeros(3,1,'single'); % Three-dimensional spatial offsets from isocenter %
- quaternion = zeros(4,1,'single'); % Angulation of acquisition %
+ readout_cosines = zeros(3,1,'single'); % Directional cosines of the readout/frequency encoding %
+ phase_cosines = zeros(3,1,'single'); % Directional cosines of the phase encoding %
+ slice_cosines = zeros(3,1,'single'); % Directional cosines of the slice %
patient_table_position = zeros(3,1,'single'); % Patient table off-center %
average = uint16(0); % e.g. signal average number %
slice = uint16(0); % e.g. imaging slice number %
@@ -65,11 +67,25 @@ classdef ImageHeader
obj.position = single(v);
end
- function obj = set.quaternion(obj,v)
- if (length(v)~=4)
- error('AcquisitionHeader.quaternion must have 4 elements')
+ function obj = set.readout_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.readout_cosines must have 3 elements')
+ end
+ obj.readout_cosines = single(v);
+ end
+
+ function obj = set.phase_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.phase_cosines must have 3 elements')
+ end
+ obj.phase_cosines = single(v);
+ end
+
+ function obj = set.slice_cosines(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.slice_cosines must have 3 elements')
end
- obj.quaternion = single(v);
+ obj.slice_cosines = single(v);
end
function obj = set.patient_table_position(obj,v)
diff --git a/matlab/+ismrmrd/hdf5_datatypes.m b/matlab/+ismrmrd/hdf5_datatypes.m
index c2315c1..7ee4d1b 100644
--- a/matlab/+ismrmrd/hdf5_datatypes.m
+++ b/matlab/+ismrmrd/hdf5_datatypes.m
@@ -89,7 +89,9 @@ classdef hdf5_datatypes
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT16'); % trajectory_dimension
typesize = typesize + H5T.get_size('H5T_NATIVE_FLOAT'); % sample_time_us
typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % position
- typesize = typesize + 4*H5T.get_size('H5T_NATIVE_FLOAT'); % quaternion
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % readout_cosines
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % phase_cosines
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % slice_cosines
typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % patient_table_position
typesize = typesize + H5T.get_size(ismrmrd.hdf5_datatypes.getType_EncodingCounters()); % idx
typesize = typesize + 8*H5T.get_size('H5T_NATIVE_INT32'); % user_int
@@ -149,8 +151,14 @@ classdef hdf5_datatypes
H5T.insert(b, 'position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
- H5T.insert(b, 'quaternion', offset, H5T.array_create('H5T_NATIVE_FLOAT',[4]));
- offset = offset + 4*H5T.get_size('H5T_NATIVE_FLOAT');
+ H5T.insert(b, 'readout_cosines', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
+ offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
+
+ H5T.insert(b, 'phase_cosines', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
+ offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
+
+ H5T.insert(b, 'slice_cosines', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
+ offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
H5T.insert(b, 'patient_table_position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
@@ -227,9 +235,17 @@ end
% boost::shared_ptr<DataType> position_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
% ret->insertMember( "position", HOFFSET(ImageHeader, position), *position_array_type);
%
-% dims[0] = 4;
-% boost::shared_ptr<DataType> quaterion_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
-% ret->insertMember( "quaternion", HOFFSET(ImageHeader, quaternion), *quaterion_array_type);
+% dims[0] = 3;
+% boost::shared_ptr<DataType> phase_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+% ret->insertMember( "phase_cosines", HOFFSET(ImageHeader, phase_cosines), *phase_cosines_array_type);
+%
+% dims[0] = 3;
+% boost::shared_ptr<DataType> slice_cosines_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+% ret->insertMember( "slice_cosines", HOFFSET(ImageHeader, slice_cosines), *slice_cosines_array_type);
+%
+% dims[0] = 3;
+% boost::shared_ptr<DataType> table_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+% ret->insertMember( "patient_table_position", HOFFSET(ImageHeader, patient_table_position), *table_array_type);
%
% dims[0] = 3;
% boost::shared_ptr<DataType> table_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
--
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