Is there any way to use vtkImageViewer2 in QT project?

I read the example about how to use vtk in qt. But it seems that I can just add a renderwinodws to QVTKWidget.
But vtkImageViewer2 is not Inherhit from renderwinodw. I really want to use the function like SetSlice in vtkImageViewer2.
So, is there any way to use vtkImageViewer2 in QT project? Or is there an example about display a sequence of images using renderwinodws.



It’s been awhile so might be a bit outdated answer. But looking at some old code I have a QVTKOpenGLWidget named qvtk and I do the following (something similar should be done for the other Qt VTK widgets):

imageViewer = vtkSmartPointer<vtkImageViewer2>::New();

// ... Set vtkImageViewer2 input...

The important bits here are setting the vtkImageViewer2 render window to the one supplied by QVTK. And then set the correct interactor style.

1 Like