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: Open IGT Link Library
4  Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlImgmetaMessage.h $
5  Language: C++
6  Date: $Date: 2009-12-16 23:58:02 -0500 (Wed, 16 Dec 2009) $
7  Version: $Revision: 5466 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notices for more information.
14 
15 =========================================================================*/
16 
17 #ifndef __igtlQuaternionTrackingDataMessage_h
18 #define __igtlQuaternionTrackingDataMessage_h
19 
20 #include <vector>
21 #include <string>
22 
23 #include "igtlObject.h"
24 //#include "igtlMacros.h"
25 #include "igtlMath.h"
26 #include "igtlMessageBase.h"
27 #include "igtlTypes.h"
28 
29 
30 namespace igtl
31 {
32 
34 {
35 public:
37  typedef Object Superclass;
40 
43 
44  // Tracking data type
45  enum {
46  TYPE_TRACKER = 1, /* Tracker */
47  TYPE_6D = 2, /* 6D instrument (regular instrument) */
48  TYPE_3D = 3, /* 3D instrument (only tip of the instrument defined) */
49  TYPE_5D = 4, /* 5D instrument (tip and handle are defined,
50  but not the normal vector) */
51  };
52 
53 public:
54  int SetName(const char* name);
55  const char* GetName() { return this->m_Name.c_str(); };
56 
57  int SetType(igtlUint8 type);
58  igtlUint8 GetType() { return this->m_Type; };
59 
60  void SetPosition(float p[3]);
61  void GetPosition(float p[3]);
62 
63  void SetPosition(float px, float py, float pz);
64  void GetPosition(float* px, float* py, float* pz);
65 
66  void SetQuaternion(float q[4]);
67  void GetQuaternion(float q[4]);
68 
69  void SetQuaternion(float qx, float qy, float qz, float w);
70  void GetQuaternion(float* qx, float* qy, float* qz, float* w);
71 
72 protected:
75 
76 protected:
77 
78  std::string m_Name; /* Name / description (< 20 bytes) */
79  igtlUint8 m_Type; /* Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D) */
80  igtlFloat32 m_position[3]; /* position (x, y, z) */
81  igtlFloat32 m_quaternion[4]; /* orientation as quaternion (qx, qy, qz, w) */
82 };
83 
84 
86 {
87 
88 public:
93 
96 
97 public:
98  void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
99  igtlInt32 GetResolution() { return this->m_Resolution; };
100 
101  int SetCoordinateName(const char* name);
102  const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
103 
104 protected:
107 
108 protected:
109  virtual int GetBodyPackSize();
110  virtual int PackBody();
111  virtual int UnpackBody();
112 
113 protected:
114  igtlInt32 m_Resolution; /* Minimum time between two frames (ms). Use 0 for as fast as possible. */
115  std::string m_CoordinateName; /* Name of the coordinate system */
116 
117 };
118 
119 
121 {
122 public:
127 
130 
131 protected:
132  StopQuaternionTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_QTDATA"; };
134 
135 protected:
136  virtual int GetBodyPackSize() { return 0; };
137  virtual int PackBody() { AllocatePack(); return 1; };
138  virtual int UnpackBody() { return 1; };
139 
140 };
141 
142 
144 {
145 public:
150 
151  // Status type
152  enum {
153  STATUS_SUCCESS = 0,
154  STATUS_ERROR = 1
155  };
156 
157 
160 
161  void SetStatus(igtlUint8 status){ this->m_Status = status; }
162  igtlUint8 GetStatus() { return this->m_Status; };
163 
164 protected:
165  RTSQuaternionTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_QTDATA"; };
167 
168  igtlUint8 m_Status;
169 
170 protected:
171  virtual int GetBodyPackSize();
172  virtual int PackBody();
173  virtual int UnpackBody();
174 
175 };
176 
177 
179 {
180 public:
185 
188 
189 public:
190  int AddQuaternionTrackingDataElement(QuaternionTrackingDataElement::Pointer& elem);
191  void ClearQuaternionTrackingDataElements();
192 
193  int GetNumberOfQuaternionTrackingDataElements();
194  void GetQuaternionTrackingDataElement(int index, QuaternionTrackingDataElement::Pointer& elem);
195 
196 
197 protected:
200 
201 protected:
202 
203  virtual int GetBodyPackSize();
204  virtual int PackBody();
205  virtual int UnpackBody();
206 
207  std::vector<QuaternionTrackingDataElement::Pointer> m_QuaternionTrackingDataList;
208 
209 };
210 
211 
212 } // namespace igtl
213 
214 #endif // _igtlQuaternionTrackingDataMessage_h
215 
216 
217 
218 

Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2000