# New Segment Editor effect: Local threshold

**URL:** <https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233>\
**Category:** Support\
**Tags:** feature, segmentation\
**Created:** [November 20, 2019, 5:01pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233 "2019-11-20T17:01:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [November 20, 2019, 5:01pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/1 "2019-11-20T17:01:15Z")

</div>

Local threshold, a new semi-automatic segmentation method, has been added to the Segment Editor. It is available in both the 4.11.0 and 4.10.2 releases through the SegmentEditorExtraEffects extension. This effect adds connected voxels to segments that are within a specified threshold, and attempts to prevent leaks into other structures through small connecting regions. The result is similar to that of the “Level trace” effect in that it delineates a region within a certain threshold value, however this effect is applied in 3D.

The initial behavior is similar to the threshold effect. Users can specify a threshold range manually, or by drawing on the image to create a histogram (see info [here](https://discourse.slicer.org/t/new-feature-histogram-for-setting-threshold-range-in-segment-editor/9221)). Instead of clicking “Apply”, CTRL+clicking on a specific region performs a flood fill using one of 3 algorithms, adding the structure to the current segment:

- Masking
- GrowCut
- WaterShed

Two additional parameters are also available to prevent leaks:

- Feature size: Used to separate structures that are connected by regions smaller than the size specified
- ROI: Only voxels within the region of interest will be filled

Suggestions and feedback are welcome.

Development was funded in part by CANARIE’s Research Software Program, OpenAnatomy, and Brigham and Women’s Hospital through NIH grant R01MH112748.

---

<div class="post-metadata">

**Author:** ![sarvpriya1985](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sarvpriya1985/32/4094_2.png) [@sarvpriya1985](https://discourse.slicer.org/u/sarvpriya1985)\
**Post date:** [November 28, 2019, 2:52pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/2 "2019-11-28T14:52:00Z")

</div>

Hi,

I found it a very nice feature. However, while trying to use it, i found that after selecting a threshold and ctrl plus left click-it doesn’t do anything. I mean no filling is done. Is there anything I am missing?

Thanks,  
Sarv

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [November 28, 2019, 3:23pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/3 "2019-11-28T15:23:43Z")

</div>

Local threshold effect attempts to reduce leaking and separates the structure that you clicked on by eroding the thresholded area by the “feature size” parameter.

If the area under the mouse would be eroded away, then the local threshold effect will not find the structure. If you reduce the “feature size” parameter, or make sure to click in a non-eroded region, than it should help find the structure.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [May 9, 2020, 1:51pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/4 "2020-05-09T13:51:58Z")

</div>

Late reply and perhaps this is documented somewhere else, but on MacOS it is command-click to add, not control-click.

Most excellent feature, by the way. Thanks!

---

<div class="post-metadata">

**Author:** ![sfglio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfglio/32/3346_2.png) [@sfglio](https://discourse.slicer.org/u/sfglio)\
**Post date:** [June 25, 2020, 4:44pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/5 "2020-06-25T16:44:07Z")

</div>

I still don’t succeed on MacOS:  
After selecting the right threshold and after I click cmd+left mouse button it does not add the blinking area to the segmentation?  
anyone has a solution for that behaviour?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [June 25, 2020, 5:01pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/6 "2020-06-25T17:01:45Z")

</div>

Did you try it with a sample data download like from the video?

---

<div class="post-metadata">

**Author:** ![sfglio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfglio/32/3346_2.png) [@sfglio](https://discourse.slicer.org/u/sfglio)\
**Post date:** [June 25, 2020, 7:58pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/7 "2020-06-25T19:58:00Z")

</div>

Yes! But I don’t get it: pressing cmd+left click (I assume mouse left click) - where (in which window) and when should I press these buttons???

e.g if I use level tracing than I just need to left-click on the mouse and I immediately see the segmented area - however in local threshold the region is getting lighter and darker green constantly but if I press cmd+left click nothing happens…

 ![Bildschirmfoto 2020-06-25 um 21.54.49](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/2/22141b7923c3bb337dbf1d8dfe99f0c5584e5705.png)

---

<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:** [June 25, 2020, 8:34pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/8 "2020-06-25T20:34:07Z")

</div>

That part that you Ctrl-Click on is added to the segment. If nothing is added then it means that the region found at the clicked position is smaller than the feature size. You need to extend the threshold range or decrease “Feature size”.

---

<div class="post-metadata">

**Author:** ![sfglio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfglio/32/3346_2.png) [@sfglio](https://discourse.slicer.org/u/sfglio)\
**Post date:** [June 26, 2020, 8:37am UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/9 "2020-06-26T08:37:18Z")

</div>

In the meantime I accidentially! managed to add a part to the segment, however repeating fails…no matter what feature size I choose (1-10cm) for my threshold, I can’t segment the implant.

 ![Bildschirmfoto 2020-06-26 um 10.34.55](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/3/03056cca488f6fb42aaa3ecd07c2b9abb885c025.png)

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [June 26, 2020, 2:19pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/10 "2020-06-26T14:19:07Z")

</div>

Have you tried lowering the feature size all the way to 0?

---

<div class="post-metadata">

**Author:** ![sfglio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfglio/32/3346_2.png) [@sfglio](https://discourse.slicer.org/u/sfglio)\
**Post date:** [June 28, 2020, 7:52pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/11 "2020-06-28T19:52:47Z")

</div>

Thanks for this hint! now it works very smooth!

I want to most accurately segment the implants (as shown in the figure above) in order to measure the blooming artefact - which algorithm would be the one of choice?  
e.g. after using watershed, creating a labelmap and superimposing it with the original scan -\> I still can see a thin (white/greyish) border around my segmented implant before the adjacent black circle.  
Or would you recommend any other algorithm in order to measure blooming?

---

<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:** [June 28, 2020, 8:15pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/12 "2020-06-28T20:15:53Z")

</div>

The “difference” is probably not real, it is probably just a result of using linear interpolation for grayscale volumes and nearest neighbor interpolation for segmentation’s binary labelmap representation. You can verify this by disabling interpolation for the volume. You can reduce the difference between these interpolations by reducing the pixel spacing of the input volume (for example, by using Crop volume module) before you start segmentation.

---

<div class="post-metadata">

**Author:** ![doc-xie](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@doc-xie](https://discourse.slicer.org/u/doc-xie)\
**Post date:** [August 12, 2020, 7:15am UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/13 "2020-08-12T07:15:50Z")

</div>

Hi Kyle Sunderland,  
A very nice function in Local Threshold. But I found it is difficult to understand clearly.How to define the Minimum, Lower, Average, Upper and Maximum value in Local histogram? What the meaning about the red line, yellow line and the curve between them? Moreover, how to set the Feature Size basing on the Volume?  
Thanks,  
Dr.Xie

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [August 12, 2020, 2:26pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/14 "2020-08-12T14:26:59Z")

</div>

The histogram represents the voxel intensities within the selected region of the image. The red lines on the left and right represent the minimum and maximum voxel intensities in the selected region, while the the the yellow line represents the average intensity. The yellow highlight underneath the histogram shows the current threshold range.

Clicking and dragging on the histogram will let you manually specify the minimum/maximum intensities. The average then becomes the median intensity between the two. Right clicking on the histogram will cancel the manual selection.

If you would like finer control over the threshold range, the threshold range slider can be used without, or in conjunction with the histogram to specify the range.

The required feature size depends on the structure being segmented. A larger feature sizes will prevent leaking through regions that are smaller than the feature size, however for thin structures, a feature size that is larger than the thinnest regions will result in the branches being truncated.

---

<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:** [August 12, 2020, 2:49pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/15 "2020-08-12T14:49:45Z")

</div>

@Sunderlandkyl This is an excellent summary! It would be great if you could add that to [https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/README.md](https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/README.md) (maybe with an additional annotated screenshot). This documentation will be moved to Slicer core documentation when the effect is moved into the Slicer core.

---

<div class="post-metadata">

**Author:** ![Henry\_Cope](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/henry_cope/32/6945_2.png) [@Henry\_Cope](https://discourse.slicer.org/u/Henry_Cope)\
**Post date:** [August 24, 2020, 1:45pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/16 "2020-08-24T13:45:01Z")

</div>

Hi, I’m trying to use this effect as it is used in your video, but I’m unable to draw a region in the image to obtain a local histogram, nor do I have the local histogram graph visible. Did I somehow not install the correct extension? This is what my control panel looks like:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/e/de771c8fc27a9f0fc61e67f41e04c43e093fd98d.png)

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [August 24, 2020, 1:51pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/17 "2020-08-24T13:51:40Z")

</div>

@Henry_Cope which version of Slicer are you using? The Histogram is not available in Slicer 4.10.2.

---

<div class="post-metadata">

**Author:** ![Henry\_Cope](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/henry_cope/32/6945_2.png) [@Henry\_Cope](https://discourse.slicer.org/u/Henry_Cope)\
**Post date:** [August 24, 2020, 1:52pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/18 "2020-08-24T13:52:26Z")

</div>

Ah then that’s the issue! I’m using 4.10.2.  
Thank you

---

<div class="post-metadata">

**Author:** ![Fadilalat](https://avatars.discourse-cdn.com/v4/letter/f/dec6dc/32.png) [@Fadilalat](https://discourse.slicer.org/u/Fadilalat)\
**Post date:** [September 28, 2020, 1:28pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/19 "2020-09-28T13:28:28Z")

</div>

Hi! I’m new to slicer and an amateur in this field. But I would like to download the local threshold effect into my slicer (4.10.2). I’ve tried, but I can’t seem to figure it out. Could you maybe help?

Thankyou in advance!

---

<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 28, 2020, 1:33pm UTC](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233/20 "2020-09-28T13:33:35Z")

</div>

It is available for Slicer-4.11 version only.

[Next page](https://discourse.slicer.org/t/new-segment-editor-effect-local-threshold/9233.md?page=2)
