Coder Social home page Coder Social logo

cutright / dvh-analytics Goto Github PK

View Code? Open in Web Editor NEW
80.0 14.0 29.0 40.22 MB

A DICOM Database Application for Radiation Oncology

License: Other

Python 100.00%
dicom bokeh machine-learning radiation-oncology pydicom dicompyler wxpython-phoenix

dvh-analytics's Introduction

DVH Analytics

NOTE: DVHA has been archived and is no longer supported. The developers of DVHA and dicompyler have teamed up to form ONCurate.

DVH Analytics (DVHA) is a software application for building a local database of radiation oncology treatment planning data. It imports data from DICOM-RT files (i.e., plan, dose, and structure), creates a SQL database, provides customizable plots, and provides tools for generating linear, multi-variable, and machine learning regressions.

pypi Documentation Status lgtm code quality lgtm Lines of code Repo Size Code style: black

Documentation

Be sure to check out the latest release for the user manual PDF, which is geared towards the user interface. For power-users, dvha.readthedocs.io contains detailed documentation for backend tools (e.g., if you want to perform queries with python commands).

Executables

Executable versions of DVHA can be found here. Please keep in mind this software is still in beta. If you have issues, compiling from source may be more informative.

About

In addition to viewing DVH data, this software provides methods to:

  • download queried data
  • create time-series plots of various planning and dosimetric variables
  • calculate correlations
  • generate multi-variable linear and machine learning regressions
  • share regression models with other DVHA users
  • additional screenshots available here

The code is built with these core libraries:

  • wxPython Phoenix - Build a native GUI on Windows, Mac, or Unix systems
  • Pydicom - Read, modify and write DICOM files with python code
  • dicompyler-core - A library of core radiation therapy modules for DICOM RT
  • Bokeh - Interactive Web Plotting for Python
  • scikit-learn - Machine Learning in Python

Installation

To install via pip:

$ pip install dvha

If you've installed via pip or setup.py, launch from your terminal with:

$ dvha

If you've cloned the project, but did not run the setup.py installer, launch DVHA with:

$ python dvha_app.py

See our installation notes for potential Shapely install issues on MS Windows and help setting up a PostgreSQL database if it is preferred over SQLite3.

Dependencies

Support

If you like DVHA and would like to support our mission, all we ask is that you cite us if we helped your publication, or help the DVHA community by submitting bugs, issues, feature requests, or solutions on the issues page.

Cite

DOI: https://doi.org/10.1002/acm2.12401

Cutright D, Gopalakrishnan M, Roy A, Panchal A, and Mittal BB. "DVH Analytics: A DVH database for clinicians and researchers." Journal of Applied Clinical Medical Physics 19.5 (2018): 413-427.

The previous web-based version described in the above publication can be found here but is no longer being developed.

DOI: http://doi.org/10.1002/mp.14795

Roy A, Widjaja R, Wang M, Cutright D, Gopalakrishnan M, Mittal BB. "Treatment plan quality control using multivariate control charts." Medical Physics. (2021).

DOI: https://doi.org/10.1016/j.adro.2019.11.006

Roy A, Cutright D, Gopalakrishnan M, Yeh AB, and Mittal BB. "A Risk-Adjusted Control Chart to Evaluate IMRT Plan Quality." Advances in Radiation Oncology (2019).

Selected Studies Using DVHA

5,000 Patients National Cancer Institute (5R01CA219013-03): Active 8/1/17 โ†’ 7/31/22 Retrospective NCI Phantom-Monte Carlo Dosimetry for Late Effects in Wilms Tumor Brannigan R (Co-Investigator), Kalapurakal J (PD/PI), Kazer R (Co-Investigator)

265 Patients DOI: https://doi.org/10.1016/j.ijrobp.2019.06.2509 Gross J, et al. "Determining the organ at risk for lymphedema after regional nodal irradiation in breast cancer." International Journal of Radiation Oncology* Biology* Physics 105.3 (2019): 649-658.

dvh-analytics's People

Contributors

cutright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dvh-analytics's Issues

DICOM Dose Sum causes crash

Bug: When importing multiple plans associated with the same StudyInstanceUID, DVHA attempts to sum these dose grids. Currently, dose summation crashes DVHA if the dose grid dimensions are different (i.e., the summation requires interpolation) and there are more than 2 dose grids. There is also a separate issue of memory allocation when using executable builds of DVHA (at least on MS Windows).

Work-around: Unknown. However, this issue does not affect planning systems that have the ability to export a composite dose grid with all prescriptions contained within one file, e.g., Pinnacle and perhaps RayStation?

DVHA uses code based on a plug-in written for dicompyler. There is a dicompyler google user thread related to this issue here.

