[vtkusers] Convex hull visuzlization crash problem in qvtkWidget
Clinton Stimpson
clinton at elemtech.com
Sat Jan 15 12:19:25 EST 2011
The default vtkRenderWindowInteractor from New() doesn't work with Qt.
You should either get the interactor from QVTKWidget or make a
QVTKInteractor.
Clint
On 01/15/2011 12:38 AM, Xiaopeng Yang wrote:
>
> Dear Members,
>
> I made a system by QT, VTK, and ITK. In the system, 10 convex hulls
> are generated and visualized by the same vtkRenderer in a qvtkWidget.
> After visualization, the interaction function does not work. I could
> not drag and rotate the convex hulls. But I can zoom in and out
> through the mouse wheel. Then after 2 or 3 seconds, the program
> crashed out. I tried many different ways to solve the problem since
> last weekend, however, still I did not succeed yet. I would appreciate
> a lot if anyone can give me some advice. I attach the code here for
> reference. Thank you very much!
>
> if(seg_no == 0)
>
> {
>
> for (i = 0; i < spl_max; i++)
>
> {
>
>
> points1->InsertNextPoint(segment_point_list[i][0],
> segment_point_list[i][1], segment_point_list[i][2]);
>
> }
>
> polydata1->SetPoints(points1);
>
> delaunay3D1->SetInput (polydata1);
>
> delaunay3D1->Update();
>
>
> delaunayMapper1->SetInputConnection(delaunay3D1->GetOutputPort());
>
> delaunayActor1->SetMapper(delaunayMapper1);
>
> delaunayActor1->GetProperty()->SetColor(1,0,0);
>
> }
>
> else if (seg_no == 1)
>
> {
>
> for (i = 0; i < spl_max; i++)
>
> {
>
>
> points2->InsertNextPoint(segment_point_list[i][0],
> segment_point_list[i][1], segment_point_list[i][2]);
>
> }
>
> polydata2->SetPoints(points2);
>
> delaunay3D2->SetInput (polydata2);
>
>
> delaunayMapper2->SetInputConnection(delaunay3D2->GetOutputPort());
>
> delaunayActor2->SetMapper(delaunayMapper2);
>
> delaunayActor2->GetProperty()->SetColor(1,1,0);
>
> }
>
> ...
>
> vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
>
> renderWindow = this->ui->qvtkWidget_4->GetRenderWindow();
>
> renderWindow->AddRenderer(delaunayRenderer);
>
> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
>
> renderWindowInteractor->SetRenderWindow(renderWindow);
>
> delaunayRenderer->AddActor(delaunayActor1);
>
> delaunayRenderer->AddActor(delaunayActor2);
>
> delaunayRenderer->AddActor(delaunayActor3);
>
> delaunayRenderer->AddActor(delaunayActor4);
>
> delaunayRenderer->AddActor(delaunayActor5);
>
> delaunayRenderer->AddActor(delaunayActor6);
>
> delaunayRenderer->AddActor(delaunayActor7);
>
> delaunayRenderer->AddActor(delaunayActor8);
>
> delaunayRenderer->AddActor(delaunayActor9);
>
> delaunayRenderer->AddActor(delaunayActor10);
>
> delaunayRenderer->SetBackground(1,1,1);
>
> renderWindow->Render();
>
> renderWindowInteractor->Initialize();
>
> renderWindowInteractor->Start();
>
> }
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110115/55a21049/attachment.htm>
More information about the vtkusers
mailing list