00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __igstkTransform_h
00019 #define __igstkTransform_h
00020
00021 #include "itkVector.h"
00022 #include "itkVersor.h"
00023
00024 #include "vtkMatrix4x4.h"
00025
00026 #include "igstkTimeStamp.h"
00027 #include "igstkMacros.h"
00028
00029 namespace igstk
00030 {
00031
00056 class Transform
00057 {
00058 public:
00059
00060 typedef ::itk::Vector<double, 3> VectorType;
00061 typedef ::itk::Point<double, 3> PointType;
00062 typedef ::itk::Versor<double> VersorType;
00063 typedef double ErrorType;
00064 typedef TimeStamp::TimePeriodType TimePeriodType;
00065
00066 public:
00067
00069 Transform();
00070 Transform( const Transform & t );
00071 virtual ~Transform();
00072
00074 static Transform TransformCompose( Transform leftTransform,
00075 Transform rightTransform );
00076
00078 const Transform & operator=( const Transform & inputTransform );
00079
00084 void SetTranslationAndRotation(
00085 const VectorType & translation,
00086 const VersorType & rotation,
00087 ErrorType errorValue,
00088 TimePeriodType millisecondsToExpiration);
00089
00090
00097 void SetRotation(
00098 const VersorType & rotation,
00099 ErrorType errorValue,
00100 TimePeriodType millisecondsToExpiration);
00101
00108 void SetTranslation(
00109 const VectorType & translation,
00110 ErrorType errorValue,
00111 TimePeriodType millisecondsToExpiration);
00112
00116 igstkGetMacro( Translation, VectorType );
00117
00118
00122 igstkGetMacro( Rotation, VersorType );
00123
00124
00128 igstkGetMacro( Error, ErrorType );
00129
00130
00138 TimePeriodType GetStartTime() const;
00139
00140
00148 TimePeriodType GetExpirationTime() const;
00149
00150
00159 bool IsValidAtTime( TimePeriodType timeToTestInMilliseconds ) const;
00160
00166 bool IsValidNow() const;
00167
00168
00174 void ExportTransform( vtkMatrix4x4 & matrix ) const;
00175
00176
00180 bool operator==( const Transform & inputTransform );
00181 bool operator!=( const Transform & inputTransform );
00182
00184 bool IsNumericallyEquivalent(
00185 const Transform& inputTransform, double tol = vnl_math::eps ) const;
00186
00188 bool IsIdentity( double tol = vnl_math::eps ) const;
00189
00191 void SetToIdentity( TimePeriodType validityPeriodInMilliseconds );
00192
00194 void Print(std::ostream& os, itk::Indent indent) const;
00195
00197 Transform GetInverse() const;
00198
00199
00200 protected:
00201
00202 void PrintHeader(std::ostream& os, itk::Indent indent) const;
00203
00204 void PrintTrailer(std::ostream& itkNotUsed(os),
00205 itk::Indent itkNotUsed(indent)) const;
00206
00208 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00209
00210 private:
00211
00212 TimeStamp m_TimeStamp;
00213 VectorType m_Translation;
00214 VersorType m_Rotation;
00215 ErrorType m_Error;
00216
00217 };
00218
00219 std::ostream& operator<<(std::ostream& os, const igstk::Transform& o);
00220 }
00221
00222 #endif