[vtkusers] Problems with massProperties at getting area from ContourWidget
David Doria
daviddoria at gmail.com
Mon Dec 3 14:03:16 EST 2012
On Mon, Dec 3, 2012 at 2:00 PM, Rodrigo Lovera <lobo.theslayer at gmail.com>wrote:
> Hello everyone,
>
> I've applied the vtkContourWidget in the same way the distancewidget is
> applied in the QT VTK FOUR PANE VIEW EXAMPLE
>
> so far everything is fine, but I'm trying now to compute the area so I
> connect the following code to an pushButton which 'll be activated after
> finishing drawing the contour.
>
> vtkSmartPointer< vtkTriangleFilter > triangleTrans =
> vtkSmartPointer< vtkTriangleFilter >::New();
>
> triangleTrans->SetInput(contourRepresentation->GetContourRepresentationAsPolyData());
> vtkSmartPointer< vtkMassProperties > massProp =
> vtkSmartPointer< vtkMassProperties >::New();
> massProp->SetInput(triangleTrans->GetOutput());
> massProp->GetSurfaceArea();
> this->ui->surfaceAreaLabel->setNum(massProp->GetSurfaceArea());
>
> What I'm trying to do is convert the contour in a triangle mesh so then I
> can apply vtkMassProperties and get the surface area which is my goal.
>
> Everythings build ok, but once in the gui when pushing the button... it
> gives me the following error:
>
> Warning: In C:\Users\RODRIGO LOVERA\Documents\PUCP\Tesis\VTK
> 5.10\VTK\Graphics\vtkMassProperties.cxx, line 120
> vtkMassProperties (04C64588): Input data type must be VTK_TRIANGLE not 3
>
> What I use to draw the contours is the following code:
>
As usual, I suggest you create a compilable example. It doesn't sound like
this has anything to do with Qt, so it should be a single, self contained
file (generate data similar to the data you are reading in your real code).
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121203/0503ce69/attachment.htm>
More information about the vtkusers
mailing list