Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlTrajectoryMessage.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 __igtlTrajectoryMessage_h
16 #define __igtlTrajectoryMessage_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 #include "igtlImageMessage.h"
27 
28 namespace igtl
29 {
30 
33 {
34 public:
36  typedef Object Superclass;
39 
42 
44  enum {
45  TYPE_ENTRY_ONLY = 1, /* Trajectory with only entry point */
46  TYPE_TARGET_ONLY = 2, /* Trajectory with only target point */
47  TYPE_ENTRY_TARGET = 3, /* Trajectory with entry and target point */
48  };
49 
50 public:
51 
53  int SetName(const char* name);
54 
56  const char* GetName() { return this->m_Name.c_str(); };
57 
59  int SetGroupName(const char* grpname);
60 
62  const char* GetGroupName() { return this->m_GroupName.c_str(); };
63 
65  int SetType(igtlUint8 type);
67  igtlUint8 GetType() { return this->m_Type; };
68 
70  void SetRGBA(igtlUint8 rgba[4]);
71 
73  void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
74 
76  void GetRGBA(igtlUint8* rgba);
77 
79  void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
80 
82  void SetEntryPosition(igtlFloat32 position[3]);
83 
85  void SetEntryPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
86 
88  void GetEntryPosition(igtlFloat32* position);
89 
91  void GetEntryPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
92 
94  void SetTargetPosition(igtlFloat32 position[3]);
95 
97  void SetTargetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
98 
100  void GetTargetPosition(igtlFloat32* position);
101 
103  void GetTargetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
104 
106  void SetRadius(igtlFloat32 radius) { this->m_Radius = radius; };
107 
109  igtlFloat32 GetRadius() { return this->m_Radius; };
110 
112  int SetOwner(const char* owner);
113 
115  const char* GetOwner() { return this->m_Owner.c_str(); };
116 
117 protected:
120 
121 protected:
122 
124  std::string m_Name;
125 
127  std::string m_GroupName;
128 
130  igtlUint8 m_Type;
131 
133  igtlUint8 m_RGBA[4];
134 
136  igtlFloat32 m_EntryPosition[3];
137 
139  igtlFloat32 m_TargetPosition[3];
140 
142  igtlFloat32 m_Radius;
143 
145  std::string m_Owner;
146 };
147 
148 
151 {
152 public:
157 
160 
161 protected:
162  GetTrajectoryMessage() : MessageBase() { this->m_DefaultBodyType = "GET_TRAJ"; };
164 protected:
165  virtual int GetBodyPackSize() { return 0; };
166  virtual int PackBody() { AllocatePack(); return 1; };
167  virtual int UnpackBody() { return 1; };
168 };
169 
170 
174 {
175 public:
180 
183 
184 public:
185 
187  int AddTrajectoryElement(TrajectoryElement::Pointer& elem);
188 
190  void ClearTrajectoryElement(TrajectoryElement::Pointer& elem);
191 
193  int GetNumberOfTrajectoryElement();
194 
196  void GetTrajectoryElement(int index, TrajectoryElement::Pointer& elem);
197 
198 
199 protected:
202 
203 protected:
204 
205  virtual int GetBodyPackSize();
206  virtual int PackBody();
207  virtual int UnpackBody();
208 
210  std::vector<TrajectoryElement::Pointer> m_TrajectoryList;
211 
212 };
213 
214 
215 } // namespace igtl
216 
217 #endif // _igtlTrajectoryMessage_h
218 
219 
220 
SmartPointer< const Self > ConstPointer
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
std::string m_Owner
Device name of the ower image.
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
igtlFloat32 GetRadius()
Gets the radius.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
SmartPointer< Self > Pointer
std::string m_Name
name / description (&lt; 64 bytes)
igtlFloat32 m_Radius
Radius of the trajectory. Can be 0.
SmartPointer< Self > Pointer
igtlUint8 m_Type
Trajectory type (see TYPE_* constants)
SmartPointer< const Self > ConstPointer
igtlUint8 GetType()
Gets the trajectory type. The returned value is either TYPE_ENTRY_ONLY, TYPE_TARGET_ONLY, or TYPE_ENTRY_TARGET.
#define IGTLCommon_EXPORT
A class for the GET_TRAJ message type.
std::string m_GroupName
Can be &quot;Labeled Trajectory&quot;, &quot;Landmark&quot;, Fiducial", ...
TrajectoryElement class is used to manage a trajectory in TrajectoryMessage class.
const char * GetName()
Gets the name of the trajectory.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
std::vector< TrajectoryElement::Pointer > m_TrajectoryList
A list of pointers to the trajectories.
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
const char * GetGroupName()
Gets the group name.
void SetRadius(igtlFloat32 radius)
Sets the radius.
Base class for most igtl classes.
Definition: igtlObject.h:60
const char * GetOwner()
Gets the owner of the trajectory.
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