Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #145 from cutright/v0.9.5
Browse files Browse the repository at this point in the history
V0.9.5
  • Loading branch information
cutright authored Feb 13, 2021
2 parents b9f1798 + ab1caad commit 5d71674
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 37 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log of DVH Analytics

v0.9.5 (2021.02.13)
------------
- [GUI] Fixed bug preventing User Preferences window from loading if on Windows without Edge being available [Issue 144](https://github.com/cutright/DVH-Analytics/issues/144)
- [ROI Map] Fixed bug where ROI Map edits didn't update previous imports [Issue 142](https://github.com/cutright/DVH-Analytics/issues/142)
- [Misc] Catch locale issue between wxWidgets and python [140](https://github.com/cutright/DVH-Analytics/issues/140)

v0.9.4 (2021.02.06)
-------------------------
- [Import] New OVH calculation [Issue 111](https://github.com/cutright/DVH-Analytics/issues/111)
Expand Down
15 changes: 10 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
dicompyler-core
dicompyler-core>=0.5.5
wxPython>=4.1.1
pypubsub
pydicom
bokeh<2.0.0
numpy
scipy
pydicom>=1.4.0
bokeh>=1.2.0,<2.0.0
psycopg2-binary
shapely[vectorized]
python-dateutil
statsmodels
scikit-learn
statsmodels>=0.8.0
scikit-learn>=0.21.0
regressors
rapidfuzz
selenium
pandas>=1.1.5
scikit-image
dvha-mlca>=0.2.3.post1
6 changes: 3 additions & 3 deletions dvha/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

__author__ = "Dan Cutright"
__email__ = "dan.cutright@gmail.com"
__version__ = "0.9.4"
__release__ = "0.9.4"
__version_info__ = (0, 9, 4)
__version__ = "0.9.5"
__release__ = "0.9.5"
__version_info__ = (0, 9, 5)
9 changes: 5 additions & 4 deletions dvha/dialogs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
set_msw_background_color,
set_frame_icon,
backup_sqlite_db,
is_edge_backend_available,
is_windows,
)
from dvha.db import sql_columns
Expand Down Expand Up @@ -836,12 +835,14 @@ class UserSettings(wx.Frame):
Customize directories and visual settings for DVHA
"""

def __init__(self, parent):
def __init__(self, parent, is_edge_backend_available=False):
"""
:param parent: main application frame
"""
wx.Frame.__init__(self, None, title="User Settings")

self.is_edge_backend_available = is_edge_backend_available

self.parent = parent
self.options = parent.options
self.options.edit_detected = False
Expand Down Expand Up @@ -963,7 +964,7 @@ def __init__(self, parent):
self.checkbox_edge_backend = wx.CheckBox(
self, wx.ID_ANY, "Enable Edge WebView Backend"
)
if not is_edge_backend_available():
if not self.is_edge_backend_available:
self.checkbox_edge_backend.Disable()

self.button_restore_defaults = wx.Button(
Expand Down Expand Up @@ -1392,7 +1393,7 @@ def __do_bind(self):
self.update_alpha_val,
id=self.spin_ctrl_alpha_input.GetId(),
)
if is_windows() and is_edge_backend_available():
if is_windows() and self.is_edge_backend_available:
self.Bind(
wx.EVT_CHECKBOX,
self.on_enable_edge,
Expand Down
21 changes: 15 additions & 6 deletions dvha/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
logger.setLevel(logging.DEBUG)

import wx
import wx.html2 as webview
from datetime import datetime
import webbrowser
from pubsub import pub
Expand Down Expand Up @@ -87,6 +88,13 @@ def __init__(self, *args, **kwds):

self.allow_window_size_save = False

self.is_edge_backend_available = None
try:
self.is_edge_backend_available = \
webview.WebView.IsBackendAvailable(webview.WebViewBackendEdge)
except Exception:
self.is_edge_backend_available = False

#############################################################################
# The following block of code for logging adapted from dicompyler
#############################################################################
Expand Down Expand Up @@ -1525,7 +1533,7 @@ def on_report_issue(evt):

def on_pref(self, *args):
if self.user_settings is None:
self.user_settings = UserSettings(self)
self.user_settings = UserSettings(self, self.is_edge_backend_available)
self.user_settings.Show()
else:
self.user_settings.Raise()
Expand Down Expand Up @@ -1855,11 +1863,12 @@ def OnExit(self):
return super().OnExit()

# May cause crash, another solution needed?
# def InitLocale(self):
# # https://docs.wxpython.org/MigrationGuide.html#possible-locale-mismatch-on-windows
# if is_windows():
# return
# super().InitLocale()
def InitLocale(self):
# https://docs.wxpython.org/MigrationGuide.html#possible-locale-mismatch-on-windows
if is_windows():
self.ResetLocale()
return
super().InitLocale()


def start():
Expand Down
4 changes: 4 additions & 0 deletions dvha/models/roi_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def __init__(self, roi_map):

self.physicians_to_delete = []

pub.subscribe(self.update_uncategorized_ignored_choices, "update_uncategorized_ignored_choices")

self.run()

def __set_properties(self):
Expand Down Expand Up @@ -1406,6 +1408,7 @@ def run(self):
wx.CallAfter(pub.sendMessage, "roi_map_close")

def update_variation(self, variation, physician, cnx):
variation = clean_name(variation)

new_physician_roi = self.roi_map.get_physician_roi(
physician, variation
Expand Down Expand Up @@ -1528,6 +1531,7 @@ def __do_subscribe(self):
def close(self):
self.roi_map.write_to_file()
self.roi_map.import_from_file()
pub.sendMessage("update_uncategorized_ignored_choices")
self.Destroy()

def update_gauge_1_info(self, msg):
Expand Down
14 changes: 8 additions & 6 deletions dvha/tools/roi_name_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,8 +1438,13 @@ def variations_to_update(self):
for physician, physician_roi_data in changes.items():
variations = []
for p_roi_data in physician_roi_data.values():
for delta_data in p_roi_data.values():
variations.extend(delta_data["variations"])
add_vars, del_vars = set(), set()
if '-' in p_roi_data:
del_vars = set(csv_to_list(p_roi_data['-']['variations'][0]))
if '+' in p_roi_data:
add_vars = set(csv_to_list(p_roi_data['+']['variations'][0]))
edited_vars = del_vars.symmetric_difference(add_vars)
variations.extend(edited_vars)
variations_to_update[physician] = list(set(variations))

for physician in list(variations_to_update):
Expand All @@ -1461,10 +1466,7 @@ def remap_rois(self):
physician, new_physician_roi
)

condition = (
"REPLACE(REPLACE(LOWER(roi_name), ''', '`'), '_', ' ') == '%s'"
% variation
)
condition = f"roi_name = '{variation}'"
sql_query = (
"SELECT DISTINCT study_instance_uid, roi_name FROM DVHs WHERE %s;"
% condition
Expand Down
13 changes: 0 additions & 13 deletions dvha/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,16 +1614,3 @@ def get_windows_webview_backend(include_edge=False):
for id, name in backends:
if webview.WebView.IsBackendAvailable(id):
return {"id": id, "name": name}


def is_edge_backend_available():
"""Check if WebViewBackendEdge is available
Returns
-------
bool
True if wx.html2.WebViewBackendEdge is available
"""
if is_windows():
return webview.WebView.IsBackendAvailable(webview.WebViewBackendEdge)
return False

0 comments on commit 5d71674

Please sign in to comment.