ITK  5.4.0
Insight Toolkit
itkIdentityTransform.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 itkIdentityTransform_h
19#define itkIdentityTransform_h
20
21#include "itkObject.h"
22#include "itkPoint.h"
23#include "itkCovariantVector.h"
24#include "vnl/vnl_vector_fixed.h"
25#include "itkArray2D.h"
26#include "itkTransform.h"
27
28namespace itk
29{
49template <typename TParametersValueType, unsigned int VDimension = 3>
50class ITK_TEMPLATE_EXPORT IdentityTransform : public Transform<TParametersValueType, VDimension, VDimension>
51{
52public:
53 ITK_DISALLOW_COPY_AND_MOVE(IdentityTransform);
54
60
62 itkNewMacro(Self);
63
65 itkOverrideGetNameOfClassMacro(IdentityTransform);
66
68 static constexpr unsigned int InputSpaceDimension = VDimension;
69 static constexpr unsigned int OutputSpaceDimension = VDimension;
70
72 using typename Superclass::ParametersType;
73 using typename Superclass::ParametersValueType;
74 using typename Superclass::FixedParametersType;
75 using typename Superclass::FixedParametersValueType;
77
78
80 using typename Superclass::JacobianType;
81 using typename Superclass::JacobianPositionType;
82 using typename Superclass::InverseJacobianPositionType;
83
85 using typename Superclass::TransformCategoryEnum;
86
90
94
96 using InputVnlVectorType = vnl_vector_fixed<TParametersValueType, Self::InputSpaceDimension>;
97 using OutputVnlVectorType = vnl_vector_fixed<TParametersValueType, Self::OutputSpaceDimension>;
98
102
105 using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
107
110 TransformPoint(const InputPointType & point) const override
111 {
112 return point;
113 }
114
116 using Superclass::TransformVector;
117 OutputVectorType
118 TransformVector(const InputVectorType & vector) const override
119 {
120 return vector;
121 }
122
124 OutputVnlVectorType
125 TransformVector(const InputVnlVectorType & vector) const override
126 {
127 return vector;
128 }
129
131 using Superclass::TransformCovariantVector;
132 OutputCovariantVectorType
134 {
135 return vector;
136 }
137
142 void
144 {}
145
174 void
176 {
177 jacobian.SetSize(VDimension, 0);
178 }
186 void
188 {
189 jac.set_identity();
190 }
191 using Superclass::ComputeJacobianWithRespectToPosition;
194 /* Always returns true if not null, as an identity is its own inverse */
195 bool
196 GetInverse(Self * inverseTransform) const
197 {
198 return (inverseTransform != nullptr);
199 }
200
203 InverseTransformBasePointer
204 GetInverseTransform() const override
205 {
206 return this->New().GetPointer();
207 }
208
214 TransformCategoryEnum
215 GetTransformCategory() const override
216 {
217 return Self::TransformCategoryEnum::Linear;
218 }
219
221 const FixedParametersType &
222 GetFixedParameters() const override
223 {
224 return this->m_FixedParameters;
225 }
226
228 void
230 {}
231
233 const ParametersType &
234 GetParameters() const override
235 {
236 return this->m_Parameters;
237 }
238
240 void
242 {}
243
244protected:
245 IdentityTransform() = default;
246 ~IdentityTransform() override = default;
247};
248} // end namespace itk
249
250#endif
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
void SetSize(unsigned int m, unsigned int n)
A templated class holding a n-Dimensional covariant vector.
Implementation of an Identity Transform.
TransformCategoryEnum GetTransformCategory() const override
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &jacobian) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
void SetFixedParameters(const FixedParametersType &) override
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
const FixedParametersType & GetFixedParameters() const override
OutputPointType TransformPoint(const InputPointType &point) const override
void SetParameters(const ParametersType &) override
InverseTransformBasePointer GetInverseTransform() const override
const ParametersType & GetParameters() const override
vnl_vector_fixed< TParametersValueType, Self::InputSpaceDimension > InputVnlVectorType
ParametersValueType ScalarType
~IdentityTransform() override=default
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &jac) const override
typename Superclass::InverseTransformBaseType InverseTransformBaseType
OutputVectorType TransformVector(const InputVectorType &vector) const override
bool GetInverse(Self *inverseTransform) const
vnl_vector_fixed< TParametersValueType, Self::OutputSpaceDimension > OutputVnlVectorType
Light weight base class for most itk classes.
Class to hold and manage different parameter types used during optimization.
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
TParametersValueType ParametersValueType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:84
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Definition: itkTransform.h:145
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents