How to extend tracker support

From IGSTK
Jump to: navigation, search

Introduction

At the core of the IGSTK toolkit is the tracking component that handles communication between control computer and tracking device and gather tracking information. IGSTK provides support for several commonly used tracking devices ( such as NDI tracker and Micron Tracker). A full list of trackers that are currently supported and not supported can be found in Supported Tracking System section. IGSTK, being an open source project, we encourage users to contribute extensions of the toolkit. This short "how-to-guide" highlights the major implementation requirements to extend the tracking component to handle a new type of tracking device.

Extending IGSTK support for a new type of tracking device involves the following main steps

  1. Implement a helper class that handles communication between the control computer and the tracking device
  2. Implement a tracker tool class that is derived from igstk::TrackerTool
  3. Implement a tracker class that is dervied from igstk::Tracker


Implementation of device specific Tracker class

The igstk::Tracker class contains the following pure virtual methods. These methods should be overloaded in the derived (device-specific) tracker class.

/** The "InternalOpen" method opens communication with a tracking device.
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalOpen( void ) = 0;
 /** The "InternalClose" method closes communication with a tracking device.
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalClose( void ) = 0;
 /** The "InternalReset" method resets tracker to a known configuration. 
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalReset( void ) = 0;
 /** The "InternalStartTracking" method starts tracking.
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalStartTracking( void ) = 0;
 /** The "InternalStopTracking" method stops tracking.
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalStopTracking( void ) = 0;
 /** The "InternalUpdateStatus" method updates tracker status.
     This method is to be implemented by a descendant class 
     and responsible for device-specific processing */
 virtual ResultType InternalUpdateStatus( void ) = 0;
 /** The "InternalThreadedUpdateStatus" method updates tracker status.
     This method is called in a separate thread.
     This method is to be implemented by a descendant class
     and responsible for device-specific processing */
 virtual ResultType InternalThreadedUpdateStatus( void ) = 0;
/** Verify if a tracker tool information is correct before attaching
  *  it to the tracker. This method is used to verify the information supplied
  *  by the user about the tracker tool. The information depends on the
  *  tracker type. For example, during the configuration step of the
  *  MicronTracker, location of the directory containing marker template files
  *  is specified. If the user tries to attach a tracker tool with a marker
  *  type whose template file is not stored in this directory, this method
  *  will return failure. Similarly, for PolarisTracker, the method returns
  *  failure,  if the tool part number specified by the user during the tracker
  *  tool configuration step does not match with the part number read from the
  *  SROM file.
  */
 virtual ResultType
       VerifyTrackerToolInformation( const TrackerToolType * ) = 0;
 /** This method will remove entries of the traceker tool from internal
   * data containers */
 virtual ResultType RemoveTrackerToolFromInternalDataContainers(
                                    const TrackerToolType * trackerTool ) = 0;
 /** Add tracker tool entry to internal containers */
 virtual ResultType AddTrackerToolToInternalDataContainers(
                                   const TrackerToolType * trackerTool ) = 0;


Implementation of a device specific Tracker tool class

This class contains the following pure virtual functions

/** Check if the tracker tool is configured or not. This method should

  *  be implemented in the derived classes. */
 virtual bool CheckIfTrackerToolIsConfigured( ) const = 0;

Implementation of a communication class

Implementation of a dedicated communication class might be necessary depending on the tracking type. Some of the tracking devices come with there own library that will provide that function.