ITK  5.2.0
Insight Toolkit
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  * 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 itkRigid2DTransform_h
19 #define itkRigid2DTransform_h
20 
22 
23 namespace itk
24 {
55 template <typename TParametersValueType = double>
56 class ITK_TEMPLATE_EXPORT Rigid2DTransform : public MatrixOffsetTransformBase<TParametersValueType, 2, 2>
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_MOVE(Rigid2DTransform);
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 ScalarType = typename Superclass::ScalarType;
80 
82  using ParametersType = typename Superclass::ParametersType;
83  using ParametersValueType = typename Superclass::ParametersValueType;
84  using FixedParametersType = typename Superclass::FixedParametersType;
85  using FixedParametersValueType = typename Superclass::FixedParametersValueType;
86 
88  using JacobianType = typename Superclass::JacobianType;
89  using JacobianPositionType = typename Superclass::JacobianPositionType;
90  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
91 
92  // / Standard matrix type for this class
93  using MatrixType = typename Superclass::MatrixType;
94  using MatrixValueType = typename Superclass::MatrixValueType;
95 
96  // / Standard vector type for this class
97  using OffsetType = typename Superclass::OffsetType;
99 
100  // / Standard vector type for this class
101  using InputVectorType = typename Superclass::InputVectorType;
102  using OutputVectorType = typename Superclass::OutputVectorType;
103  using OutputVectorValueType = typename Superclass::OutputVectorValueType;
104 
105  // / Standard covariant vector type for this class
106  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
107  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
108 
109  // / Standard vnl_vector type for this class
110  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
111  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
112 
113  // / Standard coordinate point type for this class
114  using InputPointType = typename Superclass::InputPointType;
115  using OutputPointType = typename Superclass::OutputPointType;
116 
119  using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
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
171  BackTransform(const OutputPointType & point) const;
172 
173  inline InputVectorType
174  BackTransform(const OutputVectorType & vect) const;
175 
176  inline InputVnlVectorType
177  BackTransform(const OutputVnlVectorType & vect) const;
178 
180  BackTransform(const OutputCovariantVectorType & vect) const;
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 &
201  GetRotation() const
202  {
203  return m_Angle;
204  }
206 
215  void
216  SetParameters(const ParametersType & parameters) override;
217 
226  const ParametersType &
227  GetParameters() const override;
228 
231  void
232  ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & j) const override;
233 
238  void
239  CloneInverseTo(Pointer & result) const;
240 
242  bool
243  GetInverse(Self * inverse) const;
244 
246  InverseTransformBasePointer
247  GetInverseTransform() const override;
248 
253  void
254  CloneTo(Pointer & result) const;
255 
257  void
258  SetIdentity() override;
259 
260 protected:
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
284  ComputeMatrixParameters() override;
285 
287  void
288  SetVarAngle(TParametersValueType angle)
289  {
290  m_Angle = angle;
291  }
292 
293 private:
294  TParametersValueType m_Angle;
295 
296 }; // class Rigid2DTransform
297 
298 // Back transform a point
299 template <typename TParametersValueType>
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
309 template <typename TParametersValueType>
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
319 template <typename TParametersValueType>
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
329 template <typename TParametersValueType>
332 {
333  itkWarningMacro(<< "BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() "
334  "to generate an inverse transform and then perform the transform using that inverted transform.");
335  return this->GetMatrix() * vect;
336 }
337 
338 } // namespace itk
339 
340 #ifndef ITK_MANUAL_INSTANTIATION
341 # include "itkRigid2DTransform.hxx"
342 #endif
343 
344 #endif /* itkRigid2DTransform_h */
itk::Rigid2DTransform::OutputVectorValueType
typename Superclass::OutputVectorValueType OutputVectorValueType
Definition: itkRigid2DTransform.h:103
itk::Rigid2DTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkRigid2DTransform.h:88
itk::Rigid2DTransform::MatrixType
typename Superclass::MatrixType MatrixType
Definition: itkRigid2DTransform.h:93
itk::Rigid2DTransform::BackTransform
InputPointType BackTransform(const OutputPointType &point) const
Definition: itkRigid2DTransform.h:301
itk::Rigid2DTransform::OutputVnlVectorType
typename Superclass::OutputVnlVectorType OutputVnlVectorType
Definition: itkRigid2DTransform.h:111
itk::Rigid2DTransform::OutputPointType
typename Superclass::OutputPointType OutputPointType
Definition: itkRigid2DTransform.h:115
itk::Rigid2DTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkRigid2DTransform.h:84
itk::MatrixOffsetTransformBase
Matrix and Offset transformation of a vector space (e.g. space coordinates)
Definition: itkMatrixOffsetTransformBase.h:106
itk::Rigid2DTransform::m_Angle
TParametersValueType m_Angle
Definition: itkRigid2DTransform.h:294
itk::Rigid2DTransform::SetRotation
void SetRotation(TParametersValueType angle)
Definition: itkRigid2DTransform.h:196
itk::SmartPointer< Self >
itk::Rigid2DTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkRigid2DTransform.h:90
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Rigid2DTransform::OffsetType
typename Superclass::OffsetType OffsetType
Definition: itkRigid2DTransform.h:97
itk::Rigid2DTransform::ParametersValueType
typename Superclass::ParametersValueType ParametersValueType
Definition: itkRigid2DTransform.h:83
itk::Rigid2DTransform::GetRotation
virtual const TParametersValueType & GetRotation() const
Definition: itkRigid2DTransform.h:201
itk::Rigid2DTransform::OutputVectorType
typename Superclass::OutputVectorType OutputVectorType
Definition: itkRigid2DTransform.h:102
itk::Rigid2DTransform
Rigid2DTransform of a vector space (e.g. space coordinates)
Definition: itkRigid2DTransform.h:56
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Rigid2DTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkRigid2DTransform.h:89
itk::Rigid2DTransform::InputCovariantVectorType
typename Superclass::InputCovariantVectorType InputCovariantVectorType
Definition: itkRigid2DTransform.h:106
itk::Rigid2DTransform::MatrixValueType
typename Superclass::MatrixValueType MatrixValueType
Definition: itkRigid2DTransform.h:94
itkMatrixOffsetTransformBase.h
itk::Rigid2DTransform::InputVectorType
typename Superclass::InputVectorType InputVectorType
Definition: itkRigid2DTransform.h:101
itk::Rigid2DTransform::OffsetValueType
typename Superclass::OffsetValueType OffsetValueType
Definition: itkRigid2DTransform.h:98
itk::Rigid2DTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkRigid2DTransform.h:82
itk::Rigid2DTransform::OutputCovariantVectorType
typename Superclass::OutputCovariantVectorType OutputCovariantVectorType
Definition: itkRigid2DTransform.h:107
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Rigid2DTransform::InputPointType
typename Superclass::InputPointType InputPointType
Definition: itkRigid2DTransform.h:114
itk::OffsetValueType
signed long OffsetValueType
Definition: itkIntTypes.h:94
itk::Rigid2DTransform::FixedParametersValueType
typename Superclass::FixedParametersValueType FixedParametersValueType
Definition: itkRigid2DTransform.h:85
itk::Rigid2DTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkRigid2DTransform.h:120
itk::Rigid2DTransform::ScalarType
typename Superclass::ScalarType ScalarType
Definition: itkRigid2DTransform.h:79
itk::Rigid2DTransform::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkRigid2DTransform.h:119
itk::Rigid2DTransform::InputVnlVectorType
typename Superclass::InputVnlVectorType InputVnlVectorType
Definition: itkRigid2DTransform.h:110
itk::Rigid2DTransform::SetVarAngle
void SetVarAngle(TParametersValueType angle)
Definition: itkRigid2DTransform.h:288