go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedRigid2DTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAdvancedRigid2DTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-14 18:39:05 $
00007   Version:   $Revision: 1.22 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkAdvancedRigid2DTransform_h
00018 #define __itkAdvancedRigid2DTransform_h
00019 
00020 #include <iostream>
00021 #include "itkAdvancedMatrixOffsetTransformBase.h"
00022 #include "itkExceptionObject.h"
00023 
00024 namespace itk
00025 {
00026 
00057 template < class TScalarType=double >    // Data type for scalars (float or double)
00058 class ITK_EXPORT AdvancedRigid2DTransform :
00059         public AdvancedMatrixOffsetTransformBase< TScalarType, 2, 2> // Dimensions of input and output spaces
00060 {
00061 public:
00063   typedef AdvancedRigid2DTransform                               Self;
00064   typedef AdvancedMatrixOffsetTransformBase< TScalarType, 2, 2 > Superclass;
00065   typedef SmartPointer<Self>                             Pointer;
00066   typedef SmartPointer<const Self>                       ConstPointer;
00067 
00069   itkTypeMacro( AdvancedRigid2DTransform, AdvancedMatrixOffsetTransformBase );
00070 
00072   itkNewMacro( Self );
00073 
00075   itkStaticConstMacro(InputSpaceDimension, unsigned int, 2);
00076   itkStaticConstMacro(OutputSpaceDimension, unsigned int, 2);
00077   itkStaticConstMacro(ParametersDimension, unsigned int, 3);
00078 
00080   typedef typename Superclass::ScalarType  ScalarType;
00081 
00083   typedef typename Superclass::ParametersType  ParametersType;
00084 
00086   typedef typename Superclass::JacobianType  JacobianType;
00087 
00089   typedef typename Superclass::MatrixType MatrixType;
00090 
00092   typedef typename Superclass::OffsetType OffsetType;
00093 
00095   typedef typename Superclass::InputVectorType  InputVectorType;
00096   typedef typename Superclass::OutputVectorType OutputVectorType;
00097 
00099   typedef typename Superclass::InputCovariantVectorType InputCovariantVectorType;
00100   typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00101 
00103   typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
00104   typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00105 
00107   typedef typename Superclass::InputPointType  InputPointType;
00108   typedef typename Superclass::OutputPointType OutputPointType;
00109 
00110   typedef typename Superclass
00111     ::NonZeroJacobianIndicesType                    NonZeroJacobianIndicesType;
00112   typedef typename Superclass::SpatialJacobianType  SpatialJacobianType;
00113   typedef typename Superclass
00114     ::JacobianOfSpatialJacobianType                 JacobianOfSpatialJacobianType;
00115   typedef typename Superclass::SpatialHessianType   SpatialHessianType;
00116   typedef typename Superclass
00117     ::JacobianOfSpatialHessianType                  JacobianOfSpatialHessianType;
00118   typedef typename Superclass::InternalMatrixType   InternalMatrixType;
00119 
00132   virtual void SetMatrix( const MatrixType & matrix );
00133 
00139   virtual void SetRotationMatrix(const MatrixType &matrix)
00140     { this->SetMatrix( matrix ); }
00141   const MatrixType & GetRotationMatrix() const
00142     { return this->GetMatrix(); }
00143 
00144 
00152   void Translate(const OffsetType &offset, bool pre=false);
00153 
00162   inline InputPointType      BackTransform(const OutputPointType  &point ) const;
00163   inline InputVectorType     BackTransform(const OutputVectorType &vector) const;
00164   inline InputVnlVectorType  BackTransform(const OutputVnlVectorType &vector) const;
00165 
00166   inline InputCovariantVectorType BackTransform(
00167                                      const OutputCovariantVectorType &vector) const;
00168 
00170   void SetAngle(TScalarType angle);
00171   itkGetConstReferenceMacro( Angle, TScalarType );
00172 
00174   void SetAngleInDegrees(TScalarType angle);
00175 
00179   void SetRotation(TScalarType angle)
00180     { this->SetAngle(angle); }
00181   virtual const TScalarType & GetRotation() const
00182     { return m_Angle; }
00183 
00192   void SetParameters( const ParametersType & parameters );
00193 
00202   const ParametersType & GetParameters( void ) const;
00203 
00208   virtual void GetJacobian(
00209     const InputPointType &,
00210     JacobianType &,
00211     NonZeroJacobianIndicesType & ) const;
00212 
00217   void CloneInverseTo( Pointer & newinverse ) const;
00218 
00223   void CloneTo( Pointer & clone ) const;
00224 
00226   virtual void SetIdentity(void);
00227 
00228 
00229 protected:
00230   AdvancedRigid2DTransform();
00231   AdvancedRigid2DTransform( unsigned int outputSpaceDimension,
00232                     unsigned int parametersDimension);
00233 
00234  ~AdvancedRigid2DTransform();
00235 
00239   void PrintSelf(std::ostream &os, Indent indent) const;
00240 
00245   virtual void ComputeMatrix(void);
00246 
00251   virtual void ComputeMatrixParameters(void);
00252 
00254   void SetVarAngle( TScalarType angle )
00255     { m_Angle = angle; }
00256 
00258   virtual void PrecomputeJacobianOfSpatialJacobian(void);
00259 
00260 
00261 private:
00262   AdvancedRigid2DTransform(const Self&); //purposely not implemented
00263   void operator=(const Self&); //purposely not implemented
00264 
00265   TScalarType         m_Angle;
00266 
00267 }; //class AdvancedRigid2DTransform
00268 
00269 
00270 // Back transform a point
00271 template<class TScalarType>
00272 inline
00273 typename AdvancedRigid2DTransform<TScalarType>::InputPointType
00274 AdvancedRigid2DTransform<TScalarType>::
00275 BackTransform(const OutputPointType &point) const
00276 {
00277   itkWarningMacro(
00278     <<"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."
00279     );
00280   return this->GetInverseMatrix() * (point - this->GetOffset());
00281 }
00282 
00283 // Back transform a vector
00284 template<class TScalarType>
00285 inline
00286 typename AdvancedRigid2DTransform<TScalarType>::InputVectorType
00287 AdvancedRigid2DTransform<TScalarType>::
00288 BackTransform(const OutputVectorType &vect ) const
00289 {
00290   itkWarningMacro(
00291     <<"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."
00292     );
00293   return this->GetInverseMatrix() * vect;
00294 }
00295 
00296 // Back transform a vnl_vector
00297 template<class TScalarType>
00298 inline
00299 typename AdvancedRigid2DTransform<TScalarType>::InputVnlVectorType
00300 AdvancedRigid2DTransform<TScalarType>::
00301 BackTransform(const OutputVnlVectorType &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->GetInverseMatrix() * vect;
00307 }
00308 
00309 
00310 // Back Transform a CovariantVector
00311 template<class TScalarType>
00312 inline
00313 typename AdvancedRigid2DTransform<TScalarType>::InputCovariantVectorType
00314 AdvancedRigid2DTransform<TScalarType>::
00315 BackTransform(const OutputCovariantVectorType &vect) const
00316 {
00317   itkWarningMacro(
00318     <<"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."
00319     );
00320   return this->GetMatrix() * vect;
00321 }
00322 
00323 }  // namespace itk
00324 
00325 
00326 // Define instantiation macro for this template.
00327 #define ITK_TEMPLATE_AdvancedRigid2DTransform(_, EXPORT, x, y) namespace itk { \
00328   _(1(class EXPORT AdvancedRigid2DTransform< ITK_TEMPLATE_1 x >)) \
00329   namespace Templates { typedef AdvancedRigid2DTransform< ITK_TEMPLATE_1 x > AdvancedRigid2DTransform##y; } \
00330   }
00331 
00332 #if ITK_TEMPLATE_EXPLICIT
00333 # include "Templates/itkAdvancedRigid2DTransform+-.h"
00334 #endif
00335 
00336 #if ITK_TEMPLATE_TXX
00337 # include "itkAdvancedRigid2DTransform.txx"
00338 #endif
00339 
00340 #endif /* __itkAdvancedRigid2DTransform_h */


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo