Fill holes in 3D model

Screen Shot 2020-09-16 at 11.44.10 AM

Hi all,

I would like to fill the holes in the 3D model using some sort of interpolation. How do I do it in 3DSlicer?

These are segmentations obtained from a deep learning algorithm for cardiac MR images. The myocardium should be continuous, devoid of these holes.

Thank you,
Anshro

Convex hull may fix the outer surface. You can get it by copy-pasting this code snippet to the Python console (replace mySurface with your model node’s name):

modelNode = getNode('mySurface')

convexHull = vtk.vtkDelaunay3D()
convexHull.SetInputData(modelNode.GetPolyData())
outerSurface = vtk.vtkGeometryFilter()
outerSurface.SetInputConnection(convexHull.GetOutputPort())
outerSurface.Update()
modelNode.SetAndObservePolyData(outerSurface.GetOutput())

You may then use Segment Editor, Logical operators, maybe Wrap Solidify effect to figure out a workflow for reconstructing the inner surface.

Hi Andras,

Thank you very much for the quick reply. I tried the method you suggested. The result is - Screen Shot 2020-09-16 at 6.30.22 PM

I want only the small holes to be filled and the myocardium should be hollow. Not a solid as shown above. Is there anything we can do about that. Screen Shot 2020-09-16 at 6.30.58 PM

Thanks again,
Anshro

Convex hull was just suggested as an initial step.

There are lots of tools in Segment Editor. If the holes are small then you can fill them using Smoothing effect - “Closing (fill holes)” method. You can also go full manual and fill the holes using Paint or Draw effects.

Is it possible to select a specific hole to fill while using Smoothing? Because there are some other inlets and outlets open in my model that I do not want to fill them.

Instead of applying global smoothing, you can use the smoothing brush:

Lassoan thanks for introducing very efficient way. I’m usimg slicer 4.11.20200930 and the “smoothing brush option” dose not show up!! what should I do to have it?any extension or…?

You need to use a more recent Slicer version.

1 Like

The slicer tool is very flexible. You can use different functions to achieve this effect by thinking about it. There are many tools in the segmentation.

I Installed a recent version and now I have access to brush option. when I choose smoothing and then brush option,Median smoothing method and finally kernel size of 5mm, the effect make hole instead of filling hole!!! In the video you sent it works correct and fills the holes. what is wrong with me?

i am working on Linux system. Maybe this is a bug for the linux system. please consider it.

Median means that each voxel is replaced by the median value of its neighborhood. Therefore, it can add or remove points - whatever makes the region smoother. If you want to fill holes, choose the fill holes option.