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
28namespace igtl
29{
30
32{
33public:
38
41
42public:
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
95protected:
98
99protected:
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{
125public:
130
133
134protected:
135 GetLabelMetaMessage() : MessageBase() { this->m_SendMessageType = "GET_LBMETA"; };
137protected:
138 virtual int CalculateContentBufferSize() { return 0; };
139 virtual int PackContent() { AllocateBuffer(); return 1; };
140 virtual int UnpackContent() { return 1; };
141};
142
143
148{
149public:
154
157
158public:
159
162
165
168
171
172
173protected:
176
177protected:
178
180 virtual int PackContent();
181 virtual int UnpackContent();
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
A class for the GET_LBMETA message type.
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
igtlNewMacro(igtl::GetLabelMetaMessage)
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
igtlTypeMacro(igtl::GetLabelMetaMessage, igtl::MessageBase)
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
SmartPointer< const Self > ConstPointer
void GetRGBA(igtlUint8 &r, igtlUint8 &g, igtlUint8 &b, igtlUint8 &a)
Gets the color of the structure by R, G, B, and A values.
void GetSize(igtlUint16 *size)
void SetRGBA(igtlUint8 rgba[4])
Sets the color of the structure by an array representing RGBA.
const char * GetOwner()
Gets the name of the image that owns this label map.
const char * GetDeviceName()
Gets the device name (message name).
void SetSize(igtlUint16 si, igtlUint16 sj, igtlUint16 sk)
Sets the size of the image by the numbers of voxels in i, j, and k directions.
int SetDeviceName(const char *devname)
int SetOwner(const char *owner)
Sets the name of the image that owns this label map.
SmartPointer< const Self > ConstPointer
void SetLabel(igtlUint8 label)
Sets the label of the structure.
std::string m_Owner
device name of the owner image. (can be empty)
std::string m_Name
Name / description (<= 64 bytes)
int SetName(const char *name)
Sets the image name/description. The string 'name' must not exceed 64 characters.
void GetSize(igtlUint16 &si, igtlUint16 &sj, igtlUint16 &sk)
Gets the size of the image by the numbers of voxels in i, j, and k directions.
void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a)
Sets the color of the structure by R, G, B, and A values.
SmartPointer< Self > Pointer
void GetRGBA(igtlUint8 *rgba)
Gets the color of the structure by an array representing RGBA.
std::string m_DeviceName
Device name to query the IMAGE and COLORT.
igtlNewMacro(igtl::LabelMetaElement)
igtlTypeMacro(igtl::LabelMetaElement, igtl::Object)
void SetSize(igtlUint16 size[3])
igtlUint8 GetLabel()
Gets the label of the structure.
const char * GetName()
Gets the image name/description.
igtlNewMacro(igtl::LabelMetaMessage)
int GetNumberOfLabelMetaElement()
Gets the number of the label meta elements in the list.
void GetLabelMetaElement(int index, LabelMetaElement::Pointer &elem)
Gets the label meta element specified by the index.
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
virtual int PackContent()
Packs (serialize) the content. Must be implemented in all child classes.
void ClearLabelMetaElement()
Clears the all label meta elements in the list.
igtlTypeMacro(igtl::LabelMetaMessage, igtl::MessageBase)
std::vector< LabelMetaElement::Pointer > m_LabelMetaList
int AddLabelMetaElement(LabelMetaElement::Pointer &elem)
Adds an label meta element to the list.
virtual int UnpackContent()
Unpacks (deserialize) the content. Must be implemented in all child classes.
virtual int CalculateContentBufferSize()
Gets the size of the serialized content.
Base class for most igtl classes.
Definition igtlObject.h:61
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