def beam_set_choices(ss): nr_targets = SSF.determine_nr_of_indexed_ptvs(ss) sep_plan = P.Property('Separate planer', 'sep_plan', next_category='målvolum') sep_beamset_sep_iso = P.Property('Separate beam set - separate isosenter', 'sep_beamset_sep_iso') sep_beamset_iso = P.Property('Separate beam set - felles isosenter', 'sep_beamset_iso', default=True) beamset_iso = P.Property('Samme beam set - felles isosenter', 'beamset') for i in range(nr_targets): P.Property('CTV' + str(i + 1), 'CTV' + str(i + 1), parent=sep_plan) return [sep_plan, sep_beamset_sep_iso, sep_beamset_iso, beamset_iso]
def __expand_subfeatures_aux(property, dont_validate=False): """ Helper for expand_subfeatures. Given a feature and value, or just a value corresponding to an implicit feature, returns a property set consisting of all component subfeatures and their values. For example: expand_subfeatures <toolset>gcc-2.95.2-linux-x86 -> <toolset>gcc <toolset-version>2.95.2 <toolset-os>linux <toolset-cpu>x86 equivalent to: expand_subfeatures gcc-2.95.2-linux-x86 feature: The name of the feature, or empty if value corresponds to an implicit property value: The value of the feature. dont_validate: If True, no validation of value string will be done. """ f = property.feature() v = property.value() if not dont_validate: validate_value_string(f, v) components = v.split("-") v = components[0] import property result = [property.Property(f, components[0])] subvalues = components[1:] while len(subvalues) > 0: subvalue = subvalues[0] # pop the head off of subvalues subvalues = subvalues[1:] subfeature = __find_implied_subfeature(f, subvalue, v) # If no subfeature was found, reconstitute the value string and use that if not subfeature: return [property.Property(f, '-'.join(components))] result.append(property.Property(subfeature, subvalue)) return result
def setUp(self): self.element = Element('test_ROOT_tag test') self._prop_factory = property.Property(self.element) self.font_dict = {'comment': {'family': 'Liberation Sans', 'size': '14', 'style': 'Italic'}, 'default': {'family': 'Liberation Sans', 'size': '14', 'style': 'Regular'}, 'default bold': {'family': 'Liberation Sans', 'size': '14', 'style': 'Bold'}, 'fine print': {'family': 'Liberation Sans', 'size': '12', 'style': 'Regular'}, 'header 1': {'family': 'Liberation Sans', 'size': '22', 'style': 'Bold'}, 'header 2': {'family': 'Liberation Sans', 'size': '18', 'style': 'Bold'}, 'header 3': {'family': 'Liberation Sans', 'size': '16', 'style': 'Bold'}, 'oddball': {'family': 'Liberation Sans', 'size': '40', 'style': 'Regular'}}
def defaults(features): """ Returns the default property values for the given features. """ # FIXME: should merge feature and property modules. import property result = [] for f in features: if not f.free() and not f.optional() and f.default(): result.append(property.Property(f, f.default())) return result
def setUp(self): self.element = Element('test_root') self._prop_factory = property.Property(self.element) self.color_dict = {'activetext': {'red': '255', 'green': '255', 'blue': '0', 'alpha': '255'}, 'attention': {'red': '255', 'green': '160', 'blue': '0', 'alpha': '255'}, 'background': {'red': '255', 'green': '255', 'blue': '255', 'alpha': '255'}, 'button_background': {'red': '210', 'green': '210', 'blue': 210, 'alpha': '255'}, 'disconnected': {'red': '200', 'green': '0', 'blue': '200', 'alpha': '200'}, 'grid': {'red': '128', 'green': '128', 'blue': '128', 'alpha': '255'}, 'header_background': {'red': '77', 'green': '77', 'blue': '77', 'alpha': '255'}, 'header_foreground': {'red': '255', 'green': '255', 'blue': '255', 'alpha': '255'}, 'invalid': {'red': '255', 'green': '0', 'blue': '255', 'alpha': '255'}, 'major': {'red': '255', 'green': '0', 'blue': '0', 'alpha': '255'}, 'minor': {'red': '255', 'green': '128', 'blue': '0', 'alpha': '255'}, 'off': {'red': '60', 'green': '100', 'blue': '60', 'alpha': '255'}, 'ok': {'red': '0', 'green': '255', 'blue': '0', 'alpha': '255'}, 'on': {'red': '0', 'green': '255', 'blue': '0', 'alpha': '255'}, 'read_background': {'red': '240', 'green': '240', 'blue': '240', 'alpha': '255'}, 'stop': {'red': '255', 'green': '0', 'blue': '0', 'alpha': '255'}, 'text': {'red': '0', 'green': '0', 'blue': '0', 'alpha': '255'}, 'transparent': {'red': '255', 'green': '255', 'blue': '255', 'alpha': '0'}, 'write_background': {'red': '128', 'green': '255', 'blue': '255', 'alpha': '255'}}
# encoding: utf8 # Import local files: import property as P # Regions: brain = P.Property('Hjerne', 'brain', next_category='omfang', default=True) lung = P.Property('Lunge', 'lung', next_category='intensjon') breast = P.Property('Bryst', 'breast', next_category='omfang') bladder = P.Property('Blære', 'bladder') prostate = P.Property('Prostata', 'prostate', next_category='omfang') rectum = P.Property('Rektum', 'rectum', next_category='fraksjonering') other = P.Property('Palliativ (skjelett og øvrig bløtvev)', 'other', next_category='') # Brain: Scope: brain_whole = P.Property('Hele hjernen', 'whole', parent=brain, next_category='involvering av hjernehinne', default=True) brain_partial = P.Property('Del av hjerne', 'part', parent=brain) brain_stereotactic = P.Property('Stereotaksi', 'stereotactic', parent=brain, next_category='antall målvolum') # Brain: Whole brain_whole_default = P.Property('Standard total hjerne', 'no',
def has_roi(roi_dict, oar_list): roi = None for k in range(len(oar_list)): if roi_dict.get(oar_list[k]): roi = oar_list[k] break return roi # Setup GUI choices: parameter_property = [] for i in range(len(parameter_list)): parameter_property.append(P.Property(parameter_list[i], parameter_list[i])) # Create radio button object options = RB.RadioButton('Statistikk', 'Velg:', parameter_property) # Setup and run GUI: my_window = Toplevel() frame = FRAME.StatisticsFrame(my_window, options) frame.grid(row=0, column=0) my_window.mainloop() # Extract information from the users's selections in the GUI: if frame.ok: checkBoxes = frame.checkbuttons variables = frame.variables (start_date, stop_date, stereotactic, conv) = frame.get_results()
ROIS.greatves, ROIS.trachea, ROIS.ribs_r, ROIS.ribs_l, ROIS.main_bronchus_l, ROIS.main_bronchus_r, ROIS.cauda_equina, ROIS.kidneys, ROIS.stomach, ROIS.liver, ROIS.small_bowel, ROIS.colon, ROIS.brachial, ROIS.bowel_space, ROIS.rectum, ROIS.z_rectum_p, ROIS.anal_canal, ROIS.bladder, ROIS.femoral_l, ROIS.femoral_r, ROIS.external, ROIS.body, ROIS.markers, ROIS.prosthesis_l, ROIS.prosthesis_r, ROIS.couch, ] oar_list.sort(key=get_my_key) # Setup GUI choices: oar_property = [] for i in range(len(oar_list)): oar_property.append(P.Property(oar_list[i].name, oar_list[i].name)) # Create radio button object options = RB.RadioButton('ROI','Velg:', oar_property) # Setup and run GUI: my_window = Tk() frame = FRAME.CheckButtonFrame(my_window, options) frame.grid(row = 0,column = 0) my_window.mainloop() # Extract information from the users's selections in the GUI: if frame.ok: checkBoxes = frame.checkbuttons variables = frame.variables elif not frame.ok:
if p.BeamSet.DicomPlanLabel == name: name_conflict = True if name_conflict: i = 0 while True: i += 1 name = prefix + " " + str(i) available = True for p in plan.VerificationPlans: if p.BeamSet.DicomPlanLabel == name: available = False if available: break # Radiobutton choices for dose grid: c2mm = P.Property('Konvensjonell VMAT (2 mm)', '0.2', default=True) c1mm = P.Property('Stereotaksi (1 mm)', '0.1') choices = [c2mm, c1mm] # Create radio button object options = RB.RadioButton('VMAT QA', 'Velg dosematrise:', choices) # Setup and run GUI: my_window = Tk() frame = FRAME.RadioButtonFrame(my_window, options) frame.grid(row=0, column=0) my_window.mainloop() # Extract information from the users's selections in the GUI: if frame.ok: (selection, value) = frame.get_results()
import property as prop properties = { 'Home': prop.Property('Home', 200, 10, 100), 'Store': prop.Property('Store', 400, 20, 200), 'Shop': prop.Property('Shop', 150, 8, 75), 'School': prop.Property('School', 300, 15, 150), 'Park': prop.Property('Park', 100, 5, 50) } def get_by_name(property_name): for prop_item in properties.values(): if prop_item.name == property_name: return prop_item
def setUp(self): self.element = Element('test_root') self._prop_factory = property.Property(self.element)
# encoding: utf8 # Import local files: import property as P import structure_set_functions as SSF from tkinter import messagebox # Setup techniques: conformal = P.Property('3D-CRT', 'Conformal') vmat = P.Property('VMAT', 'VMAT', default=True) ''' # Setup techniques: conformal = P.Property('3D-CRT','Conformal', next_category = 'optimalisering') vmat = P.Property('VMAT','VMAT', next_category = 'optimalisering', default = True) # Optimization choices for vmat/conformal: for tech in [conformal, vmat]: opt_without = P.Property('Uten optimalisering','without', parent = tech, default = True) opt_init = P.Property('Initiell optimalisering', 'init', parent = tech) opt_init_oar = P.Property('Initiell optimalisering med tilpasning til risikoorganer','oar', parent = tech) ''' # List of choices: techniques = [conformal, vmat] #optimization = [opt_without, opt_init, opt_init_oar] #optimization_simple = [opt_without, opt_init_oar] def beam_set_choices(ss): nr_targets = SSF.determine_nr_of_indexed_ptvs(ss) sep_plan = P.Property('Separate planer', 'sep_plan',