ITK  5.2.0
Insight Toolkit
itkTransformFileWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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_MOVE(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
72  SetAppendOff();
73 
74  void
75  SetAppendOn();
76 
77  void
78  SetAppendMode(bool mode);
79 
80  bool
81  GetAppendMode();
82 
84  itkSetMacro(UseCompression, bool);
85  itkGetConstMacro(UseCompression, bool);
86  itkBooleanMacro(UseCompression);
88 
90  void
91  SetInput(const Object * transform);
92 
93  const TransformType *
94  GetInput();
95 
97  void
98  AddTransform(const Object * transform);
99 
101  void
102  Update();
103 
105  itkSetObjectMacro(TransformIO, TransformIOType);
106  itkGetConstObjectMacro(TransformIO, TransformIOType);
108 
109 protected:
111  ~TransformFileWriterTemplate() override;
112 
113  void
114  PrintSelf(std::ostream & os, Indent indent) const override;
115 
116 private:
117  void
118  PushBackTransformList(const Object * transObj);
119 
120  std::string m_FileName;
122  bool m_AppendMode{ false };
124  bool m_UseCompression{ false };
126 };
127 
130 
131 ITK_GCC_PRAGMA_DIAG_PUSH()
132 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
133 
135 template <>
137  TransformFileWriterTemplate<double>::PushBackTransformList(const Object * transObj);
138 template <>
140  TransformFileWriterTemplate<float>::PushBackTransformList(const Object * transObj);
142 
143 ITK_GCC_PRAGMA_DIAG_POP()
144 
145 } // namespace itk
146 
147 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
148 # include "itkTransformIOFactoryRegisterManager.h"
149 #endif
150 
151 // Note: Explicit instantiation is done in itkTransformFileWriterSpecializations.cxx
152 
153 #endif // itkTransformFileWriter_h
154 
156 #ifndef ITK_TEMPLATE_EXPLICIT_TransformFileWriter
157 // Explicit instantiation is required to ensure correct dynamic_cast
158 // behavior across shared libraries.
159 //
160 // IMPORTANT: Since within the same compilation unit,
161 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
162 // need to be considered. This code *MUST* be *OUTSIDE* the header
163 // guards.
164 //
165 #if defined(ITKIOTransformBase_EXPORTS)
166 // We are building this library
167 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_TEMPLATE_EXPORT
168 #else
169 // We are using this library
170 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_EXPORT
171 #endif
172 namespace itk
173 {
174 
175 ITK_GCC_PRAGMA_DIAG_PUSH()
176 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
177 
180 
181 ITK_GCC_PRAGMA_DIAG_POP()
182 
183 } // end namespace itk
184 #undef ITKIOTransformBase_EXPORT_EXPLICIT
185 #endif
itk::TransformFileWriterTemplate::TransformPointer
typename TransformIOType::TransformPointer TransformPointer
Definition: itkTransformFileWriter.h:54
itk::LightProcessObject
LightProcessObject is the base class for all process objects (source, filters, mappers) in the Insigh...
Definition: itkLightProcessObject.h:72
ITKIOTransformBase_TEMPLATE_EXPORT
#define ITKIOTransformBase_TEMPLATE_EXPORT
Definition: itkTransformIOBase.h:36
itk::TransformIOBaseTemplate< ParametersValueType >::ConstTransformPointer
typename TransformType::ConstPointer ConstTransformPointer
Definition: itkTransformIOBase.h:81
itkTransformIOBase.h
itk::TransformIOBaseTemplate< ParametersValueType >::ConstTransformListType
std::list< ConstTransformPointer > ConstTransformListType
Definition: itkTransformIOBase.h:82
itk::TransformIOBaseTemplate< ParametersValueType >::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkTransformIOBase.h:79
ITKIOTransformBase_EXPORT_EXPLICIT
#define ITKIOTransformBase_EXPORT_EXPLICIT
Definition: itkTransformFileWriter.h:170
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::TransformFileWriterTemplate< float >
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< float >
itk::TransformFileWriterTemplate::ParametersValueType
TParametersValueType ParametersValueType
Definition: itkTransformFileWriter.h:50
itk::TransformIOBaseTemplate< ParametersValueType >
itk::TransformFileWriterTemplate::ConstTransformPointer
typename TransformIOType::ConstTransformPointer ConstTransformPointer
Definition: itkTransformFileWriter.h:55
itk::TransformFileWriterTemplate::m_FileName
std::string m_FileName
Definition: itkTransformFileWriter.h:120
itk::TransformFileWriterTemplate::m_TransformIO
TransformIOType::Pointer m_TransformIO
Definition: itkTransformFileWriter.h:125
itk::TransformFileWriterTemplate::ConstTransformListType
typename TransformIOType::ConstTransformListType ConstTransformListType
Definition: itkTransformFileWriter.h:56
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::TransformFileWriterTemplate::FixedParametersValueType
double FixedParametersValueType
Definition: itkTransformFileWriter.h:51
itk::TransformFileWriterTemplate::m_TransformList
ConstTransformListType m_TransformList
Definition: itkTransformFileWriter.h:121
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::TransformFileWriterTemplate
TODO.
Definition: itkTransformFileWriter.h:39
itk::TransformFileWriterTemplate< double >
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< double >
itk::TransformBaseTemplate
Definition: itkTransformBase.h:68