ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkVersorTransform_h 00019 #define __itkVersorTransform_h 00020 00021 #include <iostream> 00022 #include "itkRigid3DTransform.h" 00023 #include "vnl/vnl_quaternion.h" 00024 00025 namespace itk 00026 { 00046 template <class TScalarType = double> 00047 // Data type for scalars (float or double) 00048 class ITK_EXPORT VersorTransform : public Rigid3DTransform<TScalarType> 00049 { 00050 public: 00051 00053 typedef VersorTransform Self; 00054 typedef Rigid3DTransform<TScalarType> Superclass; 00055 typedef SmartPointer<Self> Pointer; 00056 typedef SmartPointer<const Self> ConstPointer; 00057 00059 itkTypeMacro(VersorTransform, Rigid3DTransform); 00060 00062 itkNewMacro(Self); 00063 00065 itkStaticConstMacro(SpaceDimension, unsigned int, 3); 00066 itkStaticConstMacro(InputSpaceDimension, unsigned int, 3); 00067 itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3); 00068 itkStaticConstMacro(ParametersDimension, unsigned int, 3); 00070 00072 typedef typename Superclass::ParametersType ParametersType; 00073 typedef typename Superclass::JacobianType JacobianType; 00074 typedef typename Superclass::ScalarType ScalarType; 00075 typedef typename Superclass::InputPointType InputPointType; 00076 typedef typename Superclass::OutputPointType OutputPointType; 00077 typedef typename Superclass::InputVectorType InputVectorType; 00078 typedef typename Superclass::OutputVectorType OutputVectorType; 00079 typedef typename Superclass::InputVnlVectorType InputVnlVectorType; 00080 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; 00081 typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType; 00082 typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType; 00083 typedef typename Superclass::MatrixType MatrixType; 00084 typedef typename Superclass::InverseMatrixType InverseMatrixType; 00085 typedef typename Superclass::CenterType CenterType; 00086 typedef typename Superclass::OffsetType OffsetType; 00087 00089 typedef vnl_quaternion<TScalarType> VnlQuaternionType; 00090 00092 typedef Versor<TScalarType> VersorType; 00093 typedef typename VersorType::VectorType AxisType; 00094 typedef typename VersorType::ValueType AngleType; 00095 typedef typename AxisType::ValueType AxisValueType; 00096 typedef typename ParametersType::ValueType ParameterValueType; 00097 00106 void SetParameters(const ParametersType & parameters); 00107 00109 const ParametersType & GetParameters(void) const; 00110 00112 void SetRotation(const VersorType & versor); 00113 00114 void SetRotation(const AxisType & axis, AngleType angle); 00115 00116 itkGetConstReferenceMacro(Versor, VersorType); 00117 00119 virtual void SetIdentity(void); 00120 00126 virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const; 00127 00128 protected: 00129 00131 VersorTransform(const MatrixType & matrix, const OutputVectorType & offset); 00132 VersorTransform(unsigned int paramDims); 00133 VersorTransform(); 00135 00137 ~VersorTransform() 00138 { 00139 } 00140 00143 virtual void SetRotationMatrix(const MatrixType & matrix) 00144 { 00145 this->Superclass::SetRotationMatrix(matrix); 00146 } 00147 00148 void SetVarVersor(const VersorType & newVersor) 00149 { 00150 m_Versor = newVersor; 00151 } 00152 00154 void PrintSelf(std::ostream & os, Indent indent) const; 00155 00158 void ComputeMatrix(void); 00159 00160 void ComputeMatrixParameters(void); 00161 00162 private: 00164 VersorTransform(const Self & other); // Not implemented 00165 00167 const Self & operator=(const Self &); // Not implemented 00168 00170 VersorType m_Versor; 00171 }; // class VersorTransform 00172 } // namespace itk 00173 00174 // Define instantiation macro for this template. 00175 #define ITK_TEMPLATE_VersorTransform(_, EXPORT, TypeX, TypeY) \ 00176 namespace itk \ 00177 { \ 00178 _( 1 ( class EXPORT VersorTransform<ITK_TEMPLATE_1 TypeX> ) ) \ 00179 namespace Templates \ 00180 { \ 00181 typedef VersorTransform<ITK_TEMPLATE_1 TypeX> VersorTransform##TypeY; \ 00182 } \ 00183 } 00184 00185 #if ITK_TEMPLATE_EXPLICIT 00186 #include "Templates/itkVersorTransform+-.h" 00187 #endif 00188 00189 #if ITK_TEMPLATE_TXX 00190 #include "itkVersorTransform.hxx" 00191 #endif 00192 00193 #endif /* __itkVersorTransform_h */ 00194