Beispiel #1
0
        static void DrawDVH(DVHPlot.ViewModel.MainWindowModel viewModel, VMS.TPS.Common.Model.API.PlanSetup curps)
        {
            StructureSet structureSet = curps.StructureSet;

            foreach (var structure in structureSet.Structures)
            {
                DVHData dvhData = curps.GetDVHCumulativeData(structure,
                                                             DoseValuePresentation.Absolute,
                                                             VolumePresentation.Relative, 1);
                OxyPlot.OxyColor   color  = new OxyPlot.OxyColor();
                OxyPlot.MarkerType marker = new OxyPlot.MarkerType();
                viewModel.AddData(dvhData, structure.Id, color, marker);
            }
        }
Beispiel #2
0
        private static PlotModel CreatePlot(VM.PlanSetup plan)
        {
            var model = new PlotModel();

            //Add Dose Axis
            model.Axes.Add(new LinearAxis()
            {
                Title                  = "Dose [cGy]",
                Position               = AxisPosition.Bottom,
                MajorGridlineStyle     = LineStyle.Solid,
                MinorGridlineStyle     = LineStyle.Dot,
                MinorGridlineThickness = 1,
                MinorGridlineColor     = OxyColor.FromRgb(15, 15, 15),
            });
            //Add Volume Axis
            model.Axes.Add(new LinearAxis()
            {
                Title              = "Volume [%]",
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                MinorGridlineColor = OxyColor.FromRgb(15, 15, 15)
            });

            foreach (var str in plan.StructureSet.Structures)
            {
                var ser = new LineSeries();
                ser.Color = OxyColor.FromRgb(str.Color.R, str.Color.G, str.Color.B);
                foreach (var pt in plan.GetDVHCumulativeData(str, D.Absolute, V.Relative, 0.1).CurveData)
                {
                    ser.Points.Add(new DataPoint(pt.DoseValue.GetDoseCGy(), pt.Volume));
                }
                model.Series.Add(ser);
            }

            return(model);
        }
        private TPReportData GetReportData(string patientstring)
        {
            CurCursor = Cursors.Wait;

            TPReportData returnvalue = new TPReportData();

            VMS.TPS.Common.Model.API.Patient   curpat = null;
            VMS.TPS.Common.Model.API.PlanSetup curps  = null;

            if (patientstring.Split(',').Count() == 3)
            {
                string patient_id   = patientstring.Split(',')[0];
                string course_id    = patientstring.Split(',')[1];
                string plansetup_id = patientstring.Split(',')[2];
                curpat = cur_app.OpenPatientById(patient_id);
                if (curpat != null)
                {
                    curps = curpat.Courses.Where(x => x.Id == course_id).Single().PlanSetups.Where(x => x.Id == plansetup_id).Single();
                }
                if (curps != null)
                {
                    returnvalue.CurPatientInfo.FirstName = curpat.FirstName;
                    returnvalue.CurPatientInfo.LastName  = curpat.LastName;
                    returnvalue.CurPatientInfo.PatientID = curpat.Id;


                    returnvalue.CurPlanInfo.CourseID = curps.Course.Id;
                    returnvalue.CurPlanInfo.PlaneID  = curps.Id;


                    returnvalue.CurDosePrescription.NumberOfFraction           = curps.UniqueFractionation.NumberOfFractions.Value.ToString();
                    returnvalue.CurDosePrescription.PrescribedDoseFractination = Math.Round(curps.UniqueFractionation.PrescribedDosePerFraction.Dose, 1).ToString();
                    returnvalue.CurDosePrescription.PlanNormalization          = Math.Round(curps.PlanNormalizationValue, 1).ToString();
                    returnvalue.CurDosePrescription.TotalPrescribedDose        = Math.Round(curps.TotalPrescribedDose.Dose, 1).ToString();


                    FieldInfo curfi = new FieldInfo();
                    foreach (Beam b in curps.Beams)
                    {
                        curfi            = new FieldInfo();
                        curfi.BeamID     = b.Id;
                        curfi.Collimator = Math.Round(b.ControlPoints[0].CollimatorAngle, 1).ToString();
                        curfi.Gantry     = Math.Round(b.ControlPoints[0].GantryAngle, 1).ToString();
                        curfi.Couch      = Math.Round(b.ControlPoints[0].PatientSupportAngle, 1).ToString();
                        curfi.Energy     = b.EnergyModeDisplayName;
                        curfi.Machine    = b.TreatmentUnit.Id;
                        curfi.MU         = Math.Round(b.Meterset.Value, 1).ToString();
                        curfi.X1         = Math.Round(b.ControlPoints[0].JawPositions.X1 / 10.0f, 1).ToString();
                        curfi.X2         = Math.Round(b.ControlPoints[0].JawPositions.X2 / 10.0f, 1).ToString();
                        curfi.Y1         = Math.Round(b.ControlPoints[0].JawPositions.Y1 / 10.0f, 1).ToString();
                        curfi.Y2         = Math.Round(b.ControlPoints[0].JawPositions.Y2 / 10.0f, 1).ToString();
                        returnvalue.CurFieldInfoList.Add(curfi);
                    }

                    StructureData cursd = new StructureData();
                    DVHData       dvhd  = null;
                    foreach (Structure s in curps.StructureSet.Structures)
                    {
                        if (colors.ContainsKey(s.Id.ToLower()) || colors.ContainsKey(s.DicomType.ToLower()))
                        {
                            if (!s.IsEmpty && s.Volume > 0.0f)
                            {
                                cursd             = new StructureData();
                                cursd.StructureID = s.Id;
                                cursd.Type        = s.DicomType;
                                cursd.Volume      = Math.Round(s.Volume, 1).ToString();
                                dvhd = curps.GetDVHCumulativeData(s, DoseValuePresentation.Absolute, VolumePresentation.Relative, 1.0f);
                                if (dvhd != null)
                                {
                                    cursd.MaxDose = Math.Round(dvhd.MaxDose.Dose, 1).ToString();
                                    cursd.MinDose = Math.Round(dvhd.MinDose.Dose, 1).ToString();
                                }
                                returnvalue.CurStructureDataList.Add(cursd);
                            }
                        }
                    }
                }
            }
            cur_app.ClosePatient();
            CurCursor = Cursors.Arrow;
            return(returnvalue);
        }