ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkVersorTransform.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 __itkVersorTransform_h
19 #define __itkVersorTransform_h
20 
21 #include <iostream>
22 #include "itkRigid3DTransform.h"
23 #include "vnl/vnl_quaternion.h"
24 
25 namespace itk
26 {
46 template <class TScalarType = double>
47 // Data type for scalars (float or double)
48 class ITK_EXPORT VersorTransform : public Rigid3DTransform<TScalarType>
49 {
50 public:
51 
57 
59  itkTypeMacro(VersorTransform, Rigid3DTransform);
60 
62  itkNewMacro(Self);
63 
65  itkStaticConstMacro(SpaceDimension, unsigned int, 3);
66  itkStaticConstMacro(InputSpaceDimension, unsigned int, 3);
67  itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3);
68  itkStaticConstMacro(ParametersDimension, unsigned int, 3);
70 
72  typedef typename Superclass::ParametersType ParametersType;
73  typedef typename Superclass::JacobianType JacobianType;
74  typedef typename Superclass::ScalarType ScalarType;
75  typedef typename Superclass::InputPointType InputPointType;
76  typedef typename Superclass::OutputPointType OutputPointType;
77  typedef typename Superclass::InputVectorType InputVectorType;
78  typedef typename Superclass::OutputVectorType OutputVectorType;
79  typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
80  typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
81  typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
82  typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
83  typedef typename Superclass::MatrixType MatrixType;
84  typedef typename Superclass::InverseMatrixType InverseMatrixType;
85  typedef typename Superclass::CenterType CenterType;
86  typedef typename Superclass::OffsetType OffsetType;
87 
89  typedef vnl_quaternion<TScalarType> VnlQuaternionType;
90 
93  typedef typename VersorType::VectorType AxisType;
94  typedef typename VersorType::ValueType AngleType;
96  typedef typename ParametersType::ValueType ParameterValueType;
97 
106  void SetParameters(const ParametersType & parameters);
107 
109  const ParametersType & GetParameters(void) const;
110 
112  void SetRotation(const VersorType & versor);
113 
114  void SetRotation(const AxisType & axis, AngleType angle);
115 
116  itkGetConstReferenceMacro(Versor, VersorType);
117 
119  virtual void SetIdentity(void);
120 
126  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const;
127 
128 protected:
129 
131  VersorTransform(const MatrixType & matrix, const OutputVectorType & offset);
132  VersorTransform(unsigned int paramDims);
133  VersorTransform();
135 
138  {
139  }
140 
141 #ifdef ITKV3_COMPATIBILITY
142 
144  itkLegacyMacro( virtual void SetRotationMatrix(const MatrixType & matrix) );
145 #endif
146 
147  void SetVarVersor(const VersorType & newVersor)
148  {
149  m_Versor = newVersor;
150  }
151 
153  void PrintSelf(std::ostream & os, Indent indent) const;
154 
157  void ComputeMatrix(void);
158 
159  void ComputeMatrixParameters(void);
160 
161 private:
163  VersorTransform(const Self & other); // Not implemented
164 
166  const Self & operator=(const Self &); // Not implemented
167 
170 }; // class VersorTransform
171 } // namespace itk
172 
173 // Define instantiation macro for this template.
174 #define ITK_TEMPLATE_VersorTransform(_, EXPORT, TypeX, TypeY) \
175  namespace itk \
176  { \
177  _( 1 ( class EXPORT VersorTransform<ITK_TEMPLATE_1 TypeX> ) ) \
178  namespace Templates \
179  { \
180  typedef VersorTransform<ITK_TEMPLATE_1 TypeX> VersorTransform##TypeY; \
181  } \
182  }
183 
184 #if ITK_TEMPLATE_EXPLICIT
185 #include "Templates/itkVersorTransform+-.h"
186 #endif
187 
188 #if ITK_TEMPLATE_TXX
189 #include "itkVersorTransform.hxx"
190 #endif
191 
192 #endif /* __itkVersorTransform_h */
193