ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTransformFileWriter.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 itkTransformFileWriter_h
19 #define itkTransformFileWriter_h
20 
21 #include "ITKIOTransformBaseExport.h"
22 
23 #include "itkTransformIOBase.h"
24 #include <iostream>
25 #include <fstream>
26 
27 namespace itk
28 {
38 template<typename TParametersValueType>
40 {
41 public:
42 
48 
49  typedef TParametersValueType ParametersValueType;
50  typedef double FixedParametersValueType;
56 
58  itkNewMacro(Self);
59 
62 
64  itkSetStringMacro(FileName);
65 
67  itkGetStringMacro(FileName);
68 
70  void SetAppendOff();
71 
72  void SetAppendOn();
73 
74  void SetAppendMode(bool mode);
75 
76  bool GetAppendMode();
77 
79  void SetInput(const Object *transform);
80 
81  const TransformType * GetInput();
82 
84  void AddTransform(const Object *transform);
85 
87  void Update();
88 
90  itkSetObjectMacro( TransformIO, TransformIOType );
91  itkGetConstObjectMacro( TransformIO, TransformIOType );
93 
94 protected:
96  virtual ~TransformFileWriterTemplate() ITK_OVERRIDE;
97 
98  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
99 
100 private:
101  void PushBackTransformList(const Object *transObj);
102 
103  std::string m_FileName;
104  ConstTransformListType m_TransformList;
105  bool m_AppendMode;
106  typename TransformIOType::Pointer m_TransformIO;
107 
108  ITK_DISALLOW_COPY_AND_ASSIGN(TransformFileWriterTemplate);
109 };
110 
112 typedef itk::TransformFileWriterTemplate<double> TransformFileWriter;
113 
114 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
115  ITK_GCC_PRAGMA_DIAG_PUSH()
116 #endif
117 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
118 
119 
120 template<> void ITKIOTransformBase_TEMPLATE_EXPORT TransformFileWriterTemplate< double >::PushBackTransformList(const Object *transObj);
121 template<> void ITKIOTransformBase_TEMPLATE_EXPORT TransformFileWriterTemplate< float >::PushBackTransformList(const Object *transObj);
123 
124 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
125  ITK_GCC_PRAGMA_DIAG_POP()
126 #else
127  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
128 #endif
129 
130 } // namespace itk
131 
132 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
133 #include "itkTransformIOFactoryRegisterManager.h"
134 #endif
135 
136 // Note: Explicit instantiation is done in itkTransformFileWriterSpecializations.cxx
137 
138 #endif // itkTransformFileWriter_h
139 
141 #ifndef ITK_TEMPLATE_EXPLICIT_TransformFileWriter
142 // Explicit instantiation is required to ensure correct dynamic_cast
143 // behavior across shared libraries.
144 //
145 // IMPORTANT: Since within the same compilation unit,
146 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
147 // need to be considered. This code *MUST* be *OUTSIDE* the header
148 // guards.
149 //
150 # if defined( ITKIOTransformBase_EXPORTS )
151 // We are building this library
152 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_TEMPLATE_EXPORT
153 # else
154 // We are using this library
155 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_EXPORT
156 # endif
157 namespace itk
158 {
159 
160 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
161  ITK_GCC_PRAGMA_DIAG_PUSH()
162 #endif
163 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
164 
167 
168 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
169  ITK_GCC_PRAGMA_DIAG_POP()
170 #else
171  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
172 #endif
173 
174 } // end namespace itk
175 # undef ITKIOTransformBase_EXPORT_EXPLICIT
176 #endif
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
TransformIOType::TransformPointer TransformPointer
TransformIOType::ConstTransformListType ConstTransformListType
TransformIOBaseTemplate< ParametersValueType > TransformIOType
TransformFileWriterTemplate Self
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< float >
std::list< ConstTransformPointer > ConstTransformListType
TransformBaseTemplate< ParametersValueType > TransformType
TransformIOType::ConstTransformPointer ConstTransformPointer
#define ITKIOTransformBase_TEMPLATE_EXPORT
#define ITKIOTransformBase_EXPORT_EXPLICIT
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< double >
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:59