This file is indexed.

/usr/include/IGSTK/igstkVideoImager.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
/*=========================================================================

  Program:   Image Guided Surgery Software Toolkit
  Module:    $RCSfile: igstkVideoImager.h,v $
  Language:  C++
  Date:      $Date: 2009-06-18 18:40:55 $
  Version:   $Revision: 1.1 $

  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 __igstkVideoImager_h
#define __igstkVideoImager_h

#include <vector>
#include <map>

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

#include "igstkObject.h"
#include "igstkStateMachine.h"
#include "igstkTransform.h"
#include "igstkFrame.h"
#include "igstkPulseGenerator.h"
#include "igstkVideoImagerTool.h"

#include "igstkCoordinateSystemInterfaceMacros.h"

namespace igstk
{

igstkEventMacro( VideoImagerEvent,                   StringEvent);
igstkEventMacro( VideoImagerErrorEvent,              IGSTKErrorWithStringEvent);

igstkEventMacro( VideoImagerOpenEvent,               VideoImagerEvent);
igstkEventMacro( VideoImagerOpenErrorEvent,          VideoImagerErrorEvent);

igstkEventMacro( VideoImagerCloseEvent,              VideoImagerEvent);
igstkEventMacro( VideoImagerCloseErrorEvent,         VideoImagerErrorEvent);

igstkEventMacro( VideoImagerInitializeEvent,         VideoImagerEvent);
igstkEventMacro( VideoImagerInitializeErrorEvent,    VideoImagerErrorEvent);

igstkEventMacro( VideoImagerStartImagingEvent,       VideoImagerEvent);
igstkEventMacro( VideoImagerStartImagingErrorEvent,  VideoImagerErrorEvent);

igstkEventMacro( VideoImagerStopImagingEvent,        VideoImagerEvent);
igstkEventMacro( VideoImagerStopImagingErrorEvent,   VideoImagerErrorEvent);

igstkEventMacro( VideoImagerUpdateStatusEvent,       VideoImagerEvent);
igstkEventMacro( VideoImagerUpdateStatusErrorEvent,  VideoImagerErrorEvent);

/** \class VideoImager
 *  \brief Abstract superclass for concrete IGSTK VideoImager classes.
 *
 *  This class presents a generic interface for grabbing videostream
 *  from video-devices such Ultrasound, Endoscope, Bronchoscope, etc.
 *  The various derived subclasses of this class provide back-ends that
 *  communicate with several standard imaging systems.
 *
 *  The state machine of this class implements the basic
 *  state transitions of an video-imager. 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.
 *
 *  The following diagram illustrates the state machine of
 *  the video-imager class
 *
 *  \image html  igstkVideoImager.png  "VideoImager State Machine Diagram"
 *  \image latex igstkVideoImager.eps  "VideoImager State Machine Diagram"
 *
 *  \ingroup VideoImager
 */

class VideoImager : public Object
{

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

public:

  igstkFriendClassMacro( VideoImagerTool );

  /** typedefs from VideoImagerTool class */
  typedef VideoImagerTool       VideoImagerToolType;

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

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

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

  /** The "RequestStartImaging" method readies the VideoImager for imaging the
  tools connected to the VideoImager. */
  void RequestStartImaging( void );

  /** The "RequestStopImaging" stops VideoImager from imaging the tools. */
  void RequestStopImaging( void );

  /** The "RequestSetFrequency" method defines the frequency at which a frame
   * will be queried from the VideoImager device. Note that
   * VideoImager devices have their own internal frequency rate, and if you set
   * here a frequency that is higher than what the VideoImager device is capable
   * to follow, then you will start receiving similar frames. */
  void RequestSetFrequency( double frequencyInHz );

protected:

  VideoImager(void);
  virtual ~VideoImager(void);

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

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

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

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

  typedef enum
    {
    FAILURE=0,
    SUCCESS
    } ResultType;

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

  /** typedefs from Frame class */
  typedef Frame                          FrameType;

  /** The "InternalOpen" method opens communication with an imaging 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 an imaging 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 VideoImager 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 "InternalStartImaging" method starts imaging.
      This method is to be implemented by a descendant class
      and responsible for device-specific processing */
  virtual ResultType InternalStartImaging( void ) = 0;

  /** The "InternalStopImaging" method stops imaging.
      This method is to be implemented by a descendant class
      and responsible for device-specific processing */
  virtual ResultType InternalStopImaging( void ) = 0;


  /** The "InternalUpdateStatus" method updates VideoImager 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 VideoImager 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 VideoImager tool information is correct before attaching
   *  it to the VideoImager. This method is used to verify the information
   *  supplied by the user about the VideoImager tool. The information depends
   *  on the VideoImager type.
   */
  virtual ResultType
        VerifyVideoImagerToolInformation( const VideoImagerToolType * ) = 0;

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

  /** This method will remove entries of the VideoImager tool from internal
    * data containers */
  virtual ResultType RemoveVideoImagerToolFromInternalDataContainers(
                              const VideoImagerToolType * videoImagerTool ) = 0;

  /** Add VideoImager tool entry to internal containers */
  virtual ResultType AddVideoImagerToolToInternalDataContainers(
                              const VideoImagerToolType * videoImagerTool ) = 0;

  /** typedefs from VideoImagerTool class */
  typedef std::map< std::string, VideoImagerToolType *>
                                                  VideoImagerToolsContainerType;

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

