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
27namespace itk
28{
37template <typename TParametersValueType = double>
38class ITK_TEMPLATE_EXPORT Rigid3DPerspectiveTransform : public Transform<TParametersValueType, 3, 2>
39{
40public:
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 &
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
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
223
226 void
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);
248protected:
250 ~Rigid3DPerspectiveTransform() override = default;
251 void
252 PrintSelf(std::ostream & os, Indent indent) const override;
253
254private:
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 */
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
A templated class holding a n-Dimensional covariant vector.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:53
Class to hold and manage different parameter types used during optimization.
TParametersValueType ValueType
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
Rigid3DTramsform of a vector space (e.g. space coordinates)
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
void ComputeJacobianWithRespectToParameters(const InputPointType &p, JacobianType &jacobian) const override
typename FixedParametersType::ValueType FixedParametersValueType
typename OffsetType::ValueType OffsetValueType
~Rigid3DPerspectiveTransform() override=default
OutputPointType TransformPoint(const InputPointType &point) const override
OutputVectorType TransformVector(const InputVectorType &) const override
void SetRotation(const VersorType &rotation)
typename VersorType::VectorType AxisType
void SetFixedParameters(const FixedParametersType &) override
void SetRotation(const Vector< TParametersValueType, 3 > &axis, double angle)
void SetParameters(const ParametersType &parameters) override
const ParametersType & GetParameters() const override
typename ParametersType::ValueType ParametersValueType
void SetFocalDistance(TParametersValueType focalDistance)
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
void PrintSelf(std::ostream &os, Indent indent) const override
vnl_quaternion< TParametersValueType > VnlQuaternionType
void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianPositionType &) const override
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:84
vnl_vector_fixed< double, VInputDimension > InputVnlVectorType
Definition: itkTransform.h:170
vnl_matrix_fixed< ParametersValueType, VOutputDimension, VInputDimension > JacobianPositionType
Definition: itkTransform.h:145
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
A templated class holding a unit quaternion.
Definition: itkVersor.h:51
const char * GetNameOfClass() const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter 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