I think this will help me <div><a href="http://www.vtk.org/doc/release/5.6/html/a01978.html">http://www.vtk.org/doc/release/5.6/html/a01978.html</a> vtkThreshold ..<br><br>Thank you..<br><br><div class="gmail_quote">2012/8/1 Gonzalo Amadio <span dir="ltr"><<a href="mailto:gonzaloamadio@gmail.com" target="_blank">gonzaloamadio@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Could you refer me to some example/class ?<br><br>Thank you.<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">
2012/8/1 David E DeMarle <span dir="ltr"><<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You've given your extracted vtkPolyData cells but you haven't copied<br>
over the points that those cells refer to.<br>
<br>
Also, why not use a threshold or selection filter to do this?<br>
<br>
David E DeMarle<br>
Kitware, Inc.<br>
R&D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: <a href="tel:518-881-4909" value="+15188814909" target="_blank">518-881-4909</a><br>
<div><div><br>
<br>
On Wed, Aug 1, 2012 at 6:08 AM, Gonzalo Amadio <<a href="mailto:gonzaloamadio@gmail.com" target="_blank">gonzaloamadio@gmail.com</a>> wrote:<br>
> Hello everyone. I have a polydata with scalars ( 0,1 or 2 ) in the cells.<br>
> I want to extract all the cells with scalar 1.<br>
> Finally, when I try to print the number of points in the extracted polydata,<br>
> it gives me 0 . What I am missing here?<br>
> Should I construct the points set explicitly?<br>
><br>
>> polydata->GetPolys()->InitTraversal();<br>
>><br>
>><br>
>> int i = 0;<br>
>><br>
>><br>
>><br>
>> while ( polydata->GetPolys()->GetNextCell ( npts, pts ) != 0 )<br>
>> {<br>
>> if (cellScalarsPolydata->GetValue( i ) == 1) // if cell scalar == 1, get<br>
>> it.<br>
>> {<br>
>> extractedCellArray->InsertNextCell(3);<br>
>> extractedCellArray->InsertCellPoint(pts[0]);<br>
>> extractedCellArray->InsertCellPoint(pts[1]);<br>
>> extractedCellArray->InsertCellPoint(pts[2]);<br>
>> }<br>
>> i++;<br>
>> }<br>
>><br>
>><br>
>><br>
>> vtkPolyData* extractedPolyData = vtkPolyData::New();<br>
>> extractedPolyData->SetPolys(extractedCellArray);<br>
>> extractedPolyData->BuildCells();<br>
>><br>
>><br>
>><br>
>> std::cout << "num points" << extractedPolyData->GetNumberOfPoints() <<<br>
>> std::endl; // This gives me 0<br>
><br>
><br>
><br>
> --<br>
> --------<br>
> Gonzalo Amadio<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>--------<br>Gonzalo Amadio<br><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>