Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkVideoBackground Class Reference

#include <QmitkVideoBackground.h>

Inheritance diagram for QmitkVideoBackground:
Collaboration diagram for QmitkVideoBackground:

Classes

struct  VideoBackgroundVectorInfo
 

Public Slots

void UpdateVideo ()
 

Signals

void NewFrameAvailable (mitk::VideoSource *)
 
void EndOfVideoSourceReached (mitk::VideoSource *)
 

Public Member Functions

 QmitkVideoBackground (QObject *parent=nullptr)
 
 QmitkVideoBackground (mitk::VideoSource *v, int TimerDelay=25)
 
virtual ~QmitkVideoBackground ()
 
void AddRenderWindow (vtkRenderWindow *renderWindow)
 add a RenderWindow in which the video is displayed. -> must be initialized before enabling the background. if the renderwindow was previously inserted it will get re-inserted (restarted videobackground) ATTENTION: to size the renderwindow correctly GetImageWidth() of the video source will be called and if no size is returned: FetchFrame() on the video source will be called to get the first frame and the corresponding size More...
 
void RemoveRenderWindow (vtkRenderWindow *renderWindow)
 removes a renderwindow = disables video background there More...
 
bool IsRenderWindowIncluded (vtkRenderWindow *renderWindow)
 
void SetTimerDelay (int ms)
 sets the update rate of the video in milli seconds, by default 25. More...
 
void Enable ()
 
void Disable ()
 disables visualization of the video. More...
 
bool IsEnabled ()
 Checks, if the Video background is currently enabled (visible). More...
 
mitk::VideoSourceGetVideoSource ()
 
int GetTimerDelay ()
 
void Pause ()
 
void Resume ()
 
void SetVideoSource (mitk::VideoSource *videoSource)
 
void OnVideoSourceDelete (const itk::Object *caller, const itk::EventObject &event)
 

Static Public Member Functions

static void OnRenderWindowDelete (vtkObject *, unsigned long eid, void *clientdata, void *)
 

Protected Types

typedef std::vector< VideoBackgroundVectorInfoRenderWindowVectorInfoType
 

Protected Member Functions

void RemoveRenderWindow (vtkRenderWindow *renderWindow, bool removeObserver)
 
void ResetVideoBackground ()
 
void Modified ()
 

Protected Attributes

RenderWindowVectorInfoType m_renderWindowVectorInfo
 
QTimer * m_QTimer
 
mitk::VideoSourcem_VideoSource
 
unsigned long m_VideoSourceObserverTag
 

Detailed Description

Displays a 3-channel (!) video data in the background of one or more vtkRenderWindow(s). The video is provided by a mitkVideoSource / GetVideoTexture(). Caution: As the texture data is not being copied, the user is responsible for a valid pointer to the data. Also the image dimensions needs to be set correctly before enabling the background.

Definition at line 45 of file QmitkVideoBackground.h.

Member Typedef Documentation

the class has to store a list of renderwindows

Definition at line 183 of file QmitkVideoBackground.h.

Constructor & Destructor Documentation

QmitkVideoBackground::QmitkVideoBackground ( QObject *  parent = nullptr)
explicit

default ctor, TimerDelay is 40 by default you must SetVideoSource() and AddRenderWindow() afterwards

Definition at line 43 of file QmitkVideoBackground.cpp.

References ResetVideoBackground().

QmitkVideoBackground::QmitkVideoBackground ( mitk::VideoSource v,
int  TimerDelay = 25 
)
explicit

constructs a video background with the given video source no parent is set here, dont forget to delete the object or call setParent() TimerDelay = refresh rate of video in ms (25 ms = 40 Hz). you must call AddRenderWindow() afterwards

Definition at line 49 of file QmitkVideoBackground.cpp.

References ResetVideoBackground(), and SetVideoSource().

QmitkVideoBackground::~QmitkVideoBackground ( )
virtual

disables all video backgrounds

