00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __igstkTrackerTool_h
00019 #define __igstkTrackerTool_h
00020
00021 #include "igstkObject.h"
00022 #include "igstkTransform.h"
00023 #include "igstkMacros.h"
00024 #include "igstkStateMachine.h"
00025 #include "igstkCoordinateSystemInterfaceMacros.h"
00026
00027
00028 namespace igstk
00029 {
00030
00031 igstkEventMacro( TrackerToolEvent, StringEvent);
00032 igstkEventMacro( TrackerToolErrorEvent, IGSTKErrorWithStringEvent);
00033 igstkEventMacro( TrackerToolConfigurationEvent,TrackerToolEvent);
00034 igstkEventMacro( TrackerToolConfigurationErrorEvent,TrackerToolErrorEvent);
00035
00036 igstkEventMacro( InvalidRequestToAttachTrackerToolErrorEvent,
00037 TrackerToolErrorEvent);
00038
00039 igstkEventMacro( InvalidRequestToDetachTrackerToolErrorEvent,
00040 TrackerToolErrorEvent);
00041
00042 igstkEventMacro( TrackerToolAttachmentToTrackerEvent,TrackerToolEvent);
00043 igstkEventMacro( TrackerToolAttachmentToTrackerErrorEvent,
00044 TrackerToolErrorEvent);
00045 igstkEventMacro( TrackerToolDetachmentFromTrackerEvent,TrackerToolEvent);
00046 igstkEventMacro( TrackerToolDetachmentFromTrackerErrorEvent,
00047 TrackerToolErrorEvent);
00048 igstkEventMacro( TrackerToolMadeTransitionToTrackedStateEvent,
00049 TrackerToolEvent);
00050 igstkEventMacro( TrackerToolNotAvailableToBeTrackedEvent,TrackerToolEvent);
00051 igstkEventMacro( ToolTrackingStartedEvent,TrackerToolEvent);
00052 igstkEventMacro( ToolTrackingStoppedEvent,TrackerToolEvent);
00053
00054 class Tracker;
00055
00072 class TrackerTool : public Object
00073 {
00074 public:
00075
00077 igstkStandardAbstractClassTraitsMacro( TrackerTool, Object )
00078
00079 public:
00080
00081 igstkFriendClassMacro( Tracker );
00082
00083 typedef Tracker TrackerType;
00084 typedef Transform TransformType;
00085
00087 igstkGetMacro( CalibrationTransform, TransformType );
00088
00090 void SetCalibrationTransform( const TransformType & );
00091
00093 igstkGetMacro( Updated, bool );
00094
00096 virtual void RequestConfigure( void );
00097
00100 virtual void RequestDetachFromTracker( );
00101
00103 const std::string GetTrackerToolIdentifier( ) const;
00104
00107 virtual void RequestAttachToTracker( TrackerType * );
00108
00109 protected:
00110
00111 TrackerTool(void);
00112
00113 virtual ~TrackerTool(void);
00114
00116 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00117
00119 void SetTrackerToolIdentifier( const std::string identifier );
00120
00121 private:
00122
00123 TrackerTool(const Self&);
00124 void operator=(const Self&);
00125
00127 virtual void RequestReportTrackingStarted( );
00128
00130 virtual void RequestReportTrackingStopped( );
00131
00133 virtual void RequestReportTrackingToolNotAvailable( );
00134
00136 virtual void RequestReportTrackingToolVisible( );
00137
00139 void RequestReportSuccessfulTrackerToolAttachment();
00140
00142 void RequestReportFailedTrackerToolAttachment();
00143
00145 igstkGetMacro( RawTransform, TransformType );
00146
00148 void SetRawTransform( const TransformType & );
00149
00151 void SetCalibratedTransform( const TransformType & );
00152
00154 igstkSetMacro( Updated, bool );
00155
00158 virtual bool CheckIfTrackerToolIsConfigured( ) const = 0;
00159
00161 igstkDeclareInputMacro( ConfigureTool );
00162 igstkDeclareInputMacro( ToolConfigurationSuccess );
00163 igstkDeclareInputMacro( ToolConfigurationFailure );
00164 igstkDeclareInputMacro( AttachToolToTracker );
00165 igstkDeclareInputMacro( TrackingStarted );
00166 igstkDeclareInputMacro( TrackingStopped );
00167 igstkDeclareInputMacro( TrackerToolNotAvailable );
00168 igstkDeclareInputMacro( TrackerToolVisible );
00169 igstkDeclareInputMacro( DetachTrackerToolFromTracker );
00170 igstkDeclareInputMacro( AttachmentToTrackerSuccess );
00171 igstkDeclareInputMacro( AttachmentToTrackerFailure );
00172 igstkDeclareInputMacro( DetachmentFromTrackerSuccess );
00173 igstkDeclareInputMacro( DetachmentFromTrackerFailure );
00174
00176 igstkDeclareStateMacro( Idle );
00177 igstkDeclareStateMacro( AttemptingToConfigureTrackerTool );
00178 igstkDeclareStateMacro( Configured );
00179 igstkDeclareStateMacro( AttemptingToAttachTrackerToolToTracker );
00180 igstkDeclareStateMacro( Attached );
00181 igstkDeclareStateMacro( AttemptingToDetachTrackerToolFromTracker );
00182 igstkDeclareStateMacro( NotAvailable );
00183 igstkDeclareStateMacro( Tracked );
00184
00186 void AttemptToConfigureProcessing( void );
00187
00189 void AttemptToAttachTrackerToolToTrackerProcessing( void );
00190
00192 void TrackerToolConfigurationSuccessProcessing( void );
00193
00195 void TrackerToolConfigurationFailureProcessing( void );
00196
00199 void TrackerToolAttachmentToTrackerSuccessProcessing( void );
00200
00202 void TrackerToolAttachmentToTrackerFailureProcessing( void );
00203
00205 void AttemptToDetachTrackerToolFromTrackerProcessing( void );
00206
00209 void TrackerToolDetachmentFromTrackerSuccessProcessing( void );
00210
00212 void TrackerToolDetachmentFromTrackerFailureProcessing( void );
00213
00215 void ReportTrackerToolVisibleStateProcessing( void );
00216
00218 void ReportTrackerToolNotAvailableProcessing( void );
00219
00221 void ReportTrackingStartedProcessing( void );
00222
00224 void ReportTrackingStoppedProcessing( void );
00225
00227 void ReportInvalidRequestProcessing( void );
00228
00230 void ReportInvalidRequestToAttachTrackerToolProcessing( void );
00231
00233 void ReportInvalidRequestToDetachTrackerToolProcessing( void );
00234
00236 void NoProcessing( void );
00237
00239 TransformType m_CalibrationTransform;
00240
00242 TransformType m_CalibratedTransform;
00243
00245 TransformType m_RawTransform;
00246
00248 bool m_Updated;
00249
00251 std::string m_TrackerToolIdentifier;
00252
00254 Tracker * m_TrackerToAttachTo;
00255
00258 igstkCoordinateSystemClassInterfaceMacro();
00259
00262 CoordinateSystem::Pointer m_CalibrationCoordinateSystem;
00263 };
00264
00265 std::ostream& operator<<(std::ostream& os, const TrackerTool& o);
00266
00267 }
00268
00269 #endif //__igstk_TrackerTool_h_