[vtkusers] How to restrict vtkGenericOpenGLRenderWindow area to vtkResliceImageViewer render window

ran kor1581 at gmail.com
Wed Dec 12 00:55:05 EST 2018

As part of an application for displaying DICOM images in Qt widget 
in windows 10, I'm using vtkResliceImageViewer, custom 
vtkInteractorStyleImage, vtkGenericOpenGLRenderWindow, QVTKOpenGLWidget for 
displaying and fitting the images in Qt window. 
I also use vtkPlaneWidget, mriVtkLineWidget2 widgets inside the DICOM
It is working properly, but the problem iswWhile Initially set the
coordinates for mriVtkLineWidget2 and vtkPlaneWidget objects it's correctly
displaying inside the DICOM image displayed area. But when moving the
widgets with mouse interactions, its rendering outside the 
DICOM image rendered area. 
But I need to restrict the widgets movement within the DICOM image displayed
area, ie within vtkResliceImageViewer render window. 

I expect the problem is the DICOM image displaying inside the 
vtkResliceImageViewer render window and the 
vtkGenericOpenGLRenderWindow render window extends beyond
vtkResliceImageViewer render window, that's because the widgets can move
beyond the DICOM displayed region.
 How can I restrict widgets inside DICOM displaying area? 

My rendering code is something like this,

    vtkNew <vtkGenericOpenGLRenderWindow> m_openGlRenWin; 
    vtkNew <MyVtkInteractionStyleImage> m_InteractorStyleWin; 
    vtkNew <vtkResliceImageViewer> m_vtkImViewerWin; 
    QScopedPointer <QVTKOpenGLWidget> m_vtkWgtWin; 
    vtkNew<vtkPlaneWidget> m_vtkPlaneWid; 
    vtkNew <mriVtkLineWidget2> m_Line; 


The code is not full, the only relevant part is included.
Before I have implemented the same application with QVTKWidget instead of
vtkGenericOpenGLRenderWindow & QVTKOpenGLWidget at that time by default the
widget movement was restricted within vtkInteractorStyleImage.
By latest VTK release I can't use QVTKWidget so changed to
vtkGenericOpenGLRenderWindow & QVTKOpenGLWidget, then the problem occurred.
Please help to restrict the widget movement.
Is it possible to set vtkGenericOpenGLRenderWindow render area to
vtkResliceImageViewer render area?

Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html

More information about the vtkusers mailing list