[vtkusers] simple question vtkCleanPolyData

Jean-Dominique Barnichon jeando.barnichon at free.fr
Tue Apr 18 13:51:06 EDT 2006


Thanks for the tip Amy,
I should be able to get it now.
Jean-Do

Amy Squillacote a écrit :
> Hi Jean-Do,
>
> No, there is not a filter in VTK to only remove duplicate points in a 
> dataset with no cells.  One thing you could do is to add a vtkVertex 
> cell per point in your dataset.  Then if you pass this new dataset 
> through vtkCleanPolyData, duplicate points will be merged, but you 
> won't have the problem of points being removed because they are not 
> being used by a cell.
>
> - Amy
>
> At 02:47 AM 4/18/2006, jeando.barnichon at free.fr wrote:
>> Ok, I understand.
>> The next question now is :
>> Is there a filter that could do the "simple" task of "cleaning" (i.e. 
>> removing
>> duplicate points) a polydata that is made of points only?
>> Jean-Do
>>
>> Selon Amy Squillacote <amy.squillacote at kitware.com>:
>>
>> > You are right; you do need cells in your vtkPolyData, not just
>> > points.  This is because one of the features of vtkCleanPolyData is
>> > to remove points that are not used by any cells.  Thus if your data
>> > has no cells, then this is true for all the points in your data set,
>> > so all of them will be removed, resulting in an empty vtkPolyData 
>> data set.
>> >
>> > - Amy
>> >
>> > At 05:06 PM 4/17/2006, Janet Kim wrote:
>> > >I tried out vtkCleanPolyData and it looked like you
>> > >might need actual geometry for the polydata to clean,
>> > >not just points.  When I just had points, I had the
>> > >same result.  But once I added the points to cells,
>> > >the clean worked.  Maybe someone else can explain a
>> > >bit better, unless, I'm wrong.
>> > >
>> > >
>> > >On Mon, 17 Apr 2006, Jean-Dominique Barnichon wrote:
>> > >
>> > >>Should be a simple one.
>> > >>I've got a polydata containing only points (see end of email), some
>> > >>of which are duplicate points.
>> > >>I want to keep only a single point with given coordinates (yes, I
>> > >>know that the vtkCleanPolyData filter should do the trick, but I
>> > >>just can couldn't get it working so far).
>> > >>When I run the piece of code given below, the cleaned polydata is
>> > >>empty (i.e. it has 0 points), and I don't understand why.
>> > >>Any Idea?
>> > >>Jean-Do
>> > >>
>> > >>Code snippet:
>> > >>       vtkPolyDataReader *re = vtkPolyDataReader::New();
>> > >>       re->SetFileName("InitialPolydata.vtk");
>> > >>
>> > >>       vtkPolyData *pdata = vtkPolyData::New();
>> > >>       pdata = re->GetOutput();
>> > >>
>> > >>       // pdata is the vtkPolyData
>> > >>       vtkCleanPolyData *Clean = vtkCleanPolyData::New();
>> > >>       Clean->SetInput(pdata);
>> > >>       Clean->SetTolerance(0.0);
>> > >>       Clean->PointMergingOn();
>> > >>       Clean->Update();
>> > >>
>> > >>       vtkPolyDataWriter *wr = vtkPolyDataWriter::New();
>> > >>       wr->SetFileName("CleanedPolydata.vtk");
>> > >>       wr->SetInput(Clean->GetOutput());
>> > >>       wr->Write();
>> > >>
>> > >>
>> > >>//beginning_of_file (InitialPolydata.vtk)
>> > >># vtk DataFile Version 3.0
>> > >>vtk output
>> > >>ASCII
>> > >>DATASET POLYDATA
>> > >>POINTS 12 float
>> > >>3.35936 1.84257 49.9219 6.3551 1.84257 40.9347 17.8945 1.84257 
>> 39.9079
>> > >>17.8945 1.84257 39.9079 25.3551 1.84257 23.6583 25.3551 1.84257 
>> 23.6583
>> > >>34.0223 1.84257 20.6629 34.0223 1.84257 20.6629 36.8945 1.84257 
>> 20.1843
>> > >>45.263 1.84257 1.84257 45.263 1.84257 1.84257 83.3594 1.84257 0
>> > >>
>> > >>POINT_DATA 12
>> > >>//end_of_file
>> > >>
>> > >>_______________________________________________
>> > >>This is the private VTK discussion list. Please keep messages
>> > >>on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> > >>Follow this link to subscribe/unsubscribe:
>> > >>http://www.vtk.org/mailman/listinfo/vtkusers
>> > >_______________________________________________
>> > >This is the private VTK discussion list. Please keep messages
>> > >on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>> > >Follow this link to subscribe/unsubscribe:
>> > >http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>> >
>
>
>
>




More information about the vtkusers mailing list