# Functionality of Automatic Threshold Calculator

**URL:** <https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652>\
**Category:** Support\
**Created:** [September 13, 2021, 8:14pm UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652 "2021-09-13T20:14:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alyssan](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alyssan](https://discourse.slicer.org/u/alyssan)\
**Post date:** [September 13, 2021, 8:14pm UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652/1 "2021-09-13T20:14:48Z")

</div>

Hello, I was looking at this example:[Automatic endocranium segmentation from dry bone CT scan · GitHub](https://gist.github.com/lassoan/4d0b94bda52d5b099432e424e03aa2b1)  
I am interested in knowing how it computes the bone threshold automatically. I am trying to segment bone. Can this be used on any data?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [September 13, 2021, 8:33pm UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652/2 "2021-09-13T20:33:27Z")

</div>

It is in line 10 of the code (Otsu threshold method).  
There are many different types of automatic threshold calculation methods. Each with different assumption about the intensity distribution and/or how they model the data. You can interactively try one after the other and see which works best for your data.

---

<div class="post-metadata">

**Author:** ![alyssan](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alyssan](https://discourse.slicer.org/u/alyssan)\
**Post date:** [September 13, 2021, 8:48pm UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652/3 "2021-09-13T20:48:43Z")

</div>

okay, thanks. Where can I find these?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [September 13, 2021, 9:02pm UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652/4 "2021-09-13T21:02:22Z")

</div>

segment editor → Threshold effect -\>Automatic threshold

---

<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 14, 2021, 5:03am UTC](https://discourse.slicer.org/t/functionality-of-automatic-threshold-calculator/19652/5 "2021-09-14T05:03:03Z")

</div>

I’ve created this script before [SurfaceWrapSolidify extension](https://github.com/sebastianandress/Slicer-SurfaceWrapSolidify/#surface-wrap-solidify) existed. I would now recommend to use SurfaceWrapSolidify extension for automatic extraction of cavities inside a segmented bone, as it is more flexible, more robust, and more accurate. See detailed description [here](https://lassoan.github.io/SlicerSegmentationRecipes/CTSkullStripping/).
