ITK  4.9.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>
39 class ITKIOTransformBase_TEMPLATE_EXPORT TransformFileWriterTemplate:public LightProcessObject
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();
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;
107 
108  TransformFileWriterTemplate(const Self &) ITK_DELETE_FUNCTION;
109  void operator=(const Self &) ITK_DELETE_FUNCTION;
110 };
111 
114 
115 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
116  ITK_GCC_PRAGMA_DIAG_PUSH()
117 #endif
118 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
119 
120 
121 template<> void ITKIOTransformBase_EXPORT TransformFileWriterTemplate< double >::PushBackTransformList(const Object *transObj);
122 template<> void ITKIOTransformBase_EXPORT TransformFileWriterTemplate< float >::PushBackTransformList(const Object *transObj);
124 
125 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
126  ITK_GCC_PRAGMA_DIAG_POP()
127 #else
128  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
129 #endif
130 
131 } // namespace itk
132 
133 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
134 #include "itkTransformIOFactoryRegisterManager.h"
135 #endif
136 
137 // Note: Explicit instantiation is done in itkTransformFileWriterSpecializations.cxx
138 
139 #endif // itkTransformFileWriter_h
140 
142 #ifndef ITK_TEMPLATE_EXPLICIT_TransformFileWriter
143 // Explicit instantiation is required to ensure correct dynamic_cast
144 // behavior across shared libraries.
145 //
146 // IMPORTANT: Since within the same compilation unit,
147 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
148 // need to be considered. This code *MUST* be *OUTSIDE* the header
149 // guards.
150 //
151 # if defined( ITKIOTransformBase_EXPORTS )
152 // We are building this library
153 # define ITKIOTransformBase_EXPORT_EXPLICIT
154 # else
155 // We are using this library
156 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_EXPORT
157 # endif
158 namespace itk
159 {
160 
161 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
162  ITK_GCC_PRAGMA_DIAG_PUSH()
163 #endif
164 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
165 
168 
169 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
170  ITK_GCC_PRAGMA_DIAG_POP()
171 #else
172  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
173 #endif
174 
175 } // end namespace itk
176 # undef ITKIOTransformBase_EXPORT_EXPLICIT
177 #endif
Light weight base class for most itk classes.
SmartPointer< const Self > ConstPointer
TransformIOType::Pointer m_TransformIO
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_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:57