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
114{
115
116public:
121
124
125public:
126
128 void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
129
131 igtlInt32 GetResolution() { return this->m_Resolution; };
132
134 int SetCoordinateName(const char* name);
135
137 const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
138
139protected:
142
143protected:
145 virtual int PackContent();
146 virtual int UnpackContent();
147
148protected:
149
151 igtlInt32 m_Resolution;
152
154 std::string m_CoordinateName;
155
156};
157
158
180
181
184{
185public:
190
192 enum {
193 STATUS_SUCCESS = 0,
194 STATUS_ERROR = 1
195 };
196
199
201 void SetStatus(igtlUint8 status){ this->m_Status = status; }
202
204 igtlUint8 GetStatus() { return this->m_Status; };
205
206protected:
209
211 igtlUint8 m_Status;
212
213protected:
215 virtual int PackContent();
216 virtual int UnpackContent();
217
218};
219
220
264
265
266} // namespace igtl
267
268#endif // _igtlQuaternionTrackingDataMessage_h
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.
int AddQuaternionTrackingDataElement(QuaternionTrackingDataElement::Pointer &elem)
Adds tracking data element.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
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 tracking data elements.
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
igtlTypeMacro(igtl::QuaternionTrackingDataMessage, igtl::MessageBase)
igtlNewMacro(igtl::QuaternionTrackingDataMessage)
void ClearQuaternionTrackingDataElements()
Clears the all tracking data element in the list.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
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 PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
igtlTypeMacro(igtl::RTSQuaternionTrackingDataMessage, igtl::MessageBase)
igtlUint8 GetStatus()
Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
Implements transparent reference counting.
igtlNewMacro(igtl::StartQuaternionTrackingDataMessage)
const char * GetCoordinateName()
Gets the name of the coordinate system.
void SetResolution(igtlInt32 res)
Sets the time resolution for streaming of QTDATA messages.
igtlTypeMacro(igtl::StartQuaternionTrackingDataMessage, igtl::MessageBase)
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
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 UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
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 UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
igtlTypeMacro(igtl::StopQuaternionTrackingDataMessage, igtl::MessageBase)
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
igtlNewMacro(igtl::StopQuaternionTrackingDataMessage)
#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