ITK  5.2.0
Insight Toolkit
itkAffineTransform.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 itkAffineTransform_h
19 #define itkAffineTransform_h
20 
22 #include <iostream>
23 
24 
25 namespace itk
26 {
98 
99 template <typename TParametersValueType = double, unsigned int NDimensions = 3>
100 // Number of dimensions in the input space
101 class ITK_TEMPLATE_EXPORT AffineTransform
102  : public MatrixOffsetTransformBase<TParametersValueType, NDimensions, NDimensions>
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(AffineTransform);
106 
110 
113 
116 
118  itkNewMacro(Self);
119 
121  static constexpr unsigned int InputSpaceDimension = NDimensions;
122  static constexpr unsigned int OutputSpaceDimension = NDimensions;
123  static constexpr unsigned int SpaceDimension = NDimensions;
124  static constexpr unsigned int ParametersDimension = NDimensions * (NDimensions + 1);
125 
127  using ParametersType = typename Superclass::ParametersType;
128  using FixedParametersType = typename Superclass::FixedParametersType;
129  using JacobianType = typename Superclass::JacobianType;
130  using JacobianPositionType = typename Superclass::JacobianPositionType;
131  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
132  using ScalarType = typename Superclass::ScalarType;
133  using InputPointType = typename Superclass::InputPointType;
134  using OutputPointType = typename Superclass::OutputPointType;
135  using InputVectorType = typename Superclass::InputVectorType;
136  using OutputVectorType = typename Superclass::OutputVectorType;
137  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
138  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
139  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
140  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
141  using MatrixType = typename Superclass::MatrixType;
142  using InverseMatrixType = typename Superclass::InverseMatrixType;
143  using CenterType = typename Superclass::CenterType;
144  using OffsetType = typename Superclass::OffsetType;
145  using TranslationType = typename Superclass::TranslationType;
146 
149  using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
150  using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
151 
158  void
159  Translate(const OutputVectorType & offset, bool pre = false);
160 
172  void
173  Scale(const OutputVectorType & factor, bool pre = false);
174 
175  void
176  Scale(const TParametersValueType & factor, bool pre = false);
177 
193  void
194  Rotate(int axis1, int axis2, TParametersValueType angle, bool pre = false);
196 
210  void
211  Rotate2D(TParametersValueType angle, bool pre = false);
212 
226  void
227  Rotate3D(const OutputVectorType & axis, TParametersValueType angle, bool pre = false);
228 
240  void
241  Shear(int axis1, int axis2, TParametersValueType coef, bool pre = false);
242 
244  bool
245  GetInverse(Self * inverse) const;
246 
249  GetInverseTransform() const override;
250 
262  ScalarType
263  Metric(const Self * other) const;
264 
268  ScalarType
269  Metric() const;
270 
271 protected:
279  AffineTransform(const MatrixType & matrix, const OutputVectorType & offset);
280  AffineTransform(unsigned int paramDims);
281  AffineTransform();
283 
285  ~AffineTransform() override = default;
286 
288  void
289  PrintSelf(std::ostream & s, Indent indent) const override;
290 }; // class AffineTransform
291 
292 } // namespace itk
293 
294 #ifndef ITK_MANUAL_INSTANTIATION
295 # include "itkAffineTransform.hxx"
296 #endif
297 
298 #endif /* itkAffineTransform_h */
itk::AffineTransform::OffsetType
typename Superclass::OffsetType OffsetType
Definition: itkAffineTransform.h:144
itk::AffineTransform::OutputVnlVectorType
typename Superclass::OutputVnlVectorType OutputVnlVectorType
Definition: itkAffineTransform.h:138
itk::AffineTransform::CenterType
typename Superclass::CenterType CenterType
Definition: itkAffineTransform.h:143
itk::AffineTransform::ScalarType
typename Superclass::ScalarType ScalarType
Definition: itkAffineTransform.h:132
itk::AffineTransform::InverseMatrixType
typename Superclass::InverseMatrixType InverseMatrixType
Definition: itkAffineTransform.h:142
itk::AffineTransform::TranslationType
typename Superclass::TranslationType TranslationType
Definition: itkAffineTransform.h:145
itk::MatrixOffsetTransformBase
Matrix and Offset transformation of a vector space (e.g. space coordinates)
Definition: itkMatrixOffsetTransformBase.h:106
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AffineTransform
Definition: itkAffineTransform.h:101
itk::AffineTransform::MatrixType
typename Superclass::MatrixType MatrixType
Definition: itkAffineTransform.h:141
itk::AffineTransform::InputVnlVectorType
typename Superclass::InputVnlVectorType InputVnlVectorType
Definition: itkAffineTransform.h:137
itk::AffineTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkAffineTransform.h:127
itk::AffineTransform::OutputVectorType
typename Superclass::OutputVectorType OutputVectorType
Definition: itkAffineTransform.h:136
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::AffineTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkAffineTransform.h:128
itk::AffineTransform::InputCovariantVectorType
typename Superclass::InputCovariantVectorType InputCovariantVectorType
Definition: itkAffineTransform.h:139
itkMatrixOffsetTransformBase.h
itk::AffineTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkAffineTransform.h:131
itk::AffineTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkAffineTransform.h:150
itk::AffineTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkAffineTransform.h:130
itk::AffineTransform::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkAffineTransform.h:149
itk::AffineTransform::OutputCovariantVectorType
typename Superclass::OutputCovariantVectorType OutputCovariantVectorType
Definition: itkAffineTransform.h:140
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::AffineTransform::OutputPointType
typename Superclass::OutputPointType OutputPointType
Definition: itkAffineTransform.h:134
itk::AffineTransform::InputPointType
typename Superclass::InputPointType InputPointType
Definition: itkAffineTransform.h:133
itk::AffineTransform::InputVectorType
typename Superclass::InputVectorType InputVectorType
Definition: itkAffineTransform.h:135
itk::AffineTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkAffineTransform.h:129