def __init__(self, parent): wx.Frame.__init__(self, parent, style=wx.SYSTEM_MENU | wx.CLOSE_BOX | wx.CAPTION) self.parent = parent self.options = parent.options self.plots = { 'DVHs': parent.plot, 'Time Series': parent.time_series.plot, 'Regression': parent.regression.plot, 'Control Chart': parent.control_chart.plot } button_keys = {'Export': wx.ID_ANY, 'Dismiss': wx.ID_CANCEL} self.button = { key: wx.Button(self, button_id, key) for key, button_id in button_keys.items() } self.__set_input_widgets() self.__set_properties() self.__do_bind() self.__do_layout() self.getter = { int: self.get_text_ctrl_int, float: self.get_text_ctrl_float, str: self.get_combo_box } set_msw_background_color(self) set_frame_icon(self)
def OnInit(self): initialize_directories_and_settings() if is_windows(): from dvha.tools.windows_reg_edit import set_ie_emulation_level, set_ie_lockdown_level set_ie_emulation_level() set_ie_lockdown_level() self.SetAppName('DVH Analytics') self.frame = DVHAMainFrame(None, wx.ID_ANY, "") set_frame_icon(self.frame) self.SetTopWindow(self.frame) self.frame.Show() return True
def __init__(self, main_app_frame, y_variable, x_variables, group_data, group, options, auto_update_plot=True): """ :param y_variable: dependent variable :type y_variable: str :param x_variables: independent variables :type x_variables: list :param group_data: dvhs, table, and stats_data :type group_data: dict :param options: user options containing visual preferences :type options: Options """ wx.Frame.__init__(self, None, title="Multi-Variable Model for %s: Group %s" % (y_variable, group)) self.main_app_frame = main_app_frame self.y_variable = y_variable self.x_variables = x_variables self.group_data = group_data self.group = group self.stats_data = group_data[group]['stats_data'] set_msw_background_color( self) # If windows, change the background color set_frame_icon(self) self.options = options self.plot = PlotMultiVarRegression(self, options, group) if auto_update_plot: self.plot.update_plot(y_variable, x_variables, self.stats_data) msg = { 'y_variable': y_variable, 'x_variables': x_variables, 'regression': self.plot.reg, 'group': group } pub.sendMessage('control_chart_set_model', **msg) self.button_back_elimination = wx.Button(self, wx.ID_ANY, 'Backward Elimination') self.button_export = wx.Button(self, wx.ID_ANY, 'Export CSV') self.button_save_figure = wx.Button(self, wx.ID_ANY, 'Save Figure') self.button_save_model = wx.Button(self, wx.ID_ANY, 'Save MVR Model') self.button_load_mlr_model = wx.Button(self, wx.ID_ANY, 'Load ML Model') algorithms = [ 'Random Forest', 'Support Vector Machine', 'Decision Tree', 'Gradient Boosting' ] self.button = { key: wx.Button(self, wx.ID_ANY, key) for key in algorithms } self.radiobox_include_back_elim = wx.RadioBox( self, wx.ID_ANY, 'Include all x-variables?', choices=['Yes', 'No']) self.__do_bind() self.__set_properties() self.__do_layout() self.ml_frames = []
def __init__(self, roi_map, options): """ :param roi_map: roi_map object :type roi_map: DatabaseROIs """ wx.Frame.__init__(self, None, title='Database Administrator') set_frame_icon(self) set_msw_background_color( self) # If windows, change the background color self.roi_map = roi_map self.options = options self.db_tree = self.get_db_tree() self.SetSize(get_window_size(0.792, 0.781)) self.window_db_editor = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_3D) self.window_pane_db_tree = wx.ScrolledWindow(self.window_db_editor, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.TAB_TRAVERSAL) self.tree_ctrl_db = wx.TreeCtrl(self.window_pane_db_tree, wx.ID_ANY, style=wx.TR_HAS_BUTTONS | wx.TR_MULTIPLE) self.window_pane_query = wx.Panel(self.window_db_editor, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.TAB_TRAVERSAL) self.text_ctrl_condition = wx.TextCtrl(self.window_pane_query, wx.ID_ANY, "") self.list_ctrl_query_results = wx.ListCtrl( self.window_pane_query, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES) self.data_query_results = DataTable( self.list_ctrl_query_results, columns=['mrn', 'study_instance_uid']) self.combo_box_query_table = wx.ComboBox(self.window_pane_query, wx.ID_ANY, choices=list(self.db_tree), style=wx.CB_DROPDOWN | wx.CB_READONLY) self.button = { 'delete_all_data': wx.Button(self, wx.ID_ANY, "Delete All Data"), 'rebuild_db': wx.Button(self, wx.ID_ANY, "Rebuild Database"), 'calculations': wx.Button(self, wx.ID_ANY, "Calculations"), 'edit_db': wx.Button(self, wx.ID_ANY, "Edit Database"), 'reimport': wx.Button(self, wx.ID_ANY, "Reimport from DICOM"), 'delete_study': wx.Button(self, wx.ID_ANY, "Delete Study"), 'change_mrn_uid': wx.Button(self, wx.ID_ANY, "Change MRN/UID"), 'query': wx.Button(self.window_pane_query, wx.ID_ANY, "Query"), 'clear': wx.Button(self.window_pane_query, wx.ID_ANY, "Clear"), 'export_csv': wx.Button(self.window_pane_query, wx.ID_ANY, "Export"), 'remap_roi_names': wx.Button(self, wx.ID_ANY, "Remap ROI Names"), 'update_from_csv': wx.Button(self, wx.ID_ANY, "Update from CSV"), # 'plan_complexity': wx.Button(self, wx.ID_ANY, "Recalc Plan Complexities"), 'auto_fit_columns': wx.Button(self.window_pane_query, wx.ID_ANY, "Auto-fit Columns") } self.checkbox_auto_backup = wx.CheckBox( self, wx.ID_ANY, "Auto Backup SQLite DB After Import") self.__set_properties() self.__do_layout() self.__do_bind() self.selected_columns = { table: {c: False for c in list(self.db_tree[table])} for table in list(self.db_tree) } self.selected_tables = {table: False for table in list(self.db_tree)} self.window_db_editor.SetSashPosition(250) self.tree_ctrl_db.Expand(self.db_tree_root) self.allow_tree_select_change = True self.Show()
def __set_properties(self): self.SetSize(get_window_size(0.714, 0.762)) set_msw_background_color(self) set_frame_icon(self)
def __init__(self, roi_map): """ :param roi_map: roi map object :type roi_map: DatabaseROIs """ wx.Frame.__init__(self, None, title='ROI Map') set_frame_icon(self) self.roi_map = roi_map self.window_size = get_window_size(0.893, 0.762) self.SetSize(self.window_size) self.window = wx.SplitterWindow(self, wx.ID_ANY) self.window_tree = wx.Panel(self.window, wx.ID_ANY, style=wx.BORDER_SUNKEN) self.combo_box_tree_plot_data = wx.ComboBox(self.window_tree, wx.ID_ANY, choices=['All', 'Linked', 'Unlinked', 'Branched'], style=wx.CB_DROPDOWN | wx.CB_READONLY) self.plot = PlotROIMap(self.window_tree, roi_map) self.window_editor = wx.Panel(self.window, wx.ID_ANY, style=wx.BORDER_SUNKEN) self.combo_box_physician = wx.ComboBox(self.window_editor, wx.ID_ANY, choices=self.roi_map.get_physicians(), style=wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_physician_roi = wx.ComboBox(self.window_editor, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY) self.list_ctrl_variations = wx.ListCtrl(self.window_editor, wx.ID_ANY, style=wx.LC_NO_HEADER | wx.LC_REPORT | wx.BORDER_SUNKEN) self.button_variation_select_all = wx.Button(self.window_editor, wx.ID_ANY, "Select All") self.button_variation_deselect_all = wx.Button(self.window_editor, wx.ID_ANY, "Deselect All") self.button_variation_add = wx.Button(self.window_editor, wx.ID_ANY, "Add") self.button_variation_delete = wx.Button(self.window_editor, wx.ID_ANY, "Delete") self.button_variation_move = wx.Button(self.window_editor, wx.ID_ANY, "Move") self.button_variation_move.Disable() self.button_variation_delete.Disable() self.button_variation_deselect_all.Disable() self.button_physician = {'add': wx.Button(self.window_editor, wx.ID_ANY, "+"), 'del': wx.Button(self.window_editor, wx.ID_ANY, "-"), 'edit': wx.Button(self.window_editor, wx.ID_ANY, "Δ")} self.button_physician_roi = {'add': wx.Button(self.window_editor, wx.ID_ANY, "+"), 'del': wx.Button(self.window_editor, wx.ID_ANY, "-"), 'edit': wx.Button(self.window_editor, wx.ID_ANY, "Δ")} self.button_link_physician_roi = wx.Button(self.window_editor, wx.ID_ANY, "Link") self.button_link_physician_roi.Disable() self.combo_box_uncategorized_ignored = wx.ComboBox(self.window_editor, wx.ID_ANY, choices=["Uncategorized", "Ignored"], style=wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_uncategorized_ignored_roi = wx.ComboBox(self.window_editor, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.button_uncategorized_ignored_delete = wx.Button(self.window_editor, wx.ID_ANY, "Delete DVH") self.button_uncategorized_ignored_ignore = wx.Button(self.window_editor, wx.ID_ANY, "Ignore DVH") self.combo_box_physician_roi_merge = {'a': wx.ComboBox(self.window_editor, wx.ID_ANY, style=wx.CB_DROPDOWN), 'b': wx.ComboBox(self.window_editor, wx.ID_ANY, style=wx.CB_DROPDOWN)} self.button_merge = wx.Button(self.window_editor, wx.ID_ANY, "Merge") self.button_save_and_update = wx.Button(self.window_editor, wx.ID_ANY, "Save and Update Database") self.button_cancel = wx.Button(self.window_editor, wx.ID_ANY, "Cancel Changes and Reload") self.uncategorized_variations = {} self.columns = ['Variations'] self.data_table = DataTable(self.list_ctrl_variations, columns=self.columns, widths=[490]) self.__set_properties() self.__do_bind() self.__do_layout() self.plot.update_roi_map_source_data(self.physician) self.run()
def __set_properties(self): self.SetTitle("Stats Data Editor: Group %s" % self.group) set_msw_background_color(self) set_frame_icon(self)