| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkSimilarity3DTransform.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 __itkSimilarity3DTransform_h |
| 19 |
|
#define __itkSimilarity3DTransform_h |
| 20 |
|
|
| 21 |
|
#include <iostream> |
| 22 |
|
#include "itkVersorRigid3DTransform.h" |
| 23 |
|
|
| 24 |
|
namespace itk |
| 25 |
|
{ |
| 26 |
|
|
| 27 |
|
/** \brief Similarity3DTransform of a vector space (e.g. space coordinates) |
| 28 |
|
* |
| 29 |
LEN |
* This transform applies a rotation, translation and isotropic scaling to the space. |
| 30 |
|
* |
| 31 |
|
* \ingroup Transforms |
| 32 |
|
* |
| 33 |
|
* \sa VersorRigid3DTransform |
| 34 |
|
*/ |
| 35 |
LEN |
template < class TScalarType=double > // Data type for scalars (float or double) |
| 36 |
MCM |
class ITK_EXPORT Similarity3DTransform : |
| 37 |
IND |
******public VersorRigid3DTransform< TScalarType > |
| 38 |
|
{ |
| 39 |
|
public: |
| 40 |
|
/** Standard class typedefs. */ |
| 41 |
|
typedef Similarity3DTransform Self; |
| 42 |
|
typedef VersorRigid3DTransform< TScalarType > Superclass; |
| 43 |
|
typedef SmartPointer<Self> Pointer; |
| 44 |
|
typedef SmartPointer<const Self> ConstPointer; |
| 45 |
|
|
| 46 |
|
/** New macro for creation of through a Smart Pointer. */ |
| 47 |
|
itkNewMacro( Self ); |
| 48 |
|
|
| 49 |
|
/** Run-time type information (and related methods). */ |
| 50 |
|
itkTypeMacro( Similarity3DTransform, VersorRigid3DTransform ); |
| 51 |
|
|
| 52 |
|
/** Dimension of parameters. */ |
| 53 |
|
itkStaticConstMacro(SpaceDimension, unsigned int, 3); |
| 54 |
|
itkStaticConstMacro(InputSpaceDimension, unsigned int, 3); |
| 55 |
|
itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3); |
| 56 |
|
itkStaticConstMacro(ParametersDimension, unsigned int, 7); |
| 57 |
|
|
| 58 |
IND |
****/** Parameters Type */ |
| 59 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 60 |
|
typedef typename Superclass::JacobianType JacobianType; |
| 61 |
|
typedef typename Superclass::ScalarType ScalarType; |
| 62 |
|
typedef typename Superclass::InputPointType InputPointType; |
| 63 |
|
typedef typename Superclass::OutputPointType OutputPointType; |
| 64 |
|
typedef typename Superclass::InputVectorType InputVectorType; |
| 65 |
|
typedef typename Superclass::OutputVectorType OutputVectorType; |
| 66 |
|
typedef typename Superclass::InputVnlVectorType InputVnlVectorType; |
| 67 |
|
typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; |
| 68 |
|
typedef typename Superclass::InputCovariantVectorType |
| 69 |
IND |
******************************************************InputCovariantVectorType; |
| 70 |
|
typedef typename Superclass::OutputCovariantVectorType |
| 71 |
IND |
******************************************************OutputCovariantVectorType; |
| 72 |
|
typedef typename Superclass::MatrixType MatrixType; |
| 73 |
|
typedef typename Superclass::InverseMatrixType InverseMatrixType; |
| 74 |
|
typedef typename Superclass::CenterType CenterType; |
| 75 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 76 |
|
typedef typename Superclass::TranslationType TranslationType; |
| 77 |
|
|
| 78 |
|
/** Versor type. */ |
| 79 |
|
typedef typename Superclass::VersorType VersorType; |
| 80 |
|
typedef typename Superclass::AxisType AxisType; |
| 81 |
|
typedef typename Superclass::AngleType AngleType; |
| 82 |
|
typedef TScalarType ScaleType; |
| 83 |
|
|
| 84 |
|
/** Set the transformation from a container of parameters This is typically |
| 85 |
|
* used by optimizers. There are 7 parameters. The first three represent the |
| 86 |
|
* versor, the next three represent the translation and the last one |
| 87 |
|
* represents the scaling factor. */ |
| 88 |
|
void SetParameters( const ParametersType & parameters ); |
| 89 |
|
virtual const ParametersType& GetParameters(void) const; |
| 90 |
|
|
| 91 |
|
/** Set/Get the value of the isotropic scaling factor */ |
| 92 |
|
void SetScale( ScaleType scale ); |
| 93 |
|
itkGetConstReferenceMacro( Scale, ScaleType ); |
| 94 |
|
|
| 95 |
|
/** This method computes the Jacobian matrix of the transformation. |
| 96 |
|
* given point or vector, returning the transformed point or |
| 97 |
|
* vector. The rank of the Jacobian will also indicate if the |
| 98 |
|
* transform is invertible at this point. */ |
| 99 |
|
const JacobianType & GetJacobian(const InputPointType &point ) const; |
| 100 |
|
|
| 101 |
|
protected: |
| 102 |
|
Similarity3DTransform(unsigned int outputSpaceDim, |
| 103 |
|
unsigned int paramDim); |
| 104 |
|
Similarity3DTransform(const MatrixType & matrix, |
| 105 |
|
const OutputVectorType & offset); |
| 106 |
|
Similarity3DTransform(); |
| 107 |
|
~Similarity3DTransform(){}; |
| 108 |
|
|
| 109 |
|
void PrintSelf(std::ostream &os, Indent indent) const; |
| 110 |
|
|
| 111 |
|
/** Recomputes the matrix by calling the Superclass::ComputeMatrix() and then |
| 112 |
|
* applying the scale factor. */ |
| 113 |
|
void ComputeMatrix(); |
| 114 |
|
|
| 115 |
|
private: |
| 116 |
|
Similarity3DTransform(const Self&); //purposely not implemented |
| 117 |
|
void operator=(const Self&); //purposely not implemented |
| 118 |
|
|
| 119 |
|
ScaleType m_Scale; |
| 120 |
|
|
| 121 |
|
}; //class Similarity3DTransform |
| 122 |
|
|
| 123 |
|
|
| 124 |
|
} // namespace itk |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 128 |
|
#include "itkSimilarity3DTransform.txx" |
| 129 |
|
#endif |
| 130 |
|
|
| 131 |
|
#endif /* __itkSimilarity3DTransform_h */ |
| 132 |
|
|