How to call CreateNewROI and CropVolume in python script

I would like to repeatedly create roi nodes and use them to create subvolumes… how do I call the underlying functions of the ui pushbuttons in the CropVolume module?

Here are the general instructions:

https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#how-to-find-a-python-function-for-any-slicer-features

You should avoid calling the callbacks for the buttons and instead have a look at the underlying logic (it’s in c++ but you can call it from python).

You may find an example Python function here.