[vtkusers] vtkPolyDataConnectivityFilter Help

Mike Jackson maillist at bluequartz.net
Wed Nov 23 18:23:41 EST 2005


On Nov 23, 2005, at 5:18 PM, Sylvain Jaume wrote:

>
> You could set ColorRegionsOn in vtkPolyDataConnectivityFilter.
> Then use vtkClipPolyData with SetValue set to the region id (i in  
> your code).
>
> Cheers,
> Sylvain

I gave that a try, looking extensively at the docs and this is what I  
have.
//Assume data is of type vtkPolyData which has been through a smoothing
// and a Decimation, just prior to this.
   vtkPolyDataConnectivityFilter *connections =  
vtkPolyDataConnectivityFilter::New();
   connections->SetInput(data);
   connections->SetExtractionModeToAllRegions();
   connections->Update();

   /// Loop on each Region
   unsigned int numRegions = connections->GetNumberOfExtractedRegions();
   vtkClipPolyData *clip = vtkClipPolyData::New();
   vtkImplicitBoolean *func = vtkImplicitBoolean::New();
   clip->SetInput(connections->GetOutput() );
   clip->SetClipFunction(func);
   clip->GenerateClipScalarsOff();

   for (unsigned int i = 0; i < numRegions; ++i)
   {
       std::cout << "----------- Region Number " << i << "  
----------" << std::endl;
       clip->SetValue( (float) i );
       clip->Update();
       clip->GetOutput()->PrintSelf(std::cout, 1);
   }

When the prints go by the number of polys, vertices, cells... are all  
Zero. Any idea what I am doing wrong?

I think I am getting confused about the implicit function and whether  
or not to have GenerateClipScalarsOff or GenerateClipScalarsOn.
---
Mike Jackson
mike _at_ bluequartz dot net





More information about the vtkusers mailing list