This file is indexed.

/usr/include/IGSTK/igstkTracker.h is in libigstk4-dev 4.4.0-2build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
/*=========================================================================

  Program:   Image Guided Surgery Software Toolkit
  Module:    $RCSfile: igstkTracker.h,v $
  Language:  C++
  Date:      $Date: 2009-06-11 21:53:53 $
  Version:   $Revision: 1.63 $

  Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef __igstkTracker_h
#define __igstkTracker_h

#include <vector>
#include <map>

#include "itkMutexLock.h"
#include "itkConditionVariable.h"
#include "itkMultiThreader.h"

#include "igstkObject.h"
#include "igstkStateMachine.h"
#include "igstkTransform.h"
#include "igstkPulseGenerator.h"
#include "igstkTrackerTool.h"

#include "igstkCoordinateSystemInterfaceMacros.h"


namespace igstk
{

igstkEventMacro( TrackerEvent,                             StringEvent);
igstkEventMacro( TrackerErrorEvent,                IGSTKErrorWithStringEvent);

igstkEventMacro( TrackerOpenEvent,                         TrackerEvent);
igstkEventMacro( TrackerOpenErrorEvent,                    TrackerErrorEvent);

igstkEventMacro( TrackerCloseEvent,                        TrackerEvent);
igstkEventMacro( TrackerCloseErrorEvent,                   TrackerErrorEvent);

igstkEventMacro( TrackerInitializeEvent,                   TrackerEvent);
igstkEventMacro( TrackerInitializeErrorEvent,              TrackerErrorEvent);

igstkEventMacro( TrackerStartTrackingEvent,                TrackerEvent);
igstkEventMacro( TrackerStartTrackingErrorEvent,           TrackerErrorEvent);

igstkEventMacro( TrackerStopTrackingEvent,                 TrackerEvent);
igstkEventMacro( TrackerStopTrackingErrorEvent,            TrackerErrorEvent);

igstkEventMacro( TrackerUpdateStatusEvent,                 TrackerEvent);
igstkEventMacro( TrackerUpdateStatusErrorEvent,            TrackerErrorEvent);

igstkEventMacro( TrackerToolTransformUpdateEvent,          TrackerEvent);


/** \class Tracker
 *  \brief Abstract superclass for concrete IGSTK Tracker classes.
 *
 *  This class presents a generic interface for tracking the
 *  positions of objects in IGSTK.  The various derived
 *  subclasses of this class provide back-ends that communicate
 *  with several of the tracking systems that are available on
 *  the market.
 *
 *  The state machine of this class implements the basic
 *  state transitions of a tracker.  Inputs to the state
 *  machine are translated into method calls that can be
 *  overridden by device-specific derive classes that do
 *  the appropriate processing for a particular device.
 *
 *  Most (but not all) of the derived classes utilize a
 *  communication object to mediate all communication between
 *  the computer and the device.  When a communication object
 *  is used, all communication can be logged, and furthermore,
 *  the communication log can be used to drive an offline
 *  simulation of a particular device 
 *  (See SerialCommunicationSimulator).
 *
 *  The following diagram illustrates the state machine of 
 *  the tracker class
 *
 *  \image html  igstkDummyTracker.png  "Tracker State Machine Diagram"
 *  \image latex igstkDummyTracker.eps  "Tracker State Machine Diagram" 
 *
 *  \ingroup Tracker
 */

class Tracker : public Object
{

public:
  /** Macro with standard traits declarations. */
  igstkStandardAbstractClassTraitsMacro( Tracker, Object ) 

public:

  igstkFriendClassMacro( TrackerTool );

  /** typedefs from TrackerTool class */
  typedef TrackerTool       TrackerToolType;

  /** The "RequestOpen" method attempts to open communication with the 
   *  tracking device. It generates a TrackerOpenEvent if successful,
   *  or a TrackerOpenErrorEvent if not successful.  */
  void RequestOpen( void );

  /** The "RequestClose" method closes communication with the device. 
   *  It generates a TrackerCloseEvent if successful,
   *  or a TrackerCloseErrorEvent if not successful. */
  void RequestClose( void );

  /** The "RequestReset" tracker method should be used to bring the tracker
  to some defined default state. */
  void RequestReset( void );

  /** The "RequestStartTracking" method readies the tracker for tracking the
  tools connected to the tracker. */
  void RequestStartTracking( void );

  /** The "RequestStopTracking" stops tracker from tracking the tools. */
  void RequestStopTracking( void );
  
  /** The "RequestSetFrequency" method defines the frequency at which the
   * Transform information will be queried from the Tracker device. Note that
   * Tracker devices have their own internal frequency rate, and if you set here
   * a frequency that is higher than what the Tracker device is capable to
   * follow, then you will start receiving transforms with repeated values. */
  void RequestSetFrequency( double frequencyInHz );

  /** Set a reference tracker tool */
  void RequestSetReferenceTool( TrackerToolType * trackerTool );

  /** SetThreadingEnabled(bool) : set m_ThreadingEnabled value */
  igstkSetMacro( ThreadingEnabled, bool );

