ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkTransformIOBase_h 00019 #define __itkTransformIOBase_h 00020 #include "itkLightProcessObject.h" 00021 #include "itkTransformBase.h" 00022 #include <list> 00023 #include <iostream> 00024 #include <fstream> 00025 #include <string> 00026 00027 namespace itk 00028 { 00040 class ITK_EXPORT TransformIOBase:public LightProcessObject 00041 { 00042 public: 00044 typedef TransformIOBase Self; 00045 typedef LightProcessObject Superclass; 00046 typedef SmartPointer< Self > Pointer; 00047 00049 itkTypeMacro(TransformIOBase, Superclass); 00050 00052 typedef TransformBase TransformType; 00053 00057 typedef TransformType::Pointer TransformPointer; 00058 typedef std::list< TransformPointer > TransformListType; 00059 typedef TransformType::ConstPointer ConstTransformPointer; 00060 typedef std::list< ConstTransformPointer > ConstTransformListType; 00061 00063 itkSetStringMacro(FileName); 00064 itkGetStringMacro(FileName); 00066 00068 virtual void Read() = 0; 00069 00071 virtual void Write() = 0; 00072 00075 virtual bool CanReadFile(const char *) = 0; 00076 00079 virtual bool CanWriteFile(const char *) = 0; 00080 00082 TransformListType & GetTransformList() { return m_ReadTransformList; } 00083 TransformListType & GetReadTransformList() { return m_ReadTransformList; } 00084 ConstTransformListType & GetWriteTransformList() { return m_WriteTransformList; } 00086 00088 void SetTransformList(ConstTransformListType & transformList); 00089 00091 itkSetMacro(AppendMode, bool); 00092 itkGetConstMacro(AppendMode, bool); 00093 itkBooleanMacro(AppendMode); 00094 protected: 00095 TransformIOBase(); 00096 virtual ~TransformIOBase(); 00097 void PrintSelf(std::ostream & os, Indent indent) const; 00099 00100 void OpenStream(std::ofstream & out, bool binary); 00101 00102 void CreateTransform(TransformPointer & ptr, const std::string & ClassName); 00103 00104 private: 00105 std::string m_FileName; 00106 TransformListType m_ReadTransformList; 00107 ConstTransformListType m_WriteTransformList; 00108 bool m_AppendMode; 00109 }; 00110 } // end namespace itk 00111 #endif // __itaTransformIOBase 00112