[vtkusers] vtkImageViewer2 and QVTKWidget

Marcos fotosentido at gmail.com
Thu Aug 27 12:26:30 EDT 2015


I have an image loaded in vtkImageViewer2 (from itk::ImageToVTKImageFilter).

The point is when I update the pipeline... a window appears and disappears
instantly.

I'm trying to connect these two buddies, but I'm unsure which render or
renderWindow assign to who.

I've tried different things reading examples (people try a lot of things!).
Right now my code is this:

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

        imageViewer->SetInputData(con->GetOutput());

        imageViewer->Render();


        //ui->qvtkwidget->SetRenderWindow(imageViewer->GetRenderWindow());

        imageViewer->SetupInteractor(ui->qvtkwidget->GetRenderWindow()->GetInteractor());



        //imageViewer->SetRenderWindow(ui->qvtkwidget->GetRenderWindow());

        imageViewer->Render();

        //renderer->ResetCamera();


        //renderWindow->AddRenderer(renderer);

        //renderWindow->Render();


        //vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();

        //vtkSmartPointer<vtkInteractorStyleImage> style =
vtkSmartPointer<vtkInteractorStyleImage>::New();

        //interactor->SetInteractorStyle(style);

        //interactor->SetRenderWindow(renderWindow);

        //interactor->Initialize();


        //renderWindow->Start();


        //ui->qvtkwidget->GetRenderWindow()->GetInteractor()->Initialize();


        ui->qvtkwidget->show();


The commented lines were uncommented sometimes, trying to find out the
correct sequence, but unsuccessfully.


Any idea?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150827/19c73547/attachment.html>


More information about the vtkusers mailing list