  /** GetThreadingEnabled(bool) : get m_ThreadingEnabled value  */
  igstkGetMacro( ThreadingEnabled, bool );

protected:

  Tracker(void);

  virtual ~Tracker(void);

  /** typedef for times used by the tracker */
  typedef Transform::TimePeriodType         TimePeriodType;

  /** Get the validity time. */
  igstkGetMacro( ValidityTime, TimePeriodType );

  typedef enum 
    { 
    FAILURE=0, 
    SUCCESS
    } ResultType;

  /** typedefs from Transform class */
  typedef Transform                      TransformType;

  /** 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;

  /** Print the object information in a stream. */
  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 

  /** 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; 

  /** The "ValidateSpecifiedFrequency" method checks if the specified  
   * frequency is valid for the tracking device that is being used. This 
   * method is to be overridden in the derived tracking-device specific  
   * classes to take into account the maximum frequency possible in the 
   * tracking device
   */
  virtual ResultType ValidateSpecifiedFrequency( double frequencyInHz );

  /** 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;

  /** typedefs from TrackerTool class */
  typedef std::map< std::string, TrackerToolType *>  TrackerToolsContainerType;

  /** Access method for the tracker tool container. This method 
    * is useful in the derived classes to access the unique identifiers 
    * of the tracker tools */
  const TrackerToolsContainerType & GetTrackerToolContainer() const;

  /** Report to tracker tool that it is not available for tracking */
  void ReportTrackingToolNotAvailable( TrackerToolType * trackerTool ) const;

  /** Report to tracker tool that it is visible */
  void ReportTrackingToolVisible( TrackerToolType * trackerTool ) const;

  /** Set tracker tool raw transform */
  void SetTrackerToolRawTransform( TrackerToolType * trackerTool, 
                                   const TransformType transform );

  /** Turn on/off update flag of the tracker tool */
  void SetTrackerToolTransformUpdate( TrackerToolType * trackerTool,
                                      bool flag ) const;

  /** Depending on the tracker type, the tracking thread should be 
    * terminated or left untouched when we stop tracking. For example,
    * in the case of MicronTracker, it is better to not terminate the
    * tracking thread. Otherwise, everytime we restart tracking, then 
    * the camera has to be reattached. For NDI trackers, the tracking
    * thread has to be terminated first to send TSTOP command */  

  /** Always called when exiting tracking state. This methold will be
    * overriden in derived classes. */
  void ExitTrackingStateProcessing( void );

  /** Exit tracking without terminating tracking thread */
  void ExitTrackingWithoutTerminatingTrackingThread();

  /** Exit tracking after terminating tracking thread */
  void ExitTrackingTerminatingTrackingThread();


private:
  Tracker(const Self&);           //purposely not implemented
  void operator=(const Self&);    //purposely not implemented

  /** Pulse generator for driving the rate of tracker updates. */
  PulseGenerator::Pointer   m_PulseGenerator;
  
  /** Pulse observer for receiving the events from the pulse generator. */
  typedef itk::SimpleMemberCommand< Self >   ObserverType;
  ObserverType::Pointer     m_PulseObserver;

  // An associative container of TrackerTool Pointer with 
  // TrackerTool identifier used as a Key
  TrackerToolsContainerType           m_TrackerTools;
  
  /** typedefs from TrackerTool class */
  typedef TrackerToolType::Pointer                   TrackerToolPointer;

  /** The reference tool */
  bool                                m_ApplyingReferenceTool;
  TrackerToolPointer                  m_ReferenceTool;

  /** Validity time, and its default value [milliseconds] */
  TimePeriodType                      m_ValidityTime;

  /** Multi-threading enabled flag : The descendant class will use
      multi-threading, if this flag is set as true */
  bool                                m_ThreadingEnabled;

  /** Boolean value to indicate that the tracking thread 
    * has started */
  bool                                m_TrackingThreadStarted;

  /** itk::MultiThreader object pointer */
  itk::MultiThreader::Pointer     m_Threader;

  /** Tracking ThreadID */
  int                             m_ThreadID;

  /** itk::ConditionVariable object pointer to signal for the next
   *  transform */
  itk::ConditionVariable::Pointer m_ConditionNextTransformReceived;
  
  /** itk::SimpleMutexLock object to be used for
      m_ConditionNextTransformReceived */
  itk::SimpleMutexLock            m_LockForConditionNextTransformReceived;

  /** List of States */
  igstkDeclareStateMacro( Idle );
  igstkDeclareStateMacro( AttemptingToEstablishCommunication );
  igstkDeclareStateMacro( AttemptingToCloseCommunication );
  igstkDeclareStateMacro( CommunicationEstablished );
  igstkDeclareStateMacro( AttemptingToAttachTrackerTool );
  igstkDeclareStateMacro( TrackerToolAttached );
  igstkDeclareStateMacro( AttemptingToTrack );
  igstkDeclareStateMacro( Tracking );
  igstkDeclareStateMacro( AttemptingToUpdate );
  igstkDeclareStateMacro( AttemptingToStopTracking );

