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
vtkSegmentationConversionPath.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==============================================================================*/
16
17#ifndef __vtkSegmentationConversionPath_h
18#define __vtkSegmentationConversionPath_h
19
20// VTK includes
21#include <vtkCollection.h>
22#include <vtkObject.h>
23
24// STD includes
25#include <vector>
26
27// Segmentation includes
28#include "vtkSegmentationCoreConfigure.h"
29
31
35class vtkSegmentationCore_EXPORT vtkSegmentationConversionPath : public vtkObject
36{
37public:
39 vtkTypeMacro(vtkSegmentationConversionPath, vtkObject);
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
45 unsigned int GetCost();
46
49
52
55
57 vtkSegmentationConverterRule* GetRule(int index) VTK_EXPECTS(0 <= index && index < GetNumberOfRules());
58
60 void RemoveRule(int index) VTK_EXPECTS(0 <= index && index < GetNumberOfRules());
61
64
68
69protected:
70
71 std::vector< vtkSmartPointer<vtkSegmentationConverterRule> > Rules;
72
73protected:
76
77private:
79 void operator=(const vtkSegmentationConversionPath&) = delete;
80};
81
82
86class vtkSegmentationCore_EXPORT vtkSegmentationConversionPaths : public vtkCollection
87{
88public:
89 vtkTypeMacro(vtkSegmentationConversionPaths, vtkCollection);
91 void PrintSelf(ostream& os, vtkIndent indent) override;
92
95
98
101
103 vtkSegmentationConversionPath* GetPath(int index) { return vtkSegmentationConversionPath::SafeDownCast(this->GetItemAsObject(index)); }
104
107 vtkSegmentationConversionPath* GetNextPath(vtkCollectionSimpleIterator& cookie);
108
110 int GetNumberOfPaths() { return this->GetNumberOfItems(); };
111
112protected:
115
116private:
117 // hide the standard AddItem from the user and the compiler.
118 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
119
120private:
122 void operator=(const vtkSegmentationConversionPaths&) = delete;
123};
124
125//----------------------------------------------------------------------------
127{
128 this->vtkCollection::AddItem(f);
129}
130
131//----------------------------------------------------------------------------
133{
134 vtkSegmentationConversionPath* path = nullptr;
135 vtkCollectionSimpleIterator it;
136 for (paths->InitTraversal(it); (path = paths->GetNextPath(it));)
137 {
138 this->AddItem(path);
139 }
140}
141
142//----------------------------------------------------------------------------
144{
145 return static_cast<vtkSegmentationConversionPath*>(this->GetNextItemAsObject());
146}
147
148#endif
Store a segmentation conversion path.
vtkSegmentationConverterRule * GetRule(int index) VTK_EXPECTS(0<
Get index-th rule.
void Copy(vtkSegmentationConversionPath *source)
int AddRule(vtkSegmentationConverterRule *rule)
Add a rule to the end of the rule list. Return the index of this rule.
void PrintSelf(ostream &os, vtkIndent indent) override
~vtkSegmentationConversionPath() override
void RemoveAllRules()
Remove all rules from this path.
void AddRules(vtkSegmentationConversionPath *path)
Concatenate all rules in "path" and to this conversion path.
std::vector< vtkSmartPointer< vtkSegmentationConverterRule > > Rules
static vtkSegmentationConversionPath * New()
void RemoveRule(int index) VTK_EXPECTS(0<
Remove index-th rule.
int GetNumberOfRules()
Return number of rules that make up this conversion path.
static vtkSegmentationConversionPath * SafeDownCast(vtkObject *o)
Store multiple segmentation conversion paths.
void AddPath(vtkSegmentationConversionPath *)
Add a path to the list.
int GetNumberOfPaths()
Get number of conversion paths stored in the collection.
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSegmentationConversionPath * GetNextPath()
Get the next path in the list.
static vtkSegmentationConversionPaths * New()
void AddPaths(vtkSegmentationConversionPaths *)
Add paths to the list.
vtkSegmentationConversionPath * GetNextPath(vtkCollectionSimpleIterator &cookie)
vtkSegmentationConversionPath * GetPath(int index)
Get the index-th path the list.
~vtkSegmentationConversionPaths() override=default
Abstract converter rule class. Subclasses perform conversions between specific representation types....