00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTransformFileWriterWithFactory.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-23 03:43:42 $ 00007 Version: $Revision: 1.3 $ 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 __itkTransformFileWriterWithFactory_h 00018 #define __itkTransformFileWriterWithFactory_h 00019 00020 #include "itkLightProcessObject.h" 00021 #include "metaTransform.h" 00022 #include "itkTransformBase.h" 00023 #include "itkTransformIOBase.h" 00024 #include <iostream> 00025 #include <fstream> 00026 00027 namespace itk 00028 { 00029 00030 class TransformFileWriter : public LightProcessObject 00031 { 00032 public: 00033 00035 typedef TransformFileWriter Self; 00036 typedef LightProcessObject Superclass; 00037 typedef SmartPointer<Self> Pointer; 00038 00039 typedef TransformBase TransformType; 00040 typedef TransformIOBase::ConstTransformPointer ConstTransformPointer; 00041 typedef TransformIOBase::ConstTransformListType ConstTransformListType; 00042 00044 itkNewMacro(Self); 00045 00047 itkTypeMacro(TransformFileWriter, LightProcessObject); 00048 00050 itkSetStringMacro(FileName); 00051 00053 itkGetStringMacro(FileName); 00054 00056 void SetAppendOff( ); 00057 void SetAppendOn( ); 00058 void SetAppendMode(bool mode); 00059 bool GetAppendMode( ); 00061 00063 void SetInput(const TransformType* transform); 00064 ConstTransformPointer GetInput() {return *(m_TransformList.begin());} 00066 00068 void AddTransform(const TransformType* transform); 00069 00071 itkSetMacro(Precision,unsigned int); 00072 itkGetConstMacro(Precision,unsigned int); 00074 00076 void Update(); 00077 00078 protected: 00079 TransformFileWriter(const Self&); //purposely not implemented 00080 void operator=(const Self&); //purposely not implemented 00081 00082 TransformFileWriter(); 00083 virtual ~TransformFileWriter(); 00084 00085 private: 00086 void OpenStream(std::ofstream &out, bool binary); 00087 00088 std::string m_FileName; 00089 ConstTransformListType m_TransformList; 00090 unsigned int m_Precision; 00091 bool m_AppendMode; 00092 }; 00093 00094 } // namespace itk 00095 00096 00097 #endif // __itkTransformFileWriter_h 00098