public ObservableCollection <PQMSummaryViewModel> AddPQMSummary(ObservableCollection <PQMSummaryViewModel> PqmSummaries, ConstraintViewModel constraintPath, PlanningItemViewModel planningItem, Patient patient) { StructureSet structureSet = planningItem.PlanningItemStructureSet; Structure evalStructure; var calculator = new PQMSummaryCalculator(); if (planningItem.PlanningItemObject is PlanSum) { var waitWindowPQM = new WaitWindowPQM(); PlanSum plansum = (PlanSum)planningItem.PlanningItemObject; if (plansum.IsDoseValid() == true) { waitWindowPQM.Show(); foreach (PQMSummaryViewModel pqm in PqmSummaries) { evalStructure = calculator.FindStructureFromAlias(structureSet, pqm.TemplateId, pqm.TemplateAliases, pqm.TemplateCodes); if (evalStructure != null) { var pqmSummary = calculator.GetObjectiveProperties(pqm, planningItem, structureSet, new StructureViewModel(evalStructure)); pqm.Achieved_Comparison = pqmSummary.Achieved; pqm.AchievedColor_Comparison = pqmSummary.AchievedColor; pqm.AchievedPercentageOfGoal_Comparison = pqmSummary.AchievedPercentageOfGoal; pqm.Met_Comparison = pqmSummary.Met; } } waitWindowPQM.Close(); } } else //is plansetup { var waitWindowPQM = new WaitWindowPQM(); PlanSetup planSetup = (PlanSetup)planningItem.PlanningItemObject; if (planSetup.IsDoseValid() == true) { waitWindowPQM.Show(); foreach (PQMSummaryViewModel pqm in PqmSummaries) { evalStructure = calculator.FindStructureFromAlias(structureSet, pqm.TemplateId, pqm.TemplateAliases, pqm.TemplateCodes); if (evalStructure != null) { if (evalStructure.Id.Contains("PTV") == true) { foreach (Structure s in structureSet.Structures) { if (s.Id == planSetup.TargetVolumeID) { evalStructure = s; } } } var pqmSummary = calculator.GetObjectiveProperties(pqm, planningItem, structureSet, new StructureViewModel(evalStructure)); pqm.Achieved_Comparison = pqmSummary.Achieved; } } waitWindowPQM.Close(); } } return(PqmSummaries); }
public void GetPQMSummaries(ConstraintViewModel constraintPath, PlanningItemViewModel planningItem, Patient patient) { PqmSummaries = new ObservableCollection <PQMSummaryViewModel>(); StructureSet structureSet = planningItem.PlanningItemStructureSet; Structure evalStructure; ObservableCollection <PQMSummaryViewModel> pqmSummaries = new ObservableCollection <PQMSummaryViewModel>(); ObservableCollection <StructureViewModel> foundStructureList = new ObservableCollection <StructureViewModel>(); var calculator = new PQMSummaryCalculator(); Objectives = calculator.GetObjectives(constraintPath); if (planningItem.PlanningItemObject is PlanSum) { var waitWindowPQM = new WaitWindowPQM(); PlanSum plansum = (PlanSum)planningItem.PlanningItemObject; if (plansum.IsDoseValid() == true) { waitWindowPQM.Show(); foreach (PQMSummaryViewModel objective in Objectives) { evalStructure = calculator.FindStructureFromAlias(structureSet, objective.TemplateId, objective.TemplateAliases, objective.TemplateCodes); if (evalStructure != null) { var evalStructureVM = new StructureViewModel(evalStructure); var obj = calculator.GetObjectiveProperties(objective, planningItem, structureSet, evalStructureVM); PqmSummaries.Add(obj); NotifyPropertyChanged("Structure"); } } waitWindowPQM.Close(); } } if (planningItem.PlanningItemObject is PlanSetup) //is plansetup { var waitWindowPQM = new WaitWindowPQM(); PlanSetup planSetup = (PlanSetup)planningItem.PlanningItemObject; if (planSetup.IsDoseValid() == true) { waitWindowPQM.Show(); foreach (PQMSummaryViewModel objective in Objectives) { evalStructure = calculator.FindStructureFromAlias(structureSet, objective.TemplateId, objective.TemplateAliases, objective.TemplateCodes); if (evalStructure != null) { if (evalStructure.Id.Contains("PTV") == true) { foreach (Structure s in structureSet.Structures) { if (s.Id == planSetup.TargetVolumeID) { evalStructure = s; } } } var evalStructureVM = new StructureViewModel(evalStructure); var obj = calculator.GetObjectiveProperties(objective, planningItem, structureSet, evalStructureVM); PqmSummaries.Add(obj); NotifyPropertyChanged("Structure"); } } waitWindowPQM.Close(); } } }