00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTransformIOBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2007-08-10 15:40:36 $ 00007 Version: $Revision: 1.2 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkTransformIOBase_h 00018 #define __itkTransformIOBase_h 00019 #include "itkLightProcessObject.h" 00020 #include "itkObjectFactory.h" 00021 #include "itkTransformBase.h" 00022 #include <list> 00023 #include <iostream> 00024 #include <fstream> 00025 #include <string> 00026 00027 namespace itk 00028 { 00039 class ITK_EXPORT TransformIOBase : public LightProcessObject 00040 { 00041 public: 00043 typedef TransformIOBase Self; 00044 typedef LightProcessObject Superclass; 00045 typedef SmartPointer<Self> Pointer; 00046 00048 itkTypeMacro(TransformIOBase, Superclass); 00049 00051 typedef TransformBase TransformType; 00052 00056 typedef TransformType::Pointer TransformPointer; 00057 typedef std::list<TransformPointer> TransformListType; 00058 typedef TransformType::ConstPointer ConstTransformPointer; 00059 typedef std::list<ConstTransformPointer> ConstTransformListType; 00060 00062 itkSetStringMacro(FileName); 00063 itkGetStringMacro(FileName); 00065 00067 virtual void Read() = 0; 00068 00070 virtual void Write() = 0; 00071 00074 virtual bool CanReadFile(const char*) = 0; 00075 00078 virtual bool CanWriteFile(const char*) = 0; 00079 00081 TransformListType &GetTransformList() { return m_ReadTransformList; } 00082 00084 void SetTransformList(ConstTransformListType &transformList); 00085 00087 itkSetMacro( AppendMode, bool ); 00088 itkGetMacro( AppendMode, bool ); 00089 itkBooleanMacro( AppendMode ); 00091 00092 protected: 00093 TransformIOBase(); 00094 virtual ~TransformIOBase(); 00095 void PrintSelf(std::ostream& os, Indent indent) const; 00096 00097 void OpenStream(std::ofstream &out, bool binary); 00098 void CreateTransform(TransformPointer &ptr, const std::string &ClassName); 00099 00100 std::string m_FileName; 00101 TransformListType m_ReadTransformList; 00102 ConstTransformListType m_WriteTransformList; 00103 bool m_AppendMode; 00104 }; 00105 } // end namespace itk 00106 #endif // __itkTransformIOBase 00107