ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMetaImageConverter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkMetaImageConverter_h
00019 #define __itkMetaImageConverter_h
00020 
00021 // to avoid an Internal Compiler Error in Visual Studio 6.0
00022 #include "metaImage.h"
00023 #include "itkMetaConverterBase.h"
00024 #include "itkImageSpatialObject.h"
00025 #include "itkMetaConverterBase.h"
00026 
00027 namespace itk
00028 {
00029 
00036 template< unsigned int NDimensions = 3,
00037           typename TPixel = unsigned char,
00038           typename TSpatialObjectType = ImageSpatialObject< NDimensions,TPixel > >
00039 class ITK_EXPORT MetaImageConverter :
00040     public MetaConverterBase< NDimensions >
00041 {
00042 public:
00044   typedef MetaImageConverter               Self;
00045   typedef MetaConverterBase< NDimensions > Superclass;
00046   typedef SmartPointer< Self >             Pointer;
00047   typedef SmartPointer< const Self >       ConstPointer;
00048 
00050   itkNewMacro(Self);
00051 
00053   itkTypeMacro(MetaImageConverter, MetaConverterBase);
00054 
00055   typedef typename Superclass::SpatialObjectType SpatialObjectType;
00056   typedef typename SpatialObjectType::Pointer    SpatialObjectPointer;
00057   typedef typename Superclass::MetaObjectType    MetaObjectType;
00058 
00060   typedef TSpatialObjectType                            ImageSpatialObjectType;
00061   typedef typename ImageSpatialObjectType::Pointer      ImageSpatialObjectPointer;
00062   typedef typename ImageSpatialObjectType::ConstPointer ImageSpatialObjectConstPointer;
00063   typedef MetaImage                                     ImageMetaObjectType;
00064   typedef Image<TPixel,NDimensions>                     ImageType;
00065 
00067   virtual SpatialObjectPointer MetaObjectToSpatialObject(const MetaObjectType *mo);
00068 
00070   virtual MetaObjectType *SpatialObjectToMetaObject(const SpatialObjectType *spatialObject);
00071 protected:
00072 
00074   virtual MetaObjectType *CreateMetaObject();
00075   virtual const char *GetMetaObjectSubType();
00077 
00078   typename ImageType::Pointer AllocateImage(const ImageMetaObjectType *image);
00079 
00080   MetaImageConverter();
00081   ~MetaImageConverter() {}
00082 
00083 private:
00084   MetaImageConverter(const Self &);   //purposely not implemented
00085   void operator=(const Self &);       //purposely not implemented
00086 };
00087 
00088 } // end namespace itk
00089 
00090 #ifndef ITK_MANUAL_INSTANTIATION
00091   #include "itkMetaImageConverter.hxx"
00092 #endif
00093 
00094 #endif
00095