  /** List of Inputs */
  igstkDeclareInputMacro( EstablishCommunication );
  igstkDeclareInputMacro( StartTracking );
  igstkDeclareInputMacro( AttachTrackerTool );
  igstkDeclareInputMacro( UpdateStatus );
  igstkDeclareInputMacro( StopTracking );
  igstkDeclareInputMacro( Reset );
  igstkDeclareInputMacro( CloseCommunication );
  igstkDeclareInputMacro( ValidFrequency );

  igstkDeclareInputMacro( Success );
  igstkDeclareInputMacro( Failure );

  /** Attach a tracker tool to the tracker. This method
   *  should be called by the tracker tool.  */
  void RequestAttachTool( TrackerToolType * trackerTool );

  /** Request to remove a tracker tool from this tracker  */
  ResultType RequestRemoveTool( TrackerToolType * trackerTool );

  /** Thread function for tracking */
  static ITK_THREAD_RETURN_TYPE TrackingThreadFunction(void* pInfoStruct);

  /** The "UpdateStatus" method is used for updating the status of 
      tools when the tracker is in tracking state. It is a callback
      method that gets invoked when a pulse event is observed */
  void UpdateStatus( void );

  /** The "AttemptToOpenProcessing" method attempts to open communication with a
      tracking device. */
  void AttemptToOpenProcessing( void );
  
  /** The "AttemptToStartTrackingProcessing" method attempts 
   *  to start tracking. */
  void AttemptToStartTrackingProcessing( void );

  /** The "AttemptToStopTrackingProcessing" method attempts to stop tracking. */
  void AttemptToStopTrackingProcessing( void );

  /** The "AttemptToAttachTrackerToolProcessing" method attempts 
   *  to attach a tracker tool to the tracker . */
  void AttemptToAttachTrackerToolProcessing( void );

  /** The "AttemptToUpdateStatusProcessing" method attempts to update status
      during tracking. */
  void AttemptToUpdateStatusProcessing( void );

  /** The "UpdateStatusFailureProcessing" method is called when an
      attempt to update failes. */
  void UpdateStatusSuccessProcessing( void );

  /** The "UpdateStatusFailureProcessing" method is called when an
      attempt to update failes. */
  void UpdateStatusFailureProcessing( void );

  /** The "CloseFromTrackingStateProcessing" method closes tracker in
      use, when the tracker is in tracking state. */
  void CloseFromTrackingStateProcessing( void );

  /** The "CloseFromCommunicatingStateProcessing" method closes
      tracker in use, when the tracker is in communicating state. */
  void CloseFromCommunicatingStateProcessing( void );

  /** The "ResetFromTrackingStateProcessing" method resets tracker in
      use, when the tracker is in tracking state. */
  void ResetFromTrackingStateProcessing( void );

  /** The "ResetFromToolsActiveStateProcessing" method resets tracker
      in use, when the tracker is in active tools state. */
  void ResetFromToolsActiveStateProcessing( void);

  /** The "ResetFromCommunicatingStateProcessing" method resets
      tracker in use, when the tracker is in communicating state. */
  void ResetFromCommunicatingStateProcessing( void );

  /** Post-processing after communication setup has been successful. */ 
  void CommunicationEstablishmentSuccessProcessing( void );

  /** Post-processing after communication setup has failed. */ 
  void CommunicationEstablishmentFailureProcessing( void );

  /** Post-processing after ports and tools setup has been successful. */ 
  void ToolsActivationSuccessProcessing( void );

  /** Post-processing after ports and tools setup has failed. */ 
  void ToolsActivationFailureProcessing( void );

  /** Post-processing after start tracking has been successful. */ 
  void StartTrackingSuccessProcessing( void );

  /** Post-processing after start tracking has failed. */ 
  void StartTrackingFailureProcessing( void );

  /** Post-processing after attaching a tracker tool
     has been successful. */ 
  void AttachingTrackerToolSuccessProcessing( void );

  /** Post-processing after an attempt to attach a tracker tool
   *  has failed. */ 
  void AttachingTrackerToolFailureProcessing( void );

  /** Post-processing after stop tracking has been successful. */ 
  void StopTrackingSuccessProcessing( void );

  /** Post-processing after start tracking has failed. */ 
  void StopTrackingFailureProcessing( void );

  /** Post-processing after close tracking has been successful. */ 
  void CloseCommunicationSuccessProcessing( void );

  /** Post-processing after close tracking has failed. */ 
  void CloseCommunicationFailureProcessing( void );

  /** Always called when entering tracking state. */
  void EnterTrackingStateProcessing( void );

  /** Detach all tracker tools from the tracker */
  void DetachAllTrackerToolsFromTracker();

  /** Report invalid request */ 
  void ReportInvalidRequestProcessing( void );

  /** Actually set the frequency of update */ 
  void SetFrequencyProcessing( void );

  /** Define the coordinate system interface 
   */
  igstkCoordinateSystemClassInterfaceMacro();

  TrackerToolType   * m_TrackerToolToBeAttached;

  double              m_FrequencyToBeSet;
};

}

#endif //__igstk_Tracker_h_