ITK  6.0.0
Insight Toolkit
itkTransformBase.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 itkTransformBase_h
19#define itkTransformBase_h
20
21#include "ITKTransformExport.h"
22
23#include "itkObject.h"
24#include "itkPoint.h"
25#include "itkCovariantVector.h"
26#include "vnl/vnl_vector_fixed.h"
27#include "itkArray2D.h"
29
30#include "itkObjectFactory.h"
31#include "itkIntTypes.h"
32
33namespace itk
34{
40{
41public:
45 enum class TransformCategory : uint8_t
46 {
48 Linear = 1,
49 BSpline = 2,
50 Spline = 3,
53 };
54};
55// Define how to print enumeration
56extern ITKTransform_EXPORT std::ostream &
57 operator<<(std::ostream & out, const TransformBaseTemplateEnums::TransformCategory value);
58
63 enum class TransformCategory : uint8_t
64 {
66 Linear = 1,
67 BSpline = 2,
68 Spline = 3,
71 };
72};
73// Define how to print enumeration
74extern ITKTransform_EXPORT std::ostream &
75 operator<<(std::ostream & out, const TransformBaseTemplateEnums::TransformCategory value);
76 *
77 * This class is an abstract class to represent a spatial transform.
78 *
79 * This class is templated over the scalar type used to store the transform's
80 * parameters.
81 *
82 * \ingroup ITKTransform
83 */
84template <typename TParametersValueType>
85class TransformBaseTemplate : public Object
86{
87public:
93 using Superclass = Object;
94 using Pointer = SmartPointer<Self>;
95 using ConstPointer = SmartPointer<const Self>;
96
99 using ParametersValueType = TParametersValueType;
100 using ParametersType = OptimizerParameters<ParametersValueType>;
102 using FixedParametersType = OptimizerParameters<FixedParametersValueType>;
103
106
110
111 /* For storing the name of InputSpace */
112 itkSetMacro(InputSpaceName, std::string);
113 itkGetConstReferenceMacro(InputSpaceName, std::string);
114
121 itkSetMacro(OutputSpaceName, std::string);
122 itkGetConstReferenceMacro(OutputSpaceName, std::string);
127
129 virtual const ParametersType &
130 GetParameters() const = 0;
131
133 virtual unsigned int
135
137 virtual unsigned int
139
141 virtual void
143
151 virtual void
153
155 virtual void
157
162 virtual void
163 CopyInParameters(const ParametersValueType * const begin, const ParametersValueType * const end) = 0;
164
169 virtual void
171
173 virtual const FixedParametersType &
177 virtual std::string
179
181#if !defined(ITK_LEGACY_REMOVE)
182 // We need to expose the enum values at the class level
183 // for backwards compatibility
184 static constexpr TransformCategoryEnum UnknownTransformCategory = TransformCategoryEnum::UnknownTransformCategory;
185 static constexpr TransformCategoryEnum Linear = TransformCategoryEnum::Linear;
186 static constexpr TransformCategoryEnum BSpline = TransformCategoryEnum::BSpline;
187 static constexpr TransformCategoryEnum Spline = TransformCategoryEnum::Spline;
188 static constexpr TransformCategoryEnum DisplacementField = TransformCategoryEnum::DisplacementField;
189 static constexpr TransformCategoryEnum VelocityField = TransformCategoryEnum::VelocityField;
190
191 // Preserve old type name for backwards compatibility
193#endif
194
198
199protected:
201 ~TransformBaseTemplate() override = default;
202
203private:
204 std::string m_InputSpaceName{};
205 std::string m_OutputSpaceName{};
206};
207
210} // end namespace itk
211
212#endif
213
virtual std::string GetTransformTypeAsString() const =0
OptimizerParameters< FixedParametersValueType > FixedParametersType
itkSetMacro(InputSpaceName, std::string)
virtual const ParametersType & GetParameters() const =0
TransformBaseTemplate()=default
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
IdentifierType NumberOfParametersType
static constexpr TransformCategoryEnum BSpline
~TransformBaseTemplate() override=default
itkGetConstReferenceMacro(InputSpaceName, std::string)
virtual void CopyInFixedParameters(const FixedParametersValueType *const begin, const FixedParametersValueType *const end)=0
TParametersValueType ParametersValueType
virtual unsigned int GetInputSpaceDimension() const =0
itkGetConstReferenceMacro(OutputSpaceName, std::string)
virtual const FixedParametersType & GetFixedParameters() const =0
SmartPointer< const Self > ConstPointer
virtual NumberOfParametersType GetNumberOfParameters() const =0
OptimizerParameters< ParametersValueType > ParametersType
virtual TransformCategoryEnum GetTransformCategory() const =0
virtual void SetParameters(const ParametersType &)=0
virtual void CopyInParameters(const ParametersValueType *const begin, const ParametersValueType *const end)=0
itkOverrideGetNameOfClassMacro(TransformBaseTemplate)
static constexpr TransformCategoryEnum Spline
virtual void SetParametersByValue(const ParametersType &p)=0
ITK_DISALLOW_COPY_AND_MOVE(TransformBaseTemplate)
SmartPointer< Self > Pointer
static constexpr TransformCategoryEnum Linear
TransformCategoryEnum TransformCategoryType
static constexpr TransformCategoryEnum VelocityField
static constexpr TransformCategoryEnum UnknownTransformCategory
static constexpr TransformCategoryEnum DisplacementField
virtual void SetFixedParameters(const FixedParametersType &)=0
virtual unsigned int GetOutputSpaceDimension() const =0
Contains all enum classes used by TransformBaseTemplate class.
unsigned long IdentifierType
ITKTransform_EXPORT std::ostream & operator<<(std::ostream &out, const TransformBaseTemplateEnums::TransformCategory value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
TransformCategory