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_POINT_H 00018 #define __IGTL_POINT_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 00024 #define IGTL_POINT_ELEMENT_SIZE 136 00025 00026 #define IGTL_POINT_LEN_NAME 64 00027 #define IGTL_POINT_LEN_GROUP_NAME 32 00028 #define IGTL_POINT_LEN_OWNER 20 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 char name[IGTL_POINT_LEN_NAME]; /* Name or description of the point */ 00042 char group_name[IGTL_POINT_LEN_GROUP_NAME]; /* Can be "Labeled Point", "Landmark", Fiducial", ... */ 00043 igtl_uint8 rgba[4]; /* Color in R/G/B/A */ 00044 igtl_float32 position[3]; /* Coordinate of the point */ 00045 igtl_float32 radius; /* Radius of the point. Can be 0. */ 00046 char owner[IGTL_POINT_LEN_OWNER];/* Device name of the ower image */ 00047 } igtl_point_element; 00048 00049 #pragma pack() 00050 00051 00052 /* 00053 * Macros for point data size 00054 * 00055 * igtl_point_get_data_size(n) calculates the size of body based on the number 00056 * of points. The size of body is used in the message header. 00057 * igtl_point_get_data_n(size) calculates the number of images in the body, based on 00058 * the body size. This function may be used when a client program parses a POINT message. 00059 * 00060 */ 00061 00062 #define igtl_point_get_data_size(n) ((n) * IGTL_POINT_ELEMENT_SIZE) 00063 #define igtl_point_get_data_n(size) ((size) / IGTL_POINT_ELEMENT_SIZE) 00064 00065 /* 00066 * Byte order conversion for an array of point data structure 00067 * 00068 * This function converts endianness of each element in an array of 00069 * igtl_igtl_point_element from host byte order to network byte order, 00070 * or vice versa. 00071 */ 00072 00073 void igtl_export igtl_point_convert_byte_order(igtl_point_element* pointlist, int nelem); 00074 00075 00076 /* 00077 * CRC calculation 00078 * 00079 * This function calculates CRC of point message 00080 * 00081 */ 00082 00083 igtl_uint64 igtl_export igtl_point_get_crc(igtl_point_element* pointlist, int nelem); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif /* __IGTL_POINT_H */ 00090 00091 00092