dicompyler / dicompyler-core

A library of core radiation therapy modules for DICOM RT used by dicompyler
https://dicompyler-core.readthedocs.io
Other
147 stars 69 forks source link

"Bug" in volume constraint with "calculate_full_volume" dvh #371

Open fdekerme opened 1 year ago

fdekerme commented 1 year ago

Hello , I've noticed an "error" when I try to calculate a V20Gy Brain with the calcdvh.volume_constraint() function. I don't think it's a bug, but it comes from the way volume constraint are calculated, from total brain histogram.

I have a patient with a truncated dose map, which does not fully cover the brain contour. However, the 20Gy isodose is entirely included in the dose map. Therefore, the brain volume outside the dose map should not influence the V20Gy calculation.

However, I get 2 different values depending on whether or not I use the "calculate_full_volume" option:
1) calcdvh_1 = dvhcalc.get_dvh(rts, rtd, ids, calculate_full_volume=False) and then calcdvh_1.volume_constraint(20, "Gy").value, I get a V20Gy of 750cm3 2) calcdvh_2 = dvhcalc.get_dvh(rts, rtd, ids, calculate_full_volume=True) and then calcdvh_2.volume_constraint(20, "Gy").value, I get a V20Gy of 770cm3.

Below are the whole brain DVHs for calcdvh_1 (orange) and calcdvh_2 (blue), from which we can see why the V20s are different.

image

Thanks :)

bastula commented 1 year ago

Thanks for providing this issue. Looking at your plot, it looks like the low isodose lines are most affected, which makes sense. The volume is lower overall across all dose bins until you approach max dose. According the code, it should just add the volume only to the histogram, so the reduced total irradiated volume makes sense. Is it possible to show a plot of the two histograms as differential? The DVHs are initially calculated as differential before converting them to cumulative. That may shine some more light on the issue.