Call SlicerRT Isodose (or create isodoses) from python

I have built a widget that calculates MRT doses and the SlicerRT Isodose widget does a great job creating isolines and volumes.

I would like to be able to call the Isodose process from within my python code so that the isodoses are displayed as soon as the doses have been calculated (and update when certain parameters are changed), however I have not been able to figure out how to do this. I have found no CLI. The help info for slicer.modules.isodose.logic do not reveal any obvious (to me) way to call it. I have also looked at the code on github…

…but I admit I’m not sure what it means (I’m pretty new to python and have never used C)

Is there a way to do what I want?

Should I try and create my own models instead (it seems a fairly complex thing to do) or go down a different path (perhaps using segmentation?). It feels like there should be a simple solution but I’ve been bashing away at it all day and am completely stumped. Any suggestions would be gratefully recieved.

There is an automatic test that does this by interacting with the UI elements directly (to test the UI):

This is not the way I’d suggest using it because it’s always better to call the logic classes. I don’t have time to write the code for you now, but you’ll have to create an isodose parameter node and set the inputs, such as


Then you’ll have to call this function in the logic:

Here’s how you can access the logic:

slicer.modules.isodose.logic()

Hope this helps!

Thanks it was useful just to know it was possible and that I wasn’t chasing a wild goose. I’ve go it all working nicely now althouth it took me a while to figure out how to turn submodels on and off using the subject hierachy.

Unfortunatly having got it working I’ve installed the new version 4.10 and the isolines are not rendering correctly :frowning:

What do you mean? Can you post a screenshot?

Thanks for getting back to me - you did so while I was creating a new topic about the rendering issues (it seemed like a different matter to me).

I have included some screenshots of the images.

Dominic

Please provide information about the incorrect isodose lines. I cannot fix it unless I know what is the problem exactly. Thanks

I created a new topic as it seemed to me the problem was due do rendering in 4.10 rather than with isodose itself (as I was having similar problems with the segment editor module) the new topic is listed as…

Model and Segment rendering issues with 4.10 (and 4.11)

Thanks