| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkScalableAffineTransform.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 __itkScalableAffineTransform_h |
| 19 |
|
#define __itkScalableAffineTransform_h |
| 20 |
|
|
| 21 |
|
#include "itkAffineTransform.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
/** |
| 28 |
|
* \brief Affine transformation with a specified center of rotation. |
| 29 |
|
* |
| 30 |
LEN |
* This class implements an Affine transform in which the rotation center can be explicitly selected. |
| 31 |
|
* |
| 32 |
|
* |
| 33 |
|
* \ingroup Transforms |
| 34 |
|
* |
| 35 |
|
* |
| 36 |
|
*/ |
| 37 |
|
|
| 38 |
|
template < |
| 39 |
|
class TScalarType=double, // Data type for scalars (e.g. float or double) |
| 40 |
|
unsigned int NDimensions=3> // Number of dimensions in the input space |
| 41 |
|
class ITK_EXPORT ScalableAffineTransform |
| 42 |
|
: public AffineTransform< TScalarType, NDimensions > |
| 43 |
|
{ |
| 44 |
|
public: |
| 45 |
|
/** Standard typedefs */ |
| 46 |
|
typedef ScalableAffineTransform Self; |
| 47 |
|
typedef AffineTransform< TScalarType, NDimensions > Superclass; |
| 48 |
|
typedef SmartPointer<Self> Pointer; |
| 49 |
|
typedef SmartPointer<const Self> ConstPointer; |
| 50 |
|
|
| 51 |
|
/** Run-time type information (and related methods). */ |
| 52 |
|
itkTypeMacro( ScalableAffineTransform, AffineTransform ); |
| 53 |
|
|
| 54 |
|
/** New macro for creation of through a Smart Pointer */ |
| 55 |
|
itkNewMacro( Self ); |
| 56 |
|
|
| 57 |
|
/** Dimension of the domain space. */ |
| 58 |
|
itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions); |
| 59 |
|
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions); |
| 60 |
|
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions); |
| 61 |
|
itkStaticConstMacro(ParametersDimension, unsigned int, |
| 62 |
|
NDimensions*(NDimensions+1)); |
| 63 |
|
|
| 64 |
|
/** Types taken from the Superclass */ |
| 65 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 66 |
|
typedef typename Superclass::JacobianType JacobianType; |
| 67 |
|
typedef typename Superclass::ScalarType ScalarType; |
| 68 |
|
typedef typename Superclass::InputVectorType InputVectorType; |
| 69 |
|
typedef typename Superclass::OutputVectorType OutputVectorType; |
| 70 |
|
typedef typename Superclass::InputCovariantVectorType |
| 71 |
TDA,IND |
*****************************************************InputCovariantVectorType; |
| 72 |
|
typedef typename Superclass::OutputCovariantVectorType |
| 73 |
TDA,IND |
*****************************************************OutputCovariantVectorType; |
| 74 |
|
typedef typename Superclass::InputVnlVectorType InputVnlVectorType; |
| 75 |
|
typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; |
| 76 |
|
typedef typename Superclass::InputPointType InputPointType; |
| 77 |
|
typedef typename Superclass::OutputPointType OutputPointType; |
| 78 |
|
typedef typename Superclass::MatrixType MatrixType; |
| 79 |
|
typedef typename Superclass::InverseMatrixType InverseMatrixType; |
| 80 |
|
typedef typename Superclass::CenterType CenterType; |
| 81 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 82 |
|
typedef typename Superclass::TranslationType TranslationType; |
| 83 |
|
|
| 84 |
|
/** Set the transformation to an Identity |
| 85 |
|
* |
| 86 |
|
* This sets the matrix to identity and the Offset to null. */ |
| 87 |
|
void SetIdentity( void ); |
| 88 |
|
|
| 89 |
|
/** Set the scale of the transform */ |
| 90 |
|
virtual void SetScale( const InputVectorType & scale ); |
| 91 |
|
virtual void SetScaleComponent( const InputVectorType & scale ) |
| 92 |
|
{ this->SetScale(scale); }; |
| 93 |
|
|
| 94 |
|
/** Set the scale of the transform */ |
| 95 |
|
virtual void SetScale( const double scale[NDimensions] ); |
| 96 |
|
virtual void SetScaleComponent( const double scale[NDimensions] ) |
| 97 |
|
{ this->SetScale(scale); }; |
| 98 |
|
|
| 99 |
|
/** Get the scale of the transform*/ |
| 100 |
|
virtual const double * GetScale() const |
| 101 |
|
{ return m_Scale; }; |
| 102 |
|
virtual const double * GetScaleComponent() const |
| 103 |
|
{ return m_Scale; }; |
| 104 |
|
|
| 105 |
|
/** Set the matrix of the transform. The matrix should not include |
| 106 |
|
* scale. |
| 107 |
|
* |
| 108 |
|
* \deprecated use SetMatrix instead */ |
| 109 |
|
void SetMatrixComponent(const MatrixType &matrix) |
| 110 |
|
{ this->SetMatrix( matrix ); }; |
| 111 |
|
/** Get matrix of the transform. |
| 112 |
|
* |
| 113 |
|
* \deprecated use GetMatrix instead */ |
| 114 |
|
const MatrixType & GetMatrixComponent() const |
| 115 |
|
{ return this->GetMatrix(); } |
| 116 |
|
|
| 117 |
|
/** Set offset (origin) of the Transform. |
| 118 |
|
* |
| 119 |
|
* \deprecated use SetTranslation instead. */ |
| 120 |
|
void SetOffsetComponent(const OffsetType &offset) |
| 121 |
|
{ this->SetTranslation( offset ); }; |
| 122 |
|
|
| 123 |
|
/** Get offset of the transform |
| 124 |
|
* |
| 125 |
|
* \deprecated use GetTranslation instead. */ |
| 126 |
|
const OffsetType & GetOffsetComponent(void) const |
| 127 |
|
{ return this->GetTranslation(); } |
| 128 |
|
|
| 129 |
|
|
| 130 |
|
protected: |
| 131 |
|
/** Construct an ScalableAffineTransform object |
| 132 |
|
* |
| 133 |
|
* This method constructs a new AffineTransform object and |
| 134 |
|
* initializes the matrix and offset parts of the transformation |
| 135 |
|
* to values specified by the caller. If the arguments are |
| 136 |
|
* omitted, then the AffineTransform is initialized to an identity |
| 137 |
|
* transformation in the appropriate number of dimensions. **/ |
| 138 |
|
ScalableAffineTransform(const MatrixType &matrix, |
| 139 |
|
const OutputVectorType &offset); |
| 140 |
|
ScalableAffineTransform(unsigned int outputSpaceDimension, |
| 141 |
|
unsigned int parametersDimension); |
| 142 |
|
ScalableAffineTransform(); |
| 143 |
|
|
| 144 |
|
void ComputeMatrix(); |
| 145 |
|
|
| 146 |
|
/** Destroy an ScalableAffineTransform object */ |
| 147 |
|
virtual ~ScalableAffineTransform(); |
| 148 |
|
|
| 149 |
|
/** Print contents of an ScalableAffineTransform */ |
| 150 |
|
void PrintSelf(std::ostream &s, Indent indent) const; |
| 151 |
|
|
| 152 |
|
void SetVarScale(const double * scale) |
| 153 |
|
{ for(int i=0; i<InputSpaceDimension; i++) { m_Scale[i] = scale[i]; } }; |
| 154 |
|
|
| 155 |
|
private: |
| 156 |
|
|
| 157 |
|
ScalableAffineTransform(const Self & other); |
| 158 |
|
const Self & operator=( const Self & ); |
| 159 |
|
|
| 160 |
|
double m_Scale[NDimensions]; |
| 161 |
|
InputVectorType m_MatrixScale; |
| 162 |
|
|
| 163 |
|
}; //class ScalableAffineTransform |
| 164 |
|
|
| 165 |
|
} // namespace itk |
| 166 |
|
|
| 167 |
|
|
| 168 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 169 |
|
#include "itkScalableAffineTransform.txx" |
| 170 |
|
#endif |
| 171 |
|
|
| 172 |
|
#endif /* __itkScalableAffineTransform_h */ |
| 173 |
|
|
| 174 |
EOF |
|