Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSegmentationConverterRule.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 __vtkSegmentationConverterRule_h
22#define __vtkSegmentationConverterRule_h
23
24#include "vtkSegmentationCoreConfigure.h"
25
26// VTK includes
27#include <vtkNew.h>
28#include <vtkObject.h>
29
30class vtkDataObject;
31class vtkSegmentation;
32class vtkSegment;
33
35
37#ifndef vtkSegmentationConverterRuleNewMacro
38# define vtkSegmentationConverterRuleNewMacro(newClass) \
39 vtkStandardNewMacro(newClass); \
40 vtkSegmentationConverterRule* newClass::CreateRuleInstance() \
41 { \
42 return newClass::New(); \
43 }
44#endif
53class vtkSegmentationCore_EXPORT vtkSegmentationConverterRule : public vtkObject
54{
55public:
58 static unsigned int GetConversionInfiniteCost() { return 10000000; };
59
60public:
61 // static vtkSegmentationConverterRule* New();
62 vtkTypeMacro(vtkSegmentationConverterRule, vtkObject);
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
68
71
75 virtual vtkDataObject* ConstructRepresentationObjectByRepresentation(std::string representationName) = 0;
76
80 virtual vtkDataObject* ConstructRepresentationObjectByClass(std::string className) = 0;
81
84 virtual bool PreConvert(vtkSegmentation* vtkNotUsed(segmentation)) { return true; };
85
89 virtual bool Convert(vtkSegment* segment) = 0;
90
93 virtual bool PostConvert(vtkSegmentation* vtkNotUsed(segmentation)) { return true; };
94
99 virtual unsigned int GetConversionCost(vtkDataObject* sourceRepresentation = nullptr, vtkDataObject* targetRepresentation = nullptr)
100 {
101 (void)(sourceRepresentation); // unused
102 (void)(targetRepresentation); // unused
103 return 100;
104 };
105
107 virtual const char* GetName() = 0;
108
110 virtual const char* GetSourceRepresentationName() = 0;
111
113 virtual const char* GetTargetRepresentationName() = 0;
114
118 virtual void GetRuleConversionParameters(vtkSegmentationConversionParameters* conversionParameters) VTK_EXPECTS(conversionParameters != nullptr);
119
121 virtual void SetConversionParameter(const std::string& name, const std::string& value, const std::string& description = "");
122
124 virtual std::string GetConversionParameter(const std::string& name);
125
127 virtual std::string GetConversionParameterDescription(const std::string& name);
128
130 bool HasConversionParameter(const std::string& name);
131
132protected:
135
139
140protected:
146 vtkNew<vtkSegmentationConversionParameters> ConversionParameters;
147
153
155};
156
157#endif
This class encapsulates a segment that is part of a segmentation.
Definition vtkSegment.h:45
vtkNew< vtkSegmentationConversionParameters > ConversionParameters
virtual bool PreConvert(vtkSegmentation *vtkNotUsed(segmentation))
virtual unsigned int GetConversionCost(vtkDataObject *sourceRepresentation=nullptr, vtkDataObject *targetRepresentation=nullptr)
virtual bool Convert(vtkSegment *segment)=0
virtual vtkSegmentationConverterRule * Clone()
Create a new instance of this rule and copy its contents.
bool HasConversionParameter(const std::string &name)
Determine if the rule has a parameter with a certain name.
~vtkSegmentationConverterRule() override
virtual bool PostConvert(vtkSegmentation *vtkNotUsed(segmentation))
void operator=(const vtkSegmentationConverterRule &)
virtual void GetRuleConversionParameters(vtkSegmentationConversionParameters *conversionParameters) VTK_EXPECTS(conversionParameters !
virtual void SetConversionParameter(const std::string &name, const std::string &value, const std::string &description="")
Set a conversion parameter.
virtual const char * GetSourceRepresentationName()=0
Human-readable name of the source representation.
virtual const char * GetTargetRepresentationName()=0
Human-readable name of the target representation.
virtual vtkDataObject * ConstructRepresentationObjectByRepresentation(std::string representationName)=0
virtual const char * GetName()=0
Human-readable name of the converter rule.
virtual std::string GetConversionParameterDescription(const std::string &name)
Get a conversion parameter description.
virtual vtkDataObject * ConstructRepresentationObjectByClass(std::string className)=0
virtual std::string GetConversionParameter(const std::string &name)
Get a conversion parameter value.
virtual bool CreateTargetRepresentation(vtkSegment *segment)
Update the target representation based on the source representation.
virtual vtkSegmentationConverterRule * CreateRuleInstance()=0
void PrintSelf(ostream &os, vtkIndent indent) override
This class encapsulates a segmentation that can contain multiple segments and multiple representation...