# Fill holes in 3D model

**URL:** <https://discourse.slicer.org/t/fill-holes-in-3d-model/13508>\
**Category:** Support\
**Tags:** 3d-model\
**Created:** [September 16, 2020, 6:52pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508 "2020-09-16T18:52:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ru6928](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@ru6928](https://discourse.slicer.org/u/ru6928)\
**Post date:** [September 16, 2020, 6:52pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/1 "2020-09-16T18:52:25Z")

</div>

![Screen Shot 2020-09-16 at 11.44.10 AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/e/3e53a0d3c9865c759fc126d6d9d480c6a9fb970a.png)

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 16, 2020, 8:07pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/2 "2020-09-16T20:07:47Z")

</div>

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):

```python
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](https://github.com/sebastianandress/Slicer-SurfaceWrapSolidify) to figure out a workflow for reconstructing the inner surface.

---

<div class="post-metadata">

**Author:** ![ru6928](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@ru6928](https://discourse.slicer.org/u/ru6928)\
**Post date:** [September 16, 2020, 10:36pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/3 "2020-09-16T22:36:30Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/0/10ec068de32fa7e091e0e1cd535d34ed21a7854c.png)

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](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/0/f0abb6d327bee2e45c77ac750de84734a7e56cbf.png)

Thanks again,  
Anshro

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 17, 2020, 2:56am UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/4 "2020-09-17T02:56:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hamid](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Hamid](https://discourse.slicer.org/u/Hamid)\
**Post date:** [April 15, 2021, 4:49pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/5 "2021-04-15T16:49:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 15, 2021, 9:17pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/6 "2021-04-15T21:17:21Z")

</div>

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

[![](https://img.youtube.com/vi/rjNcvefBaNU/maxresdefault.jpg "Segmentation smoothing brush - new segmentation tool in 3D Slicer") ](https://www.youtube.com/watch?v=rjNcvefBaNU)

---

<div class="post-metadata">

**Author:** ![Hamid](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Hamid](https://discourse.slicer.org/u/Hamid)\
**Post date:** [April 27, 2021, 8:40pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/7 "2021-04-27T20:40:09Z")

</div>

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…?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 27, 2021, 10:23pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/8 "2021-04-27T22:23:01Z")

</div>

You need to use a more recent Slicer version.

---

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [April 28, 2021, 12:28am UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/9 "2021-04-28T00:28:47Z")

</div>

> [@lassoan](#):
>
> 用“绘画”或“绘制”效果填充孔。

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.

---

<div class="post-metadata">

**Author:** ![Hamid](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Hamid](https://discourse.slicer.org/u/Hamid)\
**Post date:** [April 29, 2021, 12:32pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/10 "2021-04-29T12:32:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Hamid](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Hamid](https://discourse.slicer.org/u/Hamid)\
**Post date:** [April 29, 2021, 4:13pm UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/11 "2021-04-29T16:13:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 30, 2021, 2:29am UTC](https://discourse.slicer.org/t/fill-holes-in-3d-model/13508/12 "2021-04-30T02:29:15Z")

</div>

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.
