ITK  5.0.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  ITK_DISALLOW_COPY_AND_ASSIGN(TransformFileWriterTemplate);
43 
49 
50  using ParametersValueType = TParametersValueType;
51  using FixedParametersValueType = double;
57 
59  itkNewMacro(Self);
60 
63 
65  itkSetStringMacro(FileName);
66 
68  itkGetStringMacro(FileName);
69 
71  void SetAppendOff();
72 
73  void SetAppendOn();
74 
75  void SetAppendMode(bool mode);
76 
77  bool GetAppendMode();
78 
80  itkSetMacro(UseCompression, bool);
81  itkGetConstMacro(UseCompression, bool);
82  itkBooleanMacro(UseCompression);
84 
86  void SetInput(const Object *transform);
87 
88  const TransformType * GetInput();
89 
91  void AddTransform(const Object *transform);
92 
94  void Update();
95 
97  itkSetObjectMacro( TransformIO, TransformIOType );
98  itkGetConstObjectMacro( TransformIO, TransformIOType );
100 
101 protected:
103  ~TransformFileWriterTemplate() override;
104 
105  void PrintSelf(std::ostream & os, Indent indent) const override;
106 
107 private:
108  void PushBackTransformList(const Object *transObj);
109 
110  std::string m_FileName;
116 
117 };
118 
121 
122 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
123  ITK_GCC_PRAGMA_DIAG_PUSH()
124 #endif
125 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
126 
127 
128 template<> void ITKIOTransformBase_TEMPLATE_EXPORT TransformFileWriterTemplate< double >::PushBackTransformList(const Object *transObj);
129 template<> void ITKIOTransformBase_TEMPLATE_EXPORT TransformFileWriterTemplate< float >::PushBackTransformList(const Object *transObj);
131 
132 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
133  ITK_GCC_PRAGMA_DIAG_POP()
134 #else
135  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
136 #endif
137 
138 } // namespace itk
139 
140 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
141 #include "itkTransformIOFactoryRegisterManager.h"
142 #endif
143 
144 // Note: Explicit instantiation is done in itkTransformFileWriterSpecializations.cxx
145 
146 #endif // itkTransformFileWriter_h
147 
149 #ifndef ITK_TEMPLATE_EXPLICIT_TransformFileWriter
150 // Explicit instantiation is required to ensure correct dynamic_cast
151 // behavior across shared libraries.
152 //
153 // IMPORTANT: Since within the same compilation unit,
154 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
155 // need to be considered. This code *MUST* be *OUTSIDE* the header
156 // guards.
157 //
158 # if defined( ITKIOTransformBase_EXPORTS )
159 // We are building this library
160 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_TEMPLATE_EXPORT
161 # else
162 // We are using this library
163 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_EXPORT
164 # endif
165 namespace itk
166 {
167 
168 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
169  ITK_GCC_PRAGMA_DIAG_PUSH()
170 #endif
171 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
172 
175 
176 #ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
177  ITK_GCC_PRAGMA_DIAG_POP()
178 #else
179  ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
180 #endif
181 
182 } // end namespace itk
183 # undef ITKIOTransformBase_EXPORT_EXPLICIT
184 #endif
typename TransformIOType::ConstTransformListType ConstTransformListType
Light weight base class for most itk classes.
typename TransformIOType::TransformPointer TransformPointer
typename TransformIOType::ConstTransformPointer ConstTransformPointer
std::list< ConstTransformPointer > ConstTransformListType
TransformIOType::Pointer m_TransformIO
typename TransformType::ConstPointer ConstTransformPointer
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< float >
#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:60