ITK  4.13.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:
48 
50  itkNewMacro(Self);
51 
54 
55  typedef typename Superclass::SpatialObjectType SpatialObjectType;
57  typedef typename Superclass::MetaObjectType MetaObjectType;
58 
60  typedef TSpatialObjectType ImageSpatialObjectType;
63  typedef MetaImage ImageMetaObjectType;
65 
67  virtual SpatialObjectPointer MetaObjectToSpatialObject(const MetaObjectType *mo) ITK_OVERRIDE;
68 
70  virtual MetaObjectType *SpatialObjectToMetaObject(const SpatialObjectType *spatialObject) ITK_OVERRIDE;
71 
72 protected:
74  virtual MetaObjectType *CreateMetaObject() ITK_OVERRIDE;
75  virtual const char *GetMetaObjectSubType();
77 
78  typename ImageType::Pointer AllocateImage(const ImageMetaObjectType *image);
79 
81  ~MetaImageConverter() ITK_OVERRIDE {}
82 
83 private:
84  ITK_DISALLOW_COPY_AND_ASSIGN(MetaImageConverter);
85 };
86 
87 } // end namespace itk
88 
89 #ifndef ITK_MANUAL_INSTANTIATION
90  #include "itkMetaImageConverter.hxx"
91 #endif
92 
93 #endif
Image< TPixel, NDimensions > ImageType
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
converts between MetaObject&lt;-&gt;SpatialObject.
Superclass::SpatialObjectType SpatialObjectType
SmartPointer< Self > Pointer
ImageSpatialObjectType::Pointer ImageSpatialObjectPointer
ImageSpatialObjectType::ConstPointer ImageSpatialObjectConstPointer
MetaConverterBase< NDimensions > Superclass
Implementation of the composite pattern.
Base class for MetaObject&lt;-&gt;SpatialObject converters.
Templated n-dimensional image class.
Definition: itkImage.h:75
TSpatialObjectType ImageSpatialObjectType
Superclass::MetaObjectType MetaObjectType
SpatialObjectType::Pointer SpatialObjectPointer