ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMetaConverterBase.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 __itkMetaConverterBase_h
00019 #define __itkMetaConverterBase_h
00020 
00021 #include "itkSpatialObject.h"
00022 #include "metaObject.h"
00023 
00024 namespace itk
00025 {
00026 
00040 template <unsigned VDimension = 3>
00041 class ITK_EXPORT MetaConverterBase : public Object
00042 {
00043 public:
00045   typedef MetaConverterBase          Self;
00046   typedef Object                     Superclass;
00047   typedef SmartPointer< Self >       Pointer;
00048   typedef SmartPointer< const Self > ConstPointer;
00049 
00051   itkTypeMacro(MetaConverterBase, Object);
00052 
00053   typedef SpatialObject<VDimension>           SpatialObjectType;
00054   typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00055   typedef MetaObject                          MetaObjectType;
00056 
00058   virtual SpatialObjectPointer  ReadMeta(const char *name);
00059 
00061   virtual bool WriteMeta(const SpatialObjectType *spatialObject, const char *name);
00062 
00064   virtual SpatialObjectPointer MetaObjectToSpatialObject(const MetaObjectType *mo) = 0;
00065 
00067   virtual MetaObjectType *SpatialObjectToMetaObject(const SpatialObjectType *spatialObject) = 0;
00068 
00072   void SetWriteImagesInSeparateFile(bool writeImagesInSeparateFile);
00073   bool GetWriteImagesInSeparateFile();
00074 protected:
00075 
00077   virtual MetaObjectType *CreateMetaObject() = 0;
00078   MetaConverterBase() : m_WriteImagesInSeparateFile(false)
00079     {}
00080 private:
00081   bool m_WriteImagesInSeparateFile;
00082 };
00084 
00085 }
00086 
00087 #ifndef ITK_MANUAL_INSTATIATION
00088   #include "itkMetaConverterBase.hxx"
00089 #endif
00090 
00091 #endif // __itkMetaConverterBase_h
00092