[vtkusers] Splitting PolyData with vtkPolyDataConnectivityFilter

Will Schroeder will.schroeder at kitware.com
Tue Sep 3 16:23:19 EDT 2002

Hi Rene-

This is a very good question and I can see why you would want to do this.

What comes to mind is to modify the connectivity filter so that it provides 
additional information: cells in a certain region could be marked with the 
number of cells in that region. Then a threshold operation could be 
performed to extract the cells in regions that are big enough for your 
purposes. It looks like this would be really easy to add....there is 
already an array of sizes computed in the filter. It would just have to be 
sent to the output.

Another approach is to have the connectivity filter only output regions 
that are large enough based on a user-specified size.

I'm hoping that you can code this up (or find someone to do it); otherwise 
we'll put it on the list and add the feature when time permits.


At 08:52 PM 9/3/2002 +0200, Rene Tschirley wrote:
>Dear VTK experts,
>My application visualizes medical data (CT). After reading the slices and
>creating an isosurface with vtkImageMarchingCubes (e.g. bone surface) I'd
>like to drop all small regions which do not have at least 1% of the
>overall polygon number. vtkPolyDataConnectivity is able to do this, but
>my algorithm is terribly slow and I'd like to know if there's a better
>way for my purpose:
>  vtkPolyDataConnectivityFilter *connectFilter = 
> vtkPolyDataConnectivityFilter::New();
>  connectFilter->SetInput(mesh);
>  connectFilter->SetExtractionModeToAllRegions();
>  connectFilter->Update();
>  connectFilter->SetExtractionModeToSpecifiedRegions();
>  for (int i=0; i<connectFilter->GetNumberOfExtractedRegions(); i++)
>    {
>      connectFilter->AddSpecifiedRegion(i);
>      connectFilter->Update();
>      cerr << "Region " << i << " has " << 
> connectFilter->GetOutput()->GetNumberOfPolys() << " polys.\n";
>      // if region shall be dropped
>      if (1) connectFilter->DeleteSpecifiedRegion(i);
>    }
>Creating an isosurface with level 1200 on the head of the visible human
>female dataset creates about 170 regions. The speed of the code makes
>me believe that the ConnectivityFilter doesn't cache the connectivity
>information and neither checks if the input data has changed (and it has
>to recalculate the connectivities) nor if a change of the extraction mode
>makes recalculation neccessary. That would save me about 170 times the
>single calculation speed and would be great!
>Is there a way of creating a bunch of vtkPolyData objects, one for each
>objects, with a single cycle?
>Best regards,
>         René
>Dipl.-Inform. René Tschirley              http://www.cs.tu-berlin.de/~pooh
>TU Berlin, Computer Graphics and Computer Assisted Medicine research group

More information about the vtkusers mailing list