[ismrmrd] 100/281: make the new ismrmrd compiled in windows

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:02 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 e85c48afd96f71e3a2b85e05a66484af580ababe
Author: hxue <hui.xue at nih.gov>
Date:   Mon Mar 18 16:54:19 2013 -0400

    make the new ismrmrd compiled in windows
---
 ismrmrd.h                                        | 62 ++++++++++++------------
 tests/c/CMakeLists.txt                           |  9 ++--
 tests/c/{t_cquaternions.c => t_cquaternions.cpp} |  8 +--
 tests/c/{t_cstructs.c => t_cstructs.cpp}         | 11 ++---
 4 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/ismrmrd.h b/ismrmrd.h
index a6de831..f3952da 100644
--- a/ismrmrd.h
+++ b/ismrmrd.h
@@ -151,9 +151,9 @@ typedef 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              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              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 */
@@ -197,31 +197,31 @@ enum ImageFlags {
  */
 typedef 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[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, 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 */
+	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               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, 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 */
 } ImageHeader;
 
 #ifdef __cplusplus
@@ -1088,7 +1088,7 @@ extern "C" {
 /**
  * Calculates the determinant of the matrix and return the sign
  */
-static inline int sign_of_directions(float read_dir[3], float phase_dir[3], float slice_dir[3])
+static 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];
@@ -1108,7 +1108,7 @@ static inline int sign_of_directions(float read_dir[3], float phase_dir[3], floa
 /**
  * Creates a normalized quaternion from a 3x3 rotation matrix
  */
-static inline void directions_to_quaternion(float read_dir[3], float phase_dir[3],
+static 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];
@@ -1185,7 +1185,7 @@ static inline void directions_to_quaternion(float read_dir[3], float phase_dir[3
  *
  * http://www.cs.princeton.edu/~gewang/projects/darth/stuff/quat_faq.html#Q54
  */
-static inline void quaternion_to_directions(float quat[4], float read_dir[3],
+static 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];
diff --git a/tests/c/CMakeLists.txt b/tests/c/CMakeLists.txt
index 6f11bcb..fdd26f8 100644
--- a/tests/c/CMakeLists.txt
+++ b/tests/c/CMakeLists.txt
@@ -1,9 +1,12 @@
 enable_testing()
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
 
-add_executable(t_cstructs t_cstructs.c)
+add_executable(t_cstructs t_cstructs.cpp)
 add_test(t_cstructs ${CMAKE_CURRENT_BINARY_DIR}/t_cstructs)
 
-add_executable(t_cquaternions ../../ismrmrd.h t_cquaternions.c)
+add_executable(t_cquaternions ../../ismrmrd.h t_cquaternions.cpp)
 add_test(t_cquaternions ${CMAKE_CURRENT_BINARY_DIR}/t_cquaternions)
-target_link_libraries(t_cquaternions m)
+
+if (NOT WIN32)
+    target_link_libraries(t_cquaternions m)
+endif (NOT WIN32)
diff --git a/tests/c/t_cquaternions.c b/tests/c/t_cquaternions.cpp
similarity index 78%
rename from tests/c/t_cquaternions.c
rename to tests/c/t_cquaternions.cpp
index 87e3126..c7894ba 100644
--- a/tests/c/t_cquaternions.c
+++ b/tests/c/t_cquaternions.cpp
@@ -12,14 +12,14 @@ int main(void)
     float quaternion[4];
 
     /* convert the direction vectors to a quaternion and verify */
-    directions_to_quaternion(read_dir, phase_dir, slice_dir, quaternion);
+    ISMRMRD::directions_to_quaternion(read_dir, phase_dir, slice_dir, quaternion);
 
     if (!((quaternion[0] == 0.0) && (quaternion[1] == 0.0) && (quaternion[2] == 0.0) && (quaternion[3] == 1.0))) {
         return EXIT_FAILURE;
     }
 
     /* convert the quaternion back to direction cosines and verify */
-    quaternion_to_directions(quaternion, read_dir, phase_dir, slice_dir);
+    ISMRMRD::quaternion_to_directions(quaternion, read_dir, phase_dir, slice_dir);
     int rd = ((read_dir[0] == 1.0) && (read_dir[1] == 0.0) && (read_dir[2] == 0.0));
     int pd = ((phase_dir[0] == 0.0) && (phase_dir[1] == 1.0) && (phase_dir[2] == 0.0));
     int sd = ((slice_dir[0] == 0.0) && (slice_dir[1] == 0.0) && (slice_dir[2] == 1.0));
@@ -29,7 +29,7 @@ int main(void)
     }
 
     /* check that determinant is > 0 */
-    if (sign_of_directions(read_dir, phase_dir, slice_dir) < 0) {
+    if (ISMRMRD::sign_of_directions(read_dir, phase_dir, slice_dir) < 0) {
         return EXIT_FAILURE;
     }
 
@@ -37,7 +37,7 @@ int main(void)
     slice_dir[0] = -slice_dir[0];
     slice_dir[1] = -slice_dir[1];
     slice_dir[2] = -slice_dir[2];
-    if (sign_of_directions(read_dir, phase_dir, slice_dir) > 0) {
+    if (ISMRMRD::sign_of_directions(read_dir, phase_dir, slice_dir) > 0) {
         return EXIT_FAILURE;
     }
 
diff --git a/tests/c/t_cstructs.c b/tests/c/t_cstructs.cpp
similarity index 93%
rename from tests/c/t_cstructs.c
rename to tests/c/t_cstructs.cpp
index c24aac9..848b078 100644
--- a/tests/c/t_cstructs.c
+++ b/tests/c/t_cstructs.cpp
@@ -3,12 +3,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-
 int main(void)
 {
     int i;
 
-    EncodingCounters idx;
+    ISMRMRD::EncodingCounters idx;
 
     idx.kspace_encode_step_1 = 1;
     idx.kspace_encode_step_2 = 2;
@@ -23,7 +22,7 @@ int main(void)
         idx.user[i] = i * 42;
     }
 
-    AcquisitionHeader acq_head;
+    ISMRMRD::AcquisitionHeader acq_head;
     acq_head.version = 1;
     acq_head.flags = -1;
     acq_head.measurement_uid = 12345;
@@ -74,7 +73,7 @@ int main(void)
     }
 
 
-    ImageHeader img_head;
+    ISMRMRD::ImageHeader img_head;
     img_head.version = 1;
     img_head.flags = -1;
     img_head.measurement_uid = 12345;
@@ -122,8 +121,8 @@ int main(void)
         img_head.physiology_time_stamp[i] = 1363106388;
     }
 
-    img_head.image_data_type = DATA_FLOAT;
-    img_head.image_type = TYPE_MAGNITUDE;
+    img_head.image_data_type = ISMRMRD::DATA_FLOAT;
+    img_head.image_type = ISMRMRD::TYPE_MAGNITUDE;
     img_head.image_index = 42;
     img_head.image_series_index = 3;
 

-- 
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