ITK  6.0.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 
28 namespace itk
29 {
49 template <typename TParametersValueType, unsigned int VDimension = 3>
50 class ITK_TEMPLATE_EXPORT IdentityTransform : public Transform<TParametersValueType, VDimension, VDimension>
51 {
52 public:
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;
76  using ScalarType = ParametersValueType;
77 
78 
80  using typename Superclass::JacobianType;
81  using typename Superclass::JacobianPositionType;
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 
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(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
229  SetFixedParameters(const FixedParametersType &) override
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:
245  IdentityTransform() = default;
246  ~IdentityTransform() override = default;
247 };
248 } // end namespace itk
249 
250 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::IdentityTransform::InputVnlVectorType
vnl_vector_fixed< TParametersValueType, Self::InputSpaceDimension > InputVnlVectorType
Definition: itkIdentityTransform.h:96
itk::IdentityTransform
Implementation of an Identity Transform.
Definition: itkIdentityTransform.h:50
itkCovariantVector.h
itkPoint.h
itk::IdentityTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkIdentityTransform.h:106
itk::IdentityTransform::GetFixedParameters
const FixedParametersType & GetFixedParameters() const override
Definition: itkIdentityTransform.h:222
itk::Vector< TParametersValueType, Self::InputSpaceDimension >
itk::IdentityTransform::TransformCovariantVector
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
Definition: itkIdentityTransform.h:133
itk::SmartPointer< Self >
itk::IdentityTransform::ComputeJacobianWithRespectToPosition
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &jac) const override
Definition: itkIdentityTransform.h:187
itk::IdentityTransform::GetParameters
const ParametersType & GetParameters() const override
Definition: itkIdentityTransform.h:234
itk::IdentityTransform::TransformVector
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
Definition: itkIdentityTransform.h:125
itk::IdentityTransform::SetIdentity
void SetIdentity()
Definition: itkIdentityTransform.h:143
itk::point
*par Constraints *The filter requires an 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
itk::Array2D::SetSize
void SetSize(unsigned int m, unsigned int n)
itk::IdentityTransform::OutputVnlVectorType
vnl_vector_fixed< TParametersValueType, Self::OutputSpaceDimension > OutputVnlVectorType
Definition: itkIdentityTransform.h:97
itk::IdentityTransform::ScalarType
ParametersValueType ScalarType
Definition: itkIdentityTransform.h:76
itk::IdentityTransform::GetInverseTransform
InverseTransformBasePointer GetInverseTransform() const override
Definition: itkIdentityTransform.h:204
itk::IdentityTransform::ComputeJacobianWithRespectToParameters
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &jacobian) const override
Definition: itkIdentityTransform.h:175
itk::IdentityTransform::SetParameters
void SetParameters(const ParametersType &) override
Definition: itkIdentityTransform.h:241
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itkObject.h
itk::Transform< TParametersValueType, VDimension, VDimension >::JacobianPositionType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Definition: itkTransform.h:131
itkArray2D.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::IdentityTransform::SetFixedParameters
void SetFixedParameters(const FixedParametersType &) override
Definition: itkIdentityTransform.h:229
itk::Transform< TParametersValueType, VDimension, VDimension >::InverseJacobianPositionType
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
Definition: itkTransform.h:132
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::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkIdentityTransform.h:105
New
static Pointer New()
itkTransform.h
itk::Array2D
Array2D class representing a 2D array.
Definition: itkArray2D.h:42
itk::IdentityTransform::GetTransformCategory
TransformCategoryEnum GetTransformCategory() const override
Definition: itkIdentityTransform.h:215
itk::IdentityTransform::TransformPoint
OutputPointType TransformPoint(const InputPointType &point) const override
Definition: itkIdentityTransform.h:110
itk::IdentityTransform::GetInverse
bool GetInverse(Self *inverseTransform) const
Definition: itkIdentityTransform.h:196
itk::IdentityTransform::TransformVector
OutputVectorType TransformVector(const InputVectorType &vector) const override
Definition: itkIdentityTransform.h:118