ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkRigid2DTransform.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 itkRigid2DTransform_h
19#define itkRigid2DTransform_h
20
22
23namespace itk
24{
55template <typename TParametersValueType = double>
56class ITK_TEMPLATE_EXPORT Rigid2DTransform : public MatrixOffsetTransformBase<TParametersValueType, 2, 2>
57{
58public:
60
66
69
71 itkNewMacro(Self);
72
74 static constexpr unsigned int InputSpaceDimension = 2;
75 static constexpr unsigned int OutputSpaceDimension = 2;
76 static constexpr unsigned int ParametersDimension = 3;
77
79 using typename Superclass::ScalarType;
80
82 using typename Superclass::ParametersType;
86
88 using typename Superclass::JacobianType;
91
92 // / Standard matrix type for this class
93 using typename Superclass::MatrixType;
94 using typename Superclass::MatrixValueType;
95
96 // / Standard vector type for this class
97 using typename Superclass::OffsetType;
98 using typename Superclass::OffsetValueType;
99
100 // / Standard vector type for this class
101 using typename Superclass::InputVectorType;
102 using typename Superclass::OutputVectorType;
104
105 // / Standard covariant vector type for this class
108
109 // / Standard vnl_vector type for this class
110 using typename Superclass::InputVnlVectorType;
111 using typename Superclass::OutputVnlVectorType;
112
113 // / Standard coordinate point type for this class
114 using typename Superclass::InputPointType;
115 using typename Superclass::OutputPointType;
116
120 using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
121
134 void
135 SetMatrix(const MatrixType & matrix) override;
136
149 virtual void
150 SetMatrix(const MatrixType & matrix, const TParametersValueType tolerance);
151
159 void
160 Translate(const OffsetType & offset, bool pre = false);
161
170 inline InputPointType
172
173 inline InputVectorType
174 BackTransform(const OutputVectorType & vect) const;
175
176 inline InputVnlVectorType
178
181
183 void
184 SetAngle(TParametersValueType angle);
185
186 itkGetConstReferenceMacro(Angle, TParametersValueType);
187
189 void
190 SetAngleInDegrees(TParametersValueType angle);
191
195 void
196 SetRotation(TParametersValueType angle)
197 {
198 this->SetAngle(angle);
199 }
200 virtual const TParametersValueType &
202 {
203 return m_Angle;
204 }
205
206
215 void
216 SetParameters(const ParametersType & parameters) override;
217
226 const ParametersType &
227 GetParameters() const override;
228
231 void
233
238 void
239 CloneInverseTo(Pointer & result) const;
240
242 bool
243 GetInverse(Self * inverse) const;
244
247 GetInverseTransform() const override;
248
253 void
254 CloneTo(Pointer & result) const;
255
257 void
258 SetIdentity() override;
259
260protected:
261 Rigid2DTransform(unsigned int outputSpaceDimension, unsigned int parametersDimension);
262 Rigid2DTransform(unsigned int parametersDimension);
264
265 ~Rigid2DTransform() override = default;
266
270 void
271 PrintSelf(std::ostream & os, Indent indent) const override;
272
276 void
277 ComputeMatrix() override;
278
283 void
285
287 void
288 SetVarAngle(TParametersValueType angle)
289 {
290 m_Angle = angle;
291 }
292
293private:
294 TParametersValueType m_Angle{};
295
296}; // class Rigid2DTransform
297
298// Back transform a point
299template <typename TParametersValueType>
300inline auto
302{
303 itkWarningMacro("BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() "
304 "to generate an inverse transform and then perform the transform using that inverted transform.");
305 return this->GetInverseMatrix() * (point - this->GetOffset());
306}
307
308// Back transform a vector
309template <typename TParametersValueType>
310inline auto
312{
313 itkWarningMacro("BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() "
314 "to generate an inverse transform and then perform the transform using that inverted transform.");
315 return this->GetInverseMatrix() * vect;
316}
317
318// Back transform a vnl_vector
319template <typename TParametersValueType>
320inline auto
322{
323 itkWarningMacro("BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() "
324 "to generate an inverse transform and then perform the transform using that inverted transform.");
325 return this->GetInverseMatrix() * vect;
326}
327
328// Back Transform a CovariantVector
329template <typename TParametersValueType>
330inline auto
333{
334 itkWarningMacro("BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() "
335 "to generate an inverse transform and then perform the transform using that inverted transform.");
336 return this->GetMatrix() * vect;
337}
338
339} // namespace itk
340
341#ifndef ITK_MANUAL_INSTANTIATION
342# include "itkRigid2DTransform.hxx"
343#endif
344
345#endif /* itkRigid2DTransform_h */
OptimizerParameters< FixedParametersValueType > FixedParametersType
itkGetConstReferenceMacro(InputSpaceName, std::string)
TParametersValueType ParametersValueType
OptimizerParameters< ParametersValueType > ParametersType
itkOverrideGetNameOfClassMacro(TransformBaseTemplate)
ITK_DISALLOW_COPY_AND_MOVE(TransformBaseTemplate)
Control indentation during Print() invocation.
Definition itkIndent.h:50
vnl_vector_fixed< TParametersValueType, Self::InputSpaceDimension > InputVnlVectorType
Point< TParametersValueType, Self::InputSpaceDimension > InputPointType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Point< TParametersValueType, Self::OutputSpaceDimension > OutputPointType
Vector< TParametersValueType, Self::OutputSpaceDimension > OutputVectorType
vnl_vector_fixed< TParametersValueType, Self::OutputSpaceDimension > OutputVnlVectorType
CovariantVector< TParametersValueType, Self::InputSpaceDimension > InputCovariantVectorType
const InverseMatrixType & GetInverseMatrix() const
typename Superclass::InverseTransformBaseType InverseTransformBaseType
CovariantVector< TParametersValueType, Self::OutputSpaceDimension > OutputCovariantVectorType
MatrixOffsetTransformBase(unsigned int paramDims=ParametersDimension)
Matrix< TParametersValueType, Self::OutputSpaceDimension, Self::InputSpaceDimension > MatrixType
Vector< TParametersValueType, Self::InputSpaceDimension > InputVectorType
vnl_matrix_fixed< ParametersValueType, VInputDimension, VOutputDimension > InverseJacobianPositionType
void SetIdentity() override
void ComputeMatrixParameters() override
virtual void SetMatrix(const MatrixType &matrix, const TParametersValueType tolerance)
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
void Translate(const OffsetType &offset, bool pre=false)
void ComputeJacobianWithRespectToParameters(const InputPointType &p, JacobianType &j) const override
static constexpr unsigned int ParametersDimension
Rigid2DTransform(unsigned int outputSpaceDimension, unsigned int parametersDimension)
static constexpr unsigned int InputSpaceDimension
void SetAngle(TParametersValueType angle)
void CloneTo(Pointer &result) const
InputVectorType BackTransform(const OutputVectorType &vect) const
InputVnlVectorType BackTransform(const OutputVnlVectorType &vect) const
Array2D< ParametersValueType > JacobianType
void SetRotation(TParametersValueType angle)
void PrintSelf(std::ostream &os, Indent indent) const override
virtual const TParametersValueType & GetRotation() const
InputCovariantVectorType BackTransform(const OutputCovariantVectorType &vect) const
void SetVarAngle(TParametersValueType angle)
~Rigid2DTransform() override=default
typename Superclass::InverseTransformBaseType InverseTransformBaseType
bool GetInverse(Self *inverse) const
void ComputeMatrix() override
Rigid2DTransform(unsigned int parametersDimension)
InverseTransformBasePointer GetInverseTransform() const override
void SetAngleInDegrees(TParametersValueType angle)
void SetMatrix(const MatrixType &matrix) override
InputPointType BackTransform(const OutputPointType &point) const
void SetParameters(const ParametersType &parameters) override
static constexpr unsigned int OutputSpaceDimension
MatrixOffsetTransformBase< TParametersValueType, 2, 2 > Superclass
const ParametersType & GetParameters() const override
void CloneInverseTo(Pointer &result) const
Implements transparent reference counting.
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