# Fill holes after threshold-based bone segmentation in CT

**URL:** <https://discourse.slicer.org/t/fill-holes-after-threshold-based-bone-segmentation-in-ct/2478>\
**Category:** Support\
**Created:** [March 30, 2018, 6:16pm UTC](https://discourse.slicer.org/t/fill-holes-after-threshold-based-bone-segmentation-in-ct/2478 "2018-03-30T18:16:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alessandronavacchia](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alessandronavacchia](https://discourse.slicer.org/u/alessandronavacchia)\
**Post date:** [March 30, 2018, 6:16pm UTC](https://discourse.slicer.org/t/fill-holes-after-threshold-based-bone-segmentation-in-ct/2478/1 "2018-03-30T18:16:15Z")

</div>

Hi all,

I am segmenting the geometries of femur, tibia, fibula and patella from a CT scan using Threshold effect.  
What is the best tool to fill the holes inside the segmented cortical layer (see picture below)? I would like to export an .stl file with only the outside surface.

![Picture1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/0/7023df0ac4d20969f25f35c74d520e77c77e664c.png)

Where the cortical layer is thin (e.g. at the epiphysis) there are some gaps in the segmentation (see picture below). Are there smart ways to fill the holes accounting for those gaps without closing them manually?

 ![Picture2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/1/b189ce32be59e2685e9de0cd7862221fd8b3b4cb.png)

Thanks!

Alessandro

---

<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:** [March 31, 2018, 1:45am UTC](https://discourse.slicer.org/t/fill-holes-after-threshold-based-bone-segmentation-in-ct/2478/2 "2018-03-31T01:45:57Z")

</div>

If you are lucky then with “Smoothing” effect you can fill the gaps and then you can fill cavities using “Flood filling” effect (in SegmentEditorExtraEffects extension).

Unfortunately, often you cannot make your mesh watertight easily. In such cases, follow these instructions:

> [@Bone segmentation to create 3D-printable STL](https://discourse.slicer.org/t/how-to-edit-stl-file/960/2):
>
> In the STL that you linked, large portions of the bone is missing, so I don’t think it make sense to “fix” it. Instead, I would recommend to redo the segmentation. I would recommend to use the latest nightly version of Slicer and perform the following steps: reduce image noise: use Cast Scalar Volume' module to convert input volume to Float type; use Simple Filtersmodule withGradientAnisotropicDiffusionImageFilter` on the converted volume go to Segment Editor module, use the noise-reduced vol…

---

<div class="post-metadata">

**Author:** ![alessandronavacchia](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@alessandronavacchia](https://discourse.slicer.org/u/alessandronavacchia)\
**Post date:** [April 9, 2018, 8:07pm UTC](https://discourse.slicer.org/t/fill-holes-after-threshold-based-bone-segmentation-in-ct/2478/3 "2018-04-09T20:07:57Z")

</div>

Dear Andras,

thanks for your quick response. I was eventually able to fix the segmentation using the “Closing (fill holes)” tool in the “Smoothing” Module after some minimal manual painting. When few large holes were left inside the bone, I inverted the mask (“Logical operators” -\> “Invert”), removed the big islands one by one (“Islands” -\> “Remove selected islands”), and inverted the mask again.

I could not figure out how to fill the cavities with “Flood filling”…

Thanks for your help!

Alessandro
