diff --git a/BoneReconstructionPlanner/BoneReconstructionPlanner.py b/BoneReconstructionPlanner/BoneReconstructionPlanner.py
index 457dc97..1af2b63 100644
--- a/BoneReconstructionPlanner/BoneReconstructionPlanner.py
+++ b/BoneReconstructionPlanner/BoneReconstructionPlanner.py
@@ -260,6 +260,16 @@ def setup(self):
lockIconPath = os.path.join(os.path.dirname(__file__), 'Resources/Icons/lock_48.svg')
self.ui.lockVSPButton.setIcon(qt.QIcon(lockIconPath))
+ visibilityIconPath = os.path.join(os.path.dirname(__file__), 'Resources/Icons/visibility_48.svg')
+ self.ui.showMandiblePlanesToolButton.setIcon(qt.QIcon(visibilityIconPath))
+ self.ui.showMandiblePlanesToolButton.setIconSize(qt.QSize(24,24))
+ self.ui.showMandiblePlanesToolButton.setMinimumSize(24,24)
+
+ axesIconPath = os.path.join(os.path.dirname(__file__), 'Resources/Icons/axes.svg')
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.setIcon(qt.QIcon(axesIconPath))
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.setIconSize(qt.QSize(24,24))
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.setMinimumSize(24,24)
+
booleanOperationsIconPath = os.path.join(os.path.dirname(__file__), 'Resources/Icons/construction_48.svg')
self.ui.create3DModelOfTheReconstructionButton.setIcon(qt.QIcon(booleanOperationsIconPath))
self.ui.makeBooleanOperationsToFibulaSurgicalGuideBaseButton.setIcon(qt.QIcon(booleanOperationsIconPath))
@@ -366,8 +376,8 @@ def setup(self):
self.ui.showFibulaSegmentsLengthsCheckBox.connect('stateChanged(int)', self.updateParameterNodeFromGUI)
self.ui.showOriginalMandibleCheckBox.connect('stateChanged(int)', self.updateParameterNodeFromGUI)
self.ui.showBiggerSawBoxesInteractionHandlesCheckBox.connect('stateChanged(int)', self.updateParameterNodeFromGUI)
- self.ui.showMandiblePlanesInteractionHandlesCheckBox.connect('stateChanged(int)', self.onShowMandiblePlanesInteractionHandlesCheckBox)
- self.ui.showMandiblePlanesInteractionHandlesCheckBox_2.connect('stateChanged(int)', self.onShowMandiblePlanesInteractionHandlesCheckBox)
+ self.ui.showMandiblePlanesToolButton.connect('clicked(bool)', self.updateParameterNodeFromGUI)
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.connect('clicked(bool)', self.updateParameterNodeFromGUI)
self.ui.orientation3DCubeCheckBox.connect('stateChanged(int)', self.onOrientation3DCubeCheckBox)
self.ui.lightsRenderingComboBox.textActivated.connect(self.onLightsRenderingComboBox)
@@ -674,29 +684,46 @@ def updateGUIFromParameterNode(self, caller=None, event=None):
else:
self.ui.customTitaniumPlateGenerationCollapsibleButton.hide()
+
+ lockVSPChecked = self._parameterNode.GetParameter("lockVSP") == "True"
+
+ showMandiblePlanesChecked = self._parameterNode.GetParameter("showMandiblePlanes") == "True"
+ self.ui.showMandiblePlanesToolButton.checked = showMandiblePlanesChecked
+ self.setMandiblePlanesVisibility(showMandiblePlanesChecked)
+ showMandiblePlanesInteractionHandlesChecked = self._parameterNode.GetParameter("showMandiblePlanesInteractionHandles") == "True"
+ showMandiblePlanesInteractionHandles = (
+ showMandiblePlanesChecked and showMandiblePlanesInteractionHandlesChecked and
+ (not lockVSPChecked)
+ )
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.checked = (
+ showMandiblePlanesInteractionHandles
+ )
+ self.setMandiblePlanesInteractionHandlesVisibility(showMandiblePlanesInteractionHandles)
+ self.ui.showMandiblePlanesInteractionHandlesToolButton.enabled = (
+ showMandiblePlanesChecked and
+ (not lockVSPChecked)
+ )
+
+
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
mandibularPlanesFolder = shNode.GetItemByName("Mandibular planes")
mandibularPlanesList = createListFromFolderID(mandibularPlanesFolder)
- if self._parameterNode.GetParameter("lockVSP") == "True":
- self.logic.setInteractiveHandlesVisibilityOfMarkups(
- mandibularPlanesList,
- visibility=False
- )
- self.logic.setMarkupsListLocked(mandibularPlanesList,locked=True)
+ fibulaLine = self._parameterNode.GetNodeReference("fibulaLine")
+ mandibularCurve = self._parameterNode.GetNodeReference("mandibleCurve")
+ planningObjectsList = mandibularPlanesList + [fibulaLine,mandibularCurve]
+ if lockVSPChecked:
+ self.setMandiblePlanesVisibility(showMandiblePlanesChecked)
+ self.logic.setMarkupsListLocked(planningObjectsList,locked=True)
self.logic.removeMandiblePlaneObservers()
#
self.ui.lockVSPButton.checked = True
self.ui.parametersOfVSPFrame.enabled = False
self.ui.updateVSPButtonsFrame.enabled = False
self.ui.create3DModelOfTheReconstructionButton.enabled = False
-
else:
- self.logic.setInteractiveHandlesVisibilityOfMarkups(
- mandibularPlanesList,
- visibility=True
- )
- self.logic.setMarkupsListLocked(mandibularPlanesList,locked=False)
+ #self.setMandiblePlanesVisibility(True)
+ self.logic.setMarkupsListLocked(planningObjectsList,locked=False)
self.logic.removeMandiblePlaneObservers() # in case they already exist
self.logic.addMandiblePlaneObservers()
#
@@ -728,11 +755,6 @@ def updateGUIFromParameterNode(self, caller=None, event=None):
self.ui.showBiggerSawBoxesInteractionHandlesCheckBox.checked = showBiggerSawBoxesInteractionHandlesChecked
self.setBiggerSawBoxesInteractionHandlesVisibility(showBiggerSawBoxesInteractionHandlesChecked)
- showMandiblePlanesInteractionHandlesChecked = self._parameterNode.GetParameter("showMandiblePlanesInteractionHandles") == "True"
- self.ui.showMandiblePlanesInteractionHandlesCheckBox.checked = showMandiblePlanesInteractionHandlesChecked
- self.ui.showMandiblePlanesInteractionHandlesCheckBox_2.checked = showMandiblePlanesInteractionHandlesChecked
- self.setMandiblePlanesInteractionHandlesVisibility(showMandiblePlanesInteractionHandlesChecked)
-
# All the GUI updates are done
self._updatingGUIFromParameterNode = False
@@ -819,6 +841,14 @@ def updateParameterNodeFromGUI(self, caller=None, event=None):
self._parameterNode.SetParameter("useNonDecimatedBoneModelsForPreview","True")
else:
self._parameterNode.SetParameter("useNonDecimatedBoneModelsForPreview","False")
+ if self.ui.showMandiblePlanesToolButton.checked:
+ self._parameterNode.SetParameter("showMandiblePlanes","True")
+ else:
+ self._parameterNode.SetParameter("showMandiblePlanes","False")
+ if self.ui.showMandiblePlanesInteractionHandlesToolButton.checked:
+ self._parameterNode.SetParameter("showMandiblePlanesInteractionHandles","True")
+ else:
+ self._parameterNode.SetParameter("showMandiblePlanesInteractionHandles","False")
if self.ui.checkSecurityMarginOnMiterBoxCreationCheckBox.checked:
self._parameterNode.SetParameter("checkSecurityMarginOnMiterBoxCreation","True")
else:
@@ -859,12 +889,6 @@ def updateParameterNodeFromGUI(self, caller=None, event=None):
self._parameterNode.EndModify(wasModified)
- def onShowMandiblePlanesInteractionHandlesCheckBox(self, checked):
- if checked:
- self._parameterNode.SetParameter("showMandiblePlanesInteractionHandles", "True")
- else:
- self._parameterNode.SetParameter("showMandiblePlanesInteractionHandles", "False")
-
def onLightsRenderingComboBox(self, text):
lightsLogic = slicer.modules.lights.widgetRepresentation().self().logic
viewNodesList = slicer.util.getNodesByClass("vtkMRMLViewNode")
@@ -972,6 +996,15 @@ def setBiggerSawBoxesInteractionHandlesVisibility(self, visibility):
displayNode = sawBoxesPlanesList[i].GetDisplayNode()
displayNode.SetHandlesInteractive(visibility)
+ def setMandiblePlanesVisibility(self, visibility):
+ shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
+ mandibularPlanesFolder = shNode.GetItemByName("Mandibular planes")
+ mandibularPlanesList = createListFromFolderID(mandibularPlanesFolder)
+
+ for i in range(len(mandibularPlanesList)):
+ displayNode = mandibularPlanesList[i].GetDisplayNode()
+ displayNode.SetVisibility(visibility)
+
def setMandiblePlanesInteractionHandlesVisibility(self, visibility):
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
mandibularPlanesFolder = shNode.GetItemByName("Mandibular planes")
@@ -1073,6 +1106,8 @@ def setDefaultParameters(self, parameterNode):
parameterNode.SetParameter("showOriginalMandible","False")
if not parameterNode.GetParameter("showBiggerSawBoxesInteractionHandles"):
parameterNode.SetParameter("showBiggerSawBoxesInteractionHandles","False")
+ if not parameterNode.GetParameter("showMandiblePlanes"):
+ parameterNode.SetParameter("showMandiblePlanes","True")
if not parameterNode.GetParameter("showMandiblePlanesInteractionHandles"):
parameterNode.SetParameter("showMandiblePlanesInteractionHandles","True")
if not parameterNode.GetParameter("lockVSP"):
@@ -1404,7 +1439,8 @@ def setInteractiveHandlesVisibilityOfMarkups(self,markupsList,visibility):
def setMarkupsListLocked(self,markupsList,locked):
for i in range(len(markupsList)):
- markupsList[i].SetLocked(locked)
+ if markupsList[i] is not None:
+ markupsList[i].SetLocked(locked)
def addMandiblePlaneObservers(self):
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
diff --git a/BoneReconstructionPlanner/Resources/Icons/axes.svg b/BoneReconstructionPlanner/Resources/Icons/axes.svg
new file mode 100644
index 0000000..2568e4e
--- /dev/null
+++ b/BoneReconstructionPlanner/Resources/Icons/axes.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/BoneReconstructionPlanner/Resources/Icons/visibility_48.svg b/BoneReconstructionPlanner/Resources/Icons/visibility_48.svg
new file mode 100644
index 0000000..704e443
--- /dev/null
+++ b/BoneReconstructionPlanner/Resources/Icons/visibility_48.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/BoneReconstructionPlanner/Resources/UI/BoneReconstructionPlanner.ui b/BoneReconstructionPlanner/Resources/UI/BoneReconstructionPlanner.ui
index 768ae8d..8dcff95 100644
--- a/BoneReconstructionPlanner/Resources/UI/BoneReconstructionPlanner.ui
+++ b/BoneReconstructionPlanner/Resources/UI/BoneReconstructionPlanner.ui
@@ -7,7 +7,7 @@
0
0
686
- 3625
+ 3456
@@ -574,11 +574,63 @@
-
-
-
- Show mandible planes interaction handles
+
+
+ QLayout::SetMaximumSize
-
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Mandible planes
+
+
+
+ -
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
-