Hotkeys of segment editor for numbers 1,2,… ,9,0 work but the ones with shift +1,2,3…0 (to select effects 11 12… 20 as the documentation says) does not work, tried on slicer 4.10.1 4.10.2 and 4.11 and two different computers, is there something i’m doing wrong or was it disabled? thanks
I’ve just tried Shift+number shortcuts and they works well for me on Windows. What operating system do you use?
Maybe Shift+number keys are not reliably detected as keyboard shortcuts on all platforms. You can define your custom key combinations by customizing then copying the code below to your .slicerrc.py file:
editor = slicer.modules.segmenteditor.widgetRepresentation().self().editor shortcuts = [ ('Ctrl+b', lambda: editor.setActiveEffectByName('Surface cut')), ('Ctrl+n', lambda: editor.setActiveEffectByName('Fast Marching')), ] for (shortcutKey, callback) in shortcuts: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(shortcutKey)) shortcut.connect( 'activated()', callback)
This worked perfectly, only difference being it doesen’t switch back and forth between the effect and “none” when pressed twice like the predefined ones but does the trick, interestingly, shift+letter works fine and ctrl+number as well but shift+ number does not (maybe because it is already assigned to changing the effects)
i tried on both windows 10 and windows 7.
Thanks a lot, that will save me quite some time!!
You can call a custom function (instead of
setActiveEffectByName directly) that checks which effect is active and if the selected effect is already active then it deactivates it.