[vtkusers] vtkImageViewer2 trouble with QVTKWidget

Francois Bertel francois.bertel at kitware.com
Fri Apr 30 22:06:28 EDT 2010


You have to set the interactor before the first call to Render().


On Fri, Apr 30, 2010 at 8:14 PM, Antonin Perrot-Audet
<antonin07130 at gmail.com> wrote:
> Hello,
> I have some trouble using the QVTKWidget with a vtkImageViewer2 :
> I am able to render an image in the QVTKWidget, but if I try to setup an
> interactor, the application freezes :
> --------
>  vtkImgViewer2->SetupInteractor(this->qvtkWidget_a->GetRenderWindow()->GetInteractor());
> --------
> I have seen several mails about using vtkImageViewer2 and QT, even from
> Luis, but there seems to be no solution yet ?
> Should I use a vtkImageViewer instead ?
>
> Here is a short version of my code : vtkImage is a pointer towards a
> vtkImageData, given as an argument
> --------
> vtkSmartPointer<vtkImageViewer2> vtkImgViewer2 =
> vtkSmartPointer<vtkImageViewer2>::New();
> vtkImgViewer2->SetInput(vtkImage);
> vtkImgViewer2->Render();
>  // makes the program crash :
>  //vtkImgViewer2->SetupInteractor(this->qvtkWidget_a->GetRenderWindow()->GetInteractor());
> this->qvtkWidget_a->SetRenderWindow(vtkImgViewer2->GetRenderWindow());
> --------
>
> So that I now have the weird behavior that I can display an image and
> interact with it as a 3D object ....
>
> The vtkImageData seems to be provided just fine as I can display the image
> with the wrong interactor, so it doesn't seem to be a pipeline problem ?
> I also tried declaring an interactor of vtkImageInteractorStyle, and
> attributing it to both the vtkImageViewer2 and the QVTKWidget, with the same
> results.
>
> *any idea or even experience using these tools would be greatly
> appreciated,*
>
> Thanks,
>
> Antonin
>
>
> --
> Antonin Perrot-Audet
> Electrical Engineering&  Computer Sciences, INSA Lyon
> M2 GEGP Signal&  Image Processing, INSA Lyon, UCBL, Centrale Lyon
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list