ITK  5.4.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  * 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 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 
59  itkOverrideGetNameOfClassMacro(Rigid3DPerspectiveTransform);
60 
62  itkNewMacro(Self);
63 
65  using typename Superclass::ScalarType;
66 
68  using typename Superclass::FixedParametersType;
70  using typename Superclass::ParametersType;
72 
74  using typename Superclass::JacobianType;
75  using typename Superclass::JacobianPositionType;
76  using typename Superclass::InverseJacobianPositionType;
77 
80 
84 
88 
90  using typename Superclass::InputCovariantVectorType;
91  using typename Superclass::OutputCovariantVectorType;
92 
96 
98  using VnlQuaternionType = vnl_quaternion<TParametersValueType>;
99 
101  using typename Superclass::InputVnlVectorType;
102  using 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);
244  itkSetMacro(CenterOfRotation, InputPointType);
245  itkGetConstReferenceMacro(CenterOfRotation, InputPointType);
248 protected:
250  ~Rigid3DPerspectiveTransform() override = default;
251  void
252  PrintSelf(std::ostream & os, Indent indent) const override;
253 
254 private:
256  OffsetType m_Offset{};
257 
259  VersorType m_Versor{};
260 
262  TParametersValueType m_FocalDistance{};
263 
265  MatrixType m_RotationMatrix{};
266 
268  OffsetType m_FixedOffset{};
269 
271  InputPointType m_CenterOfRotation{};
272 }; // class Rigid3DPerspectiveTransform:
273 } // namespace itk
274 
275 #ifndef ITK_MANUAL_INSTANTIATION
276 # include "itkRigid3DPerspectiveTransform.hxx"
277 #endif
278 
279 #endif /* itkRigid3DPerspectiveTransform_h */
itk::OptimizerParameters
Class to hold and manage different parameter types used during optimization.
Definition: itkOptimizerParameters.h:36
GetNameOfClass
const char * GetNameOfClass() const override
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::Vector< TParametersValueType, Self::InputSpaceDimension >
itk::Rigid3DPerspectiveTransform
Rigid3DTramsform of a vector space (e.g. space coordinates)
Definition: itkRigid3DPerspectiveTransform.h:38
itk::OptimizerParameters::ValueType
TParametersValueType ValueType
Definition: itkOptimizerParameters.h:40
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::Vector< TParametersValueType, Self::InputSpaceDimension >::ValueType
TParametersValueType ValueType
Definition: itkVector.h:71
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
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::point
*par Constraints *The filter requires an 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
itk::Rigid3DPerspectiveTransform::TransformCovariantVector
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
Definition: itkRigid3DPerspectiveTransform.h:207
itk::Rigid3DPerspectiveTransform::SetFixedParameters
void SetFixedParameters(const FixedParametersType &) override
Definition: itkRigid3DPerspectiveTransform.h:142
itkVersor.h
itk::Rigid3DPerspectiveTransform::VnlQuaternionType
vnl_quaternion< TParametersValueType > VnlQuaternionType
Definition: itkRigid3DPerspectiveTransform.h:98
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::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::Rigid3DPerspectiveTransform::SetOffset
void SetOffset(const OffsetType &offset)
Definition: itkRigid3DPerspectiveTransform.h:148
itk::Transform< TParametersValueType, 3, 2 >::JacobianPositionType
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Definition: itkTransform.h:145
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::Point< TParametersValueType, Self::InputSpaceDimension >
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
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::Transform< TParametersValueType, 3, 2 >::InputVnlVectorType
vnl_vector_fixed< TParametersValueType, VInputDimension > InputVnlVectorType
Definition: itkTransform.h:170
itk::Rigid3DPerspectiveTransform::GetFocalDistance
double GetFocalDistance() const
Definition: itkRigid3DPerspectiveTransform.h:177