[ismrmrd] 94/281: rename *_cosines to *_dir and add quaternion helper functions
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 d406bdc9fc15bbe56a4590790371e296989c3fa6
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date: Tue Mar 5 15:41:04 2013 -0500
rename *_cosines to *_dir and add quaternion helper functions
quaternion helper functions are currently in ismrmrd.cpp. One
alternative is to declare them `inline` and put them back into
ismrmrd.h.
---
CMakeLists.txt | 2 +-
README.html | 18 ++---
doc/README.rst | 6 +-
ismrmrd.cpp | 128 ++++++++++++++++++++++++++++++++++++
ismrmrd.h | 117 ++++++++++++++++++--------------
ismrmrd_hdf5_datatypes.h | 24 +++----
matlab/+ismrmrd/AcquisitionHeader.m | 24 +++----
matlab/+ismrmrd/ImageHeader.m | 24 +++----
matlab/+ismrmrd/hdf5_datatypes.m | 20 +++---
9 files changed, 255 insertions(+), 108 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 775683c..627d432 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ WRAP_XSD(XSDS_SOURCES XSD_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/schema ${XSDS} OP
INCLUDE_DIRECTORIES(${XSD_INCLUDES} ${XSD_INCLUDE_DIR} ${XERCESC_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${HDF5_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}/cpp)
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
-add_library(ismrmrd SHARED ismrmrd_hdf5.cpp)
+add_library(ismrmrd SHARED ismrmrd.cpp ismrmrd_hdf5.cpp)
add_library(ismrmrd_xsd SHARED ${XSDS_SOURCES})
# Process the MATLAB files
diff --git a/README.html b/README.html
index 609eba1..9b18e91 100644
--- a/README.html
+++ b/README.html
@@ -652,9 +652,9 @@ 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 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 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 */
EncodingCounters idx; /**< Encoding loop counters, see above */
int32_t user_int[ISMRMRD_USER_INTS]; /**< Free user parameters */
@@ -711,9 +711,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 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 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 */
@@ -777,9 +777,9 @@ data: {1x1281 cell}
trajectory_dimensions: [1x1281 uint16]
sample_time_us: [1x1281 single]
position: [3x1281 single]
- readout_cosines: [3x1281 single]
- phase_cosines: [3x1281 single]
- slice_cosines: [3x1281 single]
+ read_dir: [3x1281 single]
+ phase_dir: [3x1281 single]
+ slice_dir: [3x1281 single]
patient_table_position: [3x1281 single]
idx: [1x1 struct]
user_int: [8x1281 int32]
diff --git a/doc/README.rst b/doc/README.rst
index fcd29cc..a2ee62d 100644
--- a/doc/README.rst
+++ b/doc/README.rst
@@ -322,9 +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]
- readout_cosines: [3x1281 single]
- phase_cosines: [3x1281 single]
- slice_cosines: [3x1281 single]
+ read_dir: [3x1281 single]
+ phase_dir: [3x1281 single]
+ slice_dir: [3x1281 single]
patient_table_position: [3x1281 single]
idx: [1x1 struct]
user_int: [8x1281 int32]
diff --git a/ismrmrd.cpp b/ismrmrd.cpp
new file mode 100644
index 0000000..a29f49d
--- /dev/null
+++ b/ismrmrd.cpp
@@ -0,0 +1,128 @@
+#include "ismrmrd.h"
+#include <math.h>
+
+#ifdef __cplusplus
+namespace ISMRMRD {
+#endif
+
+/**
+ * Calculates the determinant of the matrix and return the sign
+ */
+int sign_of_directions(float read_dir[3], float phase_dir[3], float slice_dir[3])
+{
+ float r11 = read_dir[0], r12 = phase_dir[0], r13 = slice_dir[0];
+ float r21 = read_dir[1], r22 = phase_dir[1], r23 = slice_dir[1];
+ float r31 = read_dir[2], r32 = phase_dir[2], r33 = slice_dir[2];
+
+ /* Determinant should be 1 or -1 */
+ float deti = (r11 * r22 * r33) + (r12 * r23 * r31) + (r21 * r32 * r13) -
+ (r13 * r22 * r31) - (r12 * r21 * r33) - (r11 * r23 * r32);
+
+ if (deti < 0) {
+ return -1;
+ } else {
+ return 1;
+ }
+}
+
+/**
+ * Creates a normalized quaternion from a 3x3 rotation matrix
+ */
+void directions_to_quaternion(float read_dir[3], float phase_dir[3],
+ float slice_dir[3], float quat[4])
+{
+ float r11 = read_dir[0], r12 = phase_dir[0], r13 = slice_dir[0];
+ float r21 = read_dir[1], r22 = phase_dir[1], r23 = slice_dir[1];
+ float r31 = read_dir[2], r32 = phase_dir[2], r33 = slice_dir[2];
+
+ float a = 1, b = 0, c = 0, d = 0, s = 0;
+ float trace = 0;
+ float xd, yd, zd;
+
+ /* verify the sign of the rotation*/
+ if (sign_of_directions(read_dir, phase_dir, slice_dir) < 0) {
+ /* flip 3rd column */
+ r13 = -r13;
+ r23 = -r23;
+ r33 = -r33;
+ }
+
+ /* Compute quaternion parameters */
+ /* http://www.cs.princeton.edu/~gewang/projects/darth/stuff/quat_faq.html#Q55 */
+ trace = 1.0l + r11 + r22 + r33;
+ if (trace > 0.00001l) { /* simplest case */
+ s = sqrt(trace) * 2;
+ a = (r32 - r23) / s;
+ b = (r13 - r31) / s;
+ c = (r21 - r12) / s;
+ d = 0.25l * s;
+ } else {
+ /* trickier case...
+ * determine which major diagonal element has
+ * the greatest value... */
+ xd = 1.0 + r11 - (r22 + r33); /* 4**b**b */
+ yd = 1.0 + r22 - (r11 + r33); /* 4**c**c */
+ zd = 1.0 + r33 - (r11 + r22); /* 4**d**d */
+ /* if r11 is the greatest */
+ if (xd > 1.0) {
+ s = 2.0 * sqrt(xd);
+ a = 0.25l * s;
+ b = (r21 + r12) / s;
+ c = (r31 + r13) / s;
+ d = (r32 - r23) / s;
+ }
+ /* else if r22 is the greatest */
+ else if (yd > 1.0) {
+ s = 2.0 * sqrt(yd);
+ a = (r21 + r12) / s;
+ b = 0.25l * s;
+ c = (r32 + r23) / s;
+ d = (r13 - r31) / s;
+ }
+ /* else, r33 must be the greatest */
+ else {
+ s = 2.0 * sqrt(zd);
+ a = (r13 + r31) / s;
+ b = (r23 + r32) / s;
+ c = 0.25l * s;
+ d = (r21 - r12) / s;
+ }
+
+ if (a < 0.0l) {
+ b = -b;
+ c = -c;
+ d = -d;
+ a = -a;
+ }
+ }
+
+ quat[0] = a; quat[1] = b; quat[2] = c; quat[3] = d;
+}
+
+/**
+ * Converts a quaternion of the form | a b c d | to a
+ * 3x3 rotation matrix
+ *
+ * http://www.cs.princeton.edu/~gewang/projects/darth/stuff/quat_faq.html#Q54
+ */
+void quaternion_to_directions(float quat[4], float read_dir[3],
+ float phase_dir[3], float slice_dir[3])
+{
+ float a = quat[0], b = quat[1], c = quat[2], d = quat[3];
+
+ read_dir[0] = 1.0 - 2.0 * ( b*b + c*c );
+ phase_dir[0] = 2.0 * ( a*b - c*d );
+ slice_dir[0] = 2.0 * ( a*c + b*d );
+
+ read_dir[1] = 2.0 * ( a*b + c*d );
+ phase_dir[1] = 1.0 - 2.0 * ( a*a + c*c );
+ slice_dir[1] = 2.0 * ( b*c - a*d );
+
+ read_dir[2] = 2.0 * ( a*c - b*d );
+ phase_dir[2] = 2.0 * ( b*c + a*d );
+ slice_dir[2] = 1.0 - 2.0 * ( a*a + b*b );
+}
+
+#ifdef __cplusplus
+} /* namespace ISMRMRD */
+#endif
diff --git a/ismrmrd.h b/ismrmrd.h
index 15938be..95bee5a 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_DIRCOSINES_LENGTH 3
+#define ISMRMRD_DIRECTION_LENGTH 3
#define ISMRMRD_USER_INTS 8
#define ISMRMRD_USER_FLOATS 8
#define ISMRMRD_PHYS_STAMPS 8
@@ -129,7 +129,7 @@ struct EncodingCounters {
};
/**
- Header for each MR acquisition.
+ Header for each MR acquisition.
*/
struct AcquisitionHeader
{
@@ -150,9 +150,9 @@ 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 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 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 */
EncodingCounters idx; /**< Encoding loop counters, see above */
int32_t user_int[ISMRMRD_USER_INTS]; /**< Free user parameters */
@@ -203,9 +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 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 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 */
@@ -533,42 +533,42 @@ public:
}
}
- const float getReadoutCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.readout_cosines[index];
+ const float getReadoutDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.read_dir[index];
}
return 0;
}
- void setReadoutCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.readout_cosines[index] = value;
+ void setReadoutDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.read_dir[index] = value;
}
}
- const float getPhaseCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.phase_cosines[index];
+ const float getPhaseDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.phase_dir[index];
}
return 0;
}
- void setPhaseCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.phase_cosines[index] = value;
+ void setPhaseDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.phase_dir[index] = value;
}
}
- const float getSliceCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.slice_cosines[index];
+ const float getSliceDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.slice_dir[index];
}
return 0;
}
- void setSliceCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.slice_cosines[index] = value;
+ void setSliceDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.slice_dir[index] = value;
}
}
@@ -714,14 +714,14 @@ template <> inline void Image< unsigned short >::setSpecificDataType() {
* - Test, test, test.
*/
class Acquisition {
-
+
public:
Acquisition()
: traj_(), data_() {
memset(&head_,0,sizeof(AcquisitionHeader));
head_.version = ISMRMRD_VERSION;
}
-
+
~Acquisition() {}
Acquisition (const Acquisition& a) { // copy constructor
@@ -733,7 +733,7 @@ public:
memcpy(&traj_[0],&a.traj_[0],sizeof(float)*a.traj_.size());
}
}
-
+
Acquisition& operator=(const Acquisition& a) {
if (this != &a) {
head_ = a.head_;
@@ -744,7 +744,7 @@ public:
}
return *this;
}
-
+
const AcquisitionHeader& getHead() {
return head_;
}
@@ -918,42 +918,54 @@ public:
}
}
- const float getReadoutCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.readout_cosines[index];
+ /*
+ const float* getPosition() const {
+ return head_.position;
+ }
+
+ void setPosition(float values[ISMRMRD_POSITION_LENGTH]){
+ for (int i=0; i < ISMRMRD_POSITION_LENGTH; i++) {
+ head_.position[i] = values[i];
+ }
+ }
+ */
+
+ const float getReadoutDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.read_dir[index];
}
return 0;
}
- void setReadoutCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.readout_cosines[index] = value;
+ void setReadoutDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.read_dir[index] = value;
}
}
- const float getPhaseCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.phase_cosines[index];
+ const float getPhaseDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.phase_dir[index];
}
return 0;
}
- void setPhaseCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.phase_cosines[index] = value;
+ void setPhaseDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.phase_dir[index] = value;
}
}
- const float getSliceCosine(unsigned int index) const {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- return head_.slice_cosines[index];
+ const float getSliceDirection(unsigned int index) const {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ return head_.slice_dir[index];
}
return 0;
}
- void setSliceCosine(unsigned int index, float value) {
- if (index < ISMRMRD_DIRCOSINES_LENGTH) {
- head_.slice_cosines[index] = value;
+ void setSliceDirection(unsigned int index, float value) {
+ if (index < ISMRMRD_DIRECTION_LENGTH) {
+ head_.slice_dir[index] = value;
}
}
@@ -1064,10 +1076,17 @@ protected:
AcquisitionHeader head_; /**< Header, see above */
std::valarray<float> traj_;
std::valarray<float> data_;
-
+
};
+
#endif //__cplusplus
+/* defined in ismrmrd.c */
+int sign_of_directions(float read_dir[3], float phase_dir[3], float slice_dir[3]);
+void directions_to_quaternion(float read_dir[3], float phase_dir[3],
+ float slice_dir[3], float quat[4]);
+void quaternion_to_directions(float quat[4], float read_dir[3],
+ float phase_dir[3], float slice_dir[3]);
#ifdef __cplusplus
} //End of ISMRMRD namespace
diff --git a/ismrmrd_hdf5_datatypes.h b/ismrmrd_hdf5_datatypes.h
index a28cdef..016897b 100644
--- a/ismrmrd_hdf5_datatypes.h
+++ b/ismrmrd_hdf5_datatypes.h
@@ -119,16 +119,16 @@ template <> inline boost::shared_ptr<DataType> getIsmrmrdHDF5Type<AcquisitionHea
ret->insertMember( "position", HOFFSET(AcquisitionHeader, position), *position_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);
+ boost::shared_ptr<DataType> read_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "read_dir", HOFFSET(AcquisitionHeader, read_dir), *read_dir_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);
+ boost::shared_ptr<DataType> phase_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "phase_dir", HOFFSET(AcquisitionHeader, phase_dir), *phase_dir_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);
+ boost::shared_ptr<DataType> slice_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "slice_dir", HOFFSET(AcquisitionHeader, slice_dir), *slice_dir_array_type);
dims[0] = 3;
boost::shared_ptr<DataType> table_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
@@ -220,16 +220,16 @@ template <> inline boost::shared_ptr<DataType> getIsmrmrdHDF5Type<ImageHeader>()
ret->insertMember( "position", HOFFSET(ImageHeader, position), *position_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);
+ boost::shared_ptr<DataType> read_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "read_dir", HOFFSET(ImageHeader, read_dir), *read_dir_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);
+ boost::shared_ptr<DataType> phase_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "phase_dir", HOFFSET(ImageHeader, phase_dir), *phase_dir_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);
+ boost::shared_ptr<DataType> slice_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+ ret->insertMember( "slice_dir", HOFFSET(ImageHeader, slice_dir), *slice_dir_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 4f80bf9..687561d 100644
--- a/matlab/+ismrmrd/AcquisitionHeader.m
+++ b/matlab/+ismrmrd/AcquisitionHeader.m
@@ -18,9 +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 %
- 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 %
+ read_dir = zeros(3,1,'single'); % Directional cosines of the readout/frequency encoding %
+ phase_dir = zeros(3,1,'single'); % Directional cosines of the phase encoding %
+ slice_dir = 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 %
@@ -106,25 +106,25 @@ classdef AcquisitionHeader
obj.position = single(v);
end
- function obj = set.readout_cosines(obj,v)
+ function obj = set.read_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.readout_cosines must have 3 elements')
+ error('AcquisitionHeader.read_dir must have 3 elements')
end
- obj.readout_cosines = single(v);
+ obj.read_dir = single(v);
end
- function obj = set.phase_cosines(obj,v)
+ function obj = set.phase_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.phase_cosines must have 3 elements')
+ error('AcquisitionHeader.phase_dir must have 3 elements')
end
- obj.phase_cosines = single(v);
+ obj.phase_dir = single(v);
end
- function obj = set.slice_cosines(obj,v)
+ function obj = set.slice_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.slice_cosines must have 3 elements')
+ error('AcquisitionHeader.slice_dir must have 3 elements')
end
- obj.slice_cosines = single(v);
+ obj.slice_dir = single(v);
end
function obj = set.patient_table_position(obj,v)
diff --git a/matlab/+ismrmrd/ImageHeader.m b/matlab/+ismrmrd/ImageHeader.m
index 8786cb8..5f0ca10 100644
--- a/matlab/+ismrmrd/ImageHeader.m
+++ b/matlab/+ismrmrd/ImageHeader.m
@@ -8,9 +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 %
- 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 %
+ read_dir = zeros(3,1,'single'); % Directional cosines of the readout/frequency encoding %
+ phase_dir = zeros(3,1,'single'); % Directional cosines of the phase encoding %
+ slice_dir = 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 %
@@ -67,25 +67,25 @@ classdef ImageHeader
obj.position = single(v);
end
- function obj = set.readout_cosines(obj,v)
+ function obj = set.read_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.readout_cosines must have 3 elements')
+ error('AcquisitionHeader.read_dir must have 3 elements')
end
- obj.readout_cosines = single(v);
+ obj.read_dir = single(v);
end
- function obj = set.phase_cosines(obj,v)
+ function obj = set.phase_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.phase_cosines must have 3 elements')
+ error('AcquisitionHeader.phase_dir must have 3 elements')
end
- obj.phase_cosines = single(v);
+ obj.phase_dir = single(v);
end
- function obj = set.slice_cosines(obj,v)
+ function obj = set.slice_dir(obj,v)
if (length(v)~=3)
- error('AcquisitionHeader.slice_cosines must have 3 elements')
+ error('AcquisitionHeader.slice_dir must have 3 elements')
end
- obj.slice_cosines = single(v);
+ obj.slice_dir = 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 7ee4d1b..6954366 100644
--- a/matlab/+ismrmrd/hdf5_datatypes.m
+++ b/matlab/+ismrmrd/hdf5_datatypes.m
@@ -89,9 +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 + 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'); % read_dir
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % phase_dir
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_FLOAT'); % slice_dir
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
@@ -151,13 +151,13 @@ 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, 'readout_cosines', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
+ H5T.insert(b, 'read_dir', 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]));
+ H5T.insert(b, 'phase_dir', 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]));
+ H5T.insert(b, 'slice_dir', 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]));
@@ -236,12 +236,12 @@ end
% ret->insertMember( "position", HOFFSET(ImageHeader, position), *position_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);
+% boost::shared_ptr<DataType> phase_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+% ret->insertMember( "phase_dir", HOFFSET(ImageHeader, phase_dir), *phase_dir_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);
+% boost::shared_ptr<DataType> slice_dir_array_type(new ArrayType(PredType::NATIVE_FLOAT, 1, &dims[0]));
+% ret->insertMember( "slice_dir", HOFFSET(ImageHeader, slice_dir), *slice_dir_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