Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlTrackingDataMessage.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 __igtlTrackingDataMessage_h
16 #define __igtlTrackingDataMessage_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 
31 {
32 public:
34  typedef Object Superclass;
37 
40 
46  enum {
47  TYPE_TRACKER = 1,
48  TYPE_6D = 2,
49  TYPE_3D = 3,
50  TYPE_5D = 4,
51  };
52 
53 public:
54 
56  int SetName(const char* name);
57 
59  const char* GetName() { return this->m_Name.c_str(); };
60 
62  int SetType(igtlUint8 type);
63 
65  igtlUint8 GetType() { return this->m_Type; };
66 
68  void SetPosition(float p[3]);
69 
71  void GetPosition(float p[3]);
72 
74  void SetPosition(float px, float py, float pz);
75 
77  void GetPosition(float* px, float* py, float* pz);
78 
80  void SetMatrix(Matrix4x4& mat);
81 
83  void GetMatrix(Matrix4x4& mat);
84 
85 protected:
88 
89 protected:
90 
92  std::string m_Name;
93 
95  igtlUint8 m_Type;
96 
99 };
100 
101 
104 {
105 
106 public:
111 
114 
115 public:
117  void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
118 
120  igtlInt32 GetResolution() { return this->m_Resolution; };
121 
123  int SetCoordinateName(const char* name);
124 
126  const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
127 
128 protected:
131 
132 protected:
133  virtual int GetBodyPackSize();
134  virtual int PackBody();
135  virtual int UnpackBody();
136 
137 protected:
138 
140  igtlInt32 m_Resolution;
141 
143  std::string m_CoordinateName;
144 
145 };
146 
147 
150 {
151 public:
156 
159 
160 protected:
161  StopTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_TDATA"; };
163 
164 protected:
165  virtual int GetBodyPackSize() { return 0; };
166  virtual int PackBody() { AllocatePack(); return 1; };
167  virtual int UnpackBody() { return 1; };
168 
169 };
170 
171 
174 {
175 public:
180 
182  enum {
183  STATUS_SUCCESS = 0,
184  STATUS_ERROR = 1
185  };
186 
189 
191  void SetStatus(igtlUint8 status){ this->m_Status = status; }
192 
194  igtlUint8 GetStatus() { return this->m_Status; };
195 
196 protected:
197  RTSTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_TDATA"; };
199 
201  igtlUint8 m_Status;
202 
203 protected:
204  virtual int GetBodyPackSize();
205  virtual int PackBody();
206  virtual int UnpackBody();
207 
208 };
209 
210 
217 {
218 public:
223 
226 
227 public:
228 
230  int AddTrackingDataElement(TrackingDataElement::Pointer& elem);
231 
233  void ClearTrackingDataElements();
234 
236  int GetNumberOfTrackingDataElements();
237 
238  inline int GetNumberOfTrackingDataElement() { return GetNumberOfTrackingDataElements(); }; // will be removed.
239 
241  void GetTrackingDataElement(int index, TrackingDataElement::Pointer& elem);
242 
243 
244 protected:
247 
248 protected:
249 
250  virtual int GetBodyPackSize();
251  virtual int PackBody();
252  virtual int UnpackBody();
253 
255  std::vector<TrackingDataElement::Pointer> m_TrackingDataList;
256 
257 };
258 
259 
260 } // namespace igtl
261 
262 #endif // _igtlTrackingDataMessage_h
263 
264 
265 
SmartPointer< const Self > ConstPointer
A class for the STP_TDATA message type.
std::string m_Name
Name / description (&lt; 20 bytes.
const char * GetCoordinateName()
Gets the name of the coordinate system.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
SmartPointer< const Self > ConstPointer
virtual int GetBodyPackSize()
Gets the size of the serialized body.
std::string m_CoordinateName
Name of the coordinate system.
void SetResolution(igtlInt32 res)
Sets the time resolution for streaming of QTDATA messages.
Matrix4x4 m_Matrix
Transform matrix.
const char * GetName()
Gets the name of the instrument/tracker.
igtlInt32 m_Resolution
Minimum time between two frames (ms). Use 0 for as fast as possible.
#define IGTLCommon_EXPORT
void SetStatus(igtlUint8 status)
Sets the status. &#39;status&#39; must be either STATUS_SUCCESS or STATUS_ERROR.
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.
A class for the RTS_TDATA message type.
SmartPointer< const Self > ConstPointer
SmartPointer< const Self > ConstPointer
A class for the STT_TDATA message type.
std::vector< TrackingDataElement::Pointer > m_TrackingDataList
The list of trakcing data elements.
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtlUint8 m_Type
Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D)
igtlUint8 GetStatus()
Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
Base class for most igtl classes.
Definition: igtlObject.h:60
float Matrix4x4[4][4]
Definition: igtlMath.h:23
igtlUint8 GetType()
Gets the type of the instrument/tracker.
SmartPointer< const Self > ConstPointer

Generated at Mon Nov 11 2013 00:36:45 for OpenIGTLink by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2012