Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtl_tdata.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: OpenIGTLink Library
4  Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlutil/igtl_position.h $
5  Language: C
6  Date: $Date: 2009-11-13 11:37:44 -0500 (Fri, 13 Nov 2009) $
7  Version: $Revision: 5335 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notices for more information.
14 
15 =========================================================================*/
16 
17 #ifndef __IGTL_TDATA_H
18 #define __IGTL_TDATA_H
19 
20 #include "igtl_win32header.h"
21 #include "igtl_util.h"
22 #include "igtl_types.h"
23 
24 #define IGTL_TDATA_ELEMENT_SIZE 70
25 #define IGTL_STT_TDATA_SIZE 36
26 #define IGTL_RTS_TDATA_SIZE 1
27 
28 #define IGTL_TDATA_LEN_NAME 20 /* Maximum length of tracking instrument name */
29 #define IGTL_STT_TDATA_LEN_COORDNAME 32 /* Maximum length of coordinate system name */
30 
31 #define IGTL_TDATA_TYPE_TRACKER 1 /* Tracker */
32 #define IGTL_TDATA_TYPE_6D 2 /* 6D instrument (regular instrument) */
33 #define IGTL_TDATA_TYPE_3D 3 /* 3D instrument (only tip of the instrument defined) */
34 #define IGTL_TDATA_TYPE_5D 4 /* 5D instrument (tip and handle are defined,
35  but not the normal vector) */
36 
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #pragma pack(1) /* For 1-byte boundary in memroy */
43 /*
44  * Status data header for OpenIGTLinik protocol
45  *
46  */
47 
48 typedef struct {
49  char name[IGTL_TDATA_LEN_NAME]; /* Name of instrument / tracker */
50  igtl_uint8 type; /* Tracking data type (1-4) */
51  igtl_uint8 reserved; /* Reserved byte */
52  igtl_float32 transform[12]; /* same as TRANSFORM */
54 
55 
56 typedef struct {
57  igtl_int32 resolution; /* Minimum time between two frames. Use 0 for as fast as possible. */
58  /* If e.g. 50 ms is specified, the maximum update rate will be 20 Hz. */
59  char coord_name[IGTL_STT_TDATA_LEN_COORDNAME]; /* Name of the coordinate system */
61 
62 typedef struct {
63  igtl_int8 status; /* 0: Success 1: Error */
65 
66 #pragma pack()
67 
68 /*
69  * Macros for tdata data size
70  *
71  * igtl_tdata_get_data_size(n) calculates the size of body based on the number
72  * of tdatas. The size of body is used in the message header.
73  * igtl_tdata_get_data_n(size) calculates the number of tdatas in the body, based on
74  * the body size. This function may be used when a client program parses a TDATA message.
75  *
76  */
77 
78 #define igtl_tdata_get_data_size(n) ((n) * IGTL_TDATA_ELEMENT_SIZE)
79 #define igtl_tdata_get_data_n(size) ((size) / IGTL_TDATA_ELEMENT_SIZE)
80 
81 /*
82  * Byte order conversion for an array of TDATA, STT_TDATA and RTS_TDATA data structure
83  *
84  * This function converts endianness of each element in an array of
85  * igtl_tdata_element from host byte order to network byte order,
86  * or vice versa.
87  */
88 
92 
93 
94 /*
95  * CRC calculation
96  *
97  * These functions calculate CRC of TDATA, STT_TDATA and RTS_TDATA messages
98  *
99  */
100 
101 igtl_uint64 igtl_export igtl_tdata_get_crc(igtl_tdata_element* tdatalist, int nelem);
102 igtl_uint64 igtl_export igtl_stt_tdata_get_crc(igtl_stt_tdata* stt_tdata);
103 igtl_uint64 igtl_export igtl_rts_tdata_get_crc(igtl_rts_tdata* rts_tdata);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* __IGTL_TDATA_H */
110 
111 
112 

Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2000