Definition at line 63 of file QmitkVideoBackground.cpp.

References Disable().

Member Function Documentation

void QmitkVideoBackground::AddRenderWindow ( vtkRenderWindow *  renderWindow)

add a RenderWindow in which the video is displayed. -> must be initialized before enabling the background. if the renderwindow was previously inserted it will get re-inserted (restarted videobackground) ATTENTION: to size the renderwindow correctly GetImageWidth() of the video source will be called and if no size is returned: FetchFrame() on the video source will be called to get the first frame and the corresponding size

Definition at line 68 of file QmitkVideoBackground.cpp.

References mitk::VideoSource::FetchFrame(), mitk::VideoSource::GetImageHeight(), mitk::VideoSource::GetImageWidth(), m_renderWindowVectorInfo, m_VideoSource, MITK_WARN, Modified(), mitk::New(), OnRenderWindowDelete(), RemoveRenderWindow(), QmitkVideoBackground::VideoBackgroundVectorInfo::renderWindowObserverTag, QmitkVideoBackground::VideoBackgroundVectorInfo::renWin, QmitkVideoBackground::VideoBackgroundVectorInfo::videoActor, QmitkVideoBackground::VideoBackgroundVectorInfo::videoImport, and QmitkVideoBackground::VideoBackgroundVectorInfo::videoRenderer.

Referenced by QmitkOpenCVVideoControls::Play().

void QmitkVideoBackground::Disable ( )

disables visualization of the video.

Disables drawing of the color Video background. If you want to enable it, call the Enable() function.

Definition at line 175 of file QmitkVideoBackground.cpp.

References mitk::VtkLayerController::GetInstance(), IsEnabled(), m_QTimer, m_renderWindowVectorInfo, and mitk::VtkLayerController::RemoveRenderer().

Referenced by OnVideoSourceDelete(), QmitkOpenCVVideoControls::Stop(), and ~QmitkVideoBackground().

void QmitkVideoBackground::Enable ( )

visualizes the video. Requires image dimensions and an active videosource to be set.

Enables drawing of the color Video background. If you want to disable it, call the Disable() function.

Definition at line 163 of file QmitkVideoBackground.cpp.

References m_QTimer, Modified(), and UpdateVideo().

Referenced by QmitkOpenCVVideoControls::Play().

void QmitkVideoBackground::EndOfVideoSourceReached ( mitk::VideoSource )
signal

Referenced by UpdateVideo().

int QmitkVideoBackground::GetTimerDelay ( )

Returns the timer delay

Definition at line 277 of file QmitkVideoBackground.cpp.

References m_QTimer.

Referenced by QmitkOpenCVVideoControls::SetVideoBackground().

mitk::VideoSource * QmitkVideoBackground::GetVideoSource ( )

Returns the videosource attached to this background

Definition at line 272 of file QmitkVideoBackground.cpp.

References m_VideoSource.

Referenced by QmitkOpenCVVideoControls::SetVideoBackground().

bool QmitkVideoBackground::IsEnabled ( )

Checks, if the Video background is currently enabled (visible).

Definition at line 190 of file QmitkVideoBackground.cpp.

References m_QTimer.

Referenced by Disable().

bool QmitkVideoBackground::IsRenderWindowIncluded ( vtkRenderWindow *  renderWindow)
Returns
true if "renderWindow" is currently connected to the video background or not

Definition at line 139 of file QmitkVideoBackground.cpp.

References m_renderWindowVectorInfo.

void QmitkVideoBackground::Modified ( )
protected
void QmitkVideoBackground::NewFrameAvailable ( mitk::VideoSource )
signal

emitted after all video backgrounds are filled with the new video frame

Referenced by UpdateVideo().

void QmitkVideoBackground::OnRenderWindowDelete ( vtkObject *  object,
unsigned long  eid,
void *  clientdata,
void *   
)
static

receive renderwindow delete events

