Page MenuHomePhabricator

[2DRendering] new VTK rendering does not call Qt render
Closed, ResolvedPublic

Description

If you minimize and re-maximize MITK then the 2D render windows are gray. The same applies if you switch between different Ubuntu desktops.

The 3D render window is always visible.

Event Timeline

Open MITK and render an image. Minimize MITK and maximize it again. The 2D
render windows are black or white, depending on your system.

Markus assumption is that the render method of Qt is not called properly.
However, this used to work with the old ImageMapperGL2D. So it could be related
to my changes in the new ImageVtkMapper2D.

The paintEevent of Qt called the render method of the vtkRenderWindow. We replaced this with a RequestUpdate() which solved this issue for an unknown reason. Furthermore, this should improve the performance, because the vtkRenderWindow will only be asked to be rendered if it is neceassary.

The fix commited in bug-9048-renderwindowupdate solves this issue for some reason. However, we skip the QVTKWidget by not passing the QPaintEvent there. This is against the VTK rendering design and also against the MITK rendering pipeline. We should carefully investigate the site effects and keep in mind that we are performing our own paintEvent here.

To the last comment:
Still not fixed, with an MITK snapshot of 17/09 the windows are still not repainted.

Two additional notes:
The windows will become grey after minimize and restore even if no image is opened.
The control buttons in the top right corner are repainted only if you drag the mouse pointer over them, and a white rectangle remains at their previous place.

We figured out that the render function of the QVTKWidget is only executed when the renderer of the QVTKWidget uses vtkInteraction to handle input events. Since we are using mitk interactions, the 2DRenderwindows don't redraw themselfs when the application is minimized. To make the 2DRenderwindows redraw properly

mitk::RenderingManager::GetInstance()->RequestUpdate(GetRenderWindow());

is needed in

mitk::QmitkRenderWindow::paintEvent

We pushed a solution into: bug-9048-VTKRenderingInteraction.

[7565a0]: Merge branch 'bug-9048-VTKRenderingInteraction'

Merged commits:

2011-09-28 15:29:38 Thomas Kilgus [852407]
Minor change to disable the VTK interaction. Added RequestUpdate in the QPaintEvent to fix the bug.

The fix does not solve the last problem that I mentioned in Comment 5.

If I resize the window, the controls of the renderers that should be in the top-right corner remain at their old position or disappear, and they are redrawn again only when you drag the mouse into the corners.

It can be another bug, independent of this, however.

(In reply to comment #9)

The fix does not solve the last problem that I mentioned in Comment 5.

If I resize the window, the controls of the renderers that should be in the
top-right corner remain at their old position or disappear, and they are
redrawn again only when you drag the mouse into the corners.

It can be another bug, independent of this, however.

This is actually a much older bug (#3192) and i don't think that it is related to this one here.