00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlutil/igtl_position.h $ 00005 Language: C 00006 Date: $Date: 2009-11-13 11:37:44 -0500 (Fri, 13 Nov 2009) $ 00007 Version: $Revision: 5335 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notices for more information. 00014 00015 =========================================================================*/ 00016 00017 #ifndef __IGTL_POSITION_H 00018 #define __IGTL_POSITION_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 00024 #define IGTL_POSITION_MESSAGE_DEFAULT_SIZE 28 00025 00026 #define IGTL_POSITION_MESSAGE_POSITON_ONLY_SIZE 12 /* size w/o quaternion */ 00027 #define IGTL_POSITION_MESSAGE_WITH_QUATERNION3_SIZE 24 /* size 3-element quaternion */ 00028 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 #pragma pack(1) /* For 1-byte boundary in memroy */ 00035 /* 00036 * Status data header for OpenIGTLinik protocol 00037 * 00038 */ 00039 00040 typedef struct { 00041 igtl_float32 position[3]; /* (x, y, z) */ 00042 igtl_float32 quaternion[4]; /* (ox, oy, oz, w) */ 00043 } igtl_position; 00044 00045 #pragma pack() 00046 00047 /* 00048 * Byte order conversion for the position data structure 00049 * 00050 * This function converts endianness of each member variable 00051 * in igtl_status_header from host byte order to network byte order, 00052 * or vice versa. 00053 */ 00054 00055 void igtl_export igtl_position_convert_byte_order(igtl_position* pos); 00056 00057 00058 /* 00059 * CRC calculation 00060 * 00061 * This function calculates CRC of position message 00062 * 00063 */ 00064 00065 igtl_uint64 igtl_export igtl_position_get_crc(igtl_position* pos); 00066 00067 #ifdef __cplusplus 00068 } 00069 #endif 00070 00071 #endif /* __IGTL_POSITION_H */ 00072 00073 00074