How to fill small holes in segmentations

Hi,

I’m having trouble filling the small voids in this model. I’ve tried using the “closing” operation as visualized in the photo, though it seems to have no effect. Does anyone know of alternative tools I could use here?

Thanks so much
Tom

Smoothing effect’s “closing” operation should work well, just make sure to reset masking settings (allow editing everywhere by turning off editable intensity range, etc.).

you can try margin effect , [shrink] and [grow]

1 Like

It’s true that morphological closing is closely related to shrinking and growing, but their order matters.

Closing: dilation (growing) followed by erosion (shrinking) - it fills holes. Opening: erosion followed by shrinking - it removes small extrusions.

2 Likes

you are right lasso
if only for exhibition,can use margin effect
it’s not appropriate for caculation

Try with greater kernel size… 12 … 18…

It will be a lengthy processing; you could save time using the sphere brush in slice views or 3D views. It should be doable.

1 Like

You’ve raised a very good point. If you want to use a very large kernel (20-30 pixels) then Smoothing effect’s Closing operation will be very slow. However, if you perform Margin effect’s grow operation and then shrink operation as @jay1987 suggested then you’ll get the same output as from a closing operation; but it will be hundreds of times faster (because margin effect uses a distance map instead of a kernel to dilate and erode).

The speed benefit of Margin’s Grow/Shrink is indeed confirmed.

However, the final result is less precise, please compare the second and third images below :

holes_0

holes_grow_shrink

holes_smoothing

The result should be about the same (maybe the boundary may differ by 1-2 voxels). Note that margin size (it is a radius) is half of the closing kernel size (it is a diameter).