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:
56
59 static unsigned int GetConversionInfiniteCost() { return 10000000; };
60
61public:
62 //static vtkSegmentationConverterRule* New();
63 vtkTypeMacro(vtkSegmentationConverterRule, vtkObject);
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
69
72
76 virtual vtkDataObject* ConstructRepresentationObjectByRepresentation(std::string representationName) = 0;
77
81 virtual vtkDataObject* ConstructRepresentationObjectByClass(std::string className) = 0;
82
85 virtual bool PreConvert(vtkSegmentation* vtkNotUsed(segmentation)) { return true; };
86
90 virtual bool Convert(vtkSegment* segment) = 0;
91
94 virtual bool PostConvert(vtkSegmentation* vtkNotUsed(segmentation)) { return true; };
95
100 virtual unsigned int GetConversionCost(vtkDataObject* sourceRepresentation=nullptr, vtkDataObject* targetRepresentation=nullptr)
101 {
102 (void)(sourceRepresentation); // unused
103 (void)(targetRepresentation); // unused
104 return 100;
105 };
106
108 virtual const char* GetName() = 0;
109
111 virtual const char* GetSourceRepresentationName() = 0;
112
114 virtual const char* GetTargetRepresentationName() = 0;
115
119 virtual void GetRuleConversionParameters(vtkSegmentationConversionParameters* conversionParameters) VTK_EXPECTS(conversionParameters != nullptr);
120
122 virtual void SetConversionParameter(const std::string& name, const std::string& value, const std::string& description="");
123
125 virtual std::string GetConversionParameter(const std::string& name);
126
128 virtual std::string GetConversionParameterDescription(const std::string& name);
129
131 bool HasConversionParameter(const std::string& name);
132
133protected:
136
140
141protected:
147 vtkNew<vtkSegmentationConversionParameters> ConversionParameters;
148
153 bool ReplaceTargetRepresentation{false};
154
156};
157
158#endif
This class encapsulates a segment that is part of a segmentation.
Definition vtkSegment.h:45
Abstract converter rule class. Subclasses perform conversions between specific representation types....
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
Class that can convert between different representations of a segment.
This class encapsulates a segmentation that can contain multiple segments and multiple representation...