Main Page
Namespace List
Class Hierarchy
Alphabetical List
Compound List
File List
Namespace Members
Compound Members
File Members
Source
igtlutil
igtl_qtdata.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_QTDATA_H
18
#define __IGTL_QTDATA_H
19
20
#include "
igtl_win32header.h
"
21
#include "
igtl_util.h
"
22
#include "
igtl_types.h
"
23
24
#define IGTL_QTDATA_ELEMENT_SIZE 50
25
#define IGTL_STT_QTDATA_SIZE 36
26
#define IGTL_RTS_QTDATA_SIZE 1
27
28
#define IGTL_QTDATA_LEN_NAME 20
/* Maximum length of tracking instrument name */
29
#define IGTL_STT_QTDATA_LEN_COORDNAME 32
/* Maximum length of coordinate system name */
30
31
#define IGTL_QTDATA_TYPE_TRACKER 1
/* Tracker */
32
#define IGTL_QTDATA_TYPE_6D 2
/* 6D instrument (regular instrument) */
33
#define IGTL_QTDATA_TYPE_3D 3
/* 3D instrument (only tip of the instrument defined) */
34
#define IGTL_QTDATA_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_QTDATA_LEN_NAME
];
/* Name of instrument / tracker */
50
igtl_uint8 type;
/* Tracking data type (1-4) */
51
igtl_uint8 reserved;
/* Reserved byte */
52
igtl_float32 position[3];
/* position (x, y, z) */
53
igtl_float32 quaternion[4];
/* orientation as quaternion (qx, qy, qz, w) */
54
}
igtl_qtdata_element
;
55
56
57
typedef
struct
{
58
igtl_int32 resolution;
/* Minimum time between two frames. Use 0 for as fast as possible. */
59
/* If e.g. 50 ms is specified, the maximum update rate will be 20 Hz. */
60
char
coord_name[
IGTL_STT_QTDATA_LEN_COORDNAME
];
/* Name of the coordinate system */
61
}
igtl_stt_qtdata
;
62
63
typedef
struct
{
64
igtl_int8 status;
/* 0: Success 1: Error */
65
}
igtl_rts_qtdata
;
66
67
#pragma pack()
68
69
/*
70
* Macros for qtdata data size
71
*
72
* igtl_qtdata_get_data_size(n) calculates the size of body based on the number
73
* of qtdatas. The size of body is used in the message header.
74
* igtl_qtdata_get_data_n(size) calculates the number of qtdatas in the body, based on
75
* the body size. This function may be used when a client program parses a QTDATA message.
76
*
77
*/
78
79
#define igtl_qtdata_get_data_size(n) ((n) * IGTL_QTDATA_ELEMENT_SIZE)
80
#define igtl_qtdata_get_data_n(size) ((size) / IGTL_QTDATA_ELEMENT_SIZE)
81
82
/*
83
* Byte order conversion for an array of QTDATA, STT_QTDATA and RTS_QTDATA data structure
84
*
85
* This function converts endianness of each element in an array of
86
* igtl_qtdata_element from host byte order to network byte order,
87
* or vice versa.
88
*/
89
90
void
igtl_export
igtl_qtdata_convert_byte_order
(
igtl_qtdata_element
* qtdatalist,
int
nelem);
91
void
igtl_export
igtl_stt_qtdata_convert_byte_order
(
igtl_stt_qtdata
* stt_qtdata);
92
void
igtl_export
igtl_rts_qtdata_convert_byte_order
(
igtl_rts_qtdata
* rts_qtdata);
93
94
95
/*
96
* CRC calculation
97
*
98
* These functions calculate CRC of QTDATA, STT_QTDATA and RTS_QTDATA messages
99
*
100
*/
101
102
igtl_uint64
igtl_export
igtl_qtdata_get_crc
(
igtl_qtdata_element
* qtdatalist,
int
nelem);
103
igtl_uint64
igtl_export
igtl_stt_qtdata_get_crc
(
igtl_stt_qtdata
* stt_qtdata);
104
igtl_uint64
igtl_export
igtl_rts_qtdata_get_crc
(
igtl_rts_qtdata
* rts_qtdata);
105
106
#ifdef __cplusplus
107
}
108
#endif
109
110
#endif
/* __IGTL_QTDATA_H */
111
112
113
Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by
1.8.1.2 written by
Dimitri van Heesch
, © 1997-2000