SlicerRt / SlicerRT

Open-source toolkit for radiation therapy research, an extension of 3D Slicer. Features include DICOM-RT import/export, dose volume histogram, dose accumulation, external beam planning (TPS), structure comparison and morphology, isodose line/surface generation, etc.
https://slicerrt.org
124 stars 60 forks source link

Axis scaling on DVH, or Dose step during DVH export #244

Closed HannaMalygina closed 2 months ago

HannaMalygina commented 2 months ago

Dear Community, How can I change the scaling of the x-axis on the DVH histogram? Or a similar question: how to change the step in dose when I export DVH? The step is too large.

cpinter commented 2 months ago

It is not exposed on the UI but this is the function you can use to control this dose step size: https://github.com/SlicerRt/SlicerRT/blob/master/DoseVolumeHistogram/Logic/vtkSlicerDoseVolumeHistogramModuleLogic.h#L129

Your only option without changing the SlicerRT code seems to be executing the following in the Python console before clicking the Compute DVH button:

dvhLogic = slicer.modules.dosevolumehistogram.logic()
dvhLogic.SetStepSize(0.05)
cpinter commented 2 months ago

I see the hands up, thanks. Did it work? Can we close the ticket or is there anything else?

HannaMalygina commented 2 months ago

Yes, works like magic! Thank you a lot! You can close the ticket. Completely different question, if I may: Are there any other examples of how to use the python console in Slicer? For example, how to calculate DVH, write it to files, check metadata of Dicom files? Just share with me some useful links. It is difficult for me to start (I am very new in Slicer). Thank you in advance.

cpinter commented 2 months ago

Absolutely. Python snippets about Slicer core can be found here: https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html This is a huge collection of basic (and not so basic) scripts exercising different parts of the application. The documentation itself is really useful too, if you have doubts about certain concepts it's worth a search in the documentation. If you can't find it there, the forum is at discourse.slicer.org. There are many SlicerRT related topics as well.

We don't have a collection of Python scripts in the SlicerRT documentation, but this automated test basically runs most SlicerRT modules, including DVH: https://github.com/SlicerRt/SlicerRT/blob/master/Testing/Python/IGRTWorkflow_SelfTest.py (In the app you can find it among the testing modules, you can click the buttons one by one and see what it does)