How to get current volume and model selection using Python

It’s the default not on the volumeclipwithmodel “, the display is “select a volume” , without the mouse select. I want to get the active volume object of the volumes module from the python code, and the current model object of the module. Note that I am going to get volume and model objects in the python code, can you provide the code? Thanks so much! !!!
图片
图片
图片

You can access every widget of every module using slicer.util.findChild() function, but this should only be used for testing or diagnostics, not for implementing end-user workflows.

Your module should not depend on what nodes are selected to be edited in other module’s GUI. Doing this would severely restrict what you can do in Slicer (modules would keep interfering with each other and ultimately many things would be just impossible to do).

Instead, you put node selectors and various editing widgets into the GUI of your module. Module user interfaces are typically built from reusable widgets, so you can easily put together a GUI that is a combination of several other modules.

Thank you for your answer :smiley: