ITK  5.2.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  * 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 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"
28 #include "itkOptimizerParameters.h"
29 
30 #include "itkObjectFactory.h"
31 #include "itkIntTypes.h"
32 
33 namespace itk
34 {
40 {
41 public:
46  {
48  Linear = 1,
49  BSpline = 2,
50  Spline = 3,
52  VelocityField = 5
53  };
54 };
55 // Define how to print enumeration
56 extern ITKTransform_EXPORT std::ostream &
57  operator<<(std::ostream & out, const TransformBaseTemplateEnums::TransformCategory value);
67 template <typename TParametersValueType>
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_MOVE(TransformBaseTemplate);
72 
75  using Superclass = Object;
78 
81  using ParametersValueType = TParametersValueType;
83  using FixedParametersValueType = double;
85 
87  itkTypeMacro(TransformBaseTemplate, Object);
88 
92 
95  GetNumberOfParameters() const = 0;
96 
98  virtual const ParametersType &
99  GetParameters() const = 0;
100 
102  virtual unsigned int
103  GetInputSpaceDimension() const = 0;
104 
106  virtual unsigned int
107  GetOutputSpaceDimension() const = 0;
108 
110  virtual void
111  SetParameters(const ParametersType &) = 0;
112 
120  virtual void
121  SetParametersByValue(const ParametersType & p) = 0;
122 
124  virtual void
126 
131  virtual void
132  CopyInParameters(const ParametersValueType * const begin, const ParametersValueType * const end) = 0;
133 
138  virtual void
139  CopyInFixedParameters(const FixedParametersValueType * const begin, const FixedParametersValueType * const end) = 0;
140 
142  virtual const FixedParametersType &
143  GetFixedParameters() const = 0;
144 
146  virtual std::string
147  GetTransformTypeAsString() const = 0;
148 
150 #if !defined(ITK_LEGACY_REMOVE)
151  // We need to expose the enum values at the class level
152  // for backwards compatibility
153  static constexpr TransformCategoryEnum UnknownTransformCategory = TransformCategoryEnum::UnknownTransformCategory;
154  static constexpr TransformCategoryEnum Linear = TransformCategoryEnum::Linear;
155  static constexpr TransformCategoryEnum BSpline = TransformCategoryEnum::BSpline;
156  static constexpr TransformCategoryEnum Spline = TransformCategoryEnum::Spline;
157  static constexpr TransformCategoryEnum DisplacementField = TransformCategoryEnum::DisplacementField;
158  static constexpr TransformCategoryEnum VelocityField = TransformCategoryEnum::VelocityField;
159 
160  // Preserve old type name for backwards compatibility
161  using TransformCategoryType = TransformCategoryEnum;
162 #endif
163 
165  virtual TransformCategoryEnum
166  GetTransformCategory() const = 0;
167 
168 protected:
169 #if defined(__GNUC__)
170  // A bug in some versions of the GCC and Clang compilers
171  // result in an ICE or linker error when "= default" is requested.
172  // This was observed in at least gcc 4.8 and 5.4.0, and
173  // AppleClang 7.0.2 and 8.0.0. Probably others too.
174  // "= default" doesn't gain us much, so just don't use it here.
176  ~TransformBaseTemplate() override{};
177 #else
178  TransformBaseTemplate() = default;
179  ~TransformBaseTemplate() override = default;
180 #endif
181 };
182 
185 } // end namespace itk
186 
187 #endif
188 
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::TransformBaseTemplate::CopyInParameters
virtual void CopyInParameters(const ParametersValueType *const begin, const ParametersValueType *const end)=0
itk::OptimizerParameters
Class to hold and manage different parameter types used during optimization.
Definition: itkOptimizerParameters.h:34
itkObjectFactory.h
itk::TransformBaseTemplate::GetInputSpaceDimension
virtual unsigned int GetInputSpaceDimension() const =0
itkCovariantVector.h
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:213
itk::TransformBaseTemplate::SetParameters
virtual void SetParameters(const ParametersType &)=0
itk::TransformBaseTemplateEnums::TransformCategory::VelocityField
itkPoint.h
itk::TransformBaseTemplate::SetParametersByValue
virtual void SetParametersByValue(const ParametersType &p)=0
itk::TransformBaseTemplate::TransformBaseTemplate
TransformBaseTemplate()=default
itk::TransformBaseTemplate::GetNumberOfParameters
virtual NumberOfParametersType GetNumberOfParameters() const =0
itk::TransformBaseTemplate::GetTransformTypeAsString
virtual std::string GetTransformTypeAsString() const =0
itk::SmartPointer< Self >
itk::TransformBaseTemplate::CopyInFixedParameters
virtual void CopyInFixedParameters(const FixedParametersValueType *const begin, const FixedParametersValueType *const end)=0
itk::TransformBaseTemplate::GetParameters
virtual const ParametersType & GetParameters() const =0
itk::TransformBaseTemplate::GetOutputSpaceDimension
virtual unsigned int GetOutputSpaceDimension() const =0
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkOptimizerParameters.h
itk::TransformBaseTemplateEnums::TransformCategory::BSpline
TransformCategory
itk::TransformBaseTemplate::SetFixedParameters
virtual void SetFixedParameters(const FixedParametersType &)=0
itkIntTypes.h
itk::TransformBaseTemplateEnums::TransformCategory
TransformCategory
Definition: itkTransformBase.h:45
itk::TransformBaseTemplate::GetFixedParameters
virtual const FixedParametersType & GetFixedParameters() const =0
itk::TransformBaseTemplate::FixedParametersValueType
double FixedParametersValueType
Definition: itkTransformBase.h:83
itkObject.h
itk::TransformBaseTemplateEnums
Contains all enum classes used by TransformBaseTemplate class.
Definition: itkTransformBase.h:39
itk::TransformBaseTemplate::~TransformBaseTemplate
~TransformBaseTemplate() override=default
itkArray2D.h
itk::TransformBaseTemplateEnums::TransformCategory::Spline
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::TransformBaseTemplate::GetTransformCategory
virtual TransformCategoryEnum GetTransformCategory() const =0
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::TransformBaseTemplate::ParametersValueType
TParametersValueType ParametersValueType
Definition: itkTransformBase.h:81
itk::TransformBaseTemplate::NumberOfParametersType
IdentifierType NumberOfParametersType
Definition: itkTransformBase.h:91
itk::TransformBaseTemplateEnums::TransformCategory::Linear
itk::Object::Object
Object()
itk::TransformBaseTemplateEnums::TransformCategory::UnknownTransformCategory
itk::TransformBaseTemplateEnums::TransformCategory::DisplacementField
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
itk::TransformBaseTemplate::TransformCategoryEnum
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
Definition: itkTransformBase.h:149
itk::TransformBaseTemplate
Definition: itkTransformBase.h:68