Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DVH calculation problem for Eclipse 15.6 rtdose #158

Open
SergRuset opened this issue Jul 2, 2020 · 6 comments
Open

DVH calculation problem for Eclipse 15.6 rtdose #158

SergRuset opened this issue Jul 2, 2020 · 6 comments

Comments

@SergRuset
Copy link

Hey there!
There is a problem with dvh calculation for Eclipse 15.6 rtdose.

When I use get_dvh(... use_structure_extents=True ...)
I get this:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skimage/transform/_warps.py:116: RuntimeWarning: invalid value encountered in true_divide np.asarray(output_shape, dtype=float)) Traceback (most recent call last): File "/Users/sergei/GoogleDrive/PlanCompetition/Competition.py", line 532, in <module> result = calc_scoring(IDs[i], data_dict[struct][constr]) File "/Users/sergei/GoogleDrive/PlanCompetition/Competition.py", line 414, in calc_scoring calculate_full_volume=cal_full_vol) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dicompylercore/dvhcalc.py", line 75, in get_dvh callback) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dicompylercore/dvhcalc.py", line 183, in calculate_dvh dose, z, interpolation_resolution, dgindexextents) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dicompylercore/dvhcalc.py", line 458, in get_interpolated_dose preserve_range=True) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skimage/transform/_warps.py", line 293, in rescale anti_aliasing_sigma=anti_aliasing_sigma) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skimage/transform/_warps.py", line 169, in resize tform.estimate(src_corners, dst_corners) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skimage/transform/_geometric.py", line 684, in estimate _, _, V = np.linalg.svd(A) File "<__array_function__ internals>", line 6, in svd File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 1626, in svd u, s, vh = gufunc(a, signature=signature, extobj=extobj) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 106, in _raise_linalgerror_svd_nonconvergence raise LinAlgError("SVD did not converge") numpy.linalg.LinAlgError: SVD did not converge

If I use get_dvh(... use_structure_extents=False ...)
I get the dvh, but it's really strange. The volume of the structure in % can be, for example, 1.2e+06...
image

@bastula
Copy link
Member

bastula commented Jul 2, 2020

Are you able to send a test data set that I can look at? I haven't seen this error before. Also can you list your library versions, I.e. output of pip freeze?

@SergRuset
Copy link
Author

Yes, certainly.

Here is the freeze output:
astroid==2.3.3 attrs==19.3.0 cycler==0.10.0 Cython==0.29.20 decorator==4.4.2 dicompyler-core==0.5.5 et-xmlfile==1.0.1 imageio==2.8.0 isort==4.3.21 jdcal==1.4.1 kiwisolver==1.1.0 lazy-object-proxy==1.4.3 matplotlib==3.2.1 mccabe==0.6.1 networkx==2.4 numpy==1.18.1 openpyxl==3.0.3 Pillow==7.1.2 plotly==4.5.2 pydicom==1.3.0 pylint==2.4.4 pymedphys==0.16.3 pyparsing==2.4.6 python-dateutil==2.8.1 PyWavelets==1.1.1 retrying==1.3.3 scikit-image==0.17.2 scipy==1.4.1 six==1.14.0 tifffile==2020.6.3 tqdm==4.42.1 typed-ast==1.4.1 wrapt==1.11.2 xlrd==1.2.0 XlsxWriter==1.2.7

And here is the link to the data sets: https://yadi.sk/d/Pl9sXq_5GPjWWA
There is also a Tomotherapy set with the same error.

@SergRuset
Copy link
Author

Made some layman investigations.
When I use get_dvh(... use_structure_extents=True ...) the problem is in the result of dosegrid_extents_indices(...)
Xmin (or Ymin) can be larger than Xmax (Ymax).
May be the problem is the orientation of the dataset?
On the other hand the same dataset in Eclipse 13.7 gets no errors..

@bastula
Copy link
Member

bastula commented Jul 8, 2020

That is very possible. I know that there is currently an issue with HFP or FFS patients. Referencing issue #144

@cutright
Copy link
Contributor

cutright commented Apr 10, 2021

This is what I'm getting with the latest dicompyler-core and the Eclipse 15.6 files linked above.
Correction: this was with v0.5.5

image

v0.5.6 as of today
image

@cutright
Copy link
Contributor

I believe the Non-HFS support resolves the volume issue. The use_structure_extents=True fails in the same way as the issue posted here: #215

from dicompylercore.dvhcalc import get_dvh
dvh = get_dvh("Eclipse_15.6/rtss.dcm", "Eclipse_15.6/rtdose.dcm", 2)
dvh = get_dvh("Eclipse_15.6/rtss.dcm", "Eclipse_15.6/rtdose.dcm", 2, use_structure_extents=True)
Dose plane not found for -393.250. Using -122 to calculate contour volume.
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/dicompylercore/dvhcalc.py", line 87, in get_dvh
    calcdvh = _calculate_dvh(s, rtdose, limit, calculate_full_volume,
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/dicompylercore/dvhcalc.py", line 231, in _calculate_dvh
    _, vol = calculate_plane_histogram(
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/dicompylercore/dvhcalc.py", line 269, in calculate_plane_histogram
    hist, vol = calculate_contour_dvh(grid, doseplane, maxdose, dd, id,
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/dicompylercore/dvhcalc.py", line 299, in calculate_contour_dvh
    mask = ma.array(doseplane * dd['dosegridscaling'] * 100, mask=~mask)
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/numpy/ma/core.py", line 6555, in array
    return MaskedArray(data, mask=mask, dtype=dtype, copy=copy,
  File "/Users/ninja/PycharmProjects/radoncai_analytics/venv/lib/python3.9/site-packages/numpy/ma/core.py", line 2903, in __new__
    raise MaskError(msg % (nd, nm))
numpy.ma.core.MaskError: Mask and data not compatible: data size is 30552, mask size is 0.

We should probably rename this issue since I don't think this has anything to do with the TPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants