Medical Imaging Interaction Toolkit  2023.12.99-29da53b2
Medical Imaging Interaction Toolkit
QmitkVideoBackground.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkVideoBackground_h
14 #define QmitkVideoBackground_h
15 
16 // MITK
18 #include "mitkVideoSource.h"
19 
20 // Qt
21 #include <QObject>
22 class QTimer;
23 
24 // vtk
25 class vtkRenderer;
26 class vtkRenderWindow;
27 class vtkImageActor;
28 class vtkImageImport;
29 class vtkActor2D;
30 class vtkVideoSizeCallback;
31 class vtkObject;
32 
42 {
43  Q_OBJECT
44 
45 public:
50  explicit QmitkVideoBackground(QObject *parent = nullptr);
58  explicit QmitkVideoBackground(mitk::VideoSource *v, int TimerDelay = 25);
62  ~QmitkVideoBackground() override;
63 
74  void AddRenderWindow(vtkRenderWindow *renderWindow);
78  void RemoveRenderWindow(vtkRenderWindow *renderWindow);
83  bool IsRenderWindowIncluded(vtkRenderWindow *renderWindow);
84 
88  void SetTimerDelay(int ms);
92  void Enable();
96  void Disable();
100  bool IsEnabled();
101 
105  mitk::VideoSource *GetVideoSource();
109  int GetTimerDelay();
113  void Pause();
117  void Resume();
118 
123  void SetVideoSource(mitk::VideoSource *videoSource);
124 
128  static void OnRenderWindowDelete(vtkObject *, unsigned long eid, void *clientdata, void * /*calldata*/);
129 
133  void OnVideoSourceDelete(const itk::Object *caller, const itk::EventObject &event);
134 public slots:
139  void UpdateVideo();
140 signals:
145  void NewFrameAvailable(mitk::VideoSource *);
146 
147  void EndOfVideoSourceReached(mitk::VideoSource *);
148 
149 protected:
155  {
156  vtkRenderWindow *renWin;
157  vtkRenderer *videoRenderer;
158  vtkImageActor *videoActor;
159  vtkImageImport *videoImport;
160  unsigned long renderWindowObserverTag;
161  };
162 
166  void RemoveRenderWindow(vtkRenderWindow *renderWindow, bool removeObserver);
170  void ResetVideoBackground();
171 
175  void Modified();
179  typedef std::vector<VideoBackgroundVectorInfo> RenderWindowVectorInfoType;
180 
181 protected:
186 
190  QTimer *m_QTimer;
191 
196 
201 };
202 
203 #endif
QmitkVideoBackground
Definition: QmitkVideoBackground.h:41
QmitkVideoBackground::VideoBackgroundVectorInfo::renderWindowObserverTag
unsigned long renderWindowObserverTag
Definition: QmitkVideoBackground.h:160
MITKQTWIDGETSEXT_EXPORT
#define MITKQTWIDGETSEXT_EXPORT
Definition: MitkQtWidgetsExtExports.h:15
QmitkVideoBackground::m_renderWindowVectorInfo
RenderWindowVectorInfoType m_renderWindowVectorInfo
Definition: QmitkVideoBackground.h:185
QmitkVideoBackground::m_VideoSourceObserverTag
unsigned long m_VideoSourceObserverTag
Definition: QmitkVideoBackground.h:200
QmitkVideoBackground::VideoBackgroundVectorInfo::videoImport
vtkImageImport * videoImport
Definition: QmitkVideoBackground.h:159
QmitkVideoBackground::m_QTimer
QTimer * m_QTimer
Definition: QmitkVideoBackground.h:190
QmitkVideoBackground::VideoBackgroundVectorInfo::videoActor
vtkImageActor * videoActor
Definition: QmitkVideoBackground.h:158
mitk::VideoSource
Definition: mitkVideoSource.h:27
QmitkVideoBackground::VideoBackgroundVectorInfo::renWin
vtkRenderWindow * renWin
Definition: QmitkVideoBackground.h:156
mitkVideoSource.h
QmitkVideoBackground::m_VideoSource
mitk::VideoSource * m_VideoSource
Definition: QmitkVideoBackground.h:195
MitkQtWidgetsExtExports.h
QmitkVideoBackground::VideoBackgroundVectorInfo::videoRenderer
vtkRenderer * videoRenderer
Definition: QmitkVideoBackground.h:157
QmitkVideoBackground::RenderWindowVectorInfoType
std::vector< VideoBackgroundVectorInfo > RenderWindowVectorInfoType
Definition: QmitkVideoBackground.h:179
QmitkVideoBackground::VideoBackgroundVectorInfo
Definition: QmitkVideoBackground.h:154