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
27namespace igtl
28{
29
31{
32public:
37
40
46 enum {
47 TYPE_TRACKER = 1,
48 TYPE_6D = 2,
49 TYPE_3D = 3,
50 TYPE_5D = 4,
51 };
52
53public:
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
85protected:
88
89protected:
90
92 std::string m_Name;
93
95 igtlUint8 m_Type;
96
99};
100
101
104{
105
106public:
111
114
115public:
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
128protected:
131
132protected:
133 virtual int GetBodyPackSize();
134 virtual int PackBody();
135 virtual int UnpackBody();
136
137protected:
138
140 igtlInt32 m_Resolution;
141
143 std::string m_CoordinateName;
144
145};
146
147
150{
151public:
156
159
160protected:
161 StopTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_TDATA"; };
163
164protected:
165 virtual int GetBodyPackSize() { return 0; };
166 virtual int PackBody() { AllocatePack(); return 1; };
167 virtual int UnpackBody() { return 1; };
168
169};
170
171
174{
175public:
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
196protected:
197 RTSTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_TDATA"; };
199
201 igtlUint8 m_Status;
202
203protected:
204 virtual int GetBodyPackSize();
205 virtual int PackBody();
206 virtual int UnpackBody();
207
208};
209
210
217{
218public:
223
226
227public:
228
231
234
237
238 inline int GetNumberOfTrackingDataElement() { return GetNumberOfTrackingDataElements(); }; // will be removed.
239
242
243
244protected:
247
248protected:
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
Base class for most igtl classes.
Definition igtlObject.h:61
A class for the RTS_TDATA message type.
igtlTypeMacro(igtl::RTSTrackingDataMessage, igtl::MessageBase)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::RTSTrackingDataMessage)
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlUint8 GetStatus()
Gets the status. The function returns either STATUS_SUCCESS or STATUS_ERROR.
igtlUint8 m_Status
A variable to store the status.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
SmartPointer< const Self > ConstPointer
void SetStatus(igtlUint8 status)
Sets the status. 'status' must be either STATUS_SUCCESS or STATUS_ERROR.
Implements transparent reference counting.
A class for the STT_TDATA message type.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
SmartPointer< const Self > ConstPointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
const char * GetCoordinateName()
Gets the name of the coordinate system.
void SetResolution(igtlInt32 res)
Sets the time resolution for streaming of QTDATA messages.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlInt32 m_Resolution
Minimum time between two frames (ms). Use 0 for as fast as possible.
igtlTypeMacro(igtl::StartTrackingDataMessage, igtl::MessageBase)
igtlInt32 GetResolution()
Gets the time resolution for streaming of QTDATA messages.
std::string m_CoordinateName
Name of the coordinate system.
igtlNewMacro(igtl::StartTrackingDataMessage)
int SetCoordinateName(const char *name)
Sets the name of the coordinate system. The name must be defined by the user.
A class for the STP_TDATA message type.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlNewMacro(igtl::StopTrackingDataMessage)
SmartPointer< const Self > ConstPointer
igtlTypeMacro(igtl::StopTrackingDataMessage, igtl::MessageBase)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
void SetMatrix(Matrix4x4 &mat)
Sets the 4-by-4 transformation matrix.
SmartPointer< const Self > ConstPointer
igtlNewMacro(igtl::TrackingDataElement)
int SetType(igtlUint8 type)
Sets the type of the instrument/tracker.
Matrix4x4 m_Matrix
Transform matrix.
int SetName(const char *name)
Sets the name of the instrument/tracker.
igtlTypeMacro(igtl::TrackingDataElement, igtl::Object)
std::string m_Name
Name / description (< 20 bytes.
igtlUint8 m_Type
Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D)
const char * GetName()
Gets the name of the instrument/tracker.
igtlUint8 GetType()
Gets the type of the instrument/tracker.
void GetPosition(float p[3])
Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'p'.
void GetMatrix(Matrix4x4 &mat)
Gets the 4-by-4 transformation matrix.
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 SetPosition(float p[3])
Sets the position by 3-element array of x, y, and z coordinates.
int AddTrackingDataElement(TrackingDataElement::Pointer &elem)
Adds tracking data element.
igtlTypeMacro(igtl::TrackingDataMessage, igtl::MessageBase)
virtual int GetBodyPackSize()
Gets the size of the serialized body.
std::vector< TrackingDataElement::Pointer > m_TrackingDataList
The list of trakcing data elements.
igtlNewMacro(igtl::TrackingDataMessage)
SmartPointer< const Self > ConstPointer
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
void GetTrackingDataElement(int index, TrackingDataElement::Pointer &elem)
Gets the tracking data element specified by 'index'.
void ClearTrackingDataElements()
Clears the all tracking data element in the list.
int GetNumberOfTrackingDataElements()
Gets the number of tracking data elements in the list.
virtual int PackBody()
Packs (serialize) 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...
float Matrix4x4[4][4]
Definition igtlMath.h:23

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