Пример #1
0
 def create_rois(self):
     # Delete pre-existing ROIs (except those which are manually contoured) in sorted order:
     group = self.grouped_rois()
     for key in sorted(iter(group)):
         for roi in group[key]:
             PMF.delete_matching_roi_except_manually_contoured(
                 self.pm, self.ss, roi)
     group = self.grouped_rois()
     # Create ROIs (in reverse sorted order):
     for key in reversed(sorted(iter(group))):
         for roi in group[key]:
             # Only create ROI if it doesn't already exist:
             if not PMF.has_roi(self.pm, roi.name):
                 if roi.__class__.__name__ == 'ROI':
                     if roi.model:
                         PMF.create_model_roi(self.pm, self.examination,
                                              roi)
                     else:
                         PMF.create_empty_roi(self.pm, roi)
                 elif roi.__class__.__name__ == 'ROIExpanded':
                     PMF.create_expanded_roi(self.pm, self.examination,
                                             self.ss, roi)
                 elif roi.__class__.__name__ == 'ROIAlgebra':
                     PMF.create_algebra_roi(self.pm, self.examination,
                                            self.ss, roi)
                 elif roi.__class__.__name__ == 'ROIWall':
                     PMF.create_wall_roi(self.pm, self.examination, self.ss,
                                         roi)
Пример #2
0
def site(pm, examination, ss, plan, prescription, region_code, target,
         technique_name):
    if region_code in RC.brain_codes:
        # Brain:
        if region_code not in RC.brain_whole_codes:
            if prescription.nr_fractions > 5:
                PMF.create_retina_and_cornea(pm, examination, ss, ROIS.lens_l,
                                             ROIS.box_l, ROIS.eye_l,
                                             ROIS.retina_l, ROIS.cornea_l)
                PMF.create_retina_and_cornea(pm, examination, ss, ROIS.lens_r,
                                             ROIS.box_r, ROIS.eye_r,
                                             ROIS.retina_r, ROIS.cornea_r)
        site = brain(pm, examination, ss, plan, prescription, region_code)
    elif region_code in RC.breast_codes:
        # Breast:
        if region_code in RC.breast_not_thorax_codes:
            # Create a "Markers" ROI:
            breast_target = SSF.determine_breast_primary_target(ss)
            PMF.create_grey_value_intersection_roi(pm, examination, ss,
                                                   ROIS.temp_markers,
                                                   breast_target, ROIS.markers,
                                                   250, 2500)
            if PMF.has_roi(pm, ROIS.markers.name):
                pm.RegionsOfInterest[
                    ROIS.markers.name].OrganData.OrganType = 'Other'
        site = breast(ss, plan, prescription, region_code, technique_name,
                      target)
    elif region_code in RC.lung_and_mediastinum_codes:
        # Lung:
        site = lung(ss, plan, prescription, region_code, target)
    elif region_code in RC.prostate_codes:
        # Prostate:
        if prescription.total_dose > 50:
            PMF.create_bottom_part_x_cm(pm, examination, ss, ROIS.rectum,
                                        ROIS.anal_canal, 4)
        site = prostate(ss, plan, prescription, region_code, target)
    elif region_code in RC.rectum_codes:
        # Rectum:
        site = rectum(ss, plan, prescription)
    elif region_code in RC.bladder_codes:
        # Bladder:
        site = bladder(ss, plan, prescription)
    elif region_code in RC.palliative_codes:
        # Palliative:
        if prescription.is_stereotactic():
            site = bone_stereotactic(ss, plan, prescription, region_code)
        else:
            site = palliative(ss, plan, prescription, region_code, target)
    return site
Пример #3
0
  PMF.create_posterior_half(pm, examination, ss, ROIS.rectum, ROIS.dorso_rectum)
if selected_oar_list.get(ROIS.cornea_l) and selected_oar_list.get(ROIS.retina_l):
  PMF.create_retina_and_cornea(pm, examination, ss, ROIS.lens_l, ROIS.box_l, ROIS.eye_l, ROIS.retina_l, ROIS.cornea_l)
elif selected_oar_list.get(ROIS.retina_l) and not selected_oar_list.get(ROIS.cornea_l):
  PMF.create_retina(pm, examination, ss, ROIS.lens_l, ROIS.box_l, ROIS.eye_l, ROIS.retina_l)
elif selected_oar_list.get(ROIS.cornea_l) and not selected_oar_list.get(ROIS.retina_l):
  PMF.create_cornea(pm, examination, ss, ROIS.lens_l, ROIS.box_l, ROIS.eye_l, ROIS.cornea_l)
if selected_oar_list.get(ROIS.cornea_r) and selected_oar_list.get(ROIS.retina_r):
  PMF.create_retina_and_cornea(pm, examination, ss, ROIS.lens_r, ROIS.box_r, ROIS.eye_r, ROIS.retina_r, ROIS.cornea_r)
elif selected_oar_list.get(ROIS.retina_r) and not selected_oar_list.get(ROIS.cornea_r):
  PMF.create_retina(pm, examination, ss, ROIS.lens_r, ROIS.box_r, ROIS.eye_r, ROIS.retina_r)
elif selected_oar_list.get(ROIS.cornea_r) and not selected_oar_list.get(ROIS.retina_r):
  PMF.create_cornea(pm, examination, ss, ROIS.lens_r, ROIS.box_r, ROIS.eye_r, ROIS.cornea_r)


# Create ROIs:
for roi in reversed(list(selected_oar_list)):
  # Only create ROI if it doesn't already exist:
  if not PMF.has_roi(pm, roi.name):
    if roi.__class__.__name__ == 'ROI':
      if roi.model:
        PMF.create_model_roi(pm, examination, roi)
      else:
        PMF.create_empty_roi(pm, roi)
    elif roi.__class__.__name__ == 'ROIExpanded':
      PMF.create_expanded_roi(pm, examination, ss, roi)
    elif roi.__class__.__name__ == 'ROIAlgebra':
      PMF.create_algebra_roi(pm, examination, ss, roi)
    elif roi.__class__.__name__ == 'ROIWall':
      PMF.create_wall_roi(pm, examination, ss, roi)