Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlPointMessage.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 __igtlPointMessage_h
16#define __igtlPointMessage_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
28namespace igtl
29{
30
31
34{
35public:
40
43
44public:
45
47 int SetName(const char* name);
48
50 const char* GetName() { return this->m_Name.c_str(); };
51
53 int SetGroupName(const char* grpname);
54
56 const char* GetGroupName() { return this->m_GroupName.c_str(); };
57
59 void SetRGBA(igtlUint8 rgba[4]);
60
62 void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
63
65 void GetRGBA(igtlUint8* rgba);
66
68 void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
69
71 void SetPosition(igtlFloat32 position[3]);
72
74 void SetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
75
77 void GetPosition(igtlFloat32* position);
78
80 void GetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
81
83 void SetRadius(igtlFloat32 radius) { this->m_Radius = radius; };
84
86 igtlFloat32 GetRadius() { return this->m_Radius; };
87
89 int SetOwner(const char* owner);
90
92 const char* GetOwner() { return this->m_Owner.c_str(); };
93
94protected:
97
98protected:
99
101 std::string m_Name;
102
104 std::string m_GroupName;
105
107 igtlUint8 m_RGBA[4];
108
110 igtlFloat32 m_Position[3];
111
113 igtlFloat32 m_Radius;
114
116 std::string m_Owner;
117};
118
119
122{
123public:
128
131
132protected:
133 GetPointMessage() : MessageBase() { this->m_DefaultBodyType = "GET_POINT"; };
135protected:
136 virtual int GetBodyPackSize() { return 0; };
137 virtual int PackBody() { AllocatePack(); return 1; };
138 virtual int UnpackBody() { return 1; };
139};
140
141
145{
146public:
151
154
155public:
156
160
163
166
169
170
171protected:
174
175protected:
176
177 virtual int GetBodyPackSize();
178 virtual int PackBody();
179 virtual int UnpackBody();
180
182 std::vector<PointElement::Pointer> m_PointList;
183
184};
185
186
187} // namespace igtl
188
189#endif // _igtlPointMessage_h
190
191
192
A class for the GET_POINT message type.
SmartPointer< const Self > ConstPointer
virtual int GetBodyPackSize()
Gets the size of the serialized body.
SmartPointer< Self > Pointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlTypeMacro(igtl::GetPointMessage, igtl::MessageBase)
igtlNewMacro(igtl::GetPointMessage)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
Base class for most igtl classes.
Definition igtlObject.h:61
A class to manage point information.
void GetPosition(igtlFloat32 &x, igtlFloat32 &y, igtlFloat32 &z)
Gets the position of the point using x, y and z coordinates.
int SetName(const char *name)
Sets the name/description of the point. The string 'name' must not exceed 64 characters.
int SetGroupName(const char *grpname)
Sets the group name e.g. "Labeled Point", "Landmark", "Fiducial", etc.
igtlFloat32 m_Radius
Radius of the point. Can be 0.
igtlFloat32 GetRadius()
Gets the radius of the point.
void SetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z)
Sets the position of the point by x, y and z coordinates.
igtlTypeMacro(igtl::PointElement, igtl::Object)
void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a)
Sets the color of the point specified by values of R, G, B and A.
void GetPosition(igtlFloat32 *position)
Gets the position of the point using an array of x, y and z coordinates.
std::string m_Owner
Device name of the ower image.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
std::string m_GroupName
Can be "Labeled Point", "Landmark", Fiducial", ...
void GetRGBA(igtlUint8 &r, igtlUint8 &g, igtlUint8 &b, igtlUint8 &a)
Gets the color of the point using values of R, G, B and A.
void SetPosition(igtlFloat32 position[3])
Sets the position of the point by an array of x, y and z coordinates.
int SetOwner(const char *owner)
Sets the name of the image that owns this label map.
const char * GetGroupName()
Gets the group name.
void SetRGBA(igtlUint8 rgba[4])
Sets the color of the point specified by an array of R, G, B and A.
const char * GetOwner()
Gets the name of the image that owns this label map.
const char * GetName()
Gets the name/description of the point.
void GetRGBA(igtlUint8 *rgba)
Gets the color of the point using an array of R, G, B and A.
std::string m_Name
name / description (< 64 bytes)
void SetRadius(igtlFloat32 radius)
Sets the radius of the point.
igtlNewMacro(igtl::PointElement)
igtlTypeMacro(igtl::PointMessage, igtl::MessageBase)
std::vector< PointElement::Pointer > m_PointList
A list of pointers to the points.
int AddPointElement(PointElement::Pointer &elem)
void GetPointElement(int index, PointElement::Pointer &elem)
Gets a pointer to the point specified by 'index'.
void ClearPointElement()
Clears the points in the list.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlNewMacro(igtl::PointMessage)
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
SmartPointer< const Self > ConstPointer
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
int GetNumberOfPointElement()
Gets the number of points in the list.
SmartPointer< Self > Pointer
Implements transparent reference counting.
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...

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