Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlLabelMetaMessage.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 __igtlLabelMetaMessage_h
16 #define __igtlLabelMetaMessage_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 
32 {
33 public:
35  typedef Object Superclass;
38 
41 
42 public:
43 
45  int SetName(const char* name);
46 
48  const char* GetName() { return this->m_Name.c_str(); };
49 
52  int SetDeviceName(const char* devname);
53 
55  const char* GetDeviceName() { return this->m_DeviceName.c_str(); };
56 
58  void SetLabel(igtlUint8 label) { this->m_Label = label; };
59 
61  igtlUint8 GetLabel() { return this->m_Label; };
62 
64  void SetRGBA(igtlUint8 rgba[4]);
65 
67  void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
68 
70  void GetRGBA(igtlUint8* rgba);
71 
73  void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
74 
77  void SetSize(igtlUint16 size[3]);
78 
80  void SetSize(igtlUint16 si, igtlUint16 sj, igtlUint16 sk);
81 
84  void GetSize(igtlUint16* size);
85 
87  void GetSize(igtlUint16& si, igtlUint16& sj, igtlUint16& sk);
88 
90  int SetOwner(const char* owner);
91 
93  const char* GetOwner() { return this->m_Owner.c_str(); };
94 
95 protected:
98 
99 protected:
100 
102  std::string m_Name;
103 
105  std::string m_DeviceName;
106 
108  igtlUint8 m_Label;
109 
111  igtlUint8 m_RGBA[4];
112 
114  igtlUint16 m_Size[3];
115 
117  std::string m_Owner;
118 
119 };
120 
121 
124 {
125 public:
130 
133 
134 protected:
135  GetLabelMetaMessage() : MessageBase() { this->m_DefaultBodyType = "GET_LBMETA"; };
137 protected:
138  virtual int GetBodyPackSize() { return 0; };
139  virtual int PackBody() { AllocatePack(); return 1; };
140  virtual int UnpackBody() { return 1; };
141 };
142 
143 
148 {
149 public:
154 
157 
158 public:
159 
161  int AddLabelMetaElement(LabelMetaElement::Pointer& elem);
162 
164  void ClearLabelMetaElement();
165 
167  int GetNumberOfLabelMetaElement();
168 
170  void GetLabelMetaElement(int index, LabelMetaElement::Pointer& elem);
171 
172 
173 protected:
175  ~LabelMetaMessage();
176 
177 protected:
178 
179  virtual int GetBodyPackSize();
180  virtual int PackBody();
181  virtual int UnpackBody();
182 
183  // A list of pointers to label meta data.
184  std::vector<LabelMetaElement::Pointer> m_LabelMetaList;
185 
186 };
187 
188 
189 } // namespace igtl
190 
191 #endif // _igtlLabelMetaMessage_h
192 
193 
194 
igtl::GetLabelMetaMessage::UnpackBody
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
Definition: igtlLabelMetaMessage.h:140
igtlMessageBase.h
igtl::LabelMetaElement::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlLabelMetaMessage.h:37
igtl::LabelMetaElement::GetLabel
igtlUint8 GetLabel()
Gets the label of the structure.
Definition: igtlLabelMetaMessage.h:61
igtlNewMacro
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
igtl::LabelMetaMessage::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlLabelMetaMessage.h:153
igtl::LabelMetaMessage::Self
LabelMetaMessage Self
Definition: igtlLabelMetaMessage.h:150
igtlImageMessage.h
igtl::LabelMetaElement::m_DeviceName
std::string m_DeviceName
Device name to query the IMAGE and COLORT.
Definition: igtlLabelMetaMessage.h:105
igtlMath.h
igtl::LabelMetaElement::GetName
const char * GetName()
Gets the image name/description.
Definition: igtlLabelMetaMessage.h:48
igtl::MessageBase
Definition: igtlMessageBase.h:55
igtl::LabelMetaMessage
Definition: igtlLabelMetaMessage.h:147
igtl::Object
Base class for most igtl classes.
Definition: igtlObject.h:60
igtl::LabelMetaMessage::Superclass
MessageBase Superclass
Definition: igtlLabelMetaMessage.h:151
igtl::GetLabelMetaMessage::~GetLabelMetaMessage
~GetLabelMetaMessage()
Definition: igtlLabelMetaMessage.h:136
igtl
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
Definition: igtlBindMessage.h:25
igtl::LabelMetaMessage::Pointer
SmartPointer< Self > Pointer
Definition: igtlLabelMetaMessage.h:152
IGTLCommon_EXPORT
#define IGTLCommon_EXPORT
Definition: igtlWin32Header.h:151
igtl::GetLabelMetaMessage::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: igtlLabelMetaMessage.h:129
igtl::GetLabelMetaMessage::GetLabelMetaMessage
GetLabelMetaMessage()
Definition: igtlLabelMetaMessage.h:135
igtl::GetLabelMetaMessage::Superclass
MessageBase Superclass
Definition: igtlLabelMetaMessage.h:127
igtl::LabelMetaElement::Superclass
Object Superclass
Definition: igtlLabelMetaMessage.h:35
igtl::LabelMetaElement::Pointer
SmartPointer< Self > Pointer
Definition: igtlLabelMetaMessage.h:36
igtl::GetLabelMetaMessage::PackBody
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
Definition: igtlLabelMetaMessage.h:139
igtl::GetLabelMetaMessage::Pointer
SmartPointer< Self > Pointer
Definition: igtlLabelMetaMessage.h:128
igtl::GetLabelMetaMessage::Self
GetLabelMetaMessage Self
Definition: igtlLabelMetaMessage.h:126
igtl::GetLabelMetaMessage
A class for the GET_LBMETA message type.
Definition: igtlLabelMetaMessage.h:123
igtl::LabelMetaElement::GetDeviceName
const char * GetDeviceName()
Gets the device name (message name).
Definition: igtlLabelMetaMessage.h:55
igtl::LabelMetaElement
Definition: igtlLabelMetaMessage.h:31
igtl::LabelMetaMessage::m_LabelMetaList
std::vector< LabelMetaElement::Pointer > m_LabelMetaList
Definition: igtlLabelMetaMessage.h:184
igtl::LabelMetaElement::Self
LabelMetaElement Self
Definition: igtlLabelMetaMessage.h:34
igtl::LabelMetaElement::SetLabel
void SetLabel(igtlUint8 label)
Sets the label of the structure.
Definition: igtlLabelMetaMessage.h:58
igtl::SmartPointer< Self >
igtlTypeMacro
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
igtlObject.h
igtl::LabelMetaElement::GetOwner
const char * GetOwner()
Gets the name of the image that owns this label map.
Definition: igtlLabelMetaMessage.h:93
igtlTypes.h
igtl::LabelMetaElement::m_Name
std::string m_Name
Name / description (<= 64 bytes)
Definition: igtlLabelMetaMessage.h:102
igtl::LabelMetaElement::m_Owner
std::string m_Owner
device name of the owner image. (can be empty)
Definition: igtlLabelMetaMessage.h:117
igtl::LabelMetaElement::m_Label
igtlUint8 m_Label
Label.
Definition: igtlLabelMetaMessage.h:108
igtl::GetLabelMetaMessage::GetBodyPackSize
virtual int GetBodyPackSize()
Gets the size of the serialized body.
Definition: igtlLabelMetaMessage.h:138

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