| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkScaleSkewVersor3DTransform.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:47 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
|
| 18 |
|
#ifndef __itkScaleSkewVersor3DTransform_h |
| 19 |
|
#define __itkScaleSkewVersor3DTransform_h |
| 20 |
|
|
| 21 |
|
#include <iostream> |
| 22 |
|
#include "itkVersorRigid3DTransform.h" |
| 23 |
|
|
| 24 |
|
namespace itk |
| 25 |
|
{ |
| 26 |
|
|
| 27 |
|
/** \brief ScaleSkewVersor3DTransform of a vector space (e.g. space coordinates) |
| 28 |
|
* |
| 29 |
|
* This transform applies a versor rotation and translation & scale/skew |
| 30 |
|
* to the space |
| 31 |
|
* |
| 32 |
|
* \ingroup Transforms |
| 33 |
|
*/ |
| 34 |
|
template < class TScalarType=double > // Data type for scalars:float or double |
| 35 |
MCM |
class ITK_EXPORT ScaleSkewVersor3DTransform : |
| 36 |
IND |
************public VersorRigid3DTransform< TScalarType > |
| 37 |
|
{ |
| 38 |
|
public: |
| 39 |
|
/** Standard class typedefs. */ |
| 40 |
|
typedef ScaleSkewVersor3DTransform Self; |
| 41 |
|
typedef VersorRigid3DTransform< TScalarType > Superclass; |
| 42 |
|
typedef SmartPointer<Self> Pointer; |
| 43 |
|
typedef SmartPointer<const Self> ConstPointer; |
| 44 |
|
|
| 45 |
|
/** New macro for creation of through a Smart Pointer. */ |
| 46 |
|
itkNewMacro( Self ); |
| 47 |
|
|
| 48 |
|
/** Run-time type information (and related methods). */ |
| 49 |
|
itkTypeMacro( ScaleSkewVersor3DTransform, VersorRigid3DTransform ); |
| 50 |
|
|
| 51 |
|
/** Dimension of parameters. */ |
| 52 |
|
itkStaticConstMacro(InputSpaceDimension, unsigned int, 3); |
| 53 |
|
itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3); |
| 54 |
|
itkStaticConstMacro(ParametersDimension, unsigned int, 15); |
| 55 |
|
|
| 56 |
|
/** Parameters Type */ |
| 57 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 58 |
|
typedef typename Superclass::JacobianType JacobianType; |
| 59 |
|
typedef typename Superclass::ScalarType ScalarType; |
| 60 |
|
typedef typename Superclass::InputPointType InputPointType; |
| 61 |
|
typedef typename Superclass::OutputPointType OutputPointType; |
| 62 |
|
typedef typename Superclass::InputVectorType InputVectorType; |
| 63 |
|
typedef typename Superclass::OutputVectorType OutputVectorType; |
| 64 |
|
typedef typename Superclass::InputVnlVectorType InputVnlVectorType; |
| 65 |
|
typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; |
| 66 |
|
typedef typename Superclass::InputCovariantVectorType |
| 67 |
IND |
******************************************************InputCovariantVectorType; |
| 68 |
|
typedef typename Superclass::OutputCovariantVectorType |
| 69 |
IND |
******************************************************OutputCovariantVectorType; |
| 70 |
|
typedef typename Superclass::MatrixType MatrixType; |
| 71 |
|
typedef typename Superclass::InverseMatrixType InverseMatrixType; |
| 72 |
|
typedef typename Superclass::CenterType CenterType; |
| 73 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 74 |
|
typedef typename Superclass::TranslationType TranslationType; |
| 75 |
|
|
| 76 |
|
typedef typename Superclass::VersorType VersorType; |
| 77 |
|
typedef typename Superclass::AxisType AxisType; |
| 78 |
|
typedef typename Superclass::AngleType AngleType; |
| 79 |
|
|
| 80 |
|
/** Scale & Skew Vector Type. */ |
| 81 |
|
typedef Vector<TScalarType, 3> |
| 82 |
IND |
******************************************************ScaleVectorType; |
| 83 |
|
typedef Vector<TScalarType, 6 > SkewVectorType; |
| 84 |
|
|
| 85 |
|
/** Set the transformation from a container of parameters |
| 86 |
|
* This is typically used by optimizers. |
| 87 |
|
* There are 15 parameters: |
| 88 |
|
* 0-2 versor |
| 89 |
|
* 3-5 translation |
| 90 |
|
* 6-8 Scale |
| 91 |
|
* 9-14 Skew |
| 92 |
|
** */ |
| 93 |
|
virtual void SetParameters( const ParametersType & parameters ); |
| 94 |
|
virtual const ParametersType& GetParameters(void) const; |
| 95 |
|
|
| 96 |
|
void SetScale( const ScaleVectorType & scale ); |
| 97 |
|
itkGetConstReferenceMacro( Scale, ScaleVectorType ); |
| 98 |
|
|
| 99 |
|
void SetSkew( const SkewVectorType & skew ); |
| 100 |
|
itkGetConstReferenceMacro( Skew, SkewVectorType ); |
| 101 |
|
|
| 102 |
|
void SetIdentity(); |
| 103 |
|
|
| 104 |
|
/** This method computes the Jacobian matrix of the transformation. |
| 105 |
|
* given point or vector, returning the transformed point or |
| 106 |
|
* vector. The rank of the Jacobian will also indicate if the |
| 107 |
|
* transform is invertible at this point. */ |
| 108 |
|
const JacobianType & GetJacobian(const InputPointType &point ) const; |
| 109 |
|
|
| 110 |
|
protected: |
| 111 |
|
ScaleSkewVersor3DTransform(); |
| 112 |
|
ScaleSkewVersor3DTransform(const MatrixType &matrix, |
| 113 |
|
const OutputVectorType &offset); |
| 114 |
|
ScaleSkewVersor3DTransform(unsigned int outputDims, |
| 115 |
|
unsigned int paramDims); |
| 116 |
|
~ScaleSkewVersor3DTransform(){}; |
| 117 |
|
|
| 118 |
|
void PrintSelf(std::ostream &os, Indent indent) const; |
| 119 |
|
|
| 120 |
|
void SetVarScale(const ScaleVectorType & scale) |
| 121 |
|
{ m_Scale = scale; }; |
| 122 |
|
|
| 123 |
|
void SetVarSkew(const SkewVectorType & skew) |
| 124 |
|
{ m_Skew = skew; }; |
| 125 |
|
|
| 126 |
|
/** Compute the components of the rotation matrix in the superclass. */ |
| 127 |
|
void ComputeMatrix(void); |
| 128 |
|
void ComputeMatrixParameters(void); |
| 129 |
|
|
| 130 |
|
private: |
| 131 |
|
ScaleSkewVersor3DTransform(const Self&); //purposely not implemented |
| 132 |
|
void operator=(const Self&); //purposely not implemented |
| 133 |
|
|
| 134 |
|
/** Vector containing the scale. */ |
| 135 |
|
ScaleVectorType m_Scale; |
| 136 |
|
|
| 137 |
|
/** Vector containing the skew */ |
| 138 |
|
SkewVectorType m_Skew; |
| 139 |
|
|
| 140 |
|
}; //class ScaleSkewVersor3DTransform |
| 141 |
|
|
| 142 |
|
|
| 143 |
|
} // namespace itk |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 147 |
|
#include "itkScaleSkewVersor3DTransform.txx" |
| 148 |
|
#endif |
| 149 |
|
|
| 150 |
|
#endif /* __ScaleSkewVersor3DTransform_h */ |
| 151 |
|
|