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 
igtl::TrajectoryElement::SetRadius
void SetRadius(igtlFloat32 radius)
Sets the radius.
Definition: igtlTrajectoryMessage.h:106
igtl::GetTrajectoryMessage::UnpackBody
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
Definition: igtlTrajectoryMessage.h:167
igtlMessageBase.h
igtl::GetTrajectoryMessage::GetBodyPackSize
virtual int GetBodyPackSize()
Gets the size of the serialized body.
Definition: igtlTrajectoryMessage.h:165
igtlNewMacro
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtl::TrajectoryElement::m_Type
igtlUint8 m_Type
Trajectory type (see TYPE_* constants)
Definition: igtlTrajectoryMessage.h:130
igtl::TrajectoryElement::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlTrajectoryMessage.h:38
igtlImageMessage.h
igtl::GetTrajectoryMessage::PackBody
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
Definition: igtlTrajectoryMessage.h:166
igtl::TrajectoryMessage::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlTrajectoryMessage.h:179
igtl::TrajectoryMessage::Superclass
MessageBase Superclass
Definition: igtlTrajectoryMessage.h:177
igtlMath.h
igtl::TrajectoryElement::Self
TrajectoryElement Self
Definition: igtlTrajectoryMessage.h:35
igtl::MessageBase
Definition: igtlMessageBase.h:55
igtl::TrajectoryElement::GetType
igtlUint8 GetType()
Gets the trajectory type. The returned value is either TYPE_ENTRY_ONLY, TYPE_TARGET_ONLY,...
Definition: igtlTrajectoryMessage.h:67
igtl::Object
Base class for most igtl classes.
Definition: igtlObject.h:60
igtl
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
Definition: igtlBindMessage.h:25
IGTLCommon_EXPORT
#define IGTLCommon_EXPORT
Definition: igtlWin32Header.h:151
igtl::GetTrajectoryMessage::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlTrajectoryMessage.h:156
igtl::TrajectoryMessage
Definition: igtlTrajectoryMessage.h:173
igtl::TrajectoryElement::GetRadius
igtlFloat32 GetRadius()
Gets the radius.
Definition: igtlTrajectoryMessage.h:109
igtl::GetTrajectoryMessage::GetTrajectoryMessage
GetTrajectoryMessage()
Definition: igtlTrajectoryMessage.h:162
igtl::TrajectoryElement::GetName
const char * GetName()
Gets the name of the trajectory.
Definition: igtlTrajectoryMessage.h:56
igtl::TrajectoryMessage::Self
TrajectoryMessage Self
Definition: igtlTrajectoryMessage.h:176
igtl::TrajectoryElement::m_Radius
igtlFloat32 m_Radius
Radius of the trajectory. Can be 0.
Definition: igtlTrajectoryMessage.h:142
igtl::TrajectoryElement::m_GroupName
std::string m_GroupName
Can be "Labeled Trajectory", "Landmark", Fiducial", ...
Definition: igtlTrajectoryMessage.h:127
igtl::GetTrajectoryMessage::Pointer
SmartPointer< Self > Pointer
Definition: igtlTrajectoryMessage.h:155
igtl::TrajectoryElement::Pointer
SmartPointer< Self > Pointer
Definition: igtlTrajectoryMessage.h:37
igtl::GetTrajectoryMessage::~GetTrajectoryMessage
~GetTrajectoryMessage()
Definition: igtlTrajectoryMessage.h:163
igtl::TrajectoryElement::Superclass
Object Superclass
Definition: igtlTrajectoryMessage.h:36
igtl::TrajectoryElement::GetOwner
const char * GetOwner()
Gets the owner of the trajectory.
Definition: igtlTrajectoryMessage.h:115
igtl::GetTrajectoryMessage
A class for the GET_TRAJ message type.
Definition: igtlTrajectoryMessage.h:150
igtl::GetTrajectoryMessage::Superclass
MessageBase Superclass
Definition: igtlTrajectoryMessage.h:154
igtl::TrajectoryElement::GetGroupName
const char * GetGroupName()
Gets the group name.
Definition: igtlTrajectoryMessage.h:62
igtl::TrajectoryElement::m_Name
std::string m_Name
name / description (< 64 bytes)
Definition: igtlTrajectoryMessage.h:124
igtl::TrajectoryMessage::m_TrajectoryList
std::vector< TrajectoryElement::Pointer > m_TrajectoryList
A list of pointers to the trajectories.
Definition: igtlTrajectoryMessage.h:210
igtl::SmartPointer< Self >
igtl::GetTrajectoryMessage::Self
GetTrajectoryMessage Self
Definition: igtlTrajectoryMessage.h:153
igtlTypeMacro
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
igtlObject.h
igtl::TrajectoryElement::m_Owner
std::string m_Owner
Device name of the ower image.
Definition: igtlTrajectoryMessage.h:145
igtl::TrajectoryMessage::Pointer
SmartPointer< Self > Pointer
Definition: igtlTrajectoryMessage.h:178
igtlTypes.h
igtl::TrajectoryElement
TrajectoryElement class is used to manage a trajectory in TrajectoryMessage class.
Definition: igtlTrajectoryMessage.h:32

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