This has been observed with Slicer 4.11 nightly. When a slicelet is launched such that the mainWindow is hidden, (the .bat includes --no-main-window argument). I load in a 3D volume, and the red, yellow, and green slice views in the slicelet display this volume node. I can use the slider to go through each slice, but it if I try mouse events, as in moving the mouse wheel, clicking on volume to translate, or zoom in and out, I don’t see any response from the slice widget. Similarly when I try to view slice intersections (SetSliceIntersectionVisiblity(1)
), I don’t observe the slice intersections in any of the slice widgets. Interestingly, I observe the intersections, if I launch the script with the mainWindow displayed as well. Also, if I utilize sliceViewInteractorStyle
to setActionEnabled(interactor_style.BrowseSlice, True), I’m able to observe the response to mouse wheel events. Again if I launch the slicelet with --no-main-window, then the same commands, to set BrowseSlice action enabled, don’t evoke a response on mouse wheel events.
I don’t observe this issue in stable release.
A simple way to recreate would be to set up a slicelet using the code provided here, (with layout set as slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView
instead). I ran the slicelet using a .bat with the following lines:
@echo off
"C:\Program Files\Slicer 4.11.0\Slicer.exe" --python-code "import MainWidget;" --no-splash --no-main-window --show-python-interactor
pause
Upon display of slicelet, I then load in volume using “Load Data” button click. I loaded in .MHA 3D volume, and then tried to evoke response using mouse events in red/yellow/green slice view, but couldn’t get any response. Also at one point, I think I saw these events working, but then as soon as I displayed the volume in red slice onto 3D view, I didn’t get see any response.
I noticed there was a recent commit regarding using widgets for showing slice intersections. Do any updates have to be made for slice widget/layouts in slicelets, in order to view slice intersections and maintain mouse event response?
MainWidget.py contained the same code except for the following differences:
Top of file prior to def onModuleSelected(modulename):
contains the following lines:
import qt
import main
from main import qt, slicermainWidget = qt.QWidget()
mainWidget.objectName = “qSlicerAppMainWindow”
vlayout = qt.QVBoxLayout()
mainWidget.setLayout(vlayout)def onModuleSelected(modulename):
And this line was modified from layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView)
to
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView)