ITK  5.2.0
Insight Toolkit
itkRigid3DPerspectiveTransform.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 itkRigid3DPerspectiveTransform_h
19 #define itkRigid3DPerspectiveTransform_h
20 
21 #include "itkMacro.h"
22 #include "vnl/vnl_quaternion.h"
23 #include <iostream>
24 #include "itkTransform.h"
25 #include "itkVersor.h"
26 
27 namespace itk
28 {
37 template <typename TParametersValueType = double>
38 class ITK_TEMPLATE_EXPORT Rigid3DPerspectiveTransform : public Transform<TParametersValueType, 3, 2>
39 {
40 public:
41  ITK_DISALLOW_COPY_AND_MOVE(Rigid3DPerspectiveTransform);
42 
44  static constexpr unsigned int InputSpaceDimension = 3;
45  static constexpr unsigned int OutputSpaceDimension = 2;
46 
48  static constexpr unsigned int SpaceDimension = 3;
49  static constexpr unsigned int ParametersDimension = 6;
50 
54 
57 
60 
62  itkNewMacro(Self);
63 
65  using ScalarType = typename Superclass::ScalarType;
66 
68  using FixedParametersType = typename Superclass::FixedParametersType;
69  using FixedParametersValueType = typename FixedParametersType::ValueType;
70  using ParametersType = typename Superclass::ParametersType;
71  using ParametersValueType = typename ParametersType::ValueType;
72 
74  using JacobianType = typename Superclass::JacobianType;
75  using JacobianPositionType = typename Superclass::JacobianPositionType;
76  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
77 
80 
84 
88 
90  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
91  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
92 
96 
98  using VnlQuaternionType = vnl_quaternion<TParametersValueType>;
99 
101  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
102  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
103 
108  using AxisValueType = typename AxisType::ValueType;
109 
113  const OffsetType &
114  GetOffset() const
115  {
116  return m_Offset;
117  }
118 
122  const VersorType &
123  GetRotation() const
124  {
125  return m_Versor;
126  }
127 
132  void
133  SetParameters(const ParametersType & parameters) override;
134 
135  const ParametersType &
136  GetParameters() const override;
137 
141  void
143  {}
144 
147  void
148  SetOffset(const OffsetType & offset)
149  {
150  m_Offset = offset;
151  return;
152  }
153 
156  void
157  SetRotation(const VersorType & rotation);
158 
163  void
164  SetRotation(const Vector<TParametersValueType, 3> & axis, double angle);
165 
169  void
170  SetFocalDistance(TParametersValueType focalDistance)
171  {
172  m_FocalDistance = focalDistance;
173  }
174 
176  double
178  {
179  return m_FocalDistance;
180  }
181 
185  OutputPointType
186  TransformPoint(const InputPointType & point) const override;
187 
189  using Superclass::TransformVector;
190 
191  OutputVectorType
192  TransformVector(const InputVectorType &) const override
193  {
194  itkExceptionMacro(<< "TransformVector(const InputVectorType &) is not implemented for Rigid3DPerspectiveTransform");
195  }
196 
197  OutputVnlVectorType
198  TransformVector(const InputVnlVectorType &) const override
199  {
200  itkExceptionMacro(
201  << "TransformVector(const InputVnlVectorType &) is not implemented for Rigid3DPerspectiveTransform");
202  }
203 
204  using Superclass::TransformCovariantVector;
205 
206  OutputCovariantVectorType
208  {
209  itkExceptionMacro(<< "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for "
210  "Rigid3DPerspectiveTransform");
211  }
212 
214  const MatrixType &
216  {
217  return m_RotationMatrix;
218  }
219 
221  void
222  ComputeMatrix();
223 
226  void
227  ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const override;
228 
229  void
231  {
232  itkExceptionMacro("ComputeJacobianWithRespectToPosition not yet implemented "
233  "for "
234  << this->GetNameOfClass());
235  }
236  using Superclass::ComputeJacobianWithRespectToPosition;
237 
239  itkGetConstReferenceMacro(FixedOffset, OffsetType);
240  itkSetMacro(FixedOffset, OffsetType);
242 
244  itkSetMacro(CenterOfRotation, InputPointType);
245  itkGetConstReferenceMacro(CenterOfRotation, InputPointType);
247 
248 protected:
250  ~Rigid3DPerspectiveTransform() override = default;
251  void
252  PrintSelf(std::ostream & os, Indent indent) const override;
253 
254 private:
257 
260 
262  TParametersValueType m_FocalDistance;
263 
266 
269 
272 }; // class Rigid3DPerspectiveTransform:
273 } // namespace itk
274 
275 #ifndef ITK_MANUAL_INSTANTIATION
276 # include "itkRigid3DPerspectiveTransform.hxx"
277 #endif
278 
279 #endif /* itkRigid3DPerspectiveTransform_h */
itk::Rigid3DPerspectiveTransform::ParametersType
typename Superclass::ParametersType ParametersType
Definition: itkRigid3DPerspectiveTransform.h:70
itk::Rigid3DPerspectiveTransform::InputVnlVectorType
typename Superclass::InputVnlVectorType InputVnlVectorType
Definition: itkRigid3DPerspectiveTransform.h:101
itk::Rigid3DPerspectiveTransform::m_CenterOfRotation
InputPointType m_CenterOfRotation
Definition: itkRigid3DPerspectiveTransform.h:271
itk::Rigid3DPerspectiveTransform::JacobianType
typename Superclass::JacobianType JacobianType
Definition: itkRigid3DPerspectiveTransform.h:74
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::Vector< TParametersValueType, Self::InputSpaceDimension >
itk::Rigid3DPerspectiveTransform::ScalarType
typename Superclass::ScalarType ScalarType
Definition: itkRigid3DPerspectiveTransform.h:65
itk::Rigid3DPerspectiveTransform::m_RotationMatrix
MatrixType m_RotationMatrix
Definition: itkRigid3DPerspectiveTransform.h:265
itk::Rigid3DPerspectiveTransform
Rigid3DTramsform of a vector space (e.g. space coordinates)
Definition: itkRigid3DPerspectiveTransform.h:38
itk::SmartPointer< Self >
itk::Rigid3DPerspectiveTransform::TransformVector
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
Definition: itkRigid3DPerspectiveTransform.h:198
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Rigid3DPerspectiveTransform::AxisValueType
typename AxisType::ValueType AxisValueType
Definition: itkRigid3DPerspectiveTransform.h:108
itk::Versor< TParametersValueType >
itk::Rigid3DPerspectiveTransform::GetRotationMatrix
const MatrixType & GetRotationMatrix() const
Definition: itkRigid3DPerspectiveTransform.h:215
itk::Rigid3DPerspectiveTransform::FixedParametersValueType
typename FixedParametersType::ValueType FixedParametersValueType
Definition: itkRigid3DPerspectiveTransform.h:69
itk::Rigid3DPerspectiveTransform::GetOffset
const OffsetType & GetOffset() const
Definition: itkRigid3DPerspectiveTransform.h:114
itk::Rigid3DPerspectiveTransform::AxisType
typename VersorType::VectorType AxisType
Definition: itkRigid3DPerspectiveTransform.h:106
itk::Rigid3DPerspectiveTransform::InputCovariantVectorType
typename Superclass::InputCovariantVectorType InputCovariantVectorType
Definition: itkRigid3DPerspectiveTransform.h:90
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Rigid3DPerspectiveTransform::ParametersValueType
typename ParametersType::ValueType ParametersValueType
Definition: itkRigid3DPerspectiveTransform.h:71
itk::Rigid3DPerspectiveTransform::SetFocalDistance
void SetFocalDistance(TParametersValueType focalDistance)
Definition: itkRigid3DPerspectiveTransform.h:170
itkMacro.h
itk::Rigid3DPerspectiveTransform::TransformVector
OutputVectorType TransformVector(const InputVectorType &) const override
Definition: itkRigid3DPerspectiveTransform.h:192
itk::Rigid3DPerspectiveTransform::TransformCovariantVector
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
Definition: itkRigid3DPerspectiveTransform.h:207
itk::Rigid3DPerspectiveTransform::m_FixedOffset
OffsetType m_FixedOffset
Definition: itkRigid3DPerspectiveTransform.h:268
itk::Rigid3DPerspectiveTransform::SetFixedParameters
void SetFixedParameters(const FixedParametersType &) override
Definition: itkRigid3DPerspectiveTransform.h:142
itk::Rigid3DPerspectiveTransform::OutputVnlVectorType
typename Superclass::OutputVnlVectorType OutputVnlVectorType
Definition: itkRigid3DPerspectiveTransform.h:102
itkVersor.h
itk::Rigid3DPerspectiveTransform::VnlQuaternionType
vnl_quaternion< TParametersValueType > VnlQuaternionType
Definition: itkRigid3DPerspectiveTransform.h:98
itk::Rigid3DPerspectiveTransform::InverseJacobianPositionType
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
Definition: itkRigid3DPerspectiveTransform.h:76
itk::Rigid3DPerspectiveTransform::m_Versor
VersorType m_Versor
Definition: itkRigid3DPerspectiveTransform.h:259
itk::Versor< TParametersValueType >::ValueType
TParametersValueType ValueType
Definition: itkVersor.h:58
itk::Rigid3DPerspectiveTransform::GetRotation
const VersorType & GetRotation() const
Definition: itkRigid3DPerspectiveTransform.h:123
itk::Matrix< TParametersValueType, Self::InputSpaceDimension, Self::InputSpaceDimension >
itk::Vector< TParametersValueType, Self::InputSpaceDimension >::ValueType
TParametersValueType ValueType
Definition: itkVector.h:71
itk::Rigid3DPerspectiveTransform::SetOffset
void SetOffset(const OffsetType &offset)
Definition: itkRigid3DPerspectiveTransform.h:148
itk::Rigid3DPerspectiveTransform::FixedParametersType
typename Superclass::FixedParametersType FixedParametersType
Definition: itkRigid3DPerspectiveTransform.h:68
itk::Rigid3DPerspectiveTransform::AngleType
typename VersorType::ValueType AngleType
Definition: itkRigid3DPerspectiveTransform.h:107
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Rigid3DPerspectiveTransform::m_Offset
OffsetType m_Offset
Definition: itkRigid3DPerspectiveTransform.h:256
itk::Point< TParametersValueType, Self::InputSpaceDimension >
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itk::Rigid3DPerspectiveTransform::JacobianPositionType
typename Superclass::JacobianPositionType JacobianPositionType
Definition: itkRigid3DPerspectiveTransform.h:75
itkTransform.h
itk::Rigid3DPerspectiveTransform::ComputeJacobianWithRespectToPosition
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &) const override
Definition: itkRigid3DPerspectiveTransform.h:230
itk::Rigid3DPerspectiveTransform::OffsetValueType
typename OffsetType::ValueType OffsetValueType
Definition: itkRigid3DPerspectiveTransform.h:83
itk::Rigid3DPerspectiveTransform::m_FocalDistance
TParametersValueType m_FocalDistance
Definition: itkRigid3DPerspectiveTransform.h:262
itk::Rigid3DPerspectiveTransform::OutputCovariantVectorType
typename Superclass::OutputCovariantVectorType OutputCovariantVectorType
Definition: itkRigid3DPerspectiveTransform.h:91
itk::Rigid3DPerspectiveTransform::GetFocalDistance
double GetFocalDistance() const
Definition: itkRigid3DPerspectiveTransform.h:177