ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkQuaternionRigidTransform.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 __itkQuaternionRigidTransform_h
19 #define __itkQuaternionRigidTransform_h
20 
21 #include <iostream>
22 #include "itkRigid3DTransform.h"
23 #include "vnl/vnl_quaternion.h"
24 
25 namespace itk
26 {
47 template <class TScalarType = double>
48 // Data type for scalars (float or double)
49 class ITK_EXPORT QuaternionRigidTransform :
50  public Rigid3DTransform<TScalarType>
51 {
52 public:
58 
60  itkNewMacro(Self);
61 
64 
66  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
67  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3);
68  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
69  itkStaticConstMacro(ParametersDimension, unsigned int, 7);
71 
73  typedef typename Superclass::ParametersType ParametersType;
74  typedef typename Superclass::ParametersValueType ParametersValueType;
75  typedef typename Superclass::JacobianType JacobianType;
76  typedef typename Superclass::ScalarType ScalarType;
77  typedef typename Superclass::InputPointType InputPointType;
78  typedef typename Superclass::OutputPointType OutputPointType;
79  typedef typename Superclass::InputVectorType InputVectorType;
80  typedef typename Superclass::OutputVectorType OutputVectorType;
81  typedef typename Superclass::OutputVectorValueType OutputVectorValueType;
82  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
83  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
84  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
85  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
86  typedef typename Superclass::MatrixType MatrixType;
87  typedef typename Superclass::InverseMatrixType InverseMatrixType;
88  typedef typename Superclass::CenterType CenterType;
89  typedef typename Superclass::OffsetType OffsetType;
90  typedef typename Superclass::TranslationType TranslationType;
91 
93  typedef vnl_quaternion<TScalarType> VnlQuaternionType;
94 
100  void SetRotation(const VnlQuaternionType & rotation);
101 
105  const VnlQuaternionType & GetRotation(void) const
106  {
107  return m_Rotation;
108  }
109 
111  virtual void SetIdentity(void);
112 
118  void SetParameters(const ParametersType & parameters);
119 
120  virtual const ParametersType & GetParameters() const;
121 
127  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const;
128 
129 protected:
130  QuaternionRigidTransform(const MatrixType & matrix, const OutputVectorType & offset);
131  QuaternionRigidTransform(unsigned int paramDims);
134  {
135  }
136 
137  void ComputeMatrix();
138 
139  void ComputeMatrixParameters();
140 
141  void SetVarRotation(const VnlQuaternionType & rotation)
142  {
143  m_Rotation = rotation;
144  }
145 
146  const InverseMatrixType & GetInverseMatrix(void) const;
147 
148  void PrintSelf(std::ostream & os, Indent indent) const;
149 
150 private:
151  QuaternionRigidTransform(const Self &); // purposely not implemented
152  void operator=(const Self &); // purposely not implemented
153 
156 }; // class QuaternionRigidTransform
157 } // namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkQuaternionRigidTransform.hxx"
161 #endif
162 
163 #endif /* __itkQuaternionRigidTransform_h */
164