| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkRigid3DTransform.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 |
|
#ifndef __itkRigid3DTransform_h |
| 18 |
|
#define __itkRigid3DTransform_h |
| 19 |
|
|
| 20 |
|
#include <iostream> |
| 21 |
|
#include "itkMatrixOffsetTransformBase.h" |
| 22 |
|
#include "itkExceptionObject.h" |
| 23 |
|
#include "itkMatrix.h" |
| 24 |
|
#include "itkVersor.h" |
| 25 |
|
|
| 26 |
|
namespace itk |
| 27 |
|
{ |
| 28 |
|
|
| 29 |
|
/** \brief Rigid3DTransform of a vector space (e.g. space coordinates) |
| 30 |
|
* |
| 31 |
|
* This transform applies a rotation and translation to the space |
| 32 |
|
* |
| 33 |
|
* \ingroup Transforms |
| 34 |
|
*/ |
| 35 |
|
template < class TScalarType=double > // type for scalars (float or double) |
| 36 |
MCM |
class ITK_EXPORT Rigid3DTransform : |
| 37 |
IND |
***public MatrixOffsetTransformBase< TScalarType, 3, 3> |
| 38 |
|
{ |
| 39 |
|
public: |
| 40 |
|
/** Standard class typedefs. */ |
| 41 |
|
typedef Rigid3DTransform Self; |
| 42 |
|
typedef MatrixOffsetTransformBase< TScalarType, 3, 3 > Superclass; |
| 43 |
|
typedef SmartPointer<Self> Pointer; |
| 44 |
|
typedef SmartPointer<const Self> ConstPointer; |
| 45 |
|
|
| 46 |
|
/** Run-time type information (and related methods). */ |
| 47 |
|
itkTypeMacro( Rigid3DTransform, MatrixOffsetTransformBase ); |
| 48 |
|
|
| 49 |
|
/** New macro for creation of through a Smart Pointer */ |
| 50 |
|
itkNewMacro( Self ); |
| 51 |
|
|
| 52 |
|
/** Dimension of the space. */ |
| 53 |
|
itkStaticConstMacro(SpaceDimension, unsigned int, 3); |
| 54 |
|
itkStaticConstMacro(InputSpaceDimension, unsigned int, 3); |
| 55 |
|
itkStaticConstMacro(OutputSpaceDimension, unsigned int, 3); |
| 56 |
|
itkStaticConstMacro(ParametersDimension, unsigned int, 12); |
| 57 |
|
|
| 58 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 59 |
|
typedef typename Superclass::JacobianType JacobianType; |
| 60 |
|
typedef typename Superclass::ScalarType ScalarType; |
| 61 |
|
typedef typename Superclass::InputVectorType InputVectorType; |
| 62 |
|
typedef typename Superclass::OutputVectorType OutputVectorType; |
| 63 |
|
typedef typename Superclass::InputCovariantVectorType |
| 64 |
TDA,IND |
*****************************************************InputCovariantVectorType; |
| 65 |
|
typedef typename Superclass::OutputCovariantVectorType |
| 66 |
TDA,IND |
*****************************************************OutputCovariantVectorType; |
| 67 |
|
typedef typename Superclass::InputVnlVectorType InputVnlVectorType; |
| 68 |
|
typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType; |
| 69 |
|
typedef typename Superclass::InputPointType InputPointType; |
| 70 |
|
typedef typename Superclass::OutputPointType OutputPointType; |
| 71 |
|
typedef typename Superclass::MatrixType MatrixType; |
| 72 |
|
typedef typename Superclass::InverseMatrixType InverseMatrixType; |
| 73 |
|
typedef typename Superclass::CenterType CenterType; |
| 74 |
|
typedef typename Superclass::TranslationType TranslationType; |
| 75 |
|
typedef typename Superclass::OffsetType OffsetType; |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* Get rotation Matrix from an Rigid3DTransform |
| 79 |
|
* |
| 80 |
|
* This method returns the value of the rotation of the |
| 81 |
|
* Rigid3DTransform. |
| 82 |
|
* |
| 83 |
|
* \deprecated Use GetMatrix instead |
| 84 |
|
**/ |
| 85 |
IND |
***const MatrixType & GetRotationMatrix() |
| 86 |
IND |
*****{ return this->GetMatrix(); } |
| 87 |
|
|
| 88 |
|
/** |
| 89 |
|
* Set the rotation Matrix of a Rigid3D Transform |
| 90 |
|
* |
| 91 |
|
* This method sets the 3x3 matrix representing a rotation |
| 92 |
|
* in the transform. The Matrix is expected to be orthogonal |
| 93 |
|
* with a certain tolerance. |
| 94 |
|
* |
| 95 |
|
* \deprecated Use SetMatrix instead |
| 96 |
|
* |
| 97 |
|
**/ |
| 98 |
|
virtual void SetRotationMatrix(const MatrixType & matrix) |
| 99 |
IND |
******{ this->SetMatrix(matrix); } |
| 100 |
|
|
| 101 |
|
/** |
| 102 |
|
* Compose the transformation with a translation |
| 103 |
|
* |
| 104 |
|
* This method modifies self to include a translation of the |
| 105 |
|
* origin. The translation is precomposed with self if pre is |
| 106 |
|
* true, and postcomposed otherwise. |
| 107 |
|
**/ |
| 108 |
|
void Translate(const OffsetType & offset, bool pre=false); |
| 109 |
|
|
| 110 |
|
/** |
| 111 |
|
* TransformCovariantVector can be simplified if the matrix is orthogonal |
| 112 |
|
* as is the case for rigid transforms. |
| 113 |
|
* |
| 114 |
|
* This function call is specialization for rigid transforms. |
| 115 |
|
**/ |
| 116 |
|
OutputCovariantVectorType TransformCovariantVector( |
| 117 |
|
const InputCovariantVectorType &vector) const; |
| 118 |
|
|
| 119 |
|
/** |
| 120 |
|
* Back transform by an affine transformation |
| 121 |
|
* |
| 122 |
|
* This method finds the point or vector that maps to a given |
| 123 |
|
* point or vector under the affine transformation defined by |
| 124 |
|
* self. If no such point exists, an exception is thrown. |
| 125 |
|
* |
| 126 |
|
* \deprecated Please use GetInverseTransform and then call the forward |
| 127 |
|
* transform using the result. |
| 128 |
|
* |
| 129 |
|
**/ |
| 130 |
|
inline InputPointType BackTransform(const OutputPointType |
| 131 |
|
&point ) const; |
| 132 |
|
inline InputVectorType BackTransform(const OutputVectorType |
| 133 |
|
&vector) const; |
| 134 |
|
inline InputVnlVectorType BackTransform( const OutputVnlVectorType |
| 135 |
|
&vector) const; |
| 136 |
|
inline InputCovariantVectorType BackTransform(const OutputCovariantVectorType |
| 137 |
|
&vector) const; |
| 138 |
|
|
| 139 |
|
protected: |
| 140 |
|
Rigid3DTransform(unsigned int spaceDim, |
| 141 |
|
unsigned int paramDim); |
| 142 |
|
Rigid3DTransform(const MatrixType & matrix, |
| 143 |
|
const OutputVectorType & offset); |
| 144 |
|
Rigid3DTransform(); |
| 145 |
|
~Rigid3DTransform(); |
| 146 |
|
|
| 147 |
|
/** |
| 148 |
|
* Print contents of an Rigid3DTransform |
| 149 |
|
**/ |
| 150 |
|
void PrintSelf(std::ostream &os, Indent indent) const; |
| 151 |
|
|
| 152 |
|
private: |
| 153 |
|
Rigid3DTransform(const Self&); //purposely not implemented |
| 154 |
|
void operator=(const Self&); //purposely not implemented |
| 155 |
|
|
| 156 |
|
}; //class Rigid3DTransform |
| 157 |
|
|
| 158 |
|
|
| 159 |
|
} // namespace itk |
| 160 |
|
|
| 161 |
|
|
| 162 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 163 |
|
#include "itkRigid3DTransform.txx" |
| 164 |
|
#endif |
| 165 |
|
|
| 166 |
|
#endif /* __itkRigid3DTransform_h */ |
| 167 |
|
|