Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _Qmitk_Video_Background_h_
18 #define _Qmitk_Video_Background_h_
19 
20 // MITK
22 #include "mitkVideoSource.h"
23 
24 // Qt
25 #include <QObject>
26 class QTimer;
27 
28 // vtk
29 class vtkRenderer;
30 class vtkRenderWindow;
31 class vtkImageActor;
32 class vtkImageImport;
33 class vtkActor2D;
34 class vtkVideoSizeCallback;
35 class vtkObject;
36 
46 {
47  Q_OBJECT
48 
49 public:
54  explicit QmitkVideoBackground(QObject *parent = nullptr);
62  explicit QmitkVideoBackground(mitk::VideoSource *v, int TimerDelay = 25);
66  virtual ~QmitkVideoBackground();
67 
78  void AddRenderWindow(vtkRenderWindow *renderWindow);
82  void RemoveRenderWindow(vtkRenderWindow *renderWindow);
87  bool IsRenderWindowIncluded(vtkRenderWindow *renderWindow);
88 
92  void SetTimerDelay(int ms);
96  void Enable();
100  void Disable();
104  bool IsEnabled();
105 
109  mitk::VideoSource *GetVideoSource();
113  int GetTimerDelay();
117  void Pause();
121  void Resume();
122 
127  void SetVideoSource(mitk::VideoSource *videoSource);
128 
132  static void OnRenderWindowDelete(vtkObject *, unsigned long eid, void *clientdata, void * /*calldata*/);
133 
137  void OnVideoSourceDelete(const itk::Object *caller, const itk::EventObject &event);
138 public slots:
143  void UpdateVideo();
144 signals:
149  void NewFrameAvailable(mitk::VideoSource *);
150 
151  void EndOfVideoSourceReached(mitk::VideoSource *);
152 
153 protected:
159  {
160  vtkRenderWindow *renWin;
161  vtkRenderer *videoRenderer;
162  vtkImageActor *videoActor;
163  vtkImageImport *videoImport;
164  unsigned long renderWindowObserverTag;
165  };
166 
170  void RemoveRenderWindow(vtkRenderWindow *renderWindow, bool removeObserver);
174  void ResetVideoBackground();
175 
179  void Modified();
183  typedef std::vector<VideoBackgroundVectorInfo> RenderWindowVectorInfoType;
184 
185 protected:
189  RenderWindowVectorInfoType m_renderWindowVectorInfo;
190 
194  QTimer *m_QTimer;
195 
200 
205 };
206 
207 #endif
unsigned long m_VideoSourceObserverTag
std::vector< VideoBackgroundVectorInfo > RenderWindowVectorInfoType
#define MITKQTWIDGETSEXT_EXPORT
mitk::VideoSource * m_VideoSource
RenderWindowVectorInfoType m_renderWindowVectorInfo