[vtkusers] vtkImageViewer2 and QVTKWidget
Marcos
fotosentido at gmail.com
Thu Aug 27 14:23:59 EDT 2015
Still having the problem, trying to simplify:
con->SetInput(modelo->getImageToSave());
con->Update();
imageData->DeepCopy(con->GetOutput());
imageViewer->SetInputData(con->GetOutput());
imageViewer->GetRenderer()->ResetCamera();
imageViewer->Render();
ui->qvtkwidget->SetRenderWindow(imageViewer->GetRenderWindow());
ui->qvtkwidget->GetRenderWindow()->SetInteractor(imageViewer->GetRenderWindow()->GetInteractor());
ui->qvtkwidget->update();
I'll keep on trying.
I would appreciate any help on this.
2015-08-27 18:26 GMT+02:00 Marcos <fotosentido at gmail.com>:
> 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/2efb3573/attachment.html>
More information about the vtkusers
mailing list