I would like to print the background scalarVolume value where the crosshair is when it is repositioned with Shift key.
Here is my code, it doesn’t work:
def probeBackgroundVolumeOverMouse(): infoWidget = slicer.modules.DataProbeInstance.infoWidget if infoWidget.layerValues['B'].text == '': return # cleanedTextOfDataProbe = infoWidget.layerValues['B'].text.split('<b>').split('</b>') # if cleanedTextOfDataProbe.isdecimal(): print(cleanedTextOfDataProbe) elif cleanedTextOfDataProbe[1:].isdecimal(): print(cleanedTextOfDataProbe) shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence('Shift')) #this doesn't work #shortcut.setKey(qt.QKeySequence('.')) #this does work shortcut.activated.connect(probeBackgroundVolumeOverMouse)
I guess there is some conflict because the Shift key is already used.
Really I’m just trying to get the value of the scalarVolume where the crosshair is. This is the first method that came to my mind but others are welcomed. Although retrieving the value using the Shift key is very important so it keeps it simple for the user.