private void chkBioDose_Checked(object sender, RoutedEventArgs e) { VMMetric metric = ((FrameworkElement)sender).DataContext as VMMetric; CheckBox chkbox = sender as CheckBox; DataGridRow row = dtaMetrics.ContainerFromElement(chkbox) as DataGridRow; if (row == null) { return; } int rowIndex = row.GetIndex(); VMStructure struc = dtaMetrics.Items[rowIndex] as VMStructure; //Get NTCP Parameters if (metric.NTCPParameters.AlphaBeta == 0) { BioDoseConfiguration bioConfig = Myconfig.GetBioDoseConfiguration(); if (struc.IsTarget) { metric.NTCPParameters.AlphaBeta = bioConfig.TargetAlphaBeta; } else { metric.NTCPParameters.AlphaBeta = bioConfig.OrganAlphaBeta; } } UpdateDoseMetrics(struc, metric); }
//private void btnDVH_Click(object sender, RoutedEventArgs e) //{ // UMRO.Utils.DVHViewer.DVHViewer viewer = new UMRO.Utils.DVHViewer.DVHViewer(); // viewer.PrescribedDose = (pItemOpen as PlanSetup).TotalPrescribedDose.Dose; // foreach (var structure in _viewModel.Structures.Where(s => s.IsSelected)) // { // foreach (var plan in PItemsInScope) // { // MyDVHData dvh = DVHDataModel.Instance.GetStdDVH(structure.Id, plan.Id, VMS.TPS.Common.Model.Types.DoseValuePresentation.Absolute, VMS.TPS.Common.Model.Types.VolumePresentation.AbsoluteCm3); // if (dvh != null) // { // Point[] dvhPoints = new Point[dvh.CurveData.Count()]; // for (int i = 0; i < dvh.CurveData.Count(); i++) // { // dvhPoints[i].X = dvh.CurveData[i].Dose; // dvhPoints[i].Y = dvh.CurveData[i].Volume; // } // viewer.AddCumulativeDVH(structure.Id + "-" + plan.Id, structure.Color, dvhPoints, "Gy"); // } // //check if a biological corrected DVH has beem calculated // VMMetric metric = structure.DoseMetrics.FirstOrDefault(s => s.UseBioDose); // if (metric != null) // { // MyDVHData bioDvh = DVHDataModel.Instance.GetBioDVH(structure.Id, plan.Id, VMS.TPS.Common.Model.Types.VolumePresentation.AbsoluteCm3, metric); // if (bioDvh != null) // { // Point[] dvhPoints = new Point[bioDvh.CurveData.Count()]; // for (int i = 0; i < bioDvh.CurveData.Count(); i++) // { // dvhPoints[i].X = bioDvh.CurveData[i].Dose; // dvhPoints[i].Y = bioDvh.CurveData[i].Volume; // } // viewer.AddCumulativeDVH(structure.Id + "-" + plan.Id + "(EQD2)", structure.Color, dvhPoints, "Gy"); // } // } // } // } // Window window = new Window(); // window.Content = viewer; // window.ShowDialog(); //} private void imgAddMetric_MouseDown(object sender, MouseButtonEventArgs e) { VMStructure stru = ((FrameworkElement)sender).DataContext as VMStructure; VMMetric metric = new VMMetric(); stru.DoseMetrics.Add(metric); }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { Cursor = Cursors.Wait; VMMetric selMetric = ((FrameworkElement)sender).DataContext as VMMetric; ComboBox cmb = sender as ComboBox; DataGridRow row = dtaMetrics.ContainerFromElement(cmb) as DataGridRow; if (row == null) { return; } int rowIndex = row.GetIndex(); VMStructure struc = dtaMetrics.Items[rowIndex] as VMStructure; if (cmb.SelectedValue != null) { selMetric.Name = cmb.SelectedValue.ToString(); if (selMetric.Name == "NTCP") { if (selMetric.NTCPParameters.LKBn == 0) { SiteChooser siteChoose = new SiteChooser(); siteChoose.ShowDialog(); selMetric.NTCPParameters.AlphaBeta = siteChoose.AlphaBeta; selMetric.NTCPParameters.LKBn = siteChoose.LKBn; selMetric.NTCPParameters.LKBm = siteChoose.LKBm; selMetric.NTCPParameters.LKBD50 = siteChoose.LKBD50; } } UpdateDoseMetrics(struc, selMetric); selMetric.UseBioDose = false; if (MetricUsesGy(selMetric.Name)) { selMetric.CanUseBiodose = true; } else if (selMetric.Name == "NTCP") { selMetric.UseBioDose = true; } else { selMetric.CanUseBiodose = false; } } Cursor = Cursors.Arrow; } catch (Exception ex) { throw ex; } }
private void UpdateDoseMetrics(VMStructure struc, VMMetric selMetric) { Cursor = Cursors.Wait; Structure structure = StructureSet.Structures.FirstOrDefault(s => s.Id == struc.Id); if (structure == null) { throw new ApplicationException("Could not find Structure"); } int i = 0; selMetric.StdPlanMetric = CalculateDoseMetric(StdPlan, selMetric, structure); selMetric.RapidPlanMetric = CalculateDoseMetric(RapidPlan, selMetric, structure); selMetric.RapidPlanEstimateMetric = CalculateDoseMetric(RapidPlan, selMetric, structure, true); Cursor = Cursors.Arrow; }
private void btnRecalc_Click(object sender, RoutedEventArgs e) { VMMetric metric = ((FrameworkElement)sender).DataContext as VMMetric; Button button = sender as Button; DataGridRow row = dtaMetrics.ContainerFromElement(button) as DataGridRow; if (row == null) { return; } int rowIndex = row.GetIndex(); VMStructure struc = dtaMetrics.Items[rowIndex] as VMStructure; UpdateDoseMetrics(struc, metric); metric.ShowNTCPParams = false; }
private void chkBioDose_Unchecked(object sender, RoutedEventArgs e) { VMMetric metric = ((FrameworkElement)sender).DataContext as VMMetric; CheckBox chkbox = sender as CheckBox; DataGridRow row = dtaMetrics.ContainerFromElement(chkbox) as DataGridRow; if (row == null) { return; } int rowIndex = row.GetIndex(); VMStructure struc = dtaMetrics.Items[rowIndex] as VMStructure; UpdateDoseMetrics(struc, metric); metric.ShowNTCPParams = false; }
private void chkStructures_Checked(object sender, RoutedEventArgs e) { CheckBox check = sender as CheckBox; TextBlock txt = check.Content as TextBlock; string strucId = txt.Text; VMStructure struc = _viewModel.Structures.FirstOrDefault(s => s.Id == strucId); DefaultMetricsConfiguration config = Myconfig.GetDefaultMetricsSection(); if (config != null) { foreach (DefaultMetricElement met in config.Metrics) { if (struc.Id.ToUpper().Contains(met.Structure.ToUpper())) { struc.DoseMetrics[0].Name = met.Metric; UpdateDoseMetrics(struc, struc.DoseMetrics[0]); break; } } } }