ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRigid3DPerspectiveTransform.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 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 :
39  public Transform<TParametersValueType, 3, 2>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(Rigid3DPerspectiveTransform);
43 
45  static constexpr unsigned int InputSpaceDimension = 3;
46  static constexpr unsigned int OutputSpaceDimension = 2;
47 
49  static constexpr unsigned int SpaceDimension = 3;
50  static constexpr unsigned int ParametersDimension = 6;
51 
54  using Superclass = Transform<TParametersValueType,
55  Self::InputSpaceDimension,
56  Self::OutputSpaceDimension>;
57 
60 
63 
65  itkNewMacro(Self);
66 
68  using ScalarType = typename Superclass::ScalarType;
69 
71  using FixedParametersType = typename Superclass::FixedParametersType;
72  using FixedParametersValueType = typename FixedParametersType::ValueType;
73  using ParametersType = typename Superclass::ParametersType;
74  using ParametersValueType = typename ParametersType::ValueType;
75 
77  using JacobianType = typename Superclass::JacobianType;
78  using JacobianPositionType = typename Superclass::JacobianPositionType;
79  using InverseJacobianPositionType = typename Superclass::InverseJacobianPositionType;
80 
82  using MatrixType = Matrix<TParametersValueType, Self::InputSpaceDimension,
83  Self::InputSpaceDimension>;
84 
88 
92 
94  using InputCovariantVectorType = typename Superclass::InputCovariantVectorType;
95  using OutputCovariantVectorType = typename Superclass::OutputCovariantVectorType;
96 
100 
102  using VnlQuaternionType = vnl_quaternion<TParametersValueType>;
103 
105  using InputVnlVectorType = typename Superclass::InputVnlVectorType;
106  using OutputVnlVectorType = typename Superclass::OutputVnlVectorType;
107 
112  using AxisValueType = typename AxisType::ValueType;
113 
117  const OffsetType & GetOffset() const
118  {
119  return m_Offset;
120  }
121 
125  const VersorType & GetRotation() const
126  {
127  return m_Versor;
128  }
129 
134  void SetParameters(const ParametersType & parameters) override;
135 
136  const ParametersType & GetParameters() const override;
137 
142  {
143  }
144 
147  void SetOffset(const OffsetType & offset)
148  {
149  m_Offset = offset; return;
150  }
151 
154  void SetRotation(const VersorType & rotation);
155 
160  void SetRotation(const Vector<TParametersValueType, 3> & axis, double angle);
161 
165  void SetFocalDistance(TParametersValueType focalDistance)
166  {
167  m_FocalDistance = focalDistance;
168  }
169 
171  double GetFocalDistance() const
172  {
173  return m_FocalDistance;
174  }
175 
179  OutputPointType TransformPoint(const InputPointType & point) const override;
180 
182  using Superclass::TransformVector;
183 
185  {
186  itkExceptionMacro(
187  << "TransformVector(const InputVectorType &) is not implemented for Rigid3DPerspectiveTransform");
188  }
189 
191  {
192  itkExceptionMacro(
193  << "TransformVector(const InputVnlVectorType &) is not implemented for Rigid3DPerspectiveTransform");
194  }
195 
196  using Superclass::TransformCovariantVector;
197 
199  {
200  itkExceptionMacro(
201  <<
202  "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for Rigid3DPerspectiveTransform");
203  }
204 
207  {
208  return m_RotationMatrix;
209  }
210 
212  void ComputeMatrix();
213 
216  void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const override;
217 
219  JacobianPositionType &) const override
220  {
221  itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented "
222  "for " << this->GetNameOfClass() );
223  }
224  using Superclass::ComputeJacobianWithRespectToPosition;
225 
227  itkGetConstReferenceMacro(FixedOffset, OffsetType);
228  itkSetMacro(FixedOffset, OffsetType);
230 
232  itkSetMacro(CenterOfRotation, InputPointType);
233  itkGetConstReferenceMacro(CenterOfRotation, InputPointType);
235 
236 protected:
238  ~Rigid3DPerspectiveTransform() override = default;
239  void PrintSelf(std::ostream & os, Indent indent) const override;
240 
241 private:
244 
247 
249  TParametersValueType m_FocalDistance;
250 
253 
256 
259 }; // class Rigid3DPerspectiveTransform:
260 } // namespace itk
261 
262 #ifndef ITK_MANUAL_INSTANTIATION
263 #include "itkRigid3DPerspectiveTransform.hxx"
264 #endif
265 
266 #endif /* itkRigid3DPerspectiveTransform_h */
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &) const override
Light weight base class for most itk classes.
void SetFixedParameters(const FixedParametersType &) override
typename VersorType::VectorType AxisType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
TParametersValueType ValueType
Definition: itkVersor.h:58
typename Superclass::InverseJacobianPositionType InverseJacobianPositionType
typename Superclass::OutputVnlVectorType OutputVnlVectorType
typename Superclass::InputVnlVectorType InputVnlVectorType
typename Superclass::InputCovariantVectorType InputCovariantVectorType
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
typename ParametersType::ValueType ParametersValueType
typename FixedParametersType::ValueType FixedParametersValueType
typename Superclass::ScalarType ScalarType
vnl_quaternion< TParametersValueType > VnlQuaternionType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
void SetFocalDistance(TParametersValueType focalDistance)
typename Superclass::OutputCovariantVectorType OutputCovariantVectorType
Rigid3DTramsform of a vector space (e.g. space coordinates)
typename Superclass::JacobianType JacobianType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::JacobianPositionType JacobianPositionType
OutputVectorType TransformVector(const InputVectorType &) const override
typename Superclass::FixedParametersType FixedParametersType
typename Superclass::ParametersType ParametersType
typename OffsetType::ValueType OffsetValueType