IGSTK
igstkTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkTransform.h,v $
5  Language: C++
6  Date: $Date: 2009-01-30 18:24:31 $
7  Version: $Revision: 1.25 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/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 
18 #ifndef __igstkTransform_h
19 #define __igstkTransform_h
20 
21 #include "igstkTransformBase.h"
22 
23 #include "itkVector.h"
24 #include "itkVersor.h"
25 
26 #include "vtkMatrix4x4.h"
27 
28 #include "igstkTimeStamp.h"
29 #include "igstkMacros.h"
30 
31 namespace igstk
32 {
33 
57  class Transform : public TransformBase
58 {
59 public:
60 
61  typedef ::itk::Vector<double, 3> VectorType;
62  typedef ::itk::Point<double, 3> PointType;
63  typedef ::itk::Versor<double> VersorType;
64 
65 public:
66 
68  Transform();
69  Transform( const Transform & t );
70  virtual ~Transform();
71 
73  static Transform TransformCompose( Transform leftTransform,
74  Transform rightTransform );
75 
77  const Transform & operator=( const Transform & inputTransform );
78 
84  const VectorType & translation,
85  const VersorType & rotation,
86  TransformBase::ErrorType errorValue,
87  TimeStamp::TimePeriodType millisecondsToExpiration );
88 
89 
96  void SetRotation(
97  const VersorType & rotation,
98  ErrorType errorValue,
99  TimePeriodType millisecondsToExpiration );
100 
107  void SetTranslation(
108  const VectorType & translation,
109  ErrorType errorValue,
110  TimePeriodType millisecondsToExpiration );
111 
115  igstkGetMacro( Translation, VectorType );
116 
117 
121  igstkGetMacro( Rotation, VersorType );
122 
123 
129  void ExportTransform( vtkMatrix4x4 & matrix ) const;
130 
133  void ImportTransform( vtkMatrix4x4 & matrix );
134 
138  bool operator==( const Transform & inputTransform );
139  bool operator!=( const Transform & inputTransform );
140 
143  const Transform& inputTransform, double tol = vnl_math::eps ) const;
144 
146  bool IsIdentity( double tol = vnl_math::eps ) const;
147 
149  void SetToIdentity( TimePeriodType validityPeriodInMilliseconds );
150 
152  void Print( std::ostream& os, itk::Indent indent ) const;
153 
155  Transform GetInverse() const;
156 
157 
158 protected:
159 
160  void PrintHeader( std::ostream& os, itk::Indent indent ) const;
161 
162  void PrintTrailer( std::ostream& itkNotUsed(os),
163  itk::Indent itkNotUsed(indent) ) const;
164 
166  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
167 
168 private:
169 
170  VectorType m_Translation;
171  VersorType m_Rotation;
172 
173 };
174 
175 std::ostream& operator<<( std::ostream& os, const igstk::Transform& o );
176 }
177 
178 #endif