Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkSegment.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Csaba Pinter, PerkLab, Queen's University
16 and was supported through the Applied Cancer Research Unit program of Cancer Care
17 Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
18
19==============================================================================*/
20
21#ifndef __vtkSegment_h
22#define __vtkSegment_h
23
24// VTK includes
25#include <vtkObject.h>
26#include <vtkSmartPointer.h>
27#include <vtkDataObject.h>
28
29// STD includes
30#include <vector>
31#include <map>
32
33// Segmentation includes
34#include "vtkSegmentationCoreConfigure.h"
35
44class vtkSegmentationCore_EXPORT vtkSegment : public vtkObject
45{
46 typedef std::map<std::string, vtkSmartPointer<vtkDataObject> > RepresentationMap;
47
48public:
49
50 static const double SEGMENT_COLOR_INVALID[3];
51
53 static const char* GetTerminologyEntryTagName();
54
59 void SetTerminology(std::string terminologyEntry);
60 std::string GetTerminology();
62
66
67 static vtkSegment* New();
68 vtkTypeMacro(vtkSegment, vtkObject);
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
72 virtual void ReadXMLAttributes(const char** atts);
73
75 void WriteXML(ostream& of, int nIndent);
76
78 virtual void DeepCopy(vtkSegment* source);
79
81 virtual void DeepCopyMetadata(vtkSegment* source);
82
85 virtual void GetBounds(double bounds[6]);
86
91 vtkDataObject* GetRepresentation(std::string name);
92
95 bool AddRepresentation(std::string type, vtkDataObject* representation);
96
99 bool RemoveRepresentation(std::string name);
100
104 void RemoveAllRepresentations(std::string exceptionRepresentationName="");
105
107 void SetTag(std::string tag, std::string value);
109 void SetTag(std::string tag, int value);
110
112 void RemoveTag(std::string tag);
113
118 bool GetTag(std::string tag, std::string &value);
120 bool HasTag(std::string tag);
122 void GetTags(std::map<std::string,std::string> &tags);
123
125 void GetContainedRepresentationNames(std::vector<std::string>& representationNames);
126
127public:
130 vtkGetStringMacro(Name);
131 vtkSetStringMacro(Name);
132
136 vtkGetVector3Macro(Color, double);
137 vtkSetVector3Macro(Color, double);
138
140 vtkGetMacro(NameAutoGenerated, bool);
141 vtkSetMacro(NameAutoGenerated, bool);
142 vtkBooleanMacro(NameAutoGenerated, bool);
143
145 vtkGetMacro(ColorAutoGenerated, bool);
146 vtkSetMacro(ColorAutoGenerated, bool);
147 vtkBooleanMacro(ColorAutoGenerated, bool);
148
150 vtkGetMacro(LabelValue, int);
151 vtkSetMacro(LabelValue, int);
152
153protected:
155 ~vtkSegment() override;
156
157protected:
159 RepresentationMap Representations;
160 char* Name;
161 double Color[3];
163 std::map<std::string,std::string> Tags;
167
168private:
169 vtkSegment(const vtkSegment&) = delete;
170 void operator=(const vtkSegment&) = delete;
171};
172
173#endif
double Color[3]
Definition vtkSegment.h:161
virtual void DeepCopyMetadata(vtkSegment *source)
Deep copy metadata (i.e., all data but representations) one segment into another.
~vtkSegment() override
void RemoveAllRepresentations(std::string exceptionRepresentationName="")
virtual void GetBounds(double bounds[6])
bool GetTag(std::string tag, std::string &value)
vtkDataObject * GetRepresentation(std::string name)
bool HasTerminology()
void PrintSelf(ostream &os, vtkIndent indent) override
bool AddRepresentation(std::string type, vtkDataObject *representation)
bool HasTag(std::string tag)
Determine if a tag is present.
bool RemoveRepresentation(std::string name)
bool NameAutoGenerated
Definition vtkSegment.h:164
void SetTag(std::string tag, std::string value)
Set/add tag.
std::map< std::string, std::string > Tags
Tags (for grouping and selection)
Definition vtkSegment.h:163
void SetTag(std::string tag, int value)
Set/add integer tag.
static const char * GetTerminologyEntryTagName()
Get tag name that stores terminology information (standard codes for describing the segment content).
virtual void ReadXMLAttributes(const char **atts)
Set attributes from name/value pairs.
void GetTags(std::map< std::string, std::string > &tags)
Get tags.
static vtkSegment * New()
void RemoveTag(std::string tag)
Remove tag.
RepresentationMap Representations
Stored representations. Map from type string to data object.
Definition vtkSegment.h:159
bool ColorAutoGenerated
Definition vtkSegment.h:165
void GetContainedRepresentationNames(std::vector< std::string > &representationNames)
Get representation names present in this segment in an output string vector.
void SetTerminology(std::string terminologyEntry)
virtual void DeepCopy(vtkSegment *source)
Deep copy one segment into another.
static const double SEGMENT_COLOR_INVALID[3]
Definition vtkSegment.h:50
void WriteXML(ostream &of, int nIndent)
Write this object's information to a MRML file in XML format.
std::string GetTerminology()
char * Name
Definition vtkSegment.h:160