[vtkusers] Problems with massProperties at getting area from ContourWidget

Rodrigo Lovera lobo.theslayer at gmail.com
Mon Dec 3 14:01:35 EST 2012


 //Agregar un nuevo widget
this->ContourWidget[i] = vtkSmartPointer< vtkContourWidget >::New();
this->ContourWidget[i]->SetInteractor(
this->riw[i]->GetResliceCursorWidget()->GetInteractor());

//Crear la Representacion Geometrica para el ContourWidget
contourRepresentation =vtkSmartPointer<
vtkOrientedGlyphContourRepresentation >::New();
contourRepresentation->GetProperty()->SetColor(0.25, 1.0, 0.25);

vtkSmartPointer< vtkSphereSource > ss =
vtkSmartPointer< vtkSphereSource >::New();
ss->SetRadius(0.5);

contourRepresentation->SetActiveCursorShape(ss->GetOutput());

contourRepresentation->GetActiveProperty()->SetAmbient(0.1);
contourRepresentation->GetActiveProperty()->SetDiffuse(0.9);
contourRepresentation->GetActiveProperty()->SetSpecular(0.0);

I really hope someone can help me correct these.

Regards
Rodrigo Lovera

//Configurar la prioridad mayor a la del reslice
this->ContourWidget[i]->SetPriority(
this->riw[i]->GetResliceCursorWidget()->GetPriority() + 0.01);

this->ContourWidget[i]->SetRepresentation(contourRepresentation);
this->ContourWidget[i]->EnabledOn();
//this->ContourWidget[i]->ProcessEventsOn();

this->riw[i]->GetMeasurements()->AddItem(this->ContourWidget[i]);


2012/12/3 Rodrigo Lovera <lobo.theslayer at gmail.com>

> 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:
>
>
>
>
> --
> *Rodrigo Lovera*
>



-- 
*Rodrigo aka WarHearT*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121203/aefe2f8c/attachment.htm>


More information about the vtkusers mailing list