I’m not sure what you mean by “intersection planes view”. You can show/hide slice planes and change volume rendering settings.
You can add keyboard shortcut at Qt level or add an observer to the keypress event to each 3D viewer’s interactor (you can search for vtk.vtkCommand.KeyPressEvent for examples; or use a scripted displayable manager to capture keyboard events).
How do I clear out the renderings to switch to another rendering? I can switch from the opacity rendering to the MIP, but not from the MIP to any other rendering. I think if I can reset or clear the MIP first, it might work. How do I clear out the rendering?
Hello JC, I’m seeing that I can’t set the 3D view to display MIPS or 3D rendering with the SlicerQREADS build. But when I run the SlicerQREADS module inside of the Slicer app, I can perform the 3D render with my Python changes. Did you remove this capability from SlicerQREADS?
Thanks
jcfr
(Jean Christophe Fillion Robin (Kitware))
163
Did you remove this capability from SlicerQREADS?
Since MIP was not part of the requirements, the VolumeRendering module providing the functionality has been disabled:
@spycolyf I believe you are looking for the following example in the Slicer Script repository titled Show slice views in 3D window. You had posted previously an image (seen below) which was detailing volume rendering being shown at the same time as Slice views showing in the 3D View.
.
Whenever the user zooms and pans, and then pushes the EnableWLButton to window/level, the zoom and pan resets forcing the user to zoom and pan all over again. The code that causes this is…
self._parameterNode.SetParameter("WindowLevelEnabled", "true" if self.ui.EnableWLButton.checked else "false")
How do I use the WL widget without resetting the zoom and pan?
Yes, that;s true. Slicer does not have this issue. However @jcfr implements many if the UI actions using the self._parameterNode.SetParameter function and each of them reset my views, Here are all of those features that use the self._parameterNode.SetParameter function, each resetting my views…
self._parameterNode.SetParameter("ReferenceMarkersVisible", "true" if self.ui.ShowReferenceMarkersButton.checked else "false")
self._parameterNode.SetParameter("SlabEnabled", "true" if slabEnabled else "false")
self._parameterNode.SetParameter("SlabMode", QReadsLogic.slabModeToString(self.slabModeButtonGroup.checkedId()))
self._parameterNode.SetParameter("SlabThicknessInMm", str(self.ui.SlabThicknessSliderWidget.value))
self._parameterNode.SetParameter("InverseGray", "true" if self.ui.InverseGrayButton.checked else "false")
self._parameterNode.SetParameter("Zoom", self.ui.ZoomComboBox.currentText)
self._parameterNode.SetParameter("OrientationMarkerType",
str(slicer.util.getNodesByClass('vtkMRMLAbstractViewNode')[0].GetOrientationMarkerType()))
self._parameterNode.SetParameter("RulerVisible", "true" if self.ui.RulerVisibleButton.checked else "false")
self._parameterNode.SetParameter("OrientationMarkerType", str(nextOrientationMarkerType))
def setParameterNode(self, inputParameterNode):
"""
Set and observe parameter node.
Observation is needed because when the parameter node is changed then the GUI must be updated immediately.
"""
if inputParameterNode:
self.logic.setDefaultParameters(inputParameterNode)
# Unobserve previously selected parameter node and add an observer to the newly selected.
# Changes of parameter node are observed so that whenever parameters are changed by a script or any other module
# those are reflected immediately in the GUI.
if self._parameterNode is not None:
self.removeObserver(self._parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromParameterNode)
self._parameterNode = inputParameterNode
if self._parameterNode is not None:
self.addObserver(self._parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromParameterNode)
# Initial GUI update
self.updateGUIFromParameterNode()
This two functions or calls may have something to do with the causes of view-reset you are looking for:
centerSlice
sliceLogic.FitSliceToAll()
I started looking for keywords in code as reset and found that. I also looked for ‘sliceLogic’ mentions as it may be related to the cause of your problem.
OK, thanks @mau_igna_06, I’ll have a look at that. But since only self._parameterNode.SetParameter calls cause this slice view reset behavior, I’m suspecting it’s the setParameterNode function causing it.
Have a look…
Each of the following calls reset the views…
self._parameterNode.SetParameter("ReferenceMarkersVisible", "true" if self.ui.ShowReferenceMarkersButton.checked else "false")
self._parameterNode.SetParameter("SlabEnabled", "true" if slabEnabled else "false")
self._parameterNode.SetParameter("SlabMode", QReadsLogic.slabModeToString(self.slabModeButtonGroup.checkedId()))
self._parameterNode.SetParameter("SlabThicknessInMm", str(self.ui.SlabThicknessSliderWidget.value))
self._parameterNode.SetParameter("InverseGray", "true" if self.ui.InverseGrayButton.checked else "false")
self._parameterNode.SetParameter("Zoom", self.ui.ZoomComboBox.currentText)
self._parameterNode.SetParameter("OrientationMarkerType",
str(slicer.util.getNodesByClass('vtkMRMLAbstractViewNode')[0].GetOrientationMarkerType()))
self._parameterNode.SetParameter("RulerVisible", "true" if self.ui.RulerVisibleButton.checked else "false")
self._parameterNode.SetParameter("OrientationMarkerType", str(nextOrientationMarkerType))
Do you think the following function is the culprit? It does a removeObserver followed by an add observer
def setParameterNode(self, inputParameterNode):
"""
Set and observe parameter node.
Observation is needed because when the parameter node is changed then the GUI must be updated immediately.
"""
if inputParameterNode:
self.logic.setDefaultParameters(inputParameterNode)
# Unobserve previously selected parameter node and add an observer to the newly selected.
# Changes of parameter node are observed so that whenever parameters are changed by a script or any other module
# those are reflected immediately in the GUI.
if self._parameterNode is not None:
self.removeObserver(self._parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromParameterNode)
self._parameterNode = inputParameterNode
if self._parameterNode is not None:
self.addObserver(self._parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromParameterNode)
# Initial GUI update
self.updateGUIFromParameterNode()