Remove small artifacts from 3d model

Hello,

I reconstructed a 3d model of prostate glands from histological slides by marching cubes algorithm. In my model I have a lot of small contours that i do not want to have in the model. Is there a way (e.g. a vtk filter) to extract these contours by setting a minimum size for these contours? Similar to the vtkConnectivityFilter where you can extract the largest region!?

Thanks a lot in advance.

Regards Michael

The Islands effect in Segment Editor can do this, here’s the code:

Is there a good reason for using low-level VTK functions instead of Segment Editor? You’re using Slicer I assume so why not use its features?