Is there any way to use vtkImageViewer2 in QT project?

Absolutely!

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();
imageViewer->SetRenderWindow(qvtk->GetRenderWindow());
imageViewer->SetSliceOrientation(sliceOrientation);
qvtk->GetInteractor()->SetInteractorStyle(vtkSmartPointer<InteractorStyleImage>::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