In my work, I had to create RTDOSE files to store Monte Carlo data. When creating my DICOMs, I had pixel spacings of 0.3710000000000002325/0.37109999999931. When I tried to calculate the DVHs with dicompyler-core, I got this error:
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 88, in get_dvh
calcdvh = _calculate_dvh(s, rtdose, limit, calculate_full_volume,
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 218, in _calculate_dvh
planedata[z] = calculate_plane_histogram(plane, doseplane,
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 283, in calculate_plane_histogram
hist, vol = calculate_contour_dvh(grid, doseplane, maxdose, dd, id,
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 316, in calculate_contour_dvh
mask = ma.array(doseplane dd['dosegridscaling'] 100, mask=~mask)
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/numpy/ma/core.py", line 6610, in array
return MaskedArray(data, mask=mask, dtype=dtype, copy=copy,
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/numpy/ma/core.py", line 2906, in new
raise MaskError(msg % (nd, nm))
numpy.ma.core.MaskError: Mask and data not compatible: data size is 452188, mask size is 451242.
This error came from an int conversion of 477.9999999 to 477 in the intrapolated shapes. To solve that issue I simply rounded the lut new shapes.
Here is what I changed in file dvhcalc.py line 502 and 503:
Hi all!
In my work, I had to create RTDOSE files to store Monte Carlo data. When creating my DICOMs, I had pixel spacings of 0.3710000000000002325/0.37109999999931. When I tried to calculate the DVHs with dicompyler-core, I got this error:
File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 88, in get_dvh calcdvh = _calculate_dvh(s, rtdose, limit, calculate_full_volume, File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 218, in _calculate_dvh planedata[z] = calculate_plane_histogram(plane, doseplane, File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 283, in calculate_plane_histogram hist, vol = calculate_contour_dvh(grid, doseplane, maxdose, dd, id, File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/dicompylercore/dvhcalc.py", line 316, in calculate_contour_dvh mask = ma.array(doseplane dd['dosegridscaling'] 100, mask=~mask) File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/numpy/ma/core.py", line 6610, in array return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, File "/dvh_from_dosegrid/venv/lib/python3.8/site-packages/numpy/ma/core.py", line 2906, in new raise MaskError(msg % (nd, nm)) numpy.ma.core.MaskError: Mask and data not compatible: data size is 452188, mask size is 451242.
This error came from an int conversion of 477.9999999 to 477 in the intrapolated shapes. To solve that issue I simply rounded the lut new shapes.
Here is what I changed in file dvhcalc.py line 502 and 503:
to
Best,
Sam