Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 <vtkObject.h>
28 
29 // STD includes
30 #include <map>
31 #include <string>
32 
33 class vtkDataObject;
34 
36 #ifndef vtkSegmentationConverterRuleNewMacro
37 #define vtkSegmentationConverterRuleNewMacro(newClass) \
38  vtkStandardNewMacro(newClass); \
39  vtkSegmentationConverterRule* newClass::CreateRuleInstance() \
40  { \
41  return newClass::New(); \
42  }
43 #endif
44 
49 class vtkSegmentationCore_EXPORT vtkSegmentationConverterRule : public vtkObject
50 {
51 public:
56  typedef std::map<std::string, std::pair<std::string, std::string> > ConversionParameterListType;
57 
60  static unsigned int GetConversionInfiniteCost() { return 10000000; };
61 
62 public:
63  //static vtkSegmentationConverterRule* New();
64  vtkTypeMacro(vtkSegmentationConverterRule, vtkObject);
65 
68  virtual vtkSegmentationConverterRule* CreateRuleInstance() = 0;
69 
71  virtual vtkSegmentationConverterRule* Clone();
72 
76  virtual vtkDataObject* ConstructRepresentationObjectByRepresentation(std::string representationName) = 0;
77 
81  virtual vtkDataObject* ConstructRepresentationObjectByClass(std::string className) = 0;
82 
84  virtual bool Convert(vtkDataObject* sourceRepresentation, vtkDataObject* targetRepresentation) = 0;
85 
90  virtual unsigned int GetConversionCost(vtkDataObject* sourceRepresentation=NULL, vtkDataObject* targetRepresentation=NULL)
91  {
92  (void)(sourceRepresentation); // unused
93  (void)(targetRepresentation); // unused
94  return 100;
95  };
96 
98  virtual const char* GetName() = 0;
99 
101  virtual const char* GetSourceRepresentationName() = 0;
102 
104  virtual const char* GetTargetRepresentationName() = 0;
105 
108  virtual void GetRuleConversionParameters(ConversionParameterListType& conversionParameters);
109 
111  virtual void SetConversionParameter(const std::string& name, const std::string& value, const std::string& description="");
112 
114  virtual std::string GetConversionParameter(const std::string& name);
115 
117  virtual std::string GetConversionParameterDescription(const std::string& name);
118 
120  bool HasConversionParameter(const std::string& name);
121 
122 protected:
125  void operator=(const vtkSegmentationConverterRule&);
126 
127 protected:
134 
136 };
137 
138 #endif // __vtkSegmentationConverterRule_h
ConversionParameterListType ConversionParameters
Abstract converter rule class. Subclasses perform conversions between specific representation types...
virtual unsigned int GetConversionCost(vtkDataObject *sourceRepresentation=NULL, vtkDataObject *targetRepresentation=NULL)
std::map< std::string, std::pair< std::string, std::string > > ConversionParameterListType
Class that can convert between different representations of a segment.