# How to Modify the Default Threshold Values in Segment Editor for Custom Segmentation?

**URL:** <https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [December 17, 2024, 11:54am UTC](https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727 "2024-12-17T11:54:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![VirOrange](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/virorange/32/77989_2.png) [@VirOrange](https://discourse.slicer.org/u/VirOrange)\
**Post date:** [December 17, 2024, 11:54am UTC](https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727/1 "2024-12-17T11:54:44Z")

</div>

Operating system:win11  
Slicer version:5.6.2

Hello everyone,

I’m working on developing a custom module in Slicer and started by modifying existing components. In the **Segment Editor** module, I would like to modify the **Threshold adjustment** functionality to set a specific default threshold range, such as for **skull segmentation**.

Specifically, I want to set the default threshold values (e.g., Hounsfield unit range for the skull) so that when performing segmentation, the values are pre-set and there’s no need to manually adjust them every time. This way, the default values can be used directly for segmentation tasks.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/4/84fd59f023d517dbd974269094459362c0a5cca0.jpeg)

My questions are:

1. Is this modification possible?
2. Do I need to re-engineer the whole Slicer software, or can this be done by modifying the relevant Python scripts or configuration files?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 18, 2024, 3:29pm UTC](https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727/2 "2024-12-18T15:29:55Z")

</div>

I think you can do this all from Python (`.slicerrc.py` or in your own module’s initialization).

Each Segment Editor has its own effects, and each effect has their parameters. Look at here for example to see how a parameter can be changed:  
[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#create-keyboard-shortcut-for-toggling-sphere-brush-for-paint-and-erase-effects](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#create-keyboard-shortcut-for-toggling-sphere-brush-for-paint-and-erase-effects)  
And you can see which parameters to set here:

> <https://github.com/Slicer/Slicer/blob/main/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorEffects/SegmentEditorThresholdEffect.py#L371-L372>

---

<div class="post-metadata">

**Author:** ![VirOrange](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/virorange/32/77989_2.png) [@VirOrange](https://discourse.slicer.org/u/VirOrange)\
**Post date:** [December 25, 2024, 12:28am UTC](https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727/3 "2024-12-25T00:28:20Z")

</div>

if i modify the maximum thresold, does it means i need to compile slicer again?

---

<div class="post-metadata">

**Author:** ![VirOrange](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/virorange/32/77989_2.png) [@VirOrange](https://discourse.slicer.org/u/VirOrange)\
**Post date:** [December 25, 2024, 2:40am UTC](https://discourse.slicer.org/t/how-to-modify-the-default-threshold-values-in-segment-editor-for-custom-segmentation/40727/4 "2024-12-25T02:40:38Z")

</div>

I tried compiling again, and it worked. Thank you so much for your quick response; it was really helpful. Thank you!!!
