OK, I got that poly data but one I got that into the trianglefilter and then to the massproperties is where that error shows up, so what I don't get is that step between applying<br>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">contourRep-></span><span style="font-family:arial,sans-serif;font-size:13px">GetContourRepresentationAsPoly</span><span style="font-family:arial,sans-serif;font-size:13px">Data()</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">and getting the poly into the trianglefilter.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">For example in these contourwidget code:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><div style="font-family:arial,sans-serif;font-size:13px">
#include <vtkSmartPointer.h></div><div style="font-family:arial,sans-serif;font-size:13px">#include <vtkActor.h></div><div style="font-family:arial,sans-serif;font-size:13px">#include <vtkContourWidget.h></div>
<div style="font-family:arial,sans-serif;font-size:13px">#include <vtkPolyData.h></div><div style="font-family:arial,sans-serif;font-size:13px">#include <vtkPolyDataMapper.h></div><div style="font-family:arial,sans-serif;font-size:13px">
#include <vtkProperty.h></div><div style="font-family:arial,sans-serif;font-size:13px">#include <vtkRenderer.h></div><div style="font-family:arial,sans-serif;font-size:13px">#include <vtkRenderWindow.h></div>
<div style="font-family:arial,sans-serif;font-size:13px">#include <vtkRenderWindowInteractor.h></div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px">
int main(int, char *[])</div><div style="font-family:arial,sans-serif;font-size:13px">{ </div><div style="font-family:arial,sans-serif;font-size:13px"> // Create a renderer and render window</div><div style="font-family:arial,sans-serif;font-size:13px">
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();</div><div style="font-family:arial,sans-serif;font-size:13px"> vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();</div>
<div style="font-family:arial,sans-serif;font-size:13px"> renderWindow->AddRenderer(renderer);</div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px">
// Create an interactor</div><div style="font-family:arial,sans-serif;font-size:13px"> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = </div><div style="font-family:arial,sans-serif;font-size:13px">
vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div style="font-family:arial,sans-serif;font-size:13px"> renderWindowInteractor->SetRenderWindow(renderWindow);</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><pre class="">vtkSmartPointer<span class=""><</span>vtkOrientedGlyphContourRepresentation<span class="">></span> contourRep <span class="">=</span>
vtkSmartPointer<span class=""><</span>vtkOrientedGlyphContourRepresentation<span class="">></span><span class="">::</span><span class="">New</span><span class="">(</span><span class="">)</span><span class="">;</span>
contourRep<span class="">-</span><span class="">></span>GetLinesProperty<span class="">(</span><span class="">)</span><span class="">-</span><span class="">></span>SetColor<span class="">(</span><span class="">1</span>, <span class="">0</span>, <span class="">0</span><span class="">)</span><span class="">;</span> <span class="">//set color to red</span></pre>
</div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px"> // Create a contour widget</div><div style="font-family:arial,sans-serif;font-size:13px"> vtkSmartPointer<vtkContourWidget> contourWidget = </div>
<div style="font-family:arial,sans-serif;font-size:13px"> vtkSmartPointer<vtkContourWidget>::New();</div><div style="font-family:arial,sans-serif;font-size:13px"> contourWidget->SetInteractor(renderWindowInteractor);</div>
<div style="font-family:arial,sans-serif;font-size:13px"> contourWidget->SetRepresentation(contourRep);</div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px">
renderWindow->Render();</div><div style="font-family:arial,sans-serif;font-size:13px"> renderWindowInteractor->Initialize();</div><div style="font-family:arial,sans-serif;font-size:13px"> renderWindow->Render();</div>
<div style="font-family:arial,sans-serif;font-size:13px"> contourWidget->On();</div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px"> // Begin mouse interaction</div>
<div style="font-family:arial,sans-serif;font-size:13px"> renderWindowInteractor->Start();</div><div style="font-family:arial,sans-serif;font-size:13px"> </div><div style="font-family:arial,sans-serif;font-size:13px">
return EXIT_SUCCESS;</div><div style="font-family:arial,sans-serif;font-size:13px">}</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">you start setting that points and defining the contour by mouse interaction.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Im trying to achieve that once you're done you get that contour as a polygon so the surface area could be measured. I'm for sure missing something, but really can't see it what it is. Sorry to bother with my newbie questions but I really need to get these to work.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div> vtkSmartPointer< vtkTriangleFilter > triangles =</div><div><span class="" style="white-space:pre">        </span> vtkSmartPointer< vtkTriangleFilter >::New();</div>
<div> triangles->SetInput(contourRep->GetContourRepresentationAsPolyData());</div><div> vtkSmartPointer< vtkMassProperties > massProp =</div><div><span class="" style="white-space:pre">        </span> vtkSmartPointer< vtkMassProperties >::New();</div>
<div> massProp->SetInput(triangles->GetOutput());</div><div> double area = massProp->GetSurfaceArea();</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div><font face="arial, sans-serif"> std::cout<< area;</font><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/3 David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></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:26 PM, Rodrigo Lovera <<a href="mailto:lobo.theslayer@gmail.com">lobo.theslayer@gmail.com</a>> wrote:<br>
> But, how could I get the polygon out of a contour?? I mean applying the<br>
> contour widget lets you define points and you can close that to forma a 2D<br>
> contour. Once that's finished how to get the polygon out of that contour??<br>
<br>
</div>Like you had done, right?<br>
<br>
contourRep->GetContourRepresentationAsPolyData()<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="'comic sans ms', sans-serif" color="#000066">Rodrigo aka WarHearT</font></b><br>
</div>