Create a new window with multiple slice views

Is it possible to create a new window with multiple slice views? This example shows how to create a single additional view, but I am attempting to create multiple additional views so I can display them on a separate monitor. I am assuming this requires some sort of creation of layoutNodes and the like, as is done in the qSlicerMainWindow. Is this correct, or is there a simpler way to acheive this functionality?
Thanks!

You’ll actually be interested in the concept of multiple viewports for a given layout which is specifically for the use case of multiple monitors. This is available using latest Slicer 5.3 Preview builds.

https://slicer.readthedocs.io/en/latest/developer_guide/advanced_topics.html#example-layout-containing-two-viewports

The associated PR that added this functionality:

Thanks so much @jamesobutler! This solution worked very well for me. Using the developer guide example you showed and the snippet below (modified from the compare volumes module), I was able to customize the layout of the second monitor view to fit my needs.

#customLayout is the user's custom XML string specifying the layout, as in the example above
# Built-in layout IDs are all below 100, so you can choose any large random number for your custom layout ID.
customLayoutId = 501
layoutManager = slicer.app.layoutManager()
layoutManager.layoutLogic().GetLayoutNode().AddLayoutDescription(customLayoutId, customLayout)
# Switch to the new custom layout
layoutManager.setLayout(customLayoutId)
1 Like