00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/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_TRAJECTORY_H 00018 #define __IGTL_TRAJECTORY_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 00024 #define IGTL_TRAJECTORY_ELEMENT_SIZE 150 00025 #define IGTL_TRAJECTORY_LEN_NAME 64 00026 #define IGTL_TRAJECTORY_LEN_GROUP_NAME 32 00027 #define IGTL_TRAJECTORY_LEN_OWNER 20 00028 00029 #define IGTL_TRAJECTORY_TYPE_ENTRY_ONLY 1 00030 #define IGTL_TRAJECTORY_TYPE_TARGET_ONLY 2 00031 #define IGTL_TRAJECTORY_TYPE_ENTRY_TARGET 3 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 #pragma pack(1) /* For 1-byte boundary in memroy */ 00038 /* 00039 * Status data header for OpenIGTLinik protocol 00040 * 00041 */ 00042 00043 typedef struct { 00044 char name[IGTL_TRAJECTORY_LEN_NAME]; /* Name or description of the trajectory */ 00045 char group_name[IGTL_TRAJECTORY_LEN_GROUP_NAME]; /* Can be "Trajectory", ... */ 00046 igtl_int8 type; /* Trajectory type (see IGTL_TRAJECTORY_TYPE_* macros) */ 00047 igtl_int8 reserved; 00048 igtl_uint8 rgba[4]; /* Color in R/G/B/A */ 00049 igtl_float32 entry_pos[3]; /* Coordinate of the entry point */ 00050 igtl_float32 target_pos[3]; /* Coordinate of the target point */ 00051 igtl_float32 radius; /* Radius of the trajectory. Can be 0. */ 00052 char owner_name[IGTL_TRAJECTORY_LEN_OWNER]; /* Device name of the ower image */ 00053 } igtl_trajectory_element; 00054 00055 #pragma pack() 00056 00057 00058 /* 00059 * Macros for trajectory data size 00060 * 00061 * igtl_trajectory_get_data_size(n) calculates the size of body based on the number 00062 * of trajectorys. The size of body is used in the message header. 00063 * igtl_trajectory_get_data_n(size) calculates the number of images in the body, based on 00064 * the body size. This function may be used when a client program parses a TRAJECTORY message. 00065 * 00066 */ 00067 00068 #define igtl_trajectory_get_data_size(n) ((n) * IGTL_TRAJECTORY_ELEMENT_SIZE) 00069 #define igtl_trajectory_get_data_n(size) ((size) / IGTL_TRAJECTORY_ELEMENT_SIZE) 00070 00071 /* 00072 * Byte order conversion for an array of trajectory data structure 00073 * 00074 * This function converts endianness of each element in an array of 00075 * igtl_igtl_trajectory_element from host byte order to network byte order, 00076 * or vice versa. 00077 */ 00078 00079 void igtl_export igtl_trajectory_convert_byte_order(igtl_trajectory_element* trajectorylist, int nelem); 00080 00081 00082 /* 00083 * CRC calculation 00084 * 00085 * This function calculates CRC of trajectory message 00086 * 00087 */ 00088 00089 igtl_uint64 igtl_export igtl_trajectory_get_crc(igtl_trajectory_element* trajectorylist, int nelem); 00090 00091 #ifdef __cplusplus 00092 } 00093 #endif 00094 00095 #endif /* __IGTL_POSITION_H */ 00096 00097 00098