ITK  4.13.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:
43  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
44  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
46 
48  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
49  itkStaticConstMacro(ParametersDimension, unsigned int, 6);
51 
54  typedef Transform<TParametersValueType,
55  itkGetStaticConstMacro(InputSpaceDimension),
56  itkGetStaticConstMacro(OutputSpaceDimension)> Superclass;
58 
61 
64 
66  itkNewMacro(Self);
67 
69  typedef typename Superclass::ScalarType ScalarType;
70 
72  typedef typename Superclass::FixedParametersType FixedParametersType;
73  typedef typename FixedParametersType::ValueType FixedParametersValueType;
74  typedef typename Superclass::ParametersType ParametersType;
75  typedef typename ParametersType::ValueType ParametersValueType;
76 
78  typedef typename Superclass::JacobianType JacobianType;
79 
81  typedef Matrix<TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension),
82  itkGetStaticConstMacro(InputSpaceDimension)> MatrixType;
83 
87 
92 
94  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
95  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
96 
101 
103  typedef vnl_quaternion<TParametersValueType> VnlQuaternionType;
104 
106  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
107  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
108 
114 
118  const OffsetType & GetOffset() const
119  {
120  return m_Offset;
121  }
122 
126  const VersorType & GetRotation() const
127  {
128  return m_Versor;
129  }
130 
135  void SetParameters(const ParametersType & parameters) ITK_OVERRIDE;
136 
137  const ParametersType & GetParameters() const ITK_OVERRIDE;
138 
142  virtual void SetFixedParameters(const FixedParametersType &) ITK_OVERRIDE
143  {
144  }
145 
148  void SetOffset(const OffsetType & offset)
149  {
150  m_Offset = offset; return;
151  }
152 
155  void SetRotation(const VersorType & rotation);
156 
161  void SetRotation(const Vector<TParametersValueType, 3> & axis, double angle);
162 
166  void SetFocalDistance(TParametersValueType focalDistance)
167  {
168  m_FocalDistance = focalDistance;
169  }
170 
172  double GetFocalDistance(void) const
173  {
174  return m_FocalDistance;
175  }
176 
180  OutputPointType TransformPoint(const InputPointType & point) const ITK_OVERRIDE;
181 
183  using Superclass::TransformVector;
184 
185  virtual OutputVectorType TransformVector(const InputVectorType &) const ITK_OVERRIDE
186  {
187  itkExceptionMacro(
188  << "TransformVector(const InputVectorType &) is not implemented for Rigid3DPerspectiveTransform");
189  }
190 
191  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const ITK_OVERRIDE
192  {
193  itkExceptionMacro(
194  << "TransformVector(const InputVnlVectorType &) is not implemented for Rigid3DPerspectiveTransform");
195  }
196 
197  using Superclass::TransformCovariantVector;
198 
200  {
201  itkExceptionMacro(
202  <<
203  "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for Rigid3DPerspectiveTransform");
204  }
205 
208  {
209  return m_RotationMatrix;
210  }
211 
213  void ComputeMatrix();
214 
217  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const ITK_OVERRIDE;
218 
220  JacobianType &) const ITK_OVERRIDE
221  {
222  itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented "
223  "for " << this->GetNameOfClass() );
224  }
225 
227  itkGetConstReferenceMacro(FixedOffset, OffsetType);
228  itkSetMacro(FixedOffset, OffsetType);
230 
232  itkSetMacro(CenterOfRotation, InputPointType);
233  itkGetConstReferenceMacro(CenterOfRotation, InputPointType);
235 
236 protected:
238  ~Rigid3DPerspectiveTransform() ITK_OVERRIDE;
239  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
240 
241 private:
242  ITK_DISALLOW_COPY_AND_ASSIGN(Rigid3DPerspectiveTransform);
243 
245  OffsetType m_Offset;
246 
248  VersorType m_Versor;
249 
251  TParametersValueType m_FocalDistance;
252 
254  MatrixType m_RotationMatrix;
255 
257  OffsetType m_FixedOffset;
258 
260  InputPointType m_CenterOfRotation;
261 }; // class Rigid3DPerspectiveTransform:
262 } // namespace itk
263 
264 #ifndef ITK_MANUAL_INSTANTIATION
265 #include "itkRigid3DPerspectiveTransform.hxx"
266 #endif
267 
268 #endif /* itkRigid3DPerspectiveTransform_h */
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:53
virtual OutputVectorType TransformVector(const InputVectorType &) const override
Light weight base class for most itk classes.
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
Superclass::FixedParametersType FixedParametersType
Point< TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType
Superclass::OutputCovariantVectorType OutputCovariantVectorType
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
Vector< TParametersValueType, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType
FixedParametersType::ValueType FixedParametersValueType
Transform< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension)> Superclass
Superclass::OutputVnlVectorType OutputVnlVectorType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
void SetFocalDistance(TParametersValueType focalDistance)
Vector< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &, JacobianType &) const override
Rigid3DTramsform of a vector space (e.g. space coordinates)
Vector< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> OffsetType
Superclass::InputCovariantVectorType InputCovariantVectorType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Point< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType
Superclass::InputVnlVectorType InputVnlVectorType
Matrix< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType
vnl_quaternion< TParametersValueType > VnlQuaternionType
TParametersValueType ValueType
Definition: itkVersor.h:58