IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkTransform.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-01-30 18:24:31 $ 00007 Version: $Revision: 1.25 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/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 00018 #ifndef __igstkTransform_h 00019 #define __igstkTransform_h 00020 00021 #include "igstkTransformBase.h" 00022 00023 #include "itkVector.h" 00024 #include "itkVersor.h" 00025 00026 #include "vtkMatrix4x4.h" 00027 00028 #include "igstkTimeStamp.h" 00029 #include "igstkMacros.h" 00030 00031 namespace igstk 00032 { 00033 00057 class Transform : public TransformBase 00058 { 00059 public: 00060 00061 typedef ::itk::Vector<double, 3> VectorType; 00062 typedef ::itk::Point<double, 3> PointType; 00063 typedef ::itk::Versor<double> VersorType; 00064 00065 public: 00066 00068 Transform(); 00069 Transform( const Transform & t ); 00070 virtual ~Transform(); 00071 00073 static Transform TransformCompose( Transform leftTransform, 00074 Transform rightTransform ); 00075 00077 const Transform & operator=( const Transform & inputTransform ); 00078 00083 void SetTranslationAndRotation( 00084 const VectorType & translation, 00085 const VersorType & rotation, 00086 TransformBase::ErrorType errorValue, 00087 TimeStamp::TimePeriodType millisecondsToExpiration ); 00088 00089 00096 void SetRotation( 00097 const VersorType & rotation, 00098 ErrorType errorValue, 00099 TimePeriodType millisecondsToExpiration ); 00100 00107 void SetTranslation( 00108 const VectorType & translation, 00109 ErrorType errorValue, 00110 TimePeriodType millisecondsToExpiration ); 00111 00115 igstkGetMacro( Translation, VectorType ); 00116 00117 00121 igstkGetMacro( Rotation, VersorType ); 00122 00123 00129 void ExportTransform( vtkMatrix4x4 & matrix ) const; 00130 00133 void ImportTransform( vtkMatrix4x4 & matrix ); 00134 00138 bool operator==( const Transform & inputTransform ); 00139 bool operator!=( const Transform & inputTransform ); 00140 00142 bool IsNumericallyEquivalent( 00143 const Transform& inputTransform, double tol = vnl_math::eps ) const; 00144 00146 bool IsIdentity( double tol = vnl_math::eps ) const; 00147 00149 void SetToIdentity( TimePeriodType validityPeriodInMilliseconds ); 00150 00152 void Print( std::ostream& os, itk::Indent indent ) const; 00153 00155 Transform GetInverse() const; 00156 00157 00158 protected: 00159 00160 void PrintHeader( std::ostream& os, itk::Indent indent ) const; 00161 00162 void PrintTrailer( std::ostream& itkNotUsed(os), 00163 itk::Indent itkNotUsed(indent) ) const; 00164 00166 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00167 00168 private: 00169 00170 VectorType m_Translation; 00171 VersorType m_Rotation; 00172 00173 }; 00174 00175 std::ostream& operator<<( std::ostream& os, const igstk::Transform& o ); 00176 } 00177 00178 #endif