ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkTransformFileWriter.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 __itkTransformFileWriter_h
00019 #define __itkTransformFileWriter_h
00020 
00021 #include "itkTransformIOBase.h"
00022 #include <iostream>
00023 #include <fstream>
00024 
00025 namespace itk
00026 {
00036 class ITK_EXPORT TransformFileWriter:public LightProcessObject
00037 {
00038 public:
00039 
00041   typedef TransformFileWriter  Self;
00042   typedef LightProcessObject   Superclass;
00043   typedef SmartPointer< Self > Pointer;
00044 
00045   typedef TransformBase                           TransformType;
00046   typedef TransformIOBase::ConstTransformPointer  ConstTransformPointer;
00047   typedef TransformIOBase::ConstTransformListType ConstTransformListType;
00048 
00050   itkNewMacro(Self);
00051 
00053   itkTypeMacro(TransformFileWriter, LightProcessObject);
00054 
00056   itkSetStringMacro(FileName);
00057 
00059   itkGetStringMacro(FileName);
00060 
00062   void SetAppendOff();
00063 
00064   void SetAppendOn();
00065 
00066   void SetAppendMode(bool mode);
00067 
00068   bool GetAppendMode();
00069 
00071   void SetInput(const TransformType *transform);
00072 
00073   const TransformType * GetInput();
00074 
00076   void AddTransform(const TransformType *transform);
00077 
00079   itkSetMacro(Precision, unsigned int);
00080   itkGetConstMacro(Precision, unsigned int);
00082 
00084   void Update();
00085 
00086 protected:
00087   TransformFileWriter(const Self &); //purposely not implemented
00088   void operator=(const Self &);      //purposely not implemented
00089   void PrintSelf(std::ostream & os, Indent indent) const;
00090 
00091   TransformFileWriter();
00092   virtual ~TransformFileWriter();
00093 private:
00094   void OpenStream(std::ofstream & out, bool binary);
00095 
00096   std::string            m_FileName;
00097   ConstTransformListType m_TransformList;
00098   unsigned int           m_Precision;
00099   bool                   m_AppendMode;
00100 };
00101 } // namespace itk
00102 
00103 
00104 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
00105 #include "itkTransformIOFactoryRegisterManager.h"
00106 #endif
00107 
00108 #endif // __itkTransformFileWriter_h
00109