18 #ifndef __igstkTracker_h
19 #define __igstkTracker_h
24 #include "itkMutexLock.h"
25 #include "itkConditionVariable.h"
26 #include "itkMultiThreader.h"
206 virtual void PrintSelf( std::ostream& os, itk::Indent indent )
const;
282 void operator=(
const Self&);
288 typedef itk::SimpleMemberCommand< Self > ObserverType;
289 ObserverType::Pointer m_PulseObserver;
296 typedef TrackerToolType::Pointer TrackerToolPointer;
299 bool m_ApplyingReferenceTool;
300 TrackerToolPointer m_ReferenceTool;
307 bool m_ThreadingEnabled;
311 bool m_TrackingThreadStarted;
314 itk::MultiThreader::Pointer m_Threader;
321 itk::ConditionVariable::Pointer m_ConditionNextTransformReceived;
325 itk::SimpleMutexLock m_LockForConditionNextTransformReceived;
328 igstkDeclareStateMacro( Idle );
329 igstkDeclareStateMacro( AttemptingToEstablishCommunication );
330 igstkDeclareStateMacro( AttemptingToCloseCommunication );
331 igstkDeclareStateMacro( CommunicationEstablished );
332 igstkDeclareStateMacro( AttemptingToAttachTrackerTool );
333 igstkDeclareStateMacro( TrackerToolAttached );
334 igstkDeclareStateMacro( AttemptingToTrack );
335 igstkDeclareStateMacro( Tracking );
336 igstkDeclareStateMacro( AttemptingToUpdate );
337 igstkDeclareStateMacro( AttemptingToStopTracking );
340 igstkDeclareInputMacro( EstablishCommunication );
341 igstkDeclareInputMacro( StartTracking );
342 igstkDeclareInputMacro( AttachTrackerTool );
343 igstkDeclareInputMacro( UpdateStatus );
344 igstkDeclareInputMacro( StopTracking );
345 igstkDeclareInputMacro( Reset );
346 igstkDeclareInputMacro( CloseCommunication );
347 igstkDeclareInputMacro( ValidFrequency );
349 igstkDeclareInputMacro( Success );
350 igstkDeclareInputMacro( Failure );
360 static ITK_THREAD_RETURN_TYPE TrackingThreadFunction(
void* pInfoStruct);
365 void UpdateStatus(
void );
369 void AttemptToOpenProcessing(
void );
373 void AttemptToStartTrackingProcessing(
void );
376 void AttemptToStopTrackingProcessing(
void );
380 void AttemptToAttachTrackerToolProcessing(
void );
384 void AttemptToUpdateStatusProcessing(
void );
388 void UpdateStatusSuccessProcessing(
void );
392 void UpdateStatusFailureProcessing(
void );
396 void CloseFromTrackingStateProcessing(
void );
400 void CloseFromCommunicatingStateProcessing(
void );
404 void ResetFromTrackingStateProcessing(
void );
408 void ResetFromToolsActiveStateProcessing(
void);
412 void ResetFromCommunicatingStateProcessing(
void );
415 void CommunicationEstablishmentSuccessProcessing(
void );
418 void CommunicationEstablishmentFailureProcessing(
void );
421 void ToolsActivationSuccessProcessing(
void );
424 void ToolsActivationFailureProcessing(
void );
427 void StartTrackingSuccessProcessing(
void );
430 void StartTrackingFailureProcessing(
void );
434 void AttachingTrackerToolSuccessProcessing(
void );
438 void AttachingTrackerToolFailureProcessing(
void );
441 void StopTrackingSuccessProcessing(
void );
444 void StopTrackingFailureProcessing(
void );
447 void CloseCommunicationSuccessProcessing(
void );
450 void CloseCommunicationFailureProcessing(
void );
453 void EnterTrackingStateProcessing(
void );
456 void DetachAllTrackerToolsFromTracker();
459 void ReportInvalidRequestProcessing(
void );
462 void SetFrequencyProcessing(
void );
466 igstkCoordinateSystemClassInterfaceMacro();
470 double m_FrequencyToBeSet;
475 #endif //__igstk_Tracker_h_
#define igstkStandardAbstractClassTraitsMacro(classname, superclassname)
Convenience macro for traits of an abstract non-templated class.
void ExitTrackingTerminatingTrackingThread()
Exit tracking after terminating tracking thread.
#define igstkFriendClassMacro(type)
Create a Macro for friend class.
#define igstkGetMacro(name, type)
Get built-in type.
virtual ResultType AddTrackerToolToInternalDataContainers(const TrackerToolType *trackerTool)=0
Add tracker tool entry to internal containers.
void RequestOpen(void)
The "RequestOpen" method attempts to open communication with the tracking device. ...
Transform TransformType
typedefs from Transform class
void SetTrackerToolRawTransform(TrackerToolType *trackerTool, const TransformType transform)
Set tracker tool raw transform.
void ReportTrackingToolVisible(TrackerToolType *trackerTool) const
Report to tracker tool that it is visible.
Base class for all the IGSTK classes.
Transform::TimePeriodType TimePeriodType
typedef for times used by the tracker
void RequestReset(void)
The "RequestReset" tracker method should be used to bring the tracker to some defined default state...
void ReportTrackingToolNotAvailable(TrackerToolType *trackerTool) const
Report to tracker tool that it is not available for tracking.
virtual ResultType InternalClose(void)=0
The "InternalClose" method closes communication with a tracking device.
void RequestSetFrequency(double frequencyInHz)
The "RequestSetFrequency" method defines the frequency at which the Transform information will be que...
igstkEventMacro(AuroraTrackerToolEvent, StringEvent)
virtual ResultType InternalStopTracking(void)=0
The "InternalStopTracking" method stops tracking.
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print the object information in a stream.
virtual ResultType VerifyTrackerToolInformation(const TrackerToolType *)=0
Verify if a tracker tool information is correct before attaching it to the tracker.
::itk::SmartPointer< Self > Pointer
std::map< std::string, TrackerToolType * > TrackerToolsContainerType
typedefs from TrackerTool class
const TrackerToolsContainerType & GetTrackerToolContainer() const
Access method for the tracker tool container.
virtual ResultType RemoveTrackerToolFromInternalDataContainers(const TrackerToolType *trackerTool)=0
This method will remove entries of the traceker tool from internal data containers.
virtual ResultType ValidateSpecifiedFrequency(double frequencyInHz)
The "ValidateSpecifiedFrequency" method checks if the specified frequency is valid for the tracking d...
void SetTrackerToolTransformUpdate(TrackerToolType *trackerTool, bool flag) const
Turn on/off update flag of the tracker tool.
void ExitTrackingStateProcessing(void)
Depending on the tracker type, the tracking thread should be terminated or left untouched when we sto...
Abstract superclass for concrete IGSTK Tracker classes.
virtual ResultType InternalUpdateStatus(void)=0
The "InternalUpdateStatus" method updates tracker status.
void RequestSetReferenceTool(TrackerToolType *trackerTool)
Set a reference tracker tool.
void RequestClose(void)
The "RequestClose" method closes communication with the device.
void ExitTrackingWithoutTerminatingTrackingThread()
Exit tracking without terminating tracking thread.
virtual ResultType InternalReset(void)=0
The "InternalReset" method resets tracker to a known configuration.
igstkStandardAbstractClassTraitsMacro(Tracker, Object) public typedef TrackerTool TrackerToolType
Macro with standard traits declarations.
#define igstkSetMacro(name, type)
Set built-in type.
virtual ResultType InternalOpen(void)=0
The "InternalOpen" method opens communication with a tracking device.
void RequestStopTracking(void)
The "RequestStopTracking" stops tracker from tracking the tools.
virtual ResultType InternalStartTracking(void)=0
The "InternalStartTracking" method starts tracking.
virtual ResultType InternalThreadedUpdateStatus(void)=0
The "InternalThreadedUpdateStatus" method updates tracker status.
void RequestStartTracking(void)
The "RequestStartTracking" method readies the tracker for tracking the tools connected to the tracker...