| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkRigid3DTransform.txx.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 |
DEF |
#ifndef _itkRigid3DTransform_txx |
| 18 |
DEF |
#define _itkRigid3DTransform_txx |
| 19 |
|
|
| 20 |
|
#include "itkRigid3DTransform.h" |
| 21 |
|
|
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
// Constructor with default arguments |
| 27 |
|
template<class TScalarType> |
| 28 |
|
Rigid3DTransform<TScalarType>:: |
| 29 |
|
Rigid3DTransform() : |
| 30 |
IND |
**Superclass(OutputSpaceDimension, ParametersDimension) |
| 31 |
|
{ |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
// Constructor with default arguments |
| 36 |
|
template<class TScalarType> |
| 37 |
|
Rigid3DTransform<TScalarType>:: |
| 38 |
|
Rigid3DTransform(unsigned int spaceDim, |
| 39 |
|
unsigned int paramDim) : |
| 40 |
IND |
**Superclass(spaceDim, paramDim) |
| 41 |
|
{ |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
// Constructor with default arguments |
| 45 |
|
template<class TScalarType> |
| 46 |
|
Rigid3DTransform<TScalarType>:: |
| 47 |
|
Rigid3DTransform(const MatrixType & matrix, |
| 48 |
|
const OutputVectorType & offset) : |
| 49 |
IND |
**Superclass(matrix, offset) |
| 50 |
|
{ |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
// Destructor |
| 54 |
|
template<class TScalarType> |
| 55 |
|
Rigid3DTransform<TScalarType>:: |
| 56 |
|
~Rigid3DTransform() |
| 57 |
|
{ |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
// Print self |
| 62 |
|
template<class TScalarType> |
| 63 |
|
void |
| 64 |
|
Rigid3DTransform<TScalarType>:: |
| 65 |
|
PrintSelf(std::ostream &os, Indent indent) const |
| 66 |
|
{ |
| 67 |
|
Superclass::PrintSelf(os,indent); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
// Compose with a translation |
| 72 |
|
template<class TScalarType> |
| 73 |
|
void |
| 74 |
|
Rigid3DTransform<TScalarType>:: |
| 75 |
|
Translate(const OffsetType &offset, bool) |
| 76 |
|
{ |
| 77 |
|
OutputVectorType newOffset = this->GetOffset(); |
| 78 |
|
newOffset += offset; |
| 79 |
|
this->SetVarOffset(newOffset); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
// TransformCovariantVector |
| 83 |
|
template<class TScalarType> |
| 84 |
|
typename Rigid3DTransform<TScalarType>::OutputCovariantVectorType |
| 85 |
|
Rigid3DTransform<TScalarType>:: |
| 86 |
|
TransformCovariantVector(const InputCovariantVectorType &vec) const |
| 87 |
|
{ |
| 88 |
|
return this->GetMatrix() * vec; |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
// Back transform a point |
| 92 |
|
template<class TScalarType> |
| 93 |
|
typename Rigid3DTransform<TScalarType>::InputPointType |
| 94 |
|
Rigid3DTransform<TScalarType>:: |
| 95 |
|
BackTransform(const OutputPointType &point) const |
| 96 |
|
{ |
| 97 |
LEN |
itkWarningMacro(<<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."); |
| 98 |
|
return this->GetInverseMatrix() * (point - this->GetOffset()); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
// Back transform a vector |
| 102 |
|
template<class TScalarType> |
| 103 |
|
typename Rigid3DTransform<TScalarType>::InputVectorType |
| 104 |
|
Rigid3DTransform<TScalarType>:: |
| 105 |
|
BackTransform(const OutputVectorType &vect ) const |
| 106 |
|
{ |
| 107 |
LEN |
itkWarningMacro(<<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."); |
| 108 |
|
return this->GetInverseMatrix() * vect; |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
// Back transform a vnl_vector |
| 112 |
|
template<class TScalarType> |
| 113 |
|
typename Rigid3DTransform<TScalarType>::InputVnlVectorType |
| 114 |
|
Rigid3DTransform<TScalarType>:: |
| 115 |
|
BackTransform(const OutputVnlVectorType &vect ) const |
| 116 |
|
{ |
| 117 |
LEN |
itkWarningMacro(<<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."); |
| 118 |
|
return this->GetInverseMatrix() * vect; |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
|
| 122 |
|
// Back Transform a CovariantVector |
| 123 |
|
template<class TScalarType> |
| 124 |
|
typename Rigid3DTransform<TScalarType>::InputCovariantVectorType |
| 125 |
|
Rigid3DTransform<TScalarType>:: |
| 126 |
|
BackTransform(const OutputCovariantVectorType &vect) const |
| 127 |
|
{ |
| 128 |
LEN |
itkWarningMacro(<<"BackTransform(): This method is slated to be removed from ITK. Instead, please use GetInverse() to generate an inverse transform and then perform the transform using that inverted transform."); |
| 129 |
|
return this->GetMatrix() * vect; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
} // namespace |
| 133 |
|
|
| 134 |
|
#endif |
| 135 |
|
|