# Create shortcut to toggle editable intensity range

**URL:** <https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787>\
**Category:** Support\
**Created:** [October 20, 2022, 12:56am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787 "2022-10-20T00:56:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Shen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_shen/32/14411_2.png) [@Alex\_Shen](https://discourse.slicer.org/u/Alex_Shen)\
**Post date:** [October 20, 2022, 12:56am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/1 "2022-10-20T00:56:11Z")

</div>

Hi,  
I’m currently working on customising a few things to make segmentation in slicer faster.  
I want to customize a shortcut to toggle paint with an editable intensity range. e.g. when I press ALT while I paint, it will enable the intensity rage, and release to disable it.  
I find a helpful script about how to customize the shortcuts as follows:  
[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)

The question is how may I find the parameter name for Editable intensity range tick box? Will be appreciated if someone can point it out. Also will be more interested to know how you will find it out from either codebase or documents.

Thanks ahead.

---

<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:** [October 20, 2022, 1:11am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/2 "2022-10-20T01:11:38Z")

</div>

Not exactly what you were asking as far as how to find the parameter to set, but ‘i’ toggles intensity range on and off.

The holding of a key down to enable/disable is an interesting idea. I’m not sure if there are other tools that use that kind of modifier yet, but I think it should be doable?

---

<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:** [October 20, 2022, 1:18am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/3 "2022-10-20T01:18:30Z")

</div>

This is actually implemented in the C++ code, qMRMLSegmentEditorWidget.cxx, starting on line 3187.

(Sooner or later I gotta learn how to put pointers to the code in here…)

---

<div class="post-metadata">

**Author:** ![Alex\_Shen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_shen/32/14411_2.png) [@Alex\_Shen](https://discourse.slicer.org/u/Alex_Shen)\
**Post date:** [October 20, 2022, 1:19am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/4 "2022-10-20T01:19:53Z")

</div>

Thanks for pointing that out, it fits 90% of what I want to do.  
Didn’t find it in the shortcuts document here:  
[https://slicer.readthedocs.io/en/latest/user\_guide/user\_interface.html](https://slicer.readthedocs.io/en/latest/user_guide/user_interface.html)  
Think there are similar features like hold shift while dragging will pan the view etc.

---

<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:** [October 20, 2022, 1:22am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/5 "2022-10-20T01:22:58Z")

</div>

Shift will also center all slices to the pointed to location, useful if you’re pointing at something in 3D.

I _highly_ recommend getting a true 3-button mouse; middle button while dragging pans the view.

Also, if you’re about to do a lot of manual segmentation, a tablet may be a good investment. I have a Wacom intuos pro size medium with many miles on it. You can program the buttons on the pen and tablet to do various commands (paint, erase, islands, etc) and it can speed tasks up considerably.

---

<div class="post-metadata">

**Author:** ![Alex\_Shen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_shen/32/14411_2.png) [@Alex\_Shen](https://discourse.slicer.org/u/Alex_Shen)\
**Post date:** [October 20, 2022, 1:40am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/6 "2022-10-20T01:40:00Z")

</div>

> [@hherhold](#):
>
> This is actually implemented in the C++ code, qMRMLSegmentEditorWidget.cxx, starting on line 3187.

Thanks for pointing that out. Is there a way to define it using python API (purely because I know python only)? The script offers a way to set a shortcut via qt.Qshortcut, and gave an example of pointing and changing the parameter “BrushSphere”. Wondering how may I find the feature parameter name, e.g. editable intensity range, to replace “BrushSphere” here?

---

<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:** [October 20, 2022, 10:47am UTC](https://discourse.slicer.org/t/create-shortcut-to-toggle-editable-intensity-range/25787/7 "2022-10-20T10:47:51Z")

</div>

I’m not sure - I seem to remember that at the time (this was a little while ago…) this parameter was not exposed to python, but this might have changed. @lassoan, is this still the case or can you reach this now in python?
