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
121{
122public:
127
130
131protected:
132 GetPointMessage() : MessageBase() { this->m_SendMessageType = "GET_POINT"; };
134protected:
135 virtual int CalculateContentBufferSize() { return 0; };
136 virtual int PackContent() { AllocateBuffer(); return 1; };
137 virtual int UnpackContent() { return 1; };
138};
139
140
144{
145public:
150
153
154public:
155
159
162
165
168
169
170protected:
173
174protected:
175
177 virtual int PackContent();
178 virtual int UnpackContent();
179
181 std::vector<PointElement::Pointer> m_PointList;
182
183};
184
185
186} // namespace igtl
187
188#endif // _igtlPointMessage_h
A class for the GET_POINT message type.
SmartPointer< const Self > ConstPointer
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
SmartPointer< Self > Pointer
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
igtlTypeMacro(igtl::GetPointMessage, igtl::MessageBase)
igtlNewMacro(igtl::GetPointMessage)
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
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.
igtlNewMacro(igtl::PointMessage)
SmartPointer< const Self > ConstPointer
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
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