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_COLORTABLE_H 00018 #define __IGTL_COLORTABLE_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 00024 #define IGTL_COLORTABLE_HEADER_SIZE 2 00025 00026 #define IGTL_COLORTABLE_INDEX_UINT8 3 00027 #define IGTL_COLORTABLE_INDEX_UINT16 5 00028 #define IGTL_COLORTABLE_MAP_UINT8 3 00029 #define IGTL_COLORTABLE_MAP_UINT16 5 00030 #define IGTL_COLORTABLE_MAP_RGB 19 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 #pragma pack(1) /* For 1-byte boundary in memroy */ 00037 /* 00038 * Status data header for OpenIGTLinik protocol 00039 * 00040 */ 00041 00042 typedef struct { 00043 igtl_int8 indexType; /* Index Type: 3:uint8 5:uint16 */ 00044 igtl_int8 mapType; /* 3: uint8 5:uint16 19:RGB color */ 00045 } igtl_colortable_header; 00046 00047 #pragma pack() 00048 00049 00050 /* 00051 * Colortable data size 00052 * 00053 * igtl_colortable_get_data_size(n) calculates the size of body based on the index 00054 * and map types. The size of body is used in the message header. 00055 * igtl_colortable_get_data_n(size) calculates the number of images in the body, based on 00056 * the body size. This function may be used when a client program parses a COLORTABLE message. 00057 * 00058 */ 00059 00060 igtl_uint64 igtl_export igtl_colortable_get_table_size(igtl_colortable_header* header); 00061 00062 00063 /* 00064 * Byte order conversion for an array of colortable data structure 00065 * 00066 * This function converts endianness of each element in an array of 00067 * igtl_igtl_colortable_header and color table from host byte order to network byte order, 00068 * or vice versa (if necessary). The function automatically determins the endian type of the host. 00069 */ 00070 00071 void igtl_export igtl_colortable_convert_byte_order(igtl_colortable_header* header, void* table); 00072 00073 00074 /* 00075 * CRC calculation 00076 * 00077 * This function calculates CRC of color table message 00078 * 00079 */ 00080 00081 igtl_uint64 igtl_export igtl_colortable_get_crc(igtl_colortable_header* header, void* table); 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif 00086 00087 #endif /* __IGTL_COLORTABLE_H */ 00088 00089 00090