00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTransformIOBase.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-05-11 16:37:30 $ 00007 Version: $Revision: 1.4 $ 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 TransformListType &GetReadTransformList() { return m_ReadTransformList; } 00083 ConstTransformListType &GetWriteTransformList() { return m_WriteTransformList; } 00085 00087 void SetTransformList(ConstTransformListType &transformList); 00088 00090 itkSetMacro( AppendMode, bool ); 00091 itkGetConstMacro( AppendMode, bool ); 00092 itkBooleanMacro( AppendMode ); 00094 00095 protected: 00096 TransformIOBase(); 00097 virtual ~TransformIOBase(); 00098 void PrintSelf(std::ostream& os, Indent indent) const; 00099 00100 void OpenStream(std::ofstream &out, bool binary); 00101 void CreateTransform(TransformPointer &ptr, const std::string &ClassName); 00102 00103 private: 00104 std::string m_FileName; 00105 TransformListType m_ReadTransformList; 00106 ConstTransformListType m_WriteTransformList; 00107 bool m_AppendMode; 00108 }; 00109 } // end namespace itk 00110 #endif // __itkTransformIOBase 00111