Definition at line 288 of file QmitkVideoBackground.cpp.

References RemoveRenderWindow().

Referenced by AddRenderWindow().

void QmitkVideoBackground::OnVideoSourceDelete ( const itk::Object *  caller,
const itk::EventObject &  event 
)

receive VideoSource delete event

Definition at line 282 of file QmitkVideoBackground.cpp.

References Disable(), and m_VideoSource.

Referenced by SetVideoSource().

void QmitkVideoBackground::Pause ( )

pauses the playback (stops the update timer)

Definition at line 149 of file QmitkVideoBackground.cpp.

References m_QTimer.

void QmitkVideoBackground::RemoveRenderWindow ( vtkRenderWindow *  renderWindow)

removes a renderwindow = disables video background there

Definition at line 110 of file QmitkVideoBackground.cpp.

Referenced by AddRenderWindow(), OnRenderWindowDelete(), and QmitkOpenCVVideoControls::Stop().

void QmitkVideoBackground::RemoveRenderWindow ( vtkRenderWindow *  renderWindow,
bool  removeObserver 
)
protected

removes the renderwindow and also removes the observer if the flag is set

Definition at line 115 of file QmitkVideoBackground.cpp.

References mitk::VtkLayerController::GetInstance(), m_renderWindowVectorInfo, and mitk::VtkLayerController::RemoveRenderer().

void QmitkVideoBackground::ResetVideoBackground ( )
protected

reset all video backgrounds

Definition at line 56 of file QmitkVideoBackground.cpp.

References m_QTimer, m_renderWindowVectorInfo, and UpdateVideo().

Referenced by QmitkVideoBackground().

void QmitkVideoBackground::Resume ( )

resumes the playback (restarts the update timer)

Definition at line 154 of file QmitkVideoBackground.cpp.

References m_QTimer.

void QmitkVideoBackground::SetTimerDelay ( int  ms)

sets the update rate of the video in milli seconds, by default 25.

Definition at line 267 of file QmitkVideoBackground.cpp.

References m_QTimer.

Referenced by QmitkOpenCVVideoControls::Play().

void QmitkVideoBackground::SetVideoSource ( mitk::VideoSource videoSource)

sets a new video source (if previously enabled, this will stop the video background if it was previously enabled

Definition at line 248 of file QmitkVideoBackground.cpp.

References m_VideoSource, m_VideoSourceObserverTag, mitk::New(), and OnVideoSourceDelete().

Referenced by QmitkVideoBackground().

void QmitkVideoBackground::UpdateVideo ( )
slot

Member Data Documentation

QTimer* QmitkVideoBackground::m_QTimer
protected

calls updatevideo repeateadly for framegrabbing

Definition at line 194 of file QmitkVideoBackground.h.

Referenced by Disable(), Enable(), GetTimerDelay(), IsEnabled(), Pause(), ResetVideoBackground(), Resume(), and SetTimerDelay().

RenderWindowVectorInfoType QmitkVideoBackground::m_renderWindowVectorInfo
protected

a list of renderwindows and associated renderers and actors and imageimporters

Definition at line 189 of file QmitkVideoBackground.h.

Referenced by AddRenderWindow(), Disable(), IsRenderWindowIncluded(), Modified(), RemoveRenderWindow(), ResetVideoBackground(), and UpdateVideo().

mitk::VideoSource* QmitkVideoBackground::m_VideoSource
protected

must implement GetVideoTexture() correctly (must return an OpenGL texture)

Definition at line 199 of file QmitkVideoBackground.h.

Referenced by AddRenderWindow(), GetVideoSource(), Modified(), OnVideoSourceDelete(), SetVideoSource(), and UpdateVideo().

unsigned long QmitkVideoBackground::m_VideoSourceObserverTag
protected

the observer tag for the video source

Definition at line 204 of file QmitkVideoBackground.h.

Referenced by SetVideoSource().


The documentation for this class was generated from the following files: