ITK  5.3.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  * 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 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 
28 namespace itk
29 {
49 template <typename TParametersValueType, unsigned int NDimensions = 3>
50 class ITK_TEMPLATE_EXPORT IdentityTransform : public Transform<TParametersValueType, NDimensions, NDimensions>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(IdentityTransform);
54 
60 
62  itkNewMacro(Self);
63 
65  itkTypeMacro(IdentityTransform, Transform);
66 
68  static constexpr unsigned int InputSpaceDimension = NDimensions;
69  static constexpr unsigned int OutputSpaceDimension = NDimensions;
70 
72  using ParametersType = typename Superclass::ParametersType;
73  using ParametersValueType = typename Superclass::ParametersValueType;
74  using FixedParametersType = typename Superclass::FixedParametersType;
75  using FixedParametersValueType = typename Superclass::FixedParametersValueType;
77 
78 
80  using JacobianType = typename Superclass::JacobianType;
81  using JacobianPositionType = typename Superclass::JacobianPositionType;
82  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
83 
85  using TransformCategoryEnum = 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;
106  using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
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
133  TransformCovariantVector(const InputCovariantVectorType & vector) const override
134  {
135  return vector;
136  }
137 
142  void
144  {}
145 
174  void
176  {
177  jacobian.SetSize(NDimensions, 0);
178  }
180 
181 
186  void
188  {
189  jac.set_identity();
190  }
191  using Superclass::ComputeJacobianWithRespectToPosition;
193 
194  /* Always returns true if not null, as an identity is it's 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
241  SetParameters(const ParametersType &) override
242  {}
243 
244 protected:
246  : Transform<TParametersValueType, NDimensions, NDimensions>(0)
247  {}
248 
249  ~IdentityTransform() override = default;
250 };
251 } // end namespace itk
252 
253 #endif
itk::IdentityTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkIdentityTransform.h:81
itk::IdentityTransform::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkIdentityTransform.h:105
itk::IdentityTransform::ComputeJacobianWithRespectToParameters
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &jacobian) const override
Definition: itkIdentityTransform.h:175
itk::IdentityTransform
Implementation of an Identity Transform.
Definition: itkIdentityTransform.h:50
itkCovariantVector.h
itk::IdentityTransform::FixedParametersValueType
typename Superclass::FixedParametersValueType FixedParametersValueType
Definition: itkIdentityTransform.h:75
itk::IdentityTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkIdentityTransform.h:80
itkPoint.h
itk::IdentityTransform::ScalarType
ParametersValueType ScalarType
Definition: itkIdentityTransform.h:76
itk::IdentityTransform::ComputeJacobianWithRespectToPosition
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &jac) const override
Definition: itkIdentityTransform.h:187
itk::IdentityTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkIdentityTransform.h:72
itk::Vector< TParametersValueType, Self::InputSpaceDimension >
itk::IdentityTransform::SetIdentity
void SetIdentity()
Definition: itkIdentityTransform.h:143
itk::SmartPointer< Self >
itk::IdentityTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkIdentityTransform.h:74
itk::IdentityTransform::TransformPoint
OutputPointType TransformPoint(const InputPointType &point) const override
Definition: itkIdentityTransform.h:110
itk::IdentityTransform::OutputVnlVectorType
vnl_vector_fixed< TParametersValueType, Self::OutputSpaceDimension > OutputVnlVectorType
Definition: itkIdentityTransform.h:97
itk::IdentityTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkIdentityTransform.h:106
itk::IdentityTransform::GetInverseTransform
InverseTransformBasePointer GetInverseTransform() const override
Definition: itkIdentityTransform.h:204
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::IdentityTransform::SetFixedParameters
void SetFixedParameters(const FixedParametersType &) override
Definition: itkIdentityTransform.h:229
itk::IdentityTransform::TransformVector
OutputVectorType TransformVector(const InputVectorType &vector) const override
Definition: itkIdentityTransform.h:118
itk::IdentityTransform::SetParameters
void SetParameters(const ParametersType &) override
Definition: itkIdentityTransform.h:241
itk::IdentityTransform::GetInverse
bool GetInverse(Self *inverseTransform) const
Definition: itkIdentityTransform.h:196
itk::IdentityTransform::GetFixedParameters
const FixedParametersType & GetFixedParameters() const override
Definition: itkIdentityTransform.h:222
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itkObject.h
itkArray2D.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::IdentityTransform::IdentityTransform
IdentityTransform()
Definition: itkIdentityTransform.h:245
itk::IdentityTransform::TransformCategoryEnum
typename Superclass::TransformCategoryEnum TransformCategoryEnum
Definition: itkIdentityTransform.h:85
itk::Point< TParametersValueType, Self::InputSpaceDimension >
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
itk::IdentityTransform::TransformVector
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
Definition: itkIdentityTransform.h:125
itk::IdentityTransform::TransformCovariantVector
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
Definition: itkIdentityTransform.h:133
itkTransform.h
itk::IdentityTransform::GetParameters
const ParametersType & GetParameters() const override
Definition: itkIdentityTransform.h:234
itk::IdentityTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkIdentityTransform.h:82
itk::IdentityTransform::InputVnlVectorType
vnl_vector_fixed< TParametersValueType, Self::InputSpaceDimension > InputVnlVectorType
Definition: itkIdentityTransform.h:96
itk::IdentityTransform::ParametersValueType
typename Superclass::ParametersValueType ParametersValueType
Definition: itkIdentityTransform.h:73
itk::IdentityTransform::GetTransformCategory
TransformCategoryEnum GetTransformCategory() const override
Definition: itkIdentityTransform.h:215