Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
45class vtkSegmentationCore_EXPORT vtkSegment : public vtkObject
46{
47 typedef std::map<std::string, vtkSmartPointer<vtkDataObject> > RepresentationMap;
48
49public:
50
51 static const double SEGMENT_COLOR_INVALID[3];
52
53 static const char* GetTerminologyEntryTagName();
54
55 static vtkSegment* New();
56 vtkTypeMacro(vtkSegment, vtkObject);
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
60 virtual void ReadXMLAttributes(const char** atts);
61
63 void WriteXML(ostream& of, int nIndent);
64
66 virtual void DeepCopy(vtkSegment* source);
67
69 virtual void DeepCopyMetadata(vtkSegment* source);
70
73 virtual void GetBounds(double bounds[6]);
74
79 vtkDataObject* GetRepresentation(std::string name);
80
83 bool AddRepresentation(std::string type, vtkDataObject* representation);
84
87 bool RemoveRepresentation(std::string name);
88
92 void RemoveAllRepresentations(std::string exceptionRepresentationName="");
93
95 void SetTag(std::string tag, std::string value);
97 void SetTag(std::string tag, int value);
98
100 void RemoveTag(std::string tag);
101
106 bool GetTag(std::string tag, std::string &value);
108 bool HasTag(std::string tag);
110 void GetTags(std::map<std::string,std::string> &tags);
111
113 void GetContainedRepresentationNames(std::vector<std::string>& representationNames);
114
115public:
118 vtkGetStringMacro(Name);
119 vtkSetStringMacro(Name);
120
124 vtkGetVector3Macro(Color, double);
125 vtkSetVector3Macro(Color, double);
126
128 vtkGetMacro(NameAutoGenerated, bool);
129 vtkSetMacro(NameAutoGenerated, bool);
130 vtkBooleanMacro(NameAutoGenerated, bool);
131
133 vtkGetMacro(ColorAutoGenerated, bool);
134 vtkSetMacro(ColorAutoGenerated, bool);
135 vtkBooleanMacro(ColorAutoGenerated, bool);
136
138 vtkGetMacro(LabelValue, int);
139 vtkSetMacro(LabelValue, int);
140
141protected:
143 ~vtkSegment() override;
144
145protected:
147 RepresentationMap Representations;
148 char* Name;
149 double Color[3];
151 std::map<std::string,std::string> Tags;
155
156private:
157 vtkSegment(const vtkSegment&) = delete;
158 void operator=(const vtkSegment&) = delete;
159};
160
161#endif
This class encapsulates a segment that is part of a segmentation.
Definition vtkSegment.h:46
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)
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:152
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:151
void SetTag(std::string tag, int value)
Set/add integer tag.
static const char * GetTerminologyEntryTagName()
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:147
bool ColorAutoGenerated
Definition vtkSegment.h:153
void GetContainedRepresentationNames(std::vector< std::string > &representationNames)
Get representation names present in this segment in an output string vector.
virtual void DeepCopy(vtkSegment *source)
Deep copy one segment into another.
void WriteXML(ostream &of, int nIndent)
Write this object's information to a MRML file in XML format.
char * Name
Definition vtkSegment.h:148