ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkTransformIOBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkTransformIOBase_h
19 #define __itkTransformIOBase_h
20 #include "itkLightProcessObject.h"
21 #include "itkTransformBase.h"
22 #include <list>
23 #include <iostream>
24 #include <fstream>
25 #include <string>
26 
27 namespace itk
28 {
40 class ITK_EXPORT TransformIOBase:public LightProcessObject
41 {
42 public:
47 
49  itkTypeMacro(TransformIOBase, Superclass);
50 
53 
58  typedef std::list< TransformPointer > TransformListType;
60  typedef std::list< ConstTransformPointer > ConstTransformListType;
61 
63  itkSetStringMacro(FileName);
64  itkGetStringMacro(FileName);
66 
68  virtual void Read() = 0;
69 
71  virtual void Write() = 0;
72 
75  virtual bool CanReadFile(const char *) = 0;
76 
79  virtual bool CanWriteFile(const char *) = 0;
80 
82  TransformListType & GetTransformList() { return m_ReadTransformList; }
83  TransformListType & GetReadTransformList() { return m_ReadTransformList; }
84  ConstTransformListType & GetWriteTransformList() { return m_WriteTransformList; }
86 
88  void SetTransformList(ConstTransformListType & transformList);
89 
91  itkSetMacro(AppendMode, bool);
92  itkGetConstMacro(AppendMode, bool);
93  itkBooleanMacro(AppendMode);
94 protected:
96  virtual ~TransformIOBase();
97  void PrintSelf(std::ostream & os, Indent indent) const;
99 
100  void OpenStream(std::ofstream & out, bool binary);
101 
102  void CreateTransform(TransformPointer & ptr, const std::string & ClassName);
103 
104 private:
105  std::string m_FileName;
109 };
110 } // end namespace itk
111 #endif // __itaTransformIOBase
112