27 #include <itkCommand.h>
30 #include <vtkCallbackCommand.h>
31 #include <vtkCamera.h>
32 #include <vtkCommand.h>
33 #include <vtkCommand.h>
34 #include <vtkImageActor.h>
35 #include <vtkImageImport.h>
36 #include <vtkMapper.h>
37 #include <vtkObjectFactory.h>
38 #include <vtkRenderWindow.h>
39 #include <vtkRenderer.h>
40 #include <vtkSmartPointer.h>
41 #include <vtkSystemIncludes.h>
44 : QObject(parent), m_QTimer(new QTimer(this)), m_VideoSource(nullptr), m_VideoSourceObserverTag(0)
50 : QObject(nullptr), m_QTimer(new QTimer(this)), m_VideoSource(nullptr), m_VideoSourceObserverTag(0)
72 MITK_WARN <<
"No Renderwindow or VideoSource set!";
82 videoImport->SetDataScalarTypeToUnsignedChar();
83 videoImport->SetNumberOfScalarComponents(3);
89 videoImport->SetDataExtentToWholeExtent();
100 deleteCallback->SetClientData(
this);
120 if ((*it).renWin == renderWindow)
127 (*it).videoRenderer->Delete();
128 (*it).videoActor->Delete();
129 (*it).videoImport->Delete();
132 renderWindow->RemoveObserver((*it).renderWindowObserverTag);
143 if ((*it).renWin == renderWindow)
199 unsigned char *src =
nullptr;
205 catch (
const std::logic_error &error)
216 (*it).videoImport->SetImportVoidPointer(src);
217 (*it).videoImport->Modified();
218 (*it).videoImport->Update();
224 MITK_WARN <<
"No video texture available";
233 (*it).videoImport->Update();
234 (*it).videoActor->SetInputData((*it).videoImport->GetOutput());
235 (*it).videoRenderer->AddActor2D((*it).videoActor);
236 (*it).videoRenderer->ResetCamera();
237 (*it).videoRenderer->InteractiveOff();
238 (*it).videoRenderer->GetActiveCamera()->ParallelProjectionOn();
unsigned long m_VideoSourceObserverTag
itk::SmartPointer< Self > Pointer
void RemoveRenderWindow(vtkRenderWindow *renderWindow)
removes a renderwindow = disables video background there
vtkImageActor * videoActor
vtkImageImport * videoImport
void Disable()
disables visualization of the video.
QmitkVideoBackground(QObject *parent=nullptr)
void EndOfVideoSourceReached(mitk::VideoSource *)
void AddRenderWindow(vtkRenderWindow *renderWindow)
add a RenderWindow in which the video is displayed. -> must be initialized before enabling the backgr...
virtual int GetImageHeight()
static void OnRenderWindowDelete(vtkObject *, unsigned long eid, void *clientdata, void *)
vtkRenderer * videoRenderer
static VtkLayerController * GetInstance(vtkSmartPointer< vtkRenderWindow > renWin)
mitk::VideoSource * m_VideoSource
static RenderingManager * GetInstance()
unsigned long renderWindowObserverTag
bool IsEnabled()
Checks, if the Video background is currently enabled (visible).
virtual int GetImageWidth()
mitk::VideoSource * GetVideoSource()
void NewFrameAvailable(mitk::VideoSource *)
void SetVideoSource(mitk::VideoSource *videoSource)
void RequestUpdate(vtkRenderWindow *renderWindow)
void RemoveRenderer(vtkSmartPointer< vtkRenderer > renderer)
void ResetVideoBackground()
bool IsRendererInserted(vtkSmartPointer< vtkRenderer > renderer)
void SetTimerDelay(int ms)
sets the update rate of the video in milli seconds, by default 25.
virtual unsigned char * GetVideoTexture()=0
void OnVideoSourceDelete(const itk::Object *caller, const itk::EventObject &event)
virtual ~QmitkVideoBackground()
virtual void FetchFrame()
bool IsRenderWindowIncluded(vtkRenderWindow *renderWindow)
void InsertBackgroundRenderer(vtkSmartPointer< vtkRenderer > renderer, bool forceAbsoluteBackground)
RenderWindowVectorInfoType m_renderWindowVectorInfo
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.