UCL / SkullBaseNavigation

Other
2 stars 1 forks source link

Buttons to change slice view #69

Open tdowrick opened 3 years ago

tdowrick commented 3 years ago

In GitLab by @ThomasDowrick on Jun 27, 2019, 12:06

Add buttons that will switch between the 2x2 view we have been using and a 3x3 view.

The default view is set in sbn_sliclet.py: self.layoutManager.setLayout( slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView)

One button that will call slicelet.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutThreeByThreeSliceView) to change to 3x3 view, and another button that will call slicelet.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView) to go back to the original 2x2 view.

tdowrick commented 3 years ago

In GitLab by @AnastasisGeorgoulas on Jul 5, 2019, 14:11

SlicerLayoutThreeByThreeSliceView does not include any 3D viewers, whereas we want (at least) 2 of them. The closest is SlicerLayoutDual3DView (see below).Screen_Shot_2019-07-05_at_15.08.12

We can create a custom layout (see here for description examples in XML, and here for how to use it). For now though, we can use the dual 3D view, at least to experiment.

tdowrick commented 3 years ago

In GitLab by @AnastasisGeorgoulas on Jul 5, 2019, 14:19

If we do decide to go with a custom layout, here is a way to get and pretty-print the description of the current (or any) layout:

import xml.dom.minidom

manager = slicer.app.layoutManager()  # if from slicelet, should be self.layoutManager() 
layout_id = manager.layout  # or change to desired ID

layout_node = slicer.mrmlScene.GetSingletonNode("vtkMRMLLayoutNode", "vtkMRMLLayoutNode")
dom = xml.dom.minidom.parseString(layout_node.GetLayoutDescription(layout_id))
print(dom.toprettyxml())
tdowrick commented 3 years ago

In GitLab by @AnastasisGeorgoulas on Jul 5, 2019, 16:32

mentioned in commit f63fd5982ca270e0b9b6ab2a5080518183e1f493