Create shortcut to toggle editable intensity range

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

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.

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?

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…)

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
Think there are similar features like hold shift while dragging will pan the view etc.

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.

1 Like

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?

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?