well, I tried to do what you told, I thought that GetContourRepresentationAsPolyData() &#39;d be enough to get the polygon but following the chode you showed I got to these:<div><br></div><div><div>#include &lt;vtkSmartPointer.h&gt;</div>
<div>#include &lt;vtkProperty.h&gt;</div><div>#include &lt;vtkContourWidget.h&gt;</div><div>#include &lt;vtkOrientedGlyphContourRepresentation.h&gt;</div><div>#include &lt;vtkRenderer.h&gt;</div><div>#include &lt;vtkRenderWindow.h&gt;</div>
<div>#include &lt;vtkRenderWindowInteractor.h&gt;</div><div>#include &lt;vtkCommand.h&gt;</div><div>#include &lt;vtkDebugLeaks.h&gt;</div><div>#include &lt;vtkCamera.h&gt;</div><div>#include &lt;vtkPlane.h&gt;</div><div>#include &lt;vtkPolyData.h&gt;</div>
<div>#include &lt;vtkCellArray.h&gt;</div><div>#include &lt;vtkPoints.h&gt;</div><div>#include &lt;vtkMath.h&gt;</div><div>#include &lt;vtkWidgetEvent.h&gt;</div><div>#include &lt;vtkWidgetEventTranslator.h&gt;</div><div>
#include &lt;vtkTriangleFilter.h&gt;</div><div>#include &lt;vtkMassProperties.h&gt;</div><div>#include &lt;vtkPolygon.h&gt;</div><div> </div><div>int main( int argc, char *argv[] )</div><div>{</div><div>  // Create the RenderWindow, Renderer and both Actors</div>
<div>  //</div><div>  vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkSmartPointer&lt;vtkRenderer&gt;::New();</div><div>  vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow = vtkSmartPointer&lt;vtkRenderWindow&gt;::New();</div>
<div>  renderWindow-&gt;AddRenderer(renderer);</div><div> </div><div>  vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; interactor = </div><div>      vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();</div><div>  interactor-&gt;SetRenderWindow(renderWindow);</div>
<div> </div><div>  renderer-&gt;SetBackground(0.1, 0.2, 0.4);</div><div>  renderWindow-&gt;SetSize(600, 600);</div><div> </div><div>  vtkSmartPointer&lt;vtkOrientedGlyphContourRepresentation&gt; contourRep = </div><div>      vtkSmartPointer&lt;vtkOrientedGlyphContourRepresentation&gt;::New();</div>
<div>  contourRep-&gt;GetLinesProperty()-&gt;SetColor(1, 0, 0); //set color to red</div><div> </div><div>  vtkSmartPointer&lt;vtkContourWidget&gt; contourWidget = </div><div>      vtkSmartPointer&lt;vtkContourWidget&gt;::New();</div>
<div>  contourWidget-&gt;SetInteractor(interactor);</div><div>  contourWidget-&gt;SetRepresentation(contourRep);</div><div>  contourWidget-&gt;On();</div><div> </div><div>  for (int i = 0; i &lt; argc; i++)</div><div>    {</div>
<div>    if (strcmp(&quot;-Shift&quot;, argv[i]) == 0)</div><div>      {</div><div>      contourWidget-&gt;GetEventTranslator()-&gt;RemoveTranslation( </div><div>                                        vtkCommand::LeftButtonPressEvent );</div>
<div>      contourWidget-&gt;GetEventTranslator()-&gt;SetTranslation( </div><div>                                        vtkCommand::LeftButtonPressEvent,</div><div>                                        vtkWidgetEvent::Translate );</div>
<div>      }</div><div>    else if (strcmp(&quot;-Scale&quot;, argv[i]) == 0)</div><div>      {</div><div>      contourWidget-&gt;GetEventTranslator()-&gt;RemoveTranslation( </div><div>                                        vtkCommand::LeftButtonPressEvent );</div>
<div>      contourWidget-&gt;GetEventTranslator()-&gt;SetTranslation( </div><div>                                        vtkCommand::LeftButtonPressEvent,</div><div>                                        vtkWidgetEvent::Scale );</div>
<div>      }</div><div>    }</div><div> </div><div> </div><div>  vtkSmartPointer&lt;vtkPolyData&gt; pd = vtkSmartPointer&lt;vtkPolyData&gt;::New();</div><div> </div><div>  vtkSmartPointer&lt;vtkPoints&gt; points = vtkSmartPointer&lt;vtkPoints&gt;::New();</div>
<div>  vtkSmartPointer&lt;vtkCellArray&gt; lines = vtkSmartPointer&lt;vtkCellArray&gt;::New();</div><div>  vtkIdType* lineIndices = new vtkIdType[21];</div><div>  for (int i = 0; i&lt; 20; i++)</div><div>    {</div><div>    const double angle = 2.0*vtkMath::Pi()*i/20.0;</div>
<div>    points-&gt;InsertPoint(static_cast&lt;vtkIdType&gt;(i), 0.1*cos(angle),</div><div>                        0.1*sin(angle), 0.0 );</div><div>    lineIndices[i] = static_cast&lt;vtkIdType&gt;(i);</div><div>    }</div>
<div> </div><div>  lineIndices[20] = 0;</div><div>  lines-&gt;InsertNextCell(21,lineIndices);</div><div>  delete [] lineIndices;</div><div>  pd-&gt;SetPoints(points);</div><div>  pd-&gt;SetLines(lines);</div><div><br></div>
<div>  contourWidget-&gt;Initialize(pd);</div><div>  contourWidget-&gt;Render();</div><div>  renderer-&gt;ResetCamera();</div><div>  renderWindow-&gt;Render();</div><div> </div><div>  interactor-&gt;Initialize();</div><div>
  interactor-&gt;Start();</div><div><br></div><div>  vtkSmartPointer&lt; vtkPolygon &gt; polygon =</div><div><span class="" style="white-space:pre">        </span>  vtkSmartPointer&lt; vtkPolygon &gt;::New();</div><div>  vtkSmartPointer&lt; vtkPolyData &gt; poly =</div>
<div><span class="" style="white-space:pre">        </span>  vtkSmartPointer&lt; vtkPolyData &gt;::New();</div><div>  vtkSmartPointer&lt; vtkCellArray &gt; cellArray =</div><div><span class="" style="white-space:pre">        </span>  vtkSmartPointer&lt; vtkCellArray &gt;::New();</div>
<div><br></div><div>  int numOfPoints = contourRep-&gt;GetContourRepresentationAsPolyData()-&gt;GetNumberOfPoints();</div><div>  polygon-&gt;GetPointIds()-&gt;SetNumberOfIds(numOfPoints);</div><div>  for (int i = 0; i &lt; numOfPoints; i++)</div>
<div>  {</div><div><span class="" style="white-space:pre">        </span>  polygon-&gt;GetPointIds()-&gt;SetId(i, i);</div><div>  }</div><div><br></div><div>  cellArray-&gt;InsertNextCell(polygon);</div><div>  poly-&gt;SetPoints(contourRep-&gt;GetContourRepresentationAsPolyData()-&gt;GetPoints());</div>
<div>  poly-&gt;SetPolys(cellArray);</div><div><br></div><div>  vtkSmartPointer&lt; vtkTriangleFilter &gt; triangles =</div><div><span class="" style="white-space:pre">        </span>  vtkSmartPointer&lt; vtkTriangleFilter &gt;::New();</div>
<div>  //triangles-&gt;SetInput(contourRep-&gt;GetContourRepresentationAsPolyData());</div><div>  triangles-&gt;SetInput(poly);</div><div>  vtkSmartPointer&lt; vtkMassProperties &gt; massProp =</div><div><span class="" style="white-space:pre">        </span>  vtkSmartPointer&lt; vtkMassProperties &gt;::New();</div>
<div>  massProp-&gt;SetInput(triangles-&gt;GetOutput());</div><div>  double area = massProp-&gt;GetSurfaceArea();</div><div><br></div><div>  std::cout&lt;&lt; area;</div><div><br></div><div>  contourWidget-&gt;Off();</div>
<div><br></div><div>  return EXIT_SUCCESS;</div><div>}</div></div><div><br></div><div>I see area changes as I modified the form of the contour and close the render window, correct me if there&#39;s something wrong please and if you give me some guide on that  GetContourRepresentationAsPolyData() if there&#39;s a way to use it in a more direct way.</div>
<div><br></div><div>Thx for your help</div><div><br></div><div>Regards, Rodrigo</div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/3 David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Dec 3, 2012 at 3:40 PM, Rodrigo Lovera &lt;<a href="mailto:lobo.theslayer@gmail.com">lobo.theslayer@gmail.com</a>&gt; wrote:<br>

&gt; OK, I got that poly data but one I got that into the trianglefilter and then<br>
&gt; to the massproperties is where that error shows up, so what I don&#39;t get is<br>
&gt; that step between applying<br>
&gt;<br>
&gt; contourRep-&gt;GetContourRepresentationAsPolyData()<br>
&gt;<br>
&gt; and getting the poly into the trianglefilter.<br>
<br>
</div>The easiest way would just be to read out the points from the line<br>
segments produced by the widget to create the polygon like I showed.<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><b><font face="&#39;comic sans ms&#39;, sans-serif" color="#000066">Rodrigo aka WarHearT</font></b><br>
</div>