The code lives in dvha.tools.dicom_dose_sum. I believe the issue is that the code does not allocate space based on the dose grid, rather the space is based on other tags that are not updated after a dose summation.

Unable to import any DICOM files (InvalidDicomError: File is missing DICOM File Meta Information)

Hi, thanks for the work on the project. I am unable to import any DICOM files, and any assistance would be appreciated.

MS Windows 7 Pro 64-bit SP1 with admin privileges
All DVHA dependencies installed by pip in Python 3.7 via Spyder and/or Anaconda, verified with pip list
PostGreSQL 11.0-1 +pgAdmin 4 for SQL server

After running DVH analytics from Spider, I set up the SQL server and then attempted to import a DICOM set (CT, RTDOSE, RTPLAN, RTCONSTRUCT) of one of our patients as a test, but DVHA seems to be unable to detect any DICOM files. I verified the DICOM files by opening them with various DICOM viewers.

From a previous issue thread back in May it seems that it's pretty difficult importing files in a Windows environment, might this be the issue here as well?

Thanks and regards.

DICOM Tag Editor

I built a DICOM tag editor today: DVHA DICOM Editor.

I know there are other solutions out there, but all of the ones I found either cost money, require admin rights or an installation, or are command-line only. So maybe there's some space out there for this project.

Long story short, I think there's some utility for a DICOM tag editor in DVHA... particularly with users working with anonymized or phantom data. I plan to merge this code into DVHA by v0.9.

NOTE: As of v0.2, only non-sequence tag values are supported

DVH Analytics screenshot

won't import

I have installed DVHA-v0.7.8-macOS.Mojave.dmg and DVHA-v0.7.8-Windows7.zip.
For Mac version when I clicked to import (attached image), nothing happened.
what I do wrong?
Screen Shot 2020-05-06 at 21 36 44
And also, when I did same steps with window, during import the software was closed.

Reference for publication or talks in public

Hi,
I evolve each week in understanding the code of DVHA and have began to change and add some code for my use cases.

  • I export all DVH-plots to svg in specific size to have a high resolution plot for slides and so on
  • I add some things to query (maybe eclipse specific: OperatorsName: physicists approver, ReviewerName: physician approver, specific Brainlab Elements-Module: hidden in a specific private dicomTag after export to eclipse)

Still this is all your work and I really want to reference you in papers or presentations if I use output or plots from your program. Do you have guidelines or a preferred way to do this.

Kind regards,
Max

macOS Executable only: ROI Map module will not open for v0.7.6-v0.7.8

The PyInstaller freezes for macOS v0.7.8-0.7.6 did not include the TG-263 csv file, so DVHA would crash when trying to open the ROI Map (and probably when adding a new physician with template TG-263 ROIs).

I will upload new executables for these versions. No changes to python code, so users compiling from source will observe no issue.

Querying with date filter hangs with SQLite

DVHAMainFrame.get_queryneeds to be properly updated for filtering by date when using SQLite. It looks like there may be issues at time of import too based on the different formats of the auto-populated date values. The different date formats arose because I have a custom script outside of DVHA to update simulation dates in my anonymized dataset, I didn't update that script for SQLite.

Perhaps simulation date filters should employ the dvha.dialogs.main.DatePicker class.

Screen Shot 2020-01-19 at 9 39 12 PM

Manual DICOM File connection

Currently DICOM files are connected with SOPInstanceUID and Referenced SOPInstanceUIDs (I believe in the same manner as dicompyler). If a file has been modifed since export from the TPS (e.g., new RT Structure file), these UIDs may not match.

I will add a feature to suggest unmatched DICOM files based on StudyInstanceUID for a manual connection on the Import DICOM window.

If users have similar concerns or suggestions, I'm happy to try to accommodate.

TPSs that work with DVHA

I just wanted to create a common location to document known TPS and versions that work with DVHA. If you've used DVHA and don't see your TPS and version on here, kindly add a comment. Below is a list off the top of my head.

  • BrainLab iPlan 4.5
  • Elekta Monaco 5.0
  • Elekta XiO (version unknown)
  • Philips Pinnacle 8.0m - 9.10, 16.2
  • RaySearch RayStation 5.0 - 6.1
  • Varian Eclipse 11 and 15
  • MiM [not a TPS (yet?), but their DICOM files work too]
  • VariSeed 9.0

Inbox deleted after import on MS Windows

Bug: On MS Windows only, if all files in your inbox are imported, leaving no other files in any sub-directory, DVHA may delete the inbox and crash.

Work-around: Put any non-DICOM file in your inbox

This bug is a multi-point failure. Potential fix to be pushed to 0.6.8dev branch immediately after this post. Long story short, remove_empty_folders in dvha.tools.utilities.py will be renamed to remove_empty_sub_folders

