I am doing some work where I am creating radiation dose distributions for simulated tumours from scratch (rather than exporting from a RT planning software). In Python I generate a 3D numpy array which I convert to a vtkMRMLScalarVolumeNode. How do I convert my scalar volume node into a dose volume node that is used by the Dose Volume Histogram module in SlicerRT?
I am able to successfully load in dose volumes from DICOM data. When I investigate those volumes, I find that they are also vtkMRMLScalarVolumeNodes. What differentiates a dose volume node from other Scalar Volume Nodes (besides the unit).
Yes, it is mainly about setting the unit, but you also need to have the dose volume under a proper DICOM hierarchy. You can find all the necessary steps in the implementation of the right-click menu action (in Data module) that converts a regular volume to a dose volume:
Thank you, this is exactly what I was looking for!
In case this is useful for others, here is my Python code to achieve this:
sh = slicer.util.getNodesByClass("vtkMRMLSubjectHierarchyNode")
itemID = sh.GetItemByDataNode(MmNode)
sh.SetItemAttribute(itemID, 'DoseUnitName', "Gy")
sh.SetItemAttribute(itemID, 'DoseUnitValue', "1.0")