Well, I applied what you said but I'm getting these error:<div><br></div><div><div>Warning: In C:\Users\RODRIGO LOVERA\Documents\PUCP\Tesis\VTK 5.10\VTK\Graphics\vtkMassProperties.cxx, line 120</div><div>vtkMassProperties (04C64588): Input data type must be VTK_TRIANGLE not 3</div>
</div><div><br></div><div>I'm taking as a base the FOUR PANE VIEWER VTK QT EXAMPLE that comes with the documentation.</div><div><br></div><div>I applied the vtkContourWidget in a similar way the distancewidget is applied:</div>
<div><br></div><div><div>void mainwindow::AddContourToView(int i)</div><div>{</div><div><span class="" style="white-space:pre"> </span>// Remover widgets existentes</div><div><span class="" style="white-space:pre"> </span>if (this->ContourWidget[i])</div>
<div><span class="" style="white-space:pre"> </span>{</div><div><span class="" style="white-space:pre"> </span>this->ContourWidget[i]->SetEnabled(0);</div><div><span class="" style="white-space:pre"> </span>this->ContourWidget[i] = NULL;</div>
<div><span class="" style="white-space:pre"> </span>}</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>//Agregar un nuevo widget</div><div><span class="" style="white-space:pre"> </span>this->ContourWidget[i] = vtkSmartPointer< vtkContourWidget >::New();</div>
<div><span class="" style="white-space:pre"> </span>this->ContourWidget[i]->SetInteractor(</div><div><span class="" style="white-space:pre"> </span>this->riw[i]->GetResliceCursorWidget()->GetInteractor());</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>//Crear la Representacion Geometrica para el ContourWidget</div><div><span class="" style="white-space:pre"> </span>contourRepresentation =vtkSmartPointer< vtkOrientedGlyphContourRepresentation >::New();</div>
<div><span class="" style="white-space:pre"> </span>contourRepresentation->GetProperty()->SetColor(0.25, 1.0, 0.25);</div><div><br></div><div><span class="" style="white-space:pre"> </span>vtkSmartPointer< vtkSphereSource > ss =</div>
<div><span class="" style="white-space:pre"> </span>vtkSmartPointer< vtkSphereSource >::New();</div><div><span class="" style="white-space:pre"> </span>ss->SetRadius(0.5);</div><div><br></div><div><span class="" style="white-space:pre"> </span>contourRepresentation->SetActiveCursorShape(ss->GetOutput());</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>contourRepresentation->GetActiveProperty()->SetAmbient(0.1);</div><div><span class="" style="white-space:pre"> </span>contourRepresentation->GetActiveProperty()->SetDiffuse(0.9);</div>
<div><span class="" style="white-space:pre"> </span>contourRepresentation->GetActiveProperty()->SetSpecular(0.0);</div><div><span class="" style="white-space:pre"> </span></div><div><br></div><div><span class="" style="white-space:pre"> </span>//Configurar la prioridad mayor a la del reslice</div>
<div><span class="" style="white-space:pre"> </span>this->ContourWidget[i]->SetPriority(</div><div><span class="" style="white-space:pre"> </span>this->riw[i]->GetResliceCursorWidget()->GetPriority() + 0.01);</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>this->ContourWidget[i]->SetRepresentation(contourRepresentation);</div><div><span class="" style="white-space:pre"> </span>this->ContourWidget[i]->EnabledOn();</div>
<div><span class="" style="white-space:pre"> </span>//this->ContourWidget[i]->ProcessEventsOn();</div><div><br></div><div><span class="" style="white-space:pre"> </span>this->riw[i]->GetMeasurements()->AddItem(this->ContourWidget[i]);</div>
<div>}</div></div><div><br></div><div>After that I got another button wich 'll be applied to compute the are with the method you mentioned, I wrote sth like:</div><div><br></div><div><div>vtkSmartPointer< vtkTriangleFilter > triangleTrans =</div>
<div><span class="" style="white-space:pre"> </span>vtkSmartPointer< vtkTriangleFilter >::New();</div><div><span class="" style="white-space:pre"> </span>triangleTrans->SetInput(contourRepresentation->GetContourRepresentationAsPolyData());</div>
<div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>vtkSmartPointer< vtkMassProperties > massProp =</div>
<div><span class="" style="white-space:pre"> </span>vtkSmartPointer< vtkMassProperties >::New();</div><div><span class="" style="white-space:pre"> </span>massProp->SetInput(triangleTrans->GetOutput());</div><div>
<span class="" style="white-space:pre"> </span>massProp->GetSurfaceArea();</div><div><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>this->ui->surfaceAreaLabel->setNum(massProp->GetSurfaceArea());</div>
</div><div><br></div><div>But the problem is the one I mentioned at the start, hope you have a better idea on what to do.</div><div><br></div><div>Thx in advance.</div><div>Regards</div><div><br>Rodrigo Lovera</div><div class="gmail_extra">
<br><br><div class="gmail_quote">2012/12/3 Rodrigo Lovera <span dir="ltr"><<a href="mailto:lobo.theslayer@gmail.com" target="_blank">lobo.theslayer@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Bouba,<br><br>I was checking on the method you propose, but I don't get to set the input correctly for the triangle filter, considering i'm defining the 2D contour using the vtkContourWidget, so there is where im stucked atm.<br>
<br>Checking vtkMassProperties I think surfacearea 'd suit well for computing area contained by the contour, hope you could give me an idea on how to connect the pipe between the contour widget and the triangle filter so I could test the rest.<br>
<br>Thx in advance,<br><br>Regards,<br>Rodrigo<br><div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/29 Belaroussi, Boubakeur <span dir="ltr"><<a href="mailto:Boubakeur.Belaroussi@bioclinica.com" target="_blank">Boubakeur.Belaroussi@bioclinica.com</a>></span><div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi Rodrigo,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">For 2D contours, you can use the following pipeline:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">1. Transform your contour points into triangles, using vtkTriangleFilter, which creates triangle polygons from input polygons and triangle strips<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">2. Then, to get the area of your contour, among other features, you can use the vtkMassProperties filter, which estimates volume, area, shape index of triangle
mesh.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hope it helps<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Bouba<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>]
<b>On Behalf Of </b>Rodrigo Lovera<br>
<b>Sent:</b> jeudi 29 novembre 2012 18:01<br>
<b>To:</b> VTK Users<br>
<b>Subject:</b> [vtkusers] Comput the area contained by a contour (VTK C++)<u></u><u></u></span></p><div><div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hello everyone,<br>
<br>
I was wondering if any of you know a method to compute the area cointained by a figure or maybe something like the contourwidget which shape can be changed at will.<br>
<br>
What I need -d be some kind of implementation or code or guide on how to perform that math operation, similar to the distance widget but what I need to compute now is area.<br>
<br>
Id really appreciate any kind of help<br clear="all">
<br>
-- <br>
<b><span style="font-family:"Arial","sans-serif";color:#000066">Rodrigo</span></b><u></u><u></u></p>
</div></div></div>
</div>
<div> </div>
<div style="FONT-SIZE:9pt;FONT-FAMILY:Courier New"><font face="MS Sans Serif">--</font><font face="MS Sans Serif"><br>Confidentiality Notice: This e-mail transmission may contain confidential or legally privileged information that is intended only for the individual or entity named in the e-mail address. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or reliance upon the contents of this e-mail is strictly prohibited. If you have received this e-mail transmission in error, please reply to the sender and then delete the message from your computer. Thank you.<br>
--</font><br></div></div>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><b><font face="'comic sans ms', sans-serif" color="#000066">Rodrigo aka WarHearT</font></b><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><b><font face="'comic sans ms', sans-serif" color="#000066">Rodrigo aka WarHearT</font></b><br>
</div>