This bug was not found on macOS partially due to the existence of .DS_Store files and also remove_empty_folders being called with pubsub.sendMessage to the ImportDicomFrame that is closed in macOS at the point (but not in MSW), so remove_empty_folders wasn't actually called. I'll test this on MSW tomorrow and make an official release if it works.

Implement error logging

Error logging needs to be implemented so DVHA executables can capture crashes, other issues.

Errors related to OS write privileges are not caught

If DVHA doesn't have write privileges when creating ROI maps or importing data into SQLite, the cause of unusual behavior is not made apparent.

DVHA should generate a pop-window when these errors occur.

Possible work-around, let DVHA users change the ~/Apps/dvh_analytics folder to another location. The downside is that neither the ROI map system nor SQLite is designed for multiple users. Could maybe implement a locking system to prevent simultaneous users.

"Reimport From DICOM" fails in Database Adminstrator

The Database Administrator has an option to reimport data into the SQL database from the original DICOM files. Currently, this will crash and if you selected to delete data in the database, that data will be deleted. The original DICOM files will not be deleted.

Current work-around is to use the usual DICOM Import feature. Fix coming in release of v0.6.4

Traceback (most recent call last):
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\models\database_editor.py", line 238, in on_reimport
    ReimportDialog()
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\dialogs\database.py", line 453, in __init__
    self.run()
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\dialogs\database.py", line 508, in run
    self.action()
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\dialogs\database.py", line 573, in action
    ImportDicomFrame(inbox=INBOX_DIR)
TypeError: __init__() missing 2 required positional arguments: 'roi_map' and 'options'

FileNotFoundError on Windows 10 after installing with setup.py

I tried the latest version (0.6.7) on Windows 10. After unzipping the source code, I ran

python setup.py install

Then, when launching from the command line with dvha, I got two FileNotFoundErrors: it's looking for institutional.roi and physician_BBM.roi.

Current workaround is just to create those two blank files in the folder where it's looking.

Pandas 1.0.3 breaks Regressors and Bokeh 1.4.0

I'm guessing all 1.0 versions of Pandas breaks regressors and bokeh 1.4.0, but certainly 1.0.3 does. Solution: downgrade to pandas 0.25.3.

I will update the DVHA requirements.txt