  /** Report to VideoImager tool that it is not available for imaging */
  void ReportImagingToolNotAvailable(
                                  VideoImagerToolType * VideoImagerTool ) const;

  /** Report to VideoImager tool that it is streaming */
  void ReportImagingToolStreaming(
                                  VideoImagerToolType * videoImagerTool ) const;

  void SetVideoImagerToolFrame( VideoImagerToolType * videoImagerTool,
                                   FrameType* frame );

  FrameType* GetVideoImagerToolFrame( VideoImagerToolType * videoImagerTool);

  /** Turn on/off update flag of the VideoImager tool */
  void SetVideoImagerToolUpdate( VideoImagerToolType * videoImagerTool,
                                      bool flag ) const;

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

  /** Exit imaging without terminating imaging thread */
  void ExitImagingWithoutTerminatingImagingThread();

  /** Exit imaging after terminating imaging thread */
  void ExitImagingTerminatingImagingThread();

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

  /** Pulse generator for driving the rate of VideoImager 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 VideoImagerTool Pointer with
   * VideoImagerTool identifier used as a Key*/
  VideoImagerToolsContainerType           m_VideoImagerTools;

  /** typedefs from VideoImagerTool class */
  typedef VideoImagerToolType::Pointer                   VideoImagerToolPointer;

  /** 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 imaging thread
    * has started */
  bool                                m_ImagingThreadStarted;

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

  /** Imaging ThreadID */
  int                             m_ThreadID;

  /** itk::ConditionVariable object pointer to signal for the next
   *  frame */
  itk::ConditionVariable::Pointer m_ConditionNextFrameReceived;

  /** itk::SimpleMutexLock object to be used for
      m_ConditionNextFrameReceived */
  itk::SimpleMutexLock            m_LockForConditionNextFrameReceived;

  /** List of States */
  igstkDeclareStateMacro( Idle );
  igstkDeclareStateMacro( AttemptingToEstablishCommunication );
  igstkDeclareStateMacro( AttemptingToCloseCommunication );
  igstkDeclareStateMacro( CommunicationEstablished );
  igstkDeclareStateMacro( AttemptingToAttachVideoImagerTool );
  igstkDeclareStateMacro( VideoImagerToolAttached );
  igstkDeclareStateMacro( AttemptingToImaging );
  igstkDeclareStateMacro( Imaging );
  igstkDeclareStateMacro( AttemptingToUpdate );
  igstkDeclareStateMacro( AttemptingToStopImaging );

  /** List of Inputs */
  igstkDeclareInputMacro( EstablishCommunication );
  igstkDeclareInputMacro( StartImaging );
  igstkDeclareInputMacro( AttachVideoImagerTool );
  igstkDeclareInputMacro( UpdateStatus );
  igstkDeclareInputMacro( StopImaging );
  igstkDeclareInputMacro( Reset );
  igstkDeclareInputMacro( CloseCommunication );
  igstkDeclareInputMacro( ValidFrequency );

  igstkDeclareInputMacro( Success );
  igstkDeclareInputMacro( Failure );

  /** Attach a VideoImager tool to the VideoImager. This method
   *  should be called by the VideoImager tool.  */
  void RequestAttachTool( VideoImagerToolType * videoImagerTool );

  /** Request to remove a VideoImager tool from this VideoImager  */
  ResultType RequestRemoveTool( VideoImagerToolType * videoImagerTool );

  /** Thread function for imaging */
  static ITK_THREAD_RETURN_TYPE ImagingThreadFunction(void* pInfoStruct);

  /** The "UpdateStatus" method is used for updating the status of
      tools when the VideoImager is in imaging 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
      imaging device. */
  void AttemptToOpenProcessing( void );

  /** The "AttemptToStartImagingProcessing" method attempts
   *  to start imaging. */
  void AttemptToStartImagingProcessing( void );

  /** The "AttemptToStopImagingProcessing" method attempts to stop imaging. */
  void AttemptToStopImagingProcessing( void );

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

  /** The "AttemptToUpdateStatusProcessing" method attempts to update status
      during imaging. */
  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 "CloseFromImagingStateProcessing" method closes VideoImager in
      use, when the VideoImager is in imaging state. */
  void CloseFromImagingStateProcessing( void );

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

  /** The "ResetFromImagingStateProcessing" method resets VideoImager in
      use, when the VideoImager is in imaging state. */
  void ResetFromImagingStateProcessing( void );

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

  /** The "ResetFromCommunicatingStateProcessing" method resets
      VideoImager in use, when the VideoImager 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 tools setup has been successful. */
  void ToolsActivationSuccessProcessing( void );

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

  /** Post-processing after start imaging has been successful. */
  void StartImagingSuccessProcessing( void );

  /** Post-processing after start imaging has failed. */
  void StartImagingFailureProcessing( void );

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

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

  /** Post-processing after stop imaging has been successful. */
  void StopImagingSuccessProcessing( void );

  /** Post-processing after start imaging has failed. */
  void StopImagingFailureProcessing( void );

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

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

  /** Always called when entering imaging state. */
  void EnterImagingStateProcessing( void );

  /** Detach all VideoImager tools from the VideoImager */
  void DetachAllVideoImagerToolsFromVideoImager();

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

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

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

  VideoImagerToolType   * m_VideoImagerToolToBeAttached;

  double                  m_FrequencyToBeSet;
};

}

#endif //__igstk_VideoImager_h_