[vtkusers] vtkPolyDataConnectivityFilter Help

Mike Jackson maillist at bluequartz.net
Wed Nov 23 19:21:58 EST 2005


On Nov 23, 2005, at 6:51 PM, Sylvain Jaume wrote:

> vtkPolyDataConnectivityFilter *connections =   
> vtkPolyDataConnectivityFilter::New();
> connections->SetInput(data);
> connections->SetExtractionModeToAllRegions();
> connections->ColorRegionsOn();
> connections->Update();
>
>  unsigned int numRegions = connections->GetNumberOfExtractedRegions();
>  vtkClipPolyData *clip = vtkClipPolyData::New();
>  clip->SetInput(connections->GetOutput() );
>
>  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);
>  }

I had gotten pretty close to that, but was generating the scalars  
each time in the loop. That code seems to work just fine. There was  
one more correction to do.

   unsigned int numRegions = connections->GetNumberOfExtractedRegions();
   vtkClipPolyData *clip = vtkClipPolyData::New();
   clip->SetInput(connections->GetOutput() );
   clip->InsideOutOn();
   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);
   }

Some things still are not adding up, but I am done for the night...



---
Mike Jackson
mike _at_ bluequartz dot net





More information about the vtkusers mailing list