(venv2) Ninjas-MacBook-Pro:DVH-Analytics ninja$ dvha
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
ERROR:bokeh.util.dependencies:Failed to import optional module `pandas`
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/bokeh-1.4.0-py3.6.egg/bokeh/util/dependencies.py", line 63, in import_optional
    return import_module(mod_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/bin/dvha", line 11, in <module>
    load_entry_point('dvha==0.8.1', 'console_scripts', 'dvha')()
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg/pkg_resources/__init__.py", line 489, in load_entry_point
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg/pkg_resources/__init__.py", line 2793, in load_entry_point
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg/pkg_resources/__init__.py", line 2411, in load
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg/pkg_resources/__init__.py", line 2417, in resolve
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/dvha-0.8.1-py3.6.egg/dvha/main.py", line 29, in <module>
    from dvha.models.database_editor import DatabaseEditorFrame
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/dvha-0.8.1-py3.6.egg/dvha/models/database_editor.py", line 22, in <module>
    from dvha.models.roi_map import RemapROIFrame
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/dvha-0.8.1-py3.6.egg/dvha/models/roi_map.py", line 23, in <module>
    from dvha.models.plot import PlotROIMap
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/dvha-0.8.1-py3.6.egg/dvha/models/plot.py", line 30, in <module>
    from dvha.tools.stats import MultiVariableRegression, get_control_limits
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/dvha-0.8.1-py3.6.egg/dvha/tools/stats.py", line 19, in <module>
    from regressors import stats as regressors_stats
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/regressors-0.0.3-py3.6.egg/regressors/stats.py", line 11, in <module>
    import pandas as pd
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/__init__.py", line 124, in <module>
    from pandas.core.computation.api import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/api.py", line 3, in <module>
    from pandas.core.computation.eval import eval
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/eval.py", line 14, in <module>
    from pandas.core.computation.engines import _engines
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/engines.py", line 9, in <module>
    from pandas.core.computation.ops import _mathops, _reductions
  File "/Users/ninja/PycharmProjects/DVH-Analytics/venv2/lib/python3.6/site-packages/pandas-1.0.3-py3.6-macosx-10.6-intel.egg/pandas/core/computation/ops.py", line 15, in <module>
    import pandas.core.common as com
AttributeError: module 'pandas' has no attribute 'core'

Multiple issues for v0.7.4dev

Critical Issues:

  1. In ROI Map Editor, when "DEFAULT" Physician is selected, a new institutional ROI is added but it does not show up in the list.
  2. In import DICOM window, the "ROI Manager" button doesn't work. I got the error message: "AttributeError: 'DatabaseROIs' object has no attribute 'physicians'". I guess it might be caused by physician name is missing in the DICOM plan file.
  3. In import DICOM window, once a ROI label has been assigned to a RT structure, it disappears from the dropdown list. This is a problem for PTV and CTV. Because the same label could be assigned to multiple structures.
  4. A physician's ROI table needs to have a copy of every labels in the institutional ROI table, even though the physician has no variations for some structure labels. This requirement is very inconvenient for physician tables that have already been created and are missing labels compared to the new institutional table. In other words, if the institutional table is updated, all physician tables have to be individually updated, which is very annoying.

Minor Issues:

  1. In ROI Map Editor, after a Physician ROI is added, the dropdown box for the Physician was reset to DEFAULT, which is annoying.
  2. In ROI Map Editor, after "Save and Update Database" button is clicked, the ROI Map window should not be automatically closed.
  3. In ROI Map Editor, allow a variation label to be edited.
  4. The multiple consecutive spaces/underscores in a structure label should be pre-processed and be treated as a single space/underscore. For example, "CTV Prostate" and "CTV Prostate" should be considered as the same label variation.

Rad Bio module

I tried an alpha = 7 in the rad bio module for brainstem and clicked apply parameter. Got the following error -

File "/Users/arkaroy1/PycharmProjects/DVH-Analytics-Desktop/dvh-analytics-desktop/models/rad_bio.py", line 188, in apply_parameters
new_row[6] = "%0.2f" % round(calc_tcp(float(new_row[3]), float(new_row[4]), float(new_row[5])), 3)
ValueError: could not convert string to float:

DVH Endpoint Constraint Evaluation

I plan to merge the code for DVH Check into DVHA. This will probably include a standalone plan viewer (i.e., view DVHs and stats for a plan without importing into your database).

Unable to write to SQLite DB without OS Admin user

Dear Dan
Today, I tried to install DVH-Analytic software for dvh analysis proposes. I tried to install it through the executable method. But after import necessary data (RT plan, RT dose, and RT structure), software closed automatically.
I also tried to clone the source code and run " python dvha_app.py" command in cmd and it returns an error:" from rapidfuzz._fuzz import *
ImportError: DLL load failed: The specified module could not be found.".
All necessary dependencies were installed according to the requirement.txt file.

Os: Win10 (Version 1803)
Python: 3.6

Best Regards

Problem when trying to import DICOMs (AttributeError: 'Dataset' object has no attribute 'TransferSyntaxUID')

Hi. As a follow-up to a previous issue, DVHA can parse the patient plans, however it is still unable to import patient plans, as documented below

Windows 7 Pro 64bit SP1, PostgresQL 11.0-1, pgAdmin4
DVHA launched with all dependencies, from Spyder 3.3.6 (Python 3.7) via Anaconda
DICOM files were obtained from Xio by Elekta

  1. Import -> Point to folder with target DICOMs
    1

  2. Ticked checkbox next to 'Patients' -> All ROIs are red with X
    2

  3. Click and opened 'ROI Manager' and 'Dismiss'ed it immediately -> Some ROIs turned Green check
    -> Also checked 'Import uncategorized ROIs'
    3

  4. After clicking 'Import', DVHA crashes with the following screen and terminal output.
    5
    4

  5. Restarting DVHA and clicking 'Import' again.
    6

Attempting to repeat the process now results in the same results - although sometimes it crashes with a window that says 'Parsing DICOM files' that doesn't go away until I completely exit Python.

Without checking 'import uncategorized ROIs' in step 3, the import seems to go through; I am able to query things like 'Patient Sex' etc. DVHs, Endpoints, etc are always empty is this situation - probably because all the ROIs in my particular DICOM are uncategorized, so there aren't any contours in the data to build DVHs from. Will try to get screenshots of this.

Any assistance would be greatly appreciated.

Unable to add variations to Physician ROI

I tried to add a variation "PTV78" to the example Physician "BBM" and got the following error message.
"'ptv' is already a variation of ptv for BBM".
But apparently it is not. Actually I could not add any new variations to a ROI.

PIP install version crashes with ModuleNotFoundError: No module named 'paths'

The following is the output from PIP:

(DVH) C:\>pip install dvh-analytics
Collecting dvh-analytics
  Using cached https://files.pythonhosted.org/packages/e2/f9/d4ecc88b641276c4c896901fae493a663a9c7e9399a191e2ff1476d0592c/dvh-analytics-0.5.11.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\gsalomon\anaconda3\envs\DVH\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"
'C:\\Users\\gsalomon\\AppData\\Local\\Temp\\pip-install-w8bw_quw\\dvh-analytics\\setup.py'"'"'; __file__='"'"'C:\\Users\
\gsalomon\\AppData\\Local\\Temp\\pip-install-w8bw_quw\\dvh-analytics\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"',
open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"
'))' egg_info --egg-base 'C:\Users\gsalomon\AppData\Local\Temp\pip-install-w8bw_quw\dvh-analytics\pip-egg-info'
         cwd: C:\Users\gsalomon\AppData\Local\Temp\pip-install-w8bw_quw\dvh-analytics\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\gsalomon\AppData\Local\Temp\pip-install-w8bw_quw\dvh-analytics\setup.py", line 2, in <module>
        from dvh.modules.default_options import VERSION
      File "C:\Users\gsalomon\AppData\Local\Temp\pip-install-w8bw_quw\dvh-analytics\dvh\modules\default_options.py", line 8, in <module>
        import paths
    ModuleNotFoundError: No module named 'paths'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Using Anaconda environment with Python 3.7
All listed dependencies already installed:
DVH Packages.txt

deactivate doseSum function?

Here is my problem with the dose summation.
I have cases with the same StudyUID and multiple plans of intracranial stereotactic cases of different PTVs in the brain. First of all the summation do not work for these cohort (Import freeze or quit and no query results).
But even if the summation would work, it makes no sense for - in some cases - different fractionation schemes (not biological equivalent).
Here my question:
Is there a simple way to deactivate this feature, add a button in the importer or change the code that dose summation will not take place if ...

My workaround:
I anomynize the extra plans (>1 plans) and therefore every patient only has one plan. With this trick my patient cohort works fine with DVHA.

Queries with StudyInstanceUIDs that don't exist in the Beams table cause crash (e.g. Brachy plans)

DVHA <=v0.7.6 does not properly catch tx modality (at least for BrachyVision) and leads to a None for the tx_modality. When querying for tx_modality = None, this happens.

The v0.7.7dev branch has a fix for the bracy tx_modality issue. But there may be a larger issue involving queries of None-Type values in the database.

(venv) C:\Users\dcutright\PycharmProjects\DVH-Analytics>python dvha_app.py
Traceback (most recent call last):
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\main.py", line 666, in exec_query_button
    self.exec_query()
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\main.py", line 688, in exec_query
    DVH(dvh_condition=dvh_str, uid=uids, dvh_bin_width=self.options.dvh_bin_width)
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\models\dvh.py", line 70, in __init__
    self.rx_dose = self.get_plan_values('rx_dose')
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\models\dvh.py", line 134, in get_plan_values
    values[i] = 'None'
  File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\models\dvh.py", line 134, in <listcomp>
    values[i] = 'None'
ValueError: '<redacted study instance uid>' is not in list

EUD calculation incorrect if dvh_bin_width not equal to 1cGy

Bug: EUD calculations have not been updated to account for a dvh with a bin width other than 1cGy. This affects v0.6.5 to current (v0.6.9)

Work-around: DVHA versions with this bug should set their DVH bin width in user settings to 1cGy for accurate EUD calculation.

def calc_eud(dvh, a, dvh_bin_width=1):
"""
EUD = sum[ v(i) * D(i)^a ] ^ [1/a]
:param dvh: a single DVH as a list of numpy 1D array with 1cGy bins
:param a: standard a-value for EUD calculations, organ and dose fractionation specific
:return: equivalent uniform dose
"""
v = -np.gradient(dvh)
dose_bins = np.linspace(1, np.size(dvh), np.size(dvh))
dose_bins = np.round(dose_bins, 3)
bin_centers = dose_bins - 0.5
eud = np.power(np.sum(np.multiply(v, np.power(bin_centers, a))), 1. / float(a))
eud = np.round(eud, 2) * 0.01
return eud

ROI-Map with organ type

Hi Dan,

I process a little plan study from 5 top TPS (Pinnacle, Eclipse, Tomotherapy, Raystation and Monaco) right now.

The import is working without problems. But I had the idea that it would be nice when ROI Map could also define ROI-Type (when an entry is set in the .roi-file) too.

At the moment the ROI type is set from DICOM-info. The problem is that many people change the appropriate ROI-type to trick the optimizer (or some other reason). In my case I had to manually change many ROI-Types in Import-Window to get the right ptv calculations at the end.

Do you think that would be good?

Best regards
Max

Incorrect DVHs for FFS, HFP patient orientations (non-HFS?)

Multiple users have identified a bug where DVHs are incorrectly calculated for Foot-First-Supine patient orientations. This appears to be an issue with dicompyler-core and can be observed by independently loading CT and RT-Structure data in the dicompyler GUI/program, the structures to do not line up with the CT.

Thanks to Mahesh and Mike for catching this.

Are there any other users out that that have observed similar behavior for other patient orientations? It would be easy to check, simply include a Patient Orientation filter in your query. The DVHs will almost certainly not monotonically decrease.

The resolution is unclear for the moment, but at a minimum I'll flag FFS plans in DVHA on import in v0.7.5 when it's released.

Idea for additional feature

Hi Dan,

I really like the frequent updates. I will try 0.7.8 right now.

Today, I had an idea. I think it would be nice to add a label-function for the importer.

Say I have a big DICOM data set from clinic A and one from clinic B but all anonymized. Firstly, I import data set A and give a label to the first plan and apply this to the remaining plans. After this, I import the data from clinic B and can then compare specific things between them.

Let me know what you think about it.
Kind regards
Max

Unable to import, error for invalid syntax for Eclipse plan

Import of a patient planned in Eclipse v15.5 is failing. The command windows reports back the following notes during import.
image

Before attempting to import, the "Import DICOM" window did not contain any warnings beyond many non-mapped ROIs.
image

DICOMparser -> get value of a private DICOM-tag

Hi,

very nice work so far.

If it possible to get the content from a DICOM-object without Tag-name? It seems that the pydicom_attribute has to be the TagName but many tags only have the number "(0xx,00xx)".

I want to change the BeamName-Property because in Eclipse-plans the BeamName has no TagName (only the BeamID has a TagName ("BeamName"^^).

For instance this is what I tried but no luck:
self.rt_data['plan'].PatientID
-> self.rt_data['plan'].pydicom.tag.Tag(0010,0040)

Solution:
....
'protocol': [self.tps_protocol_hack, 'text'],
....

@Property
def tps_protocol_hack(self):
if 'xxy' in self.rt_data['plan'].BeamSequence[0][0x3243,0x1009].value.decode('utf-8'):
ans = 'xxy2'
elif 'xxz' in self.rt_data['plan'].BeamSequence[0][0x3243,0x1009].value.decode('utf-8'):
ans = 'xxz2'
elif self.rt_data['plan'].BeamSequence[0][0x3243,0x1009].value.decode('utf-8').startswith('Xxw'):
ans = 'xxw2'
else:
ans = 'DEFAULT'
return ans

No interactive Bokeh/JS visualization.

After setting up a postgresql database and import the demo data.
It seems that it renders HTML but with no interactive visualization of plots, is it an expected result?
tables: DVH, time series, and regression.

imported_DVH_no_interactive_plots

Issue with Regression module

The program crashes if you try to run a regression with the same independent and dependent variable. This is because the denominator for the F-stat is zero in this case. Can replace the zero with something very small to rectify this.

ROI map file sharing

The current system is designed that all ROI map files are stored in the user's application folder. This will be a problem when multiple users are modifying and sharing both the institutional and the physician's ROI maps. It would be better that a user can specify the path of the ROI map files in the User Settings window. In this way, all uses have the options to share the ROI map files.

Executable build with PyInstaller

I'm adding this partially to help me remember what I've done, and partially in hopes that someone with more experience out there might be able to help.

I think I have successfully compiled DVHA for macOS Mojave. You can give this a try by downloading DVHA_macOS_Mojave.zip on the releases page - or directly download with this hard link to 0.6.3 (+ minor fixes) here. Your browser may automatically unzip this file which contains a single app, double click to run. You may need to enable this app in System Preferences -> Security & Privacy -> Open Anyway.

Screen Shot 2020-01-04 at 10 09 36 AM

Screen Shot 2020-01-04 at 10 05 57 AM

Here is the Pyinstaller spec file I used:

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['dvha_app.py'],
             pathex=['./',
                     './venv/lib/python3.6/site-packages'],
             binaries=[('/System/Library/Frameworks/Tk.framework/Tk', 'tk'),
                       ('/System/Library/Frameworks/Tcl.framework/Tcl', 'tcl')],
             datas=[('./dvha/icons/', './dvha/icons/'),
                    ('./dvha/logo.png', './dvha/'),
                    ('./dvha/LICENSE', './dvha/'),
                    ('./dvha/db/create_tables.sql', './dvha/db/'),
                    ('./dvha/db/institutional.roi', './dvha/db/'),
                    ('./dvha/db/physician_BBM.roi', './dvha/db/')],
             hiddenimports=['sklearn.utils._cython_blas',
                            'sklearn.neighbors._typedefs',
                            'sklearn.neighbors._quad_tree',
                            'sklearn.tree._utils'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='dvha_app',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=False,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False)
app = BUNDLE(exe,
             name='DVH Analytics',
             icon='./dvha/icon.jpg',
             bundle_identifier=None,
             info_plist={'NSHighResolutionCapable': 'True'}
             )

For MS Windows, I've successfully packaged an executable that works on my PC, but no one else's... so I suspect there's some more dll files I'm missing. I also ran into issues with SciPy because it moved its dll files, but I got around this by downgrading SciPy by one version. I'll post my MSW spec file on Monday (I left it at work).

Cannot add a new Physician to ROI Map

I'm not sure when this bug was introduced, but at least after TG-263 implementation. I'll post a new release by end of the day tomorrow. The following occurs when trying to add a new physician in the import screen or in the ROI map module.

(venv) Ninjas-MacBook-Pro:DVH-Analytics ninja$ python dvha_app.py
<class 'dict'> {'Anatomic Group': ['Abdomen']}
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/models/roi_map.py", line 485, in add_physician
    dlg = AddPhysician(self.roi_map)
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/dialogs/roi_map.py", line 57, in __init__
    self.run()
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/dialogs/roi_map.py", line 112, in run
    self.action()
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/dialogs/roi_map.py", line 101, in action
    dlg = TG263Dialog(physician, self.roi_map)
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/dialogs/roi_map.py", line 144, in __init__
    self.run()
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/dialogs/roi_map.py", line 193, in run
    self.map_file_path = self.generator(map_file_name, body_sites=self.checked_values)
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/tools/roi_map_generator.py", line 40, in __call__
    data = self.tg_263 if data_filter is None else self.get_filtered_data(data_filter)
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/tools/roi_map_generator.py", line 84, in get_filtered_data
    if data_filter[key].lower() == 'all':
AttributeError: 'list' object has no attribute 'lower'

2 plans for the same structure set

Hi Dan,

I tested a DataSet today that had more than one plan variant for the same structure set. Therefore the import queue looks something like that:
2plansForsamStructureSet

The DicomParser will have problems after the first imported plan.

My temporary fix is: I copy the structure set and import iterative because the importer will skip the copied structure set in the first import run.

Here is a sample patient. Hope you can help. Maybe it would work with dose summation but because these are plans for the same PTV, I deactivated dose summation.
Dan_TestFiles2_OneStructureSet for multiple plans.zip

DoseSummationType (3004, 000A) should be considered during import

Issue

DVHA assumes only one DICOM-RT dose file per DICOM-RT plan. Until now, if multiple dose files are found with matching UID, only the first dose file found was used.

Example scenario

Most treatment planning systems can export plan dose and beam dose, and some even control-point dose. If you had been exporting both plan dose and beam dose, it's possible only one beam dose file was used as opposed to the plan dose.

Proposed Solution

The DICOM tag DoseSummationType (3004, 000A), can have any of the following values:
PLAN, MULTI_PLAN, FRACTION, BEAM, BRACHY, FRACTION_SESSION, BEAM_SESSION, BRACHY_SESSION, CONTROL_POINT, RECORD.

If only one dose file is found (for a given plan), DVHA v0.7.8 will import it regardless of DoseSummationType. If multiple types are found, only PLAN or BRACHY will be considered.

If multiple dose files are found after this filtering, only the latest one will be used, based on your OS's timestamp with os.path.getmtime().

Comments

It is best practice to let your TPS export one dose file. If that's not possible, DVHA can auto-sum dose grids across multiple DICOM-RT plans. Making assumptions about how to auto-sum within a plan seems dangerous and can should be easily handled by your TPS.

You could import each dose file one at a time and edit the StudyInstanceUID as you import, but keep in mind DVHA does not store the DoseSummationType in the SQL database.

The safest way to import plans is to export plan, structure, dose files from your TPS at the same time such that their SOPInstanceUIDs/ReferencedSOPInstanceUIDs are linked. If you have a lazy DICOM annonymizer, you may lose this link, in which case DVHA will default to simply matching StudyInstanceUID.... but that isn't ideal.

Pb installation

Good morning,

I fallowed all instructions, and unfortunaltey I am not able to start / or launch the app according to your instruction.
I am using python 3.7 (from anaconda). I installed all libs from setup.py, and then manually.
I have still this message on the Prompt.

File "G:\code python\DVH-Analytics-master\dvha\main.py", line 786, in OnInit
self.frame = DVHAMainFrame(None, wx.ID_ANY, "")
File "G:\code python\DVH-Analytics-master\dvha\main.py", line 83, in init
self.__add_notebook_frames()
File "G:\code python\DVH-Analytics-master\dvha\main.py", line 258, in __add_notebook_frames
self.plot = PlotStatDVH(self.notebook_tab['DVHs'], self.dvh, self.options)
File "G:\code python\DVH-Analytics-master\dvha\models\plot.py", line 171, in init
self.__add_plot_data()
File "G:\code python\DVH-Analytics-master\dvha\models\plot.py", line 215, in __add_plot_data
self.iqr = self.figure.varea('x', 'y1', 'y2', source=self.source['patch'], alpha=self.options.IQR_ALPHA,
AttributeError: 'Figure' object has no attribute 'varea'
OnInit returned false, exiting...

Could I have some help.

Thank you.
Oliv

Screenshots

DVHs
dvhs

Time Series
time_series

Regression
regression

Control Chart
control_chart

Random Forest
random_forest

ROI Map
roi_map

Import
import

Readme
dvha-desktop-readme-image
dvha-desktop-readme-image_new

MemoryError during DICOM Import on MS Windows and Linux

Bug: Importing too many plans at once on MS Windows may result in memory errors, sometimes preventing subsequent queries within the same DVHA session.

Current work-around: Import fewer plans at a time (typically <= 10) and restart DVHA afterwards if needed.

I've not noticed memory errors when no plans have been imported in a session (unless your query includes nearly every DVH in the database). I have a database of 80 patients in SQLite3 (DVHA v0.6.7dev only at the moment) and the same 80 in a PostgreSQL database with no plotting issues.

I've been able to import all 80 at once on macOS. Not sure if Linux has this issue or not.

wxPython==4.1.0 crashes DVHA

One of my DVH DICOM Editor users found an issue with wxpython==4.1.0. You'll get the following error:

(venv2) Ninjas-MacBook-Pro:DVH-Analytics ninja$ python dvha_app.py
Traceback (most recent call last):
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/main.py", line 1086, in OnInit
    self.frame = DVHAMainFrame(None, wx.ID_ANY, "")
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/main.py", line 103, in __init__
    self.__do_layout()
  File "/Users/ninja/PycharmProjects/DVH-Analytics/dvha/main.py", line 349, in __do_layout
    sizer_query_exec_buttons.Add(self.button_query_execute, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 10)
wx._core.wxAssertionError: C++ assertion "!(flags & (wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL))" failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/sizer.cpp(2114) in DoInsert(): Vertical alignment flags are ignored with wxEXPAND
OnInit returned false, exiting...

ROI name prediction with fuzzy logic string comparison

The v0.7.3dev branch currently supports right-clicking an ROI on the Import Screen to edit the ROI Map based on the right-clicked ROI Name.

Adding the right-clicked ROI as a variation will predict an existing physician ROI using fuzzy logic. Still testing this algorithm. Currently a fuzz-ratio is calculated for a simple and a partial match with fuzzywuzzy with a 62.5 to 37.5 weighting, a normalized product of these scores are used for comparison with all variations in the map, the associated physician ROI is returned. Still testing different methods of combining scores.

image

class ROINamePredictor:
def __init__(self, roi_map, weight_simple=1., weight_partial=0.6, threshold=0):
"""
:param roi_map: ROI map object
:type roi_map: DatabaseROIs
"""
self.roi_map = roi_map
norm_weight = weight_partial + weight_simple
self.weight = {'simple': 2 * weight_simple / norm_weight,
'partial': 2 * weight_partial / norm_weight}
self.threshold = threshold
def get_best_roi_match(self, roi, physician, return_score=False):
physician_variations = self.roi_map.get_all_variations_of_physician(physician)
fuzz_scores = self.get_combined_fuzz_scores(roi, physician_variations)
if fuzz_scores:
predicted_variation, score = fuzz_scores[0][1], fuzz_scores[0][0]
prediction = self.roi_map.get_physician_roi(physician, predicted_variation)
if score > self.threshold:
if return_score:
return prediction, score
return prediction
def get_combined_fuzz_score(self, a, b, mode='sqrt'):
a, b = clean_name(a), clean_name(b)
simple = float(fuzz.ratio(a, b) * self.weight['simple'])
partial = float(fuzz.partial_ratio(a, b) * self.weight['partial'])
return self.combine_scores(simple, partial, mode=mode)
@staticmethod
def combine_scores(score_1, score_2, mode='average'):
if mode == 'sqrt':
return (score_1 * score_2) ** 0.5
elif mode == 'product':
return score_1 * score_2 / 100.
else: # average
return (score_1 + score_2) / 2.
def get_combined_fuzz_scores(self, string, list_of_strings):
scores = [self.get_combined_fuzz_score(string, string_b) for string_b in list_of_strings]
if scores:
order_index = sorted(range(len(scores)), key=lambda k: scores[k])
return [(scores[i], list_of_strings[i]) for i in order_index[::-1]]

Delete Database is not working in v.07.4

Hi,

I like DVHA very much but for testing I often delete the database. This function is not working anymore. Something about a missing option. Sadly I am not able to fix this.

There is a workaround. Press 'rebuild database', quit the importer and delete or move the files in the imported folder.

Please keep up the good work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.