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: 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 __igtlTrackingDataMessage_h
18 #define __igtlTrackingDataMessage_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 SetMatrix(Matrix4x4& mat);
67  void GetMatrix(Matrix4x4& mat);
68 
69 protected:
72 
73 protected:
74 
75  std::string m_Name; /* Name / description (< 20 bytes) */
76  igtlUint8 m_Type; /* Tracking data type (TYPE_TRACKER, TYPE_6D, TYPE_3D, TYPE_5D) */
77  Matrix4x4 m_Matrix; /* Transform matrix */
78 };
79 
80 
82 {
83 
84 public:
89 
92 
93 public:
94  void SetResolution(igtlInt32 res) { this->m_Resolution = res; }; // ms
95  igtlInt32 GetResolution() { return this->m_Resolution; };
96 
97  int SetCoordinateName(const char* name);
98  const char* GetCoordinateName() { return this->m_CoordinateName.c_str(); };
99 
100 protected:
103 
104 protected:
105  virtual int GetBodyPackSize();
106  virtual int PackBody();
107  virtual int UnpackBody();
108 
109 protected:
110  igtlInt32 m_Resolution; /* Minimum time between two frames (ms). Use 0 for as fast as possible. */
111  std::string m_CoordinateName; /* Name of the coordinate system */
112 
113 };
114 
115 
117 {
118 public:
123 
126 
127 protected:
128  StopTrackingDataMessage() : MessageBase() { this->m_DefaultBodyType = "STP_TDATA"; };
130 
131 protected:
132  virtual int GetBodyPackSize() { return 0; };
133  virtual int PackBody() { AllocatePack(); return 1; };
134  virtual int UnpackBody() { return 1; };
135 
136 };
137 
138 
140 {
141 public:
146 
147  // Status type
148  enum {
149  STATUS_SUCCESS = 0,
150  STATUS_ERROR = 1
151  };
152 
153 
156 
157  void SetStatus(igtlUint8 status){ this->m_Status = status; }
158  igtlUint8 GetStatus() { return this->m_Status; };
159 
160 protected:
161  RTSTrackingDataMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_TDATA"; };
163 
164  igtlUint8 m_Status;
165 
166 protected:
167  virtual int GetBodyPackSize();
168  virtual int PackBody();
169  virtual int UnpackBody();
170 
171 };
172 
173 
174 
176 {
177 public:
182 
185 
186 public:
187  int AddTrackingDataElement(TrackingDataElement::Pointer& elem);
188  void ClearTrackingDataElements();
189 
190  int GetNumberOfTrackingDataElements();
191  inline int GetNumberOfTrackingDataElement() { return GetNumberOfTrackingDataElements(); }; // will be removed.
192  void GetTrackingDataElement(int index, TrackingDataElement::Pointer& elem);
193 
194 
195 protected:
198 
199 protected:
200 
201  virtual int GetBodyPackSize();
202  virtual int PackBody();
203  virtual int UnpackBody();
204 
205  std::vector<TrackingDataElement::Pointer> m_TrackingDataList;
206 
207 };
208 
209 
210 } // namespace igtl
211 
212 #endif // _igtlTrackingDataMessage_h
213 
214 
215 
216 

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