Generating Fluence Maps from DICOM RTPlan Files in Python

242 views
Skip to first unread message

Bianka Mandac

unread,
Sep 8, 2020, 10:54:49 AM9/8/20
to Python in Medical Physics
Hi! I'm trying to generate fluence maps from DICOM RTPlan files. I have used the equation function from Craft et al (2018) (https://arxiv.org/abs/1608.02842) to generate the exposure function. But I am confused on how to proceed in incorporating the MU in order to generate the fluence maps for sliding window IMRT. 

Is there any document/paper that can help explain the computation of Sliding Window IMRT Fluence Map generation?

Thanks!


Simon Biggs

unread,
Sep 8, 2020, 5:36:30 PM9/8/20
to python-...@googlegroups.com
Hi Bianca,

If you just want to calculate an "MU Density" there is the following tool within pymedphys:


To use it, install pymedphys with:

pip install pymedphys[user]

Then within python:

```
import pymedphys

filepath = 'path/to/dicom/plan.dcm'
delivery = pymedphys.Delivery.from_dicom(file path)

mlc = delivery.mlc
jaw = delivery.jaw

```

Then use pymedphys.mudensity.calculate as described within the following API doc:


If you have some success and are interested in writing a little how-to I'd be quite keen to include what you write over at https://docs.pymedphys.com/howto/index.html. There is a noticeable lack of how-to guides at the moment.

Cheers,
Simon

--
You received this message because you are subscribed to the Google Groups "Python in Medical Physics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-medphy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-medphys/d3cfb3da-6ce2-4454-9991-419b1a260a75n%40googlegroups.com.

Bianka Mandac

unread,
Sep 10, 2020, 10:22:49 PM9/10/20
to Python in Medical Physics
Hi Simon!

I've tried using:

pymedphys.Delivery.from_dicom(imrt_plan_ds, fraction_number=1) 

However I keep encountering errors regarding the jaw:

VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  jaw = np.array(dicom_jaw)

and 

  File "C:\Users\USER\PycharmProjects\venv\lib\site-packages\pymedphys\_dicom\delivery\core.py", line 172, in _from_dicom_beam
    second_col = deepcopy(jaw[:, 1])
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed


I've yet to try using the mu_density function alone.

I'll update you as soon as I figure it out.


Thanks!

Simon Biggs

unread,
Sep 11, 2020, 12:43:15 AM9/11/20
to python-...@googlegroups.com
Hi Bianka,

Would you be able to copy those details onto an issue over at https://github.com/pymedphys/pymedphys/issues that way we can better track it there.

Cheers,
Simon

Bianka Mandac

unread,
Sep 11, 2020, 8:33:14 PM9/11/20
to Python in Medical Physics
Sure!

I'll post the details later.

Thanks!

Sincerely, 

Simon Biggs

unread,
Sep 11, 2020, 10:28:02 PM9/11/20
to python-...@googlegroups.com
So that future internet peeps can follow the trail here's the link to Bianka's issue on GitHub:


Reply all
Reply to author
Forward
0 new messages