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 
27 namespace igtl
28 {
29 
33 {
34 public:
36  typedef Object Superclass;
39 
42 
48  enum {
49  TYPE_TRACKER = 1,
50  TYPE_6D = 2,
51  TYPE_3D = 3,
52  TYPE_5D = 4,
53  };
54 
55 public:
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 
93 protected:
96 
97 protected:
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 
117 public:
122 
125 
126 public:
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 
140 protected:
143 
144 protected:
145  virtual int GetBodyPackSize();
146  virtual int PackBody();
147  virtual int UnpackBody();
148 
149 protected:
150 
152  igtlInt32 m_Resolution;
153 
155  std::string m_CoordinateName;
156 
157 };
158 
159 
161 {
162 public:
167 
170 
171 protected:
172  StopQuaternionTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_QTDATA"; };
174 
175 protected:
176  virtual int GetBodyPackSize() { return 0; };
177  virtual int PackBody() { AllocatePack(); return 1; };
178  virtual int UnpackBody() { return 1; };
179 
180 };
181 
182 
185 {
186 public:
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 
207 protected:
208  RTSQuaternionTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_QTDATA"; };
210 
212  igtlUint8 m_Status;
213 
214 protected:
215  virtual int GetBodyPackSize();
216  virtual int PackBody();
217  virtual int UnpackBody();
218 
219 };
220 
221 
226 {
227 public:
232 
235 
236 public:
237 
239  int AddQuaternionTrackingDataElement(QuaternionTrackingDataElement::Pointer& elem);
240 
242  void ClearQuaternionTrackingDataElements();
243 
245  int GetNumberOfQuaternionTrackingDataElements();
246 
248  void GetQuaternionTrackingDataElement(int index, QuaternionTrackingDataElement::Pointer& elem);
249 
250 
251 protected:
254 
255 protected:
256 
257  virtual int GetBodyPackSize();
258  virtual int PackBody();
259  virtual int UnpackBody();
260 
262  std::vector<QuaternionTrackingDataElement::Pointer> m_QuaternionTrackingDataList;
263 
264 };
265 
266 
267 } // namespace igtl
268 
269 #endif // _igtlQuaternionTrackingDataMessage_h
270 
271 
272 
std::string m_Name
Name / description (< 20 bytes)
A class for the STT_QTDATA message type.
std::vector< QuaternionTrackingDataElement::Pointer > m_QuaternionTrackingDataList
The list of trakcing data elements.
void SetStatus(igtlUint8 status)
Sets the status. 'status' must be either STATUS_SUCCESS or STATUS_ERROR.
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
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.
void SetResolution(igtlInt32 res)
Sets the time resolution for streaming of QTDATA messages.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
const char * GetCoordinateName()
Gets the name of the coordinate system.
#define IGTLCommon_EXPORT
igtlUint8 GetType()
Gets the type of the instrument/tracker.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
std::string m_CoordinateName
Name of the coordinate system.
igtlUint8 GetStatus()
Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtlUint8 m_Type
Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D)
Base class for most igtl classes.
Definition: igtlObject.h:60
const char * GetName()
Gets the name of the instrument/tracker.
A class for the RTS_QTDATA message type.

Generated at Tue Aug 4 2015 16:20:53 for OpenIGTLink by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2012