Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlQuaternionTrackingDataMessage.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: The OpenIGTLink Library
4 Language: C++
5 Web page: http://openigtlink.org/
6
7 Copyright (c) Insight Software Consortium. All rights reserved.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12
13=========================================================================*/
14
15#ifndef __igtlQuaternionTrackingDataMessage_h
16#define __igtlQuaternionTrackingDataMessage_h
17
18#include <vector>
19#include <string>
20
21#include "igtlObject.h"
22#include "igtlMath.h"
23#include "igtlMessageBase.h"
24#include "igtlTypes.h"
25
26
27namespace igtl
28{
29
33{
34public:
39
42
48 enum {
49 TYPE_TRACKER = 1,
50 TYPE_6D = 2,
51 TYPE_3D = 3,
52 TYPE_5D = 4,
53 };
54
55public:
56
58 int SetName(const char* name);
59
61 const char* GetName() { return this->m_Name.c_str(); };
62
64 int SetType(igtlUint8 type);
65
67 igtlUint8 GetType() { return this->m_Type; };
68
70 void SetPosition(float p[3]);
71
73 void GetPosition(float p[3]);
74
76 void SetPosition(float px, float py, float pz);
77
79 void GetPosition(float* px, float* py, float* pz);
80
82 void SetQuaternion(float q[4]);
83
85 void GetQuaternion(float q[4]);
86
88 void SetQuaternion(float qx, float qy, float qz, float w);
89
91 void GetQuaternion(float* qx, float* qy, float* qz, float* w);
92
93protected:
96
97protected:
98
100 std::string m_Name;
101
103 igtlUint8 m_Type;
104
106 igtlFloat32 m_position[3];
107
109 igtlFloat32 m_quaternion[4];
110};
111
112
115{
116
117public:
122
125
126public:
127
129 void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
130
132 igtlInt32 GetResolution() { return this->m_Resolution; };
133
135 int SetCoordinateName(const char* name);
136
138 const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
139
140protected:
143
144protected:
145 virtual int GetBodyPackSize();
146 virtual int PackBody();
147 virtual int UnpackBody();
148
149protected:
150
152 igtlInt32 m_Resolution;
153
155 std::string m_CoordinateName;
156
157};
158
159
181
182
185{
186public:
191
193 enum {
194 STATUS_SUCCESS = 0,
195 STATUS_ERROR = 1
196 };
197
200
202 void SetStatus(igtlUint8 status){ this->m_Status = status; }
203
205 igtlUint8 GetStatus() { return this->m_Status; };
206
207protected:
208 RTSQuaternionTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_QTDATA"; };
210
212 igtlUint8 m_Status;
213
214protected:
215 virtual int GetBodyPackSize();
216 virtual int PackBody();
217 virtual int UnpackBody();
218
219};
220
221
265
266
267} // namespace igtl
268
269#endif // _igtlQuaternionTrackingDataMessage_h
270
271
272
Base class for most igtl classes.
Definition igtlObject.h:61
igtlTypeMacro(igtl::QuaternionTrackingDataElement, igtl::Object)
int SetName(const char *name)
Sets the name of the instrument/tracker.
void GetQuaternion(float q[4])
Gets the quaternion. The function substitutes the array of elements of the quaternion in 'q'.
const char * GetName()
Gets the name of the instrument/tracker.
int SetType(igtlUint8 type)
Sets the type of the instrument/tracker.
igtlUint8 m_Type
Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D)
igtlNewMacro(igtl::QuaternionTrackingDataElement)
void SetQuaternion(float qx, float qy, float qz, float w)
Sets the quaternion by elements of the quaternion (x, y, z and w).
igtlUint8 GetType()
Gets the type of the instrument/tracker.
void GetQuaternion(float *qx, float *qy, float *qz, float *w)
Gets the quaternion. The function substitutes the elements of the quaternion in 'qx',...
void SetPosition(float px, float py, float pz)
Sets the position by x, y, and z coordinates.
void GetPosition(float *px, float *py, float *pz)
Gets the position. The function substitutes the xyz coordinates in 'px', 'py', and 'pz'.
void GetPosition(float p[3])
Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'p'.
std::string m_Name
Name / description (< 20 bytes)
void SetQuaternion(float q[4])
Sets the quaternion by 4-element array.
void SetPosition(float p[3])
Sets the position by 3-element array of x, y, and z coordinates.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
int AddQuaternionTrackingDataElement(QuaternionTrackingDataElement::Pointer &elem)
Adds tracking data element.
void GetQuaternionTrackingDataElement(int index, QuaternionTrackingDataElement::Pointer &elem)
Gets the tracking data element specified by 'index'.
int GetNumberOfQuaternionTrackingDataElements()
Gets the number of tracking data elements in the list.
std::vector< QuaternionTrackingDataElement::Pointer > m_QuaternionTrackingDataList
The list of trakcing data elements.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlTypeMacro(igtl::QuaternionTrackingDataMessage, igtl::MessageBase)
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::QuaternionTrackingDataMessage)
void ClearQuaternionTrackingDataElements()
Clears the all tracking data element in the list.
void SetStatus(igtlUint8 status)
Sets the status. 'status' must be either STATUS_SUCCESS or STATUS_ERROR.
igtlUint8 m_Status
A variable to store the status.
igtlNewMacro(igtl::RTSQuaternionTrackingDataMessage)
virtual int GetBodyPackSize()
Gets the size of the serialized body.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlTypeMacro(igtl::RTSQuaternionTrackingDataMessage, igtl::MessageBase)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlUint8 GetStatus()
Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
Implements transparent reference counting.
igtlNewMacro(igtl::StartQuaternionTrackingDataMessage)
const char * GetCoordinateName()
Gets the name of the coordinate system.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
void SetResolution(igtlInt32 res)
Sets the time resolution for streaming of QTDATA messages.
igtlTypeMacro(igtl::StartQuaternionTrackingDataMessage, igtl::MessageBase)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
int SetCoordinateName(const char *name)
Sets the name of the coordinate system. The name must be defined by the user.
std::string m_CoordinateName
Name of the coordinate system.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlInt32 m_Resolution
Minimum time between two frames (ms). Use 0 for as fast as possible.
igtlInt32 GetResolution()
Gets the time resolution for streaming of QTDATA messages.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlTypeMacro(igtl::StopQuaternionTrackingDataMessage, igtl::MessageBase)
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlNewMacro(igtl::StopQuaternionTrackingDataMessage)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...

Generated for OpenIGTLink by Doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2012