[vtkusers] missing points in polydata

Gonzalo Amadio gonzaloamadio at gmail.com
Wed Aug 1 09:43:37 EDT 2012


I think this will help me
http://www.vtk.org/doc/release/5.6/html/a01978.html  vtkThreshold ..

Thank you..

2012/8/1 Gonzalo Amadio <gonzaloamadio at gmail.com>

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


-- 
--------
Gonzalo Amadio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120801/dcaf193b/attachment.htm>


More information about the vtkusers mailing list