Hello everyone. I have a polydata with scalars ( 0,1 or 2 ) in the cells.<div>I want to extract all the cells with scalar 1.</div><div>Finally, when I try to print the number of points in the extracted polydata, it gives me 0 . What I am missing here?</div>
<div>Should I construct the points set explicitly? </div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
polydata->GetPolys()->InitTraversal();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">int i = 0; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">while ( polydata->GetPolys()->GetNextCell ( npts, pts ) != 0 )<br>
{<br><span class="Apple-tab-span" style="white-space:pre">        </span>if (cellScalarsPolydata->GetValue( i ) == 1) // if cell scalar == 1, get it.<br><span class="Apple-tab-span" style="white-space:pre">        </span>{<br><span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray->InsertNextCell(3);<br>
<span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray->InsertCellPoint(pts[0]);<br><span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray->InsertCellPoint(pts[1]);<br>
<span class="Apple-tab-span" style="white-space:pre">                </span>extractedCellArray->InsertCellPoint(pts[2]);<br><span class="Apple-tab-span" style="white-space:pre">        </span>}<br><span class="Apple-tab-span" style="white-space:pre">        </span>i++;<br>
}<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
vtkPolyData* extractedPolyData = vtkPolyData::New();<br>extractedPolyData->SetPolys(extractedCellArray);<br>extractedPolyData->BuildCells();<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">std::cout << "num points" << extractedPolyData->GetNumberOfPoints() << std::endl; <font color="#ff0000">// This gives me 0</font></blockquote>
</div><div><br clear="all"><div><br></div>-- <br>--------<br>Gonzalo Amadio<br><br>
</div>