itkRigid2DTransform.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkRigid2DTransform_h
00018 #define __itkRigid2DTransform_h
00019
00020 #include <iostream>
00021 #include "itkMatrixOffsetTransformBase.h"
00022 #include "itkExceptionObject.h"
00023
00024 namespace itk
00025 {
00026
00057 template < class TScalarType=double >
00058 class ITK_EXPORT Rigid2DTransform :
00059 public MatrixOffsetTransformBase< TScalarType, 2, 2>
00060 {
00061 public:
00063 typedef Rigid2DTransform Self;
00064 typedef MatrixOffsetTransformBase< TScalarType, 2, 2 > Superclass;
00065 typedef SmartPointer<Self> Pointer;
00066 typedef SmartPointer<const Self> ConstPointer;
00067
00069 itkTypeMacro( Rigid2DTransform, MatrixOffsetTransformBase );
00070
00072 itkNewMacro( Self );
00073
00075 itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
00076 itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00077 itkStaticConstMacro(ParametersDimension, unsigned int, 3);
00079
00081 typedef typename Superclass::ScalarType ScalarType;
00082
00084 typedef typename Superclass::ParametersType ParametersType;
00085
00087 typedef typename Superclass::JacobianType JacobianType;
00088
00090 typedef typename Superclass::MatrixType MatrixType;
00091
00093 typedef typename Superclass::OffsetType OffsetType;
00094
00096 typedef typename Superclass::InputVectorType InputVectorType;
00097 typedef typename Superclass::OutputVectorType OutputVectorType;
00098
00100 typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
00101 typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00102
00104 typedef typename Superclass::InputVnlVectorType InputVnlVectorType;
00105 typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00106
00108 typedef typename Superclass::InputPointType InputPointType;
00109 typedef typename Superclass::OutputPointType OutputPointType;
00110
00123 virtual void SetMatrix( const MatrixType & matrix );
00124
00130 virtual void SetRotationMatrix(const MatrixType &matrix)
00131 { this->SetMatrix( matrix ); }
00132 const MatrixType & GetRotationMatrix() const
00133 { return this->GetMatrix(); }
00135
00136
00144 void Translate(const OffsetType &offset, bool pre=false);
00145
00154 inline InputPointType BackTransform(const OutputPointType &point ) const;
00155 inline InputVectorType BackTransform(const OutputVectorType &vector) const;
00156 inline InputVnlVectorType BackTransform(const OutputVnlVectorType &vector) const;
00158
00159 inline InputCovariantVectorType BackTransform(
00160 const OutputCovariantVectorType &vector) const;
00161
00163 void SetAngle(TScalarType angle);
00164 itkGetConstReferenceMacro( Angle, TScalarType );
00166
00168 void SetAngleInDegrees(TScalarType angle);
00169
00173 void SetRotation(TScalarType angle)
00174 { this->SetAngle(angle); }
00175 virtual const TScalarType & GetRotation() const
00176 { return m_Angle; }
00178
00187 void SetParameters( const ParametersType & parameters );
00188
00197 const ParametersType & GetParameters( void ) const;
00198
00203 const JacobianType & GetJacobian(const InputPointType &point ) const;
00204
00209 void CloneInverseTo( Pointer & newinverse ) const;
00210
00215 void CloneTo( Pointer & clone ) const;
00216
00218 virtual void SetIdentity(void);
00219
00220 protected:
00221 Rigid2DTransform();
00222 Rigid2DTransform( unsigned int outputSpaceDimension,
00223 unsigned int parametersDimension);
00224
00225 ~Rigid2DTransform();
00226
00230 void PrintSelf(std::ostream &os, Indent indent) const;
00231
00235 virtual void ComputeMatrix(void);
00236
00241 virtual void ComputeMatrixParameters(void);
00242
00244 void SetVarAngle( TScalarType angle )
00245 { m_Angle = angle; }
00246
00247 private:
00248 Rigid2DTransform(const Self&);
00249 void operator=(const Self&);
00250
00251 TScalarType m_Angle;
00252
00253 };
00254
00255
00256
00257 template<class TScalarType>
00258 inline
00259 typename Rigid2DTransform<TScalarType>::InputPointType
00260 Rigid2DTransform<TScalarType>::
00261 BackTransform(const OutputPointType &point) const
00262 {
00263 itkWarningMacro(
00264 <<"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."
00265 );
00266 return this->GetInverseMatrix() * (point - this->GetOffset());
00267 }
00268
00269
00270 template<class TScalarType>
00271 inline
00272 typename Rigid2DTransform<TScalarType>::InputVectorType
00273 Rigid2DTransform<TScalarType>::
00274 BackTransform(const OutputVectorType &vect ) const
00275 {
00276 itkWarningMacro(
00277 <<"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."
00278 );
00279 return this->GetInverseMatrix() * vect;
00280 }
00281
00282
00283 template<class TScalarType>
00284 inline
00285 typename Rigid2DTransform<TScalarType>::InputVnlVectorType
00286 Rigid2DTransform<TScalarType>::
00287 BackTransform(const OutputVnlVectorType &vect ) const
00288 {
00289 itkWarningMacro(
00290 <<"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."
00291 );
00292 return this->GetInverseMatrix() * vect;
00293 }
00294
00295
00296
00297 template<class TScalarType>
00298 inline
00299 typename Rigid2DTransform<TScalarType>::InputCovariantVectorType
00300 Rigid2DTransform<TScalarType>::
00301 BackTransform(const OutputCovariantVectorType &vect) const
00302 {
00303 itkWarningMacro(
00304 <<"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."
00305 );
00306 return this->GetMatrix() * vect;
00307 }
00308
00309 }
00310
00311
00312
00313 #define ITK_TEMPLATE_Rigid2DTransform(_, EXPORT, x, y) namespace itk { \
00314 _(1(class EXPORT Rigid2DTransform< ITK_TEMPLATE_1 x >)) \
00315 namespace Templates { typedef Rigid2DTransform< ITK_TEMPLATE_1 x > Rigid2DTransform##y; } \
00316 }
00317
00318 #if ITK_TEMPLATE_EXPLICIT
00319 # include "Templates/itkRigid2DTransform+-.h"
00320 #endif
00321
00322 #if ITK_TEMPLATE_TXX
00323 # include "itkRigid2DTransform.txx"
00324 #endif
00325
00326 #endif
00327