IndexError on get_dvh if using interpolation outside of dose grid
cutright opened this issue · 1 comments
cutright commented
Line 492 of dvhcalc.py raises an IndexError if get_interpolated_dose
is called on a z
with no dose. I injected a print statement to verify that it occurs on z
values with no dose plane and that dose.GetDoseGrid(z)
returns a 0 length array.
I edited get_interpolated_dose
to just return dose.GetDoseGrid(z)
in this situation, but that causes further issues.
dicompyler-core/dicompylercore/dvhcalc.py
Lines 490 to 492 in 84ed037
from dicompylercore.dvhcalc import get_dvh
dvh = get_dvh(struct, dose, 6, interpolation_resolution=(0.5, 0.5))
Traceback (most recent call last):
File "<input>", line 4, in <module>
File "/Users/ninja/PycharmProjects/DVH-Analytics/venv/lib/python3.6/site-packages/dicompylercore/dvhcalc.py", line 90, in get_dvh
callback)
File "/Users/ninja/PycharmProjects/DVH-Analytics/venv/lib/python3.6/site-packages/dicompylercore/dvhcalc.py", line 210, in _calculate_dvh
dose, z, interpolation_resolution, dgindexextents)
File "/Users/ninja/PycharmProjects/DVH-Analytics/venv/lib/python3.6/site-packages/dicompylercore/dvhcalc.py", line 492, in get_interpolated_dose
extents[0]:extents[2]] if len(extents) else d
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed