OK, these &#39;d be the example:<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> </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> </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; 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>  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 algo = massProp-&gt;GetSurfaceArea();</div><div><br></div><div>  std::cout&lt;&lt; algo;</div><div><br></div><div>  contourWidget-&gt;Off();</div><div><br></div><div>  return EXIT_SUCCESS;</div><div>}</div></div>
<div><br></div><div>There&#39;s is the contourwidget example but i&#39;m adding the pipe I think &#39;d be necessary to compute the area.</div><div><br></div><div>It still gives me same error as before at closing the renderwindow for some reason:</div>
<div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">Warning: In C:\Users\RODRIGO LOVERA\Documents\PUCP\Tesis\VTK 5.10\VTK\Graphics\vtkMassProperties.cxx, line 120</div><div style="font-family:arial,sans-serif;font-size:13px">
vtkMassProperties (04C64588): Input data type must be VTK_TRIANGLE not 3</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Hope you can help me get throught these or maybe give some other advice on how to get the value of the area contained by a contourwidget created at will.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Rodrigo Lovera</div><div><br></div><div><br></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="gmail_quote"><div><div class="h5">On Mon, Dec 3, 2012 at 2:00 PM, Rodrigo Lovera <span dir="ltr">&lt;<a href="mailto:lobo.theslayer@gmail.com" target="_blank">lobo.theslayer@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello everyone,<div><br></div><div>I&#39;ve applied the vtkContourWidget in the same way the distancewidget is applied in the QT VTK FOUR PANE VIEW EXAMPLE</div><div><br></div><div>so far everything is fine, but I&#39;m trying now to compute the area so I connect the following code to an pushButton which &#39;ll be activated after finishing drawing the contour.</div>


<div><br></div><div><div><span style="white-space:pre-wrap">        </span>vtkSmartPointer&lt; vtkTriangleFilter &gt; triangleTrans =</div><div><span style="white-space:pre-wrap">                </span>vtkSmartPointer&lt; vtkTriangleFilter &gt;::New();</div>


<div><span style="white-space:pre-wrap">        </span>triangleTrans-&gt;SetInput(contourRepresentation-&gt;GetContourRepresentationAsPolyData());</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span></div>


<div><span style="white-space:pre-wrap">        </span>vtkSmartPointer&lt; vtkMassProperties &gt; massProp =</div><div><span style="white-space:pre-wrap">                </span>vtkSmartPointer&lt; vtkMassProperties &gt;::New();</div><div>
<span style="white-space:pre-wrap">        </span>massProp-&gt;SetInput(triangleTrans-&gt;GetOutput());</div><div><span style="white-space:pre-wrap">        </span>massProp-&gt;GetSurfaceArea();</div><div><span style="white-space:pre-wrap">        </span></div>


<div><span style="white-space:pre-wrap">        </span>this-&gt;ui-&gt;surfaceAreaLabel-&gt;setNum(massProp-&gt;GetSurfaceArea());</div></div><div><br></div><div>What I&#39;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.</div>


<div><br></div><div>Everythings build ok, but once in the gui when pushing the button... it gives me the following error:</div><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>What I use to draw the contours is the following code:</div></blockquote><div><br></div></div></div>As usual, I suggest you create a compilable example. It doesn&#39;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).<span class="HOEnZb"><font color="#888888"><br clear="all">

<br><div>David </div></font></span></div>
</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>