Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 std::vector<vtkSmartPointer<vtkSegmentationConverterRule>> Rules;
71
72protected:
75
76private:
78 void operator=(const vtkSegmentationConversionPath&) = delete;
79};
80
84class vtkSegmentationCore_EXPORT vtkSegmentationConversionPaths : public vtkCollection
85{
86public:
87 vtkTypeMacro(vtkSegmentationConversionPaths, vtkCollection);
89 void PrintSelf(ostream& os, vtkIndent indent) override;
90
93
96
99
101 vtkSegmentationConversionPath* GetPath(int index) { return vtkSegmentationConversionPath::SafeDownCast(this->GetItemAsObject(index)); }
102
105 vtkSegmentationConversionPath* GetNextPath(vtkCollectionSimpleIterator& cookie);
106
108 int GetNumberOfPaths() { return this->GetNumberOfItems(); };
109
110protected:
113
114private:
115 // hide the standard AddItem from the user and the compiler.
116 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
117
118private:
120 void operator=(const vtkSegmentationConversionPaths&) = delete;
121};
122
123//----------------------------------------------------------------------------
125{
126 this->vtkCollection::AddItem(f);
127}
128
129//----------------------------------------------------------------------------
131{
132 vtkSegmentationConversionPath* path = nullptr;
133 vtkCollectionSimpleIterator it;
134 for (paths->InitTraversal(it); (path = paths->GetNextPath(it));)
135 {
136 this->AddItem(path);
137 }
138}
139
140//----------------------------------------------------------------------------
142{
143 return static_cast<vtkSegmentationConversionPath*>(this->GetNextItemAsObject());
144}
145
146#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....