Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
45 class vtkSegmentationCore_EXPORT vtkSegment : public vtkObject
46 {
47  typedef std::map<std::string, vtkSmartPointer<vtkDataObject> > RepresentationMap;
48 
49 public:
50  static const double SEGMENT_COLOR_INVALID[3];
51 
52  static const char* GetTerminologyEntryTagName();
53 
54  static vtkSegment* New();
55  vtkTypeMacro(vtkSegment, vtkObject);
56  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
57 
59  virtual void ReadXMLAttributes(const char** atts);
60 
62  void WriteXML(ostream& of, int nIndent);
63 
65  virtual void DeepCopy(vtkSegment* source);
66 
68  virtual void DeepCopyMetadata(vtkSegment* source);
69 
72  virtual void GetBounds(double bounds[6]);
73 
78  vtkDataObject* GetRepresentation(std::string name);
79 
81  void AddRepresentation(std::string type, vtkDataObject* representation);
82 
84  void RemoveRepresentation(std::string name);
85 
89  void RemoveAllRepresentations(std::string exceptionRepresentationName="");
90 
92  void SetTag(std::string tag, std::string value);
94  void SetTag(std::string tag, int value);
95 
97  void RemoveTag(std::string tag);
98 
103  bool GetTag(std::string tag, std::string &value);
105  bool HasTag(std::string tag);
107  void GetTags(std::map<std::string,std::string> &tags);
108 
110  void GetContainedRepresentationNames(std::vector<std::string>& representationNames);
111 
112 public:
113  vtkGetStringMacro(Name);
114  vtkSetStringMacro(Name);
115 
116  vtkGetVector3Macro(Color, double);
117  vtkSetVector3Macro(Color, double);
118 
119  vtkGetMacro(NameAutoGenerated, bool);
120  vtkSetMacro(NameAutoGenerated, bool);
121  vtkBooleanMacro(NameAutoGenerated, bool);
122 
123  vtkGetMacro(ColorAutoGenerated, bool);
124  vtkSetMacro(ColorAutoGenerated, bool);
125  vtkBooleanMacro(ColorAutoGenerated, bool);
126 
127 protected:
128  vtkSegment();
129  ~vtkSegment();
130  void operator=(const vtkSegment&);
131 
132 protected:
134  RepresentationMap Representations;
135 
138  char* Name;
139 
143  double Color[3];
144 
146  std::map<std::string,std::string> Tags;
147 
152 };
153 
154 #endif // __vtkSegment_h
std::map< std::string, std::string > Tags
Tags (for grouping and selection)
Definition: vtkSegment.h:146
This class encapsulates a segment that is part of a segmentation.
Definition: vtkSegment.h:45
bool NameAutoGenerated
Flag indicating whether name was automatically generated. False after user manually overrides...
Definition: vtkSegment.h:149
RepresentationMap Representations
Stored representations. Map from type string to data object.
Definition: vtkSegment.h:134
bool ColorAutoGenerated
Flag indicating whether color was automatically generated. False after user manually overrides...
Definition: vtkSegment.h:151
char * Name
Definition: vtkSegment.h:138