ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkMetaImageConverter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 itkMetaImageConverter_h
19 #define itkMetaImageConverter_h
20 
21 // to avoid an Internal Compiler Error in Visual Studio 6.0
22 #include "metaImage.h"
23 #include "itkMetaConverterBase.h"
24 #include "itkImageSpatialObject.h"
25 #include "itkMetaConverterBase.h"
26 
27 namespace itk
28 {
29 
36 template< unsigned int NDimensions = 3,
37  typename TPixel = unsigned char,
38  typename TSpatialObjectType = ImageSpatialObject< NDimensions,TPixel > >
39 class ITK_TEMPLATE_EXPORT MetaImageConverter :
40  public MetaConverterBase< NDimensions >
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_ASSIGN(MetaImageConverter);
44 
50 
52  itkNewMacro(Self);
53 
56 
57  using SpatialObjectType = typename Superclass::SpatialObjectType;
59  using MetaObjectType = typename Superclass::MetaObjectType;
60 
62  using ImageSpatialObjectType = TSpatialObjectType;
65  using ImageMetaObjectType = MetaImage;
67 
69  SpatialObjectPointer MetaObjectToSpatialObject(const MetaObjectType *mo) override;
70 
72  MetaObjectType *SpatialObjectToMetaObject(const SpatialObjectType *spatialObject) override;
73 
74 protected:
76  MetaObjectType *CreateMetaObject() override;
77  virtual const char *GetMetaObjectSubType();
79 
80  typename ImageType::Pointer AllocateImage(const ImageMetaObjectType *image);
81 
82  MetaImageConverter() = default;
83  ~MetaImageConverter() override = default;
84 };
85 
86 } // end namespace itk
87 
88 #ifndef ITK_MANUAL_INSTANTIATION
89  #include "itkMetaImageConverter.hxx"
90 #endif
91 
92 #endif
Implementation of an image mask as spatial object.
Light weight base class for most itk classes.
converts between MetaObject&lt;-&gt;SpatialObject.
Implementation of the composite pattern.
Base class for MetaObject&lt;-&gt;SpatialObject converters.
typename SpatialObjectType::Pointer SpatialObjectPointer
Templated n-dimensional image class.
Definition: itkImage.h:75