ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkTranslationTransform.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 itkTranslationTransform_h
19#define itkTranslationTransform_h
20
21#include "itkTransform.h"
22#include "itkMacro.h"
23#include "itkMatrix.h"
24
25namespace itk
26{
27
42template <typename TParametersValueType = double, unsigned int VDimension = 3>
43class ITK_TEMPLATE_EXPORT TranslationTransform : public Transform<TParametersValueType, VDimension, VDimension>
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(TranslationTransform);
47
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(TranslationTransform);
59
61 static constexpr unsigned int SpaceDimension = VDimension;
62 static constexpr unsigned int ParametersDimension = VDimension;
63
65 using typename Superclass::ScalarType;
66
69 using typename Superclass::ParametersType;
70
72 using typename Superclass::JacobianType;
75
78
82
86
88 using InputVnlVectorType = vnl_vector_fixed<TParametersValueType, VDimension>;
89 using OutputVnlVectorType = vnl_vector_fixed<TParametersValueType, VDimension>;
90
94
98 using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
99
102
105 const OutputVectorType &
106 GetOffset() const
107 {
108 return m_Offset;
109 }
110
113 void
114 SetParameters(const ParametersType & parameters) override;
115
117 const ParametersType &
118 GetParameters() const override;
119
123 void
125 {
126 m_Offset = offset;
127 }
128
130 void
131 Compose(const Self * other, bool pre = false);
132
137 void
138 Translate(const OutputVectorType & offset, bool pre = false);
139
145 TransformPoint(const InputPointType & point) const override;
146
149 TransformVector(const InputVectorType & vect) const override;
150
152 TransformVector(const InputVnlVectorType & vect) const override;
153
157
161 inline InputPointType
162 BackTransform(const OutputPointType & point) const;
163
164 inline InputVectorType
165 BackTransform(const OutputVectorType & vect) const;
166
167 inline InputVnlVectorType
168 BackTransform(const OutputVnlVectorType & vect) const;
169
171 BackTransform(const OutputCovariantVectorType & vect) const;
172
177 bool
178 GetInverse(Self * inverse) const;
179
182 GetInverseTransform() const override;
183
185 void
186 ComputeJacobianWithRespectToParameters(const InputPointType & point, JacobianType & jacobian) const override;
187
188
193 void
196
198 void
200
203 GetNumberOfParameters() const override
204 {
205 return VDimension;
206 }
207
213 [[nodiscard]] bool
214 IsLinear() const override
215 {
216 return true;
217 }
218
222 TransformCategoryEnum
223 GetTransformCategory() const override
224 {
225 return Self::TransformCategoryEnum::Linear;
226 }
227
231 void
233 {}
234
238 const FixedParametersType &
239 GetFixedParameters() const override
240 {
241 this->m_FixedParameters.SetSize(0);
242 return this->m_FixedParameters;
243 }
244
245protected:
247 ~TranslationTransform() override = default;
249 void
250 PrintSelf(std::ostream & os, Indent indent) const override;
251
252private:
254 OutputVectorType m_Offset{}; // Offset of the transformation
255}; // class TranslationTransform
256
257// Back transform a point
258template <typename TParametersValueType, unsigned int VDimension>
259inline auto
265
266// Back transform a vector
267template <typename TParametersValueType, unsigned int VDimension>
268inline auto
274
275// Back transform a vnl_vector
276template <typename TParametersValueType, unsigned int VDimension>
277inline auto
283
284// Back Transform a CovariantVector
285template <typename TParametersValueType, unsigned int VDimension>
286inline auto
292
293} // namespace itk
294
295#ifndef ITK_MANUAL_INSTANTIATION
296# include "itkTranslationTransform.hxx"
297#endif
298
299#endif /* itkTranslationTransform_h */
A templated class holding a n-Dimensional covariant vector.
Control indentation during Print() invocation.
Definition itkIndent.h:50
A templated class holding a geometric point in n-Dimensional space.
Definition itkPoint.h:54
Implements transparent reference counting.
OptimizerParameters< ParametersValueType > ParametersType
Transform< TParametersValueType, VOutputDimension, VInputDimension > InverseTransformBaseType
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &x, JacobianPositionType &jacobian) const
FixedParametersType m_FixedParameters
OptimizerParameters< FixedParametersValueType > FixedParametersType
virtual OutputVectorType TransformVector(const InputVectorType &) const
TransformBaseTemplateEnums::TransformCategory TransformCategoryEnum
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
static constexpr unsigned int ParametersDimension
OutputVectorType TransformVector(const InputVectorType &vect) const override
const OutputVectorType & GetOffset() const
typename Superclass::InverseTransformBaseType InverseTransformBaseType
SmartPointer< const Self > ConstPointer
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vect) const override
void ComputeJacobianWithRespectToParameters(const InputPointType &point, JacobianType &jacobian) const override
Array2D< ParametersValueType > JacobianType
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Vector< TParametersValueType, VDimension > InputVectorType
void SetParameters(const ParametersType &parameters) override
~TranslationTransform() override=default
void SetFixedParameters(const FixedParametersType &) override
const ParametersType & GetParameters() const override
Vector< TParametersValueType, VDimension > OutputVectorType
CovariantVector< TParametersValueType, VDimension > OutputCovariantVectorType
Point< TParametersValueType, VDimension > InputPointType
CovariantVector< TParametersValueType, VDimension > InputCovariantVectorType
OptimizerParameters< FixedParametersValueType > FixedParametersType
IdentifierType NumberOfParametersType
OutputPointType TransformPoint(const InputPointType &point) const override
InputPointType BackTransform(const OutputPointType &point) const
bool GetInverse(Self *inverse) const
NumberOfParametersType GetNumberOfParameters() const override
TransformCategoryEnum GetTransformCategory() const override
void PrintSelf(std::ostream &os, Indent indent) const override
const FixedParametersType & GetFixedParameters() const override
Transform< TParametersValueType, VDimension, VDimension > Superclass
vnl_vector_fixed< TParametersValueType, VDimension > InputVnlVectorType
void SetOffset(const OutputVectorType &offset)
void ComputeJacobianWithRespectToPosition(const InputPointType &x, JacobianPositionType &jac) const override
void Compose(const Self *other, bool pre=false)
InverseTransformBasePointer GetInverseTransform() const override
OptimizerParameters< ParametersValueType > ParametersType
Point< TParametersValueType, VDimension > OutputPointType
static constexpr unsigned int SpaceDimension
void Translate(const OutputVectorType &offset, bool pre=false)
OutputVnlVectorType TransformVector(const InputVnlVectorType &vect) const override
vnl_vector_fixed< TParametersValueType, VDimension > OutputVnlVectorType
A templated class holding a n-Dimensional vector.
Definition itkVector.h:63
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....