[vtkusers] Problems with vtkCleanPolyData

Christopher Bayley bayley at me.queensu.ca
Thu Mar 20 17:16:00 EST 2003


Hello vtker's

I am trying to use the vtkCleanPolyData filter to eliminate cells with
points that lie within a certain tolerance.  vtkClipPolyData produces
some un-acceptably small cells for my application and I would like to
merge these cells with their neighbours.  The description for
vtkCleanPolyData suggests that this is the proper tool for the job,
however I can't get it to work for me.

The program written in C++ compiles without an error message, but upon
execution eliminates all of the data within the vtkpolydata mesh.  Even
when I set SetAbsoluteTolerance(0.0), which would suggest that it should
not merge the data, it does.  

Any Suggestions?

Thanks for your help

Sincerely

Christopher Bayley
PhD Candidate
Queens' University
Kingston On,
Canada

PS my version of VTK is 4.0 and I'm using vtkCleanPolyData revision
1.49, Oct 11,2001

/* Clip the image data at a greyscale value of 127.5 */

vtkClipPolyData *aClipper=vtkClipPolyData::New();
    aClipper->SetInput(geometry->GetOutput());
    aClipper->SetValue(127.5);
    aClipper->GenerateClipScalarsOff();
    aClipper->InsideOutOff();
    aClipper->Update();

/* Clean the Mesh by removing points that lie within a tolerance */

printf(" .... Cleaning Mesh \n");
vtkCleanPolyData *CleanMesh = vtkCleanPolyData::New();
   CleanMesh->SetInput(aClipper->GetClippedOutput());
   CleanMesh->PointMergingOn();
   CleanMesh->ToleranceIsAbsoluteOn();
   CleanMesh->SetAbsoluteTolerance(0.05);
   CleanMesh->Update();
      
vtkPolyData *mesh=vtkPolyData::New();
   mesh->ShallowCopy(CleanMesh->GetOutput());
   mesh->Squeeze();
   mesh->BuildCells();
   mesh->BuildLinks();

NumCells=mesh->GetNumberOfCells();
NumPts=mesh->GetNumberOfPoints();
printf("Mesh Size - Elements %d Nodes %d\n",NumCells,NumPts);



More information about the vtkusers mailing list