18 #ifndef __igstkVideoImager_h
19 #define __igstkVideoImager_h
24 #include "itkMutexLock.h"
25 #include "itkConditionVariable.h"
26 #include "itkMultiThreader.h"
50 igstkEventMacro( VideoImagerInitializeErrorEvent, VideoImagerErrorEvent);
53 igstkEventMacro( VideoImagerStartImagingErrorEvent, VideoImagerErrorEvent);
56 igstkEventMacro( VideoImagerStopImagingErrorEvent, VideoImagerErrorEvent);
59 igstkEventMacro( VideoImagerUpdateStatusErrorEvent, VideoImagerErrorEvent);
193 virtual void PrintSelf( std::ostream& os, itk::Indent indent )
const;
220 typedef std::map< std::string, VideoImagerToolType *>
257 void operator=(
const Self&);
263 typedef itk::SimpleMemberCommand< Self > ObserverType;
264 ObserverType::Pointer m_PulseObserver;
271 typedef VideoImagerToolType::Pointer VideoImagerToolPointer;
278 bool m_ThreadingEnabled;
282 bool m_ImagingThreadStarted;
285 itk::MultiThreader::Pointer m_Threader;
292 itk::ConditionVariable::Pointer m_ConditionNextFrameReceived;
296 itk::SimpleMutexLock m_LockForConditionNextFrameReceived;
299 igstkDeclareStateMacro( Idle );
300 igstkDeclareStateMacro( AttemptingToEstablishCommunication );
301 igstkDeclareStateMacro( AttemptingToCloseCommunication );
302 igstkDeclareStateMacro( CommunicationEstablished );
303 igstkDeclareStateMacro( AttemptingToAttachVideoImagerTool );
304 igstkDeclareStateMacro( VideoImagerToolAttached );
305 igstkDeclareStateMacro( AttemptingToImaging );
306 igstkDeclareStateMacro( Imaging );
307 igstkDeclareStateMacro( AttemptingToUpdate );
308 igstkDeclareStateMacro( AttemptingToStopImaging );
311 igstkDeclareInputMacro( EstablishCommunication );
312 igstkDeclareInputMacro( StartImaging );
313 igstkDeclareInputMacro( AttachVideoImagerTool );
314 igstkDeclareInputMacro( UpdateStatus );
315 igstkDeclareInputMacro( StopImaging );
316 igstkDeclareInputMacro( Reset );
317 igstkDeclareInputMacro( CloseCommunication );
318 igstkDeclareInputMacro( ValidFrequency );
320 igstkDeclareInputMacro( Success );
321 igstkDeclareInputMacro( Failure );
331 static ITK_THREAD_RETURN_TYPE ImagingThreadFunction(
void* pInfoStruct);
336 void UpdateStatus(
void );
340 void AttemptToOpenProcessing(
void );
344 void AttemptToStartImagingProcessing(
void );
347 void AttemptToStopImagingProcessing(
void );
351 void AttemptToAttachVideoImagerToolProcessing(
void );
355 void AttemptToUpdateStatusProcessing(
void );
359 void UpdateStatusSuccessProcessing(
void );
363 void UpdateStatusFailureProcessing(
void );
367 void CloseFromImagingStateProcessing(
void );
371 void CloseFromCommunicatingStateProcessing(
void );
375 void ResetFromImagingStateProcessing(
void );
379 void ResetFromToolsActiveStateProcessing(
void);
383 void ResetFromCommunicatingStateProcessing(
void );
386 void CommunicationEstablishmentSuccessProcessing(
void );
389 void CommunicationEstablishmentFailureProcessing(
void );
392 void ToolsActivationSuccessProcessing(
void );
395 void ToolsActivationFailureProcessing(
void );
398 void StartImagingSuccessProcessing(
void );
401 void StartImagingFailureProcessing(
void );
405 void AttachingVideoImagerToolSuccessProcessing(
void );
409 void AttachingVideoImagerToolFailureProcessing(
void );
412 void StopImagingSuccessProcessing(
void );
415 void StopImagingFailureProcessing(
void );
418 void CloseCommunicationSuccessProcessing(
void );
421 void CloseCommunicationFailureProcessing(
void );
424 void EnterImagingStateProcessing(
void );
427 void DetachAllVideoImagerToolsFromVideoImager();
430 void ReportInvalidRequestProcessing(
void );
433 void SetFrequencyProcessing(
void );
437 igstkCoordinateSystemClassInterfaceMacro();
441 double m_FrequencyToBeSet;
446 #endif //__igstk_VideoImager_h_
Frame FrameType
typedefs from Frame class
std::map< std::string, VideoImagerToolType * > VideoImagerToolsContainerType
typedefs from VideoImagerTool class
void RequestStopImaging(void)
The "RequestStopImaging" stops VideoImager from imaging the tools.
#define igstkStandardAbstractClassTraitsMacro(classname, superclassname)
Convenience macro for traits of an abstract non-templated class.
void ReportImagingToolNotAvailable(VideoImagerToolType *VideoImagerTool) const
Report to VideoImager tool that it is not available for imaging.
igstkStandardAbstractClassTraitsMacro(VideoImager, Object) public typedef VideoImagerTool VideoImagerToolType
Macro with standard traits declarations.
#define igstkFriendClassMacro(type)
Create a Macro for friend class.
virtual ResultType InternalClose(void)=0
The "InternalClose" method closes communication with an imaging device.
#define igstkGetMacro(name, type)
Get built-in type.
void RequestReset(void)
The "RequestReset" method should be used to bring the VideoImager to some defined default state...
const VideoImagerToolsContainerType & GetVideoImagerToolContainer() const
Access method for the VideoImager tool container.
Base class for all the IGSTK classes.
void ExitImagingStateProcessing(void)
Always called when exiting imaging state.
virtual ResultType InternalStartImaging(void)=0
The "InternalStartImaging" method starts imaging.
igstkEventMacro(AuroraTrackerToolEvent, StringEvent)
virtual ResultType InternalReset(void)=0
The "InternalReset" method resets VideoImager to a known configuration.
virtual ResultType InternalThreadedUpdateStatus(void)=0
The "InternalThreadedUpdateStatus" method updates VideoImager status.
virtual ResultType ValidateSpecifiedFrequency(double frequencyInHz)
The "ValidateSpecifiedFrequency" method checks if the specified frequency is valid for the imaging de...
::itk::SmartPointer< Self > Pointer
Transform TransformType
typedefs from Transform class
void RequestOpen(void)
The "RequestOpen" method attempts to open communication with the imaging device.
virtual ResultType InternalUpdateStatus(void)=0
The "InternalUpdateStatus" method updates VideoImager status.
FrameType * GetVideoImagerToolFrame(VideoImagerToolType *videoImagerTool)
virtual ResultType AddVideoImagerToolToInternalDataContainers(const VideoImagerToolType *videoImagerTool)=0
Add VideoImager tool entry to internal containers.
void RequestStartImaging(void)
The "RequestStartImaging" method readies the VideoImager for imaging the tools connected to the Video...
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print the object information in a stream.
void RequestSetFrequency(double frequencyInHz)
The "RequestSetFrequency" method defines the frequency at which a frame will be queried from the Vide...
Abstract superclass for concrete IGSTK VideoImager classes.
void ExitImagingWithoutTerminatingImagingThread()
Exit imaging without terminating imaging thread.
void SetVideoImagerToolUpdate(VideoImagerToolType *videoImagerTool, bool flag) const
Turn on/off update flag of the VideoImager tool.
void ExitImagingTerminatingImagingThread()
Exit imaging after terminating imaging thread.
Transform::TimePeriodType TimePeriodType
typedef for times used by the VideoImager
void RequestClose(void)
The "RequestClose" method closes communication with the device.
#define igstkSetMacro(name, type)
Set built-in type.
void SetVideoImagerToolFrame(VideoImagerToolType *videoImagerTool, FrameType *frame)
virtual ResultType RemoveVideoImagerToolFromInternalDataContainers(const VideoImagerToolType *videoImagerTool)=0
This method will remove entries of the VideoImager tool from internal data containers.
virtual ResultType VerifyVideoImagerToolInformation(const VideoImagerToolType *)=0
Verify if a VideoImager tool information is correct before attaching it to the VideoImager.
void ReportImagingToolStreaming(VideoImagerToolType *videoImagerTool) const
Report to VideoImager tool that it is streaming.
Frame from an external input device.
virtual ResultType InternalOpen(void)=0
The "InternalOpen" method opens communication with an imaging device.
virtual ResultType InternalStopImaging(void)=0
The "InternalStopImaging" method stops imaging.