ITK  6.0.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  * https://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 
62  itkOverrideGetNameOfClassMacro(TransformFileWriterTemplate);
63 
65  itkSetStringMacro(FileName);
66 
68  itkGetStringMacro(FileName);
69 
70 #if !defined(ITK_FUTURE_LEGACY_REMOVE)
71 
73  void
74  SetAppendOff();
75 
76  void
77  SetAppendOn();
78 
79  bool
80  GetAppendMode();
81 #endif
82 
84  itkSetMacro(AppendMode, bool);
85  itkGetConstMacro(AppendMode, bool);
86  itkBooleanMacro(AppendMode);
90  itkSetMacro(UseCompression, bool);
91  itkGetConstMacro(UseCompression, bool);
92  itkBooleanMacro(UseCompression);
96  void
97  SetInput(const Object * transform);
98 
99  const TransformType *
100  GetInput();
101 
103  void
104  AddTransform(const Object * transform);
105 
107  void
108  Update();
109 
111  itkSetObjectMacro(TransformIO, TransformIOType);
112  itkGetConstObjectMacro(TransformIO, TransformIOType);
115 protected:
117  ~TransformFileWriterTemplate() override;
118 
119  void
120  PrintSelf(std::ostream & os, Indent indent) const override;
121 
122 private:
123  void
124  PushBackTransformList(const Object * transObj);
125 
126  std::string m_FileName{};
127  ConstTransformListType m_TransformList{};
128  bool m_AppendMode{ false };
130  bool m_UseCompression{ false };
131  typename TransformIOType::Pointer m_TransformIO{};
132 };
133 
136 
137 ITK_GCC_PRAGMA_DIAG_PUSH()
138 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
139 
141 template <>
143  TransformFileWriterTemplate<double>::PushBackTransformList(const Object * transObj);
144 template <>
146  TransformFileWriterTemplate<float>::PushBackTransformList(const Object * transObj);
149 ITK_GCC_PRAGMA_DIAG_POP()
150 
151 } // namespace itk
152 
153 #if defined ITK_TRANSFORMIO_FACTORY_REGISTER_MANAGER || defined ITK_IO_FACTORY_REGISTER_MANAGER
154 # include "itkTransformIOFactoryRegisterManager.h"
155 #endif
156 
157 // Note: Explicit instantiation is done in itkTransformFileWriterSpecializations.cxx
158 
159 #endif // itkTransformFileWriter_h
160 
162 #ifndef ITK_TEMPLATE_EXPLICIT_TransformFileWriter
163 // Explicit instantiation is required to ensure correct dynamic_cast
164 // behavior across shared libraries.
165 //
166 // IMPORTANT: Since within the same compilation unit,
167 // ITK_TEMPLATE_EXPLICIT_<classname> defined and undefined states
168 // need to be considered. This code *MUST* be *OUTSIDE* the header
169 // guards.
170 //
171 #if defined(ITKIOTransformBase_EXPORTS)
172 // We are building this library
173 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_TEMPLATE_EXPORT
174 #else
175 // We are using this library
176 # define ITKIOTransformBase_EXPORT_EXPLICIT ITKIOTransformBase_EXPORT
177 #endif
178 namespace itk
179 {
180 
181 ITK_GCC_PRAGMA_DIAG_PUSH()
182 ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
183 
186 
187 ITK_GCC_PRAGMA_DIAG_POP()
188 
189 } // end namespace itk
190 #undef ITKIOTransformBase_EXPORT_EXPLICIT
191 #endif
TransformBaseTemplate
Definition: itkTransformBase.h:85
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:176
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:55
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::ConstTransformListType
typename TransformIOType::ConstTransformListType ConstTransformListType
Definition: itkTransformFileWriter.h:56
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::TransformFileWriterTemplate::FixedParametersValueType
double FixedParametersValueType
Definition: itkTransformFileWriter.h:51
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::TransformFileWriterTemplate
TODO.
Definition: itkTransformFileWriter.h:39
itk::TransformFileWriterTemplate< double >
template class ITKIOTransformBase_EXPORT_EXPLICIT TransformFileWriterTemplate< double >