ITK  5.1.0
Insight Toolkit
itkAffineTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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:
108 
111 
114 
116  itkNewMacro(Self);
117 
119  static constexpr unsigned int InputSpaceDimension = NDimensions;
120  static constexpr unsigned int OutputSpaceDimension = NDimensions;
121  static constexpr unsigned int SpaceDimension = NDimensions;
122  static constexpr unsigned int ParametersDimension = NDimensions * (NDimensions + 1);
123 
125  using ParametersType = typename Superclass::ParametersType;
126  using FixedParametersType = typename Superclass::FixedParametersType;
127  using JacobianType = typename Superclass::JacobianType;
128  using JacobianPositionType = typename Superclass::JacobianPositionType;
129  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
130  using ScalarType = typename Superclass::ScalarType;
131  using InputPointType = typename Superclass::InputPointType;
132  using OutputPointType = typename Superclass::OutputPointType;
133  using InputVectorType = typename Superclass::InputVectorType;
134  using OutputVectorType = typename Superclass::OutputVectorType;
135  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
136  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
137  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
138  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
139  using MatrixType = typename Superclass::MatrixType;
140  using InverseMatrixType = typename Superclass::InverseMatrixType;
141  using CenterType = typename Superclass::CenterType;
142  using OffsetType = typename Superclass::OffsetType;
143  using TranslationType = typename Superclass::TranslationType;
144 
147  using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
148  using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
149 
156  void
157  Translate(const OutputVectorType & offset, bool pre = false);
158 
170  void
171  Scale(const OutputVectorType & factor, bool pre = false);
172 
173  void
174  Scale(const TParametersValueType & factor, bool pre = false);
175 
191  void
192  Rotate(int axis1, int axis2, TParametersValueType angle, bool pre = false);
194 
208  void
209  Rotate2D(TParametersValueType angle, bool pre = false);
210 
224  void
225  Rotate3D(const OutputVectorType & axis, TParametersValueType angle, bool pre = false);
226 
238  void
239  Shear(int axis1, int axis2, TParametersValueType coef, bool pre = false);
240 
242  bool
243  GetInverse(Self * inverse) const;
244 
247  GetInverseTransform() const override;
248 
260  ScalarType
261  Metric(const Self * other) const;
262 
266  ScalarType
267  Metric() const;
268 
269 protected:
277  AffineTransform(const MatrixType & matrix, const OutputVectorType & offset);
278  AffineTransform(unsigned int paramDims);
279  AffineTransform();
281 
283  ~AffineTransform() override = default;
284 
286  void
287  PrintSelf(std::ostream & s, Indent indent) const override;
288 
289 private:
290  AffineTransform(const Self & other) = delete;
291  const Self &
292  operator=(const Self &) = delete;
293 }; // class AffineTransform
294 
295 } // namespace itk
296 
297 #ifndef ITK_MANUAL_INSTANTIATION
298 # include "itkAffineTransform.hxx"
299 #endif
300 
301 #endif /* itkAffineTransform_h */
itk::AffineTransform::OffsetType
typename Superclass::OffsetType OffsetType
Definition: itkAffineTransform.h:142
itk::AffineTransform::OutputVnlVectorType
typename Superclass::OutputVnlVectorType OutputVnlVectorType
Definition: itkAffineTransform.h:136
itk::AffineTransform::CenterType
typename Superclass::CenterType CenterType
Definition: itkAffineTransform.h:141
itk::AffineTransform::ScalarType
typename Superclass::ScalarType ScalarType
Definition: itkAffineTransform.h:130
itk::AffineTransform::InverseMatrixType
typename Superclass::InverseMatrixType InverseMatrixType
Definition: itkAffineTransform.h:140
itk::AffineTransform::TranslationType
typename Superclass::TranslationType TranslationType
Definition: itkAffineTransform.h:143
itk::MatrixOffsetTransformBase
Matrix and Offset transformation of a vector space (e.g. space coordinates)
Definition: itkMatrixOffsetTransformBase.h:105
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:139
itk::AffineTransform::InputVnlVectorType
typename Superclass::InputVnlVectorType InputVnlVectorType
Definition: itkAffineTransform.h:135
itk::AffineTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkAffineTransform.h:125
itk::AffineTransform::OutputVectorType
typename Superclass::OutputVectorType OutputVectorType
Definition: itkAffineTransform.h:134
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::AffineTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkAffineTransform.h:126
itk::AffineTransform::InputCovariantVectorType
typename Superclass::InputCovariantVectorType InputCovariantVectorType
Definition: itkAffineTransform.h:137
itkMatrixOffsetTransformBase.h
itk::AffineTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkAffineTransform.h:129
itk::AffineTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkAffineTransform.h:148
itk::AffineTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkAffineTransform.h:128
itk::AffineTransform::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition: itkAffineTransform.h:147
itk::AffineTransform::OutputCovariantVectorType
typename Superclass::OutputCovariantVectorType OutputCovariantVectorType
Definition: itkAffineTransform.h:138
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::AffineTransform::OutputPointType
typename Superclass::OutputPointType OutputPointType
Definition: itkAffineTransform.h:132
itk::AffineTransform::InputPointType
typename Superclass::InputPointType InputPointType
Definition: itkAffineTransform.h:131
itk::AffineTransform::InputVectorType
typename Superclass::InputVectorType InputVectorType
Definition: itkAffineTransform.h:133
itk::AffineTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkAffineTransform.h:127