Regarding this issue, I came across a question titled Call SlicerRT Isodose (or create isodoses) from python which was asked in the 3DSlicer Community.
I realized that in the Python Interactor, in addition to the slicer.util.getModule
method which I mentioned in my previous message, there is another method called slicer.util.getModuleLogic
that seems to provide access to the settings (logic) of modules, including Isodose module. In other words, it seems that the getModuleLogic
method in slicer.util
is used for setting the settings of modules.
According to the help provided for the SetNumberOfIsodoseLevels
method, it seems that this method takes two input arguments: a vtkMRMLIsodoseNode
type and an integer
.
The following commands were executed.
>>> object_vtkMRMLIsodoseNode = slicer.vtkMRMLIsodoseNode().CreateNodeInstance()
>>> type(object_vtkMRMLIsodoseNode)
<class 'vtkSlicerIsodoseModuleLogic.vtkMRMLIsodoseNode'>
>>> numberOfColors = 1
>>> myIsodose = slicer.util.getModuleLogic('Isodose').SetNumberOfIsodoseLevels(object_vtkMRMLIsodoseNode, numberOfColors)
>>> type(myIsodose)
<class 'NoneType'>
>>> myIsodose.__dir__()
['__repr__', '__bool__', '__new__', '__doc__', '__hash__', '__str__', '__getattribute__', '__setattr__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__init__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__']
>>>
It seems that there was no syntax error when executing the above commands, but since the output type is NoneType
, it seems that a logical error must have occurred.
Please guide me on how to implement the settings of the Isodose module in Python so that I can generate the output of this module by taking the RTDose input.
Best regards.
Shahrokh.