ITK  6.0.0
Insight Toolkit
itkMetaConverterBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMetaConverterBase_h
19 #define itkMetaConverterBase_h
20 
21 #include "itkSpatialObject.h"
22 #include "metaObject.h"
23 
24 namespace itk
25 {
26 
41 template <unsigned int VDimension = 3>
42 class ITK_TEMPLATE_EXPORT MetaConverterBase : public Object
43 {
44 public:
45 
48  using Superclass = Object;
51 
53  itkOverrideGetNameOfClassMacro(MetaConverterBase);
54 
58  using MetaObjectType = MetaObject;
59 
60  itkSetMacro(MetaIOVersion, unsigned int);
61  itkGetConstMacro(MetaIOVersion, unsigned int);
62 
64  virtual SpatialObjectPointer
65  ReadMeta(const char * name);
66 
68  virtual bool
69  WriteMeta(const SpatialObjectType * spatialObject, const char * name);
70 
71  void
72  MetaObjectToSpatialObjectBase(const MetaObjectType * mo, SpatialObjectPointer spatialObject);
73 
74  void
75  SpatialObjectToMetaObjectBase(SpatialObjectConstPointer spatialObject, MetaObjectType * mo);
76 
78  virtual SpatialObjectPointer
79  MetaObjectToSpatialObject(const MetaObjectType * mo) = 0;
80 
82  virtual MetaObjectType *
83  SpatialObjectToMetaObject(const SpatialObjectType * spatialObject) = 0;
84 
88  itkSetMacro(WriteImagesInSeparateFile, bool);
89  itkGetConstMacro(WriteImagesInSeparateFile, bool);
90  itkBooleanMacro(WriteImagesInSeparateFile);
93 protected:
94  MetaConverterBase() = default;
95  ~MetaConverterBase() override = default;
96 
98  virtual MetaObjectType *
99  CreateMetaObject() = 0;
100 
101 
102 private:
103  bool m_WriteImagesInSeparateFile{ false };
104  unsigned int m_MetaIOVersion{ 0 };
105 };
106 
107 } // namespace itk
108 
109 #ifndef ITK_MANUAL_INSTATIATION
110 # include "itkMetaConverterBase.hxx"
111 #endif
112 
113 #endif // itkMetaConverterBase_h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itkSpatialObject.h
itk::SmartPointer< Self >
itk::MetaConverterBase::SpatialObjectConstPointer
typename SpatialObjectType::ConstPointer SpatialObjectConstPointer
Definition: itkMetaConverterBase.h:57
itk::MetaConverterBase::MetaObjectType
MetaObject MetaObjectType
Definition: itkMetaConverterBase.h:58
itk::MetaConverterBase::SpatialObjectPointer
typename SpatialObjectType::Pointer SpatialObjectPointer
Definition: itkMetaConverterBase.h:56
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::SpatialObject
Implementation of the composite pattern.
Definition: itkSpatialObject.h:58
itk::MetaConverterBase
Base class for MetaObject<->SpatialObject converters.
Definition: itkMetaConverterBase.h:42
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61