00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: $ 00005 Language: C 00006 Date: $Date: 2010-11-23 14:47:40 -0500 (Tue, 23 Nov 2010) $ 00007 Version: $Revision: 6958 $ 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_SENSOR_H 00018 #define __IGTL_SENSOR_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 #include "igtl_unit.h" 00024 #include "igtl_win32header.h" 00025 00026 #define IGTL_SENSOR_HEADER_SIZE 10 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 #pragma pack(1) /* For 1-byte boundary in memroy */ 00033 00034 typedef struct { 00035 igtl_uint8 larray; /* Length of array (0-255) */ 00036 igtl_uint8 status; /* (reserved) sensor status */ 00037 igtl_unit unit; /* Unit */ 00038 } igtl_sensor_header; 00039 00040 #pragma pack() 00041 00042 /* 00043 * Sensor data size 00044 * 00045 * This function calculates size of the pixel array, which will be 00046 * transferred with the specified header. 00047 */ 00048 00049 igtl_uint32 igtl_export igtl_sensor_get_data_size(igtl_sensor_header * header); 00050 00051 /* 00052 * Byte order conversion 00053 * 00054 * This function converts endianness from host byte order to network byte order, 00055 * or vice versa. 00056 */ 00057 00058 void igtl_export igtl_sensor_convert_byte_order(igtl_sensor_header * header, igtl_float64* data); 00059 00060 00061 /* 00062 * CRC calculation 00063 * 00064 * This function calculates CRC of image data body including header 00065 * and array of pixel data. 00066 * 00067 */ 00068 00069 igtl_uint64 igtl_export igtl_sensor_get_crc(igtl_sensor_header * header, igtl_float64* data); 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif /* __IGTL_SENSOR_H */ 00076