Slicer 5.4
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
36class vtkSegmentationCore_EXPORT vtkSegmentationConversionPath : public vtkObject
37{
38public:
40 vtkTypeMacro(vtkSegmentationConversionPath, vtkObject);
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
46 unsigned int GetCost();
47
50
53
56
58 vtkSegmentationConverterRule* GetRule(int index) VTK_EXPECTS(0 <= index && index < GetNumberOfRules());
59
61 void RemoveRule(int index) VTK_EXPECTS(0 <= index && index < GetNumberOfRules());
62
65
69
70protected:
71
72 std::vector< vtkSmartPointer<vtkSegmentationConverterRule> > Rules;
73
74protected:
77
78private:
80 void operator=(const vtkSegmentationConversionPath&) = delete;
81};
82
83
88class vtkSegmentationCore_EXPORT vtkSegmentationConversionPaths : public vtkCollection
89{
90public:
91 vtkTypeMacro(vtkSegmentationConversionPaths, vtkCollection);
93 void PrintSelf(ostream& os, vtkIndent indent) override;
94
96 void AddPath(vtkSegmentationConversionPath*);
97
99 void AddPaths(vtkSegmentationConversionPaths*);
100
102 vtkSegmentationConversionPath* GetNextPath();
103
105 vtkSegmentationConversionPath* GetPath(int index) { return vtkSegmentationConversionPath::SafeDownCast(this->GetItemAsObject(index)); }
106
109 vtkSegmentationConversionPath* GetNextPath(vtkCollectionSimpleIterator& cookie);
110
112 int GetNumberOfPaths() { return this->GetNumberOfItems(); };
113
114protected:
117
118private:
119 // hide the standard AddItem from the user and the compiler.
120 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
121
122private:
124 void operator=(const vtkSegmentationConversionPaths&) = delete;
125};
126
127//----------------------------------------------------------------------------
129{
130 this->vtkCollection::AddItem(f);
131}
132
133//----------------------------------------------------------------------------
135{
136 vtkSegmentationConversionPath* path = nullptr;
137 vtkCollectionSimpleIterator it;
138 for (paths->InitTraversal(it); (path = paths->GetNextPath(it));)
139 {
140 this->AddItem(path);
141 }
142}
143
144//----------------------------------------------------------------------------
146{
147 return static_cast<vtkSegmentationConversionPath*>(this->GetNextItemAsObject());
148}
149
150#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....