# Python Library for Local Threshold Effect

**URL:** <https://discourse.slicer.org/t/python-library-for-local-threshold-effect/12345>\
**Category:** Development\
**Created:** [July 2, 2020, 6:30pm UTC](https://discourse.slicer.org/t/python-library-for-local-threshold-effect/12345 "2020-07-02T18:30:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vertebra](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vertebra/32/7475_2.png) [@vertebra](https://discourse.slicer.org/u/vertebra)\
**Post date:** [July 2, 2020, 6:30pm UTC](https://discourse.slicer.org/t/python-library-for-local-threshold-effect/12345/1 "2020-07-02T18:30:33Z")

</div>

In Python through slicer, is there a way to run the local threshold effect like the following pseudocode?

set feature size to 6.000 mm  
set threshold range to 245.00 to 1003.00  
set type to grow cut  
segment = point.localThreshold()

Thank you!

---

<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:** [July 2, 2020, 7:35pm UTC](https://discourse.slicer.org/t/python-library-for-local-threshold-effect/12345/2 "2020-07-02T19:35:36Z")

</div>

You need to set the effect parameters and then call [`apply(ijkPoints)`](https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/SegmentEditorLocalThreshold/SegmentEditorLocalThresholdLib/SegmentEditorEffect.py#L309). These examples should help with the details: [https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How\_to\_run\_segment\_editor\_effects\_from\_a\_script](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_run_segment_editor_effects_from_a_script)
