Exemple #1
0
        public DVHViewModel(Patient pat, PlanningItem pItem, Course course, StructureSet ss, User user)
        {
            //patient information
            _contextInfo = new ContextInformation
            {
                SelectedPatient      = pat,
                SelectedPlanningItem = pItem,
                SelectedCourse       = course,
                SelectedStructureSet = pItem is PlanSetup ? ss : (pItem as PlanSum).StructureSet,
                CurrentUser          = user
            };

            _plans = new ObservableCollection <PlanInformation>();

            //add plans to be displayed
            if (pItem is PlanSetup)
            {
                PlanSumDoseVisibility = Visibility.Hidden;
                _plans.Add(new PlanInformation(pItem as PlanSetup));
            }
            else             //plan sum, so add all plans in it
            {
                PlanSumDoseVisibility = Visibility.Visible;
                DoseValue tempPlanSumTotalDose = new DoseValue(0, SelectedPlanningItem.Dose.DoseMax3D.Unit);

                foreach (PlanSetup plan in (pItem as PlanSum).PlanSetups)
                {
                    _plans.Add(new PlanInformation(plan));
                    tempPlanSumTotalDose = DvhExtensions.AddDoseValues(tempPlanSumTotalDose, plan.TotalDose);
                }

                _planSumTotalDose     = tempPlanSumTotalDose;
                _planSumTotalDoseText = tempPlanSumTotalDose.Dose.ToString();
            }

            //protocol selection dropdowns
            _categories       = ConstraintList.GetCategories();
            _protocols        = ConstraintList.GetProtocols();
            _selectedCategory = _categories.First();

            //DVH
            PlotModel     = CreatePlotModel();
            DVHStructures = GetContouredStructures();

            //constraints table
            DVHTable = new ObservableCollection <DVHTableRow>();

            //misc
            Username = _contextInfo.CurrentUser.Id;
        }
Exemple #2
0
        private static void AddAxes(PlotModel plotModel, ContextInformation context)
        {
            plotModel.Axes.Add(new LinearAxis
            {
                Title              = "Dose [Gy]",
                Position           = AxisPosition.Bottom,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                AbsoluteMinimum    = 0,
                AbsoluteMaximum    = context.SelectedPlanningItem.Dose.DoseMax3D.Unit == DoseValue.DoseUnit.Percent ? context.SelectedPlanningItem.Dose.DoseMax3D.Dose * (context.SelectedPlanningItem as PlanSetup).TotalDose.Dose / 100 : context.SelectedPlanningItem.Dose.DoseMax3D.Dose
            });

            plotModel.Axes.Add(new LinearAxis
            {
                Title              = "Volume [%]",
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                AbsoluteMinimum    = 0,
                AbsoluteMaximum    = 100
            });
        }