Add all nodes to custom module gui

I would like to enable the user of a custom python module to look at all the volume nodes at once, rather than selecting them using a qMRMLComboBox to select them individually. In addition, I would like to allow them to click on the “eye” icon, like in the subject hierarchy of the data module, to render the selected volume node in the slice panes. Does a widget exist for this? If not, it doesn’t need to be exactly the same–it just needs to be able to show all volume names simultaneously and load them on an icon click. I included the picture of what I’m referencing in case it helps. Any help with this task would be greatly appreciated!

1 Like

Hi–I want to make sure I provide all necessary information for this question. Is there anything else I should add that would help provide full context to this topic? Thank you again for your support!

subject_hierarchy_table_view = slicer.qMRMLSubjectHierarchyTreeView()
subject_hierarchy_table_view.setMRMLScene(slicer.mrmlScene)  # As a mrml widget, set the mrml scene
subject_hierarchy_table_view.nodeTypes = ["vtkMRMLScalarVolumeNode"]  # limit to just Scalar Volume Nodes
subject_hierarchy_table_view.show()  # show this example widget

If you are using Qt Designer to create your UI, if you launch Slicer with the Designer arg (./Slicer.exe --designer) it will open Qt Designer with the Slicer custom widgets included. Then you can add a qMRMLSubjectHierarchyTreeView to your UI and inspect all the available options through a GUI interface.