Esempio n. 1
0
        public static double NTCP(Structure structure, PlanSetup plan, VMMetric metric, bool useRapPlanEstimate)
        {
            MyDVHData StdDVH = new MyDVHData();

            StdDVH.LoadDVH(structure, plan, DoseValuePresentation.Absolute, VolumePresentation.AbsoluteCm3, useRapPlanEstimate);

            if (StdDVH.CurveData == null)
            {
                //missing upper or lower dvh estimate
                return(0);
            }
            //Convert DHV to direct
            MyDVHData.DVHPoint[] dirDVH = new MyDVHData.DVHPoint[StdDVH.CurveData.Count()];
            dirDVH[dirDVH.Count() - 1] = new MyDVHData.DVHPoint
            {
                Dose   = StdDVH.CurveData[StdDVH.CurveData.Count() - 1].Dose,
                Volume = StdDVH.CurveData[StdDVH.CurveData.Count() - 1].Volume
            };

            for (int i = 0; i < StdDVH.CurveData.Count() - 1; i++)
            {
                dirDVH[i] = new MyDVHData.DVHPoint
                {
                    Dose   = StdDVH.CurveData[i].Dose,
                    Volume = StdDVH.CurveData[i].Volume - StdDVH.CurveData[i + 1].Volume
                };
            }

            //Biocorrect DVH
            foreach (var point in dirDVH)
            {
                point.Dose = BioDose.bioCorrectEQD2(point.Dose, plan, structure, metric.NTCPParameters.AlphaBeta);
            }

            double EUD_a = 1.0 / metric.NTCPParameters.LKBn;

            double sum_bEUD = 0;

            for (int i = 0; i < dirDVH.Count(); i++)
            {
                double tEUD = (dirDVH[i].Volume / (structure.Volume)) * Math.Pow(dirDVH[i].Dose, EUD_a);
                sum_bEUD = sum_bEUD + tEUD;
            }

            double gEUD = Math.Pow(sum_bEUD, metric.NTCPParameters.LKBn);
            //NORMSDIST((gEUD-lkb_d50)/(lkb_m*lkb_d50))
            double NTCPOPER = (gEUD - metric.NTCPParameters.LKBD50) / (metric.NTCPParameters.LKBm * metric.NTCPParameters.LKBD50);

            if (NTCPOPER > 4.89)//ANYTHING OVER THIS RESULTS IN AN NTCP OF 100%, BUT CAN GIVE THE STATS PACKAGE AN ERROR
            {
                NTCPOPER = 4.89;
            }
            return(100 * Statistics.NormSDist(NTCPOPER));
        }
Esempio n. 2
0
        public static double DMax(Structure structure, PlanSetup plan, VMMetric metric, bool useRapPlanEstimate)
        {
            MyDVHData cumDVH = new MyDVHData();

            cumDVH.LoadDVH(structure, plan, DoseValuePresentation.Absolute, VolumePresentation.AbsoluteCm3, useRapPlanEstimate);
            if (cumDVH != null)
            {
                return(cumDVH.MaxDose);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 3
0
        private static double GetVolumeWithDose(Structure structure, PlanSetup plan, double dose, DoseValuePresentation dosePresentation, VolumePresentation volPresentation, VMMetric metric, bool useRapPlanEstimate)
        {
            double volume = 0;

            MyDVHData dvh = new MyDVHData();

            dvh.LoadDVH(structure, plan, dosePresentation, volPresentation, useRapPlanEstimate);

            if (dvh != null)
            {
                if (dvh.CurveData == null)
                {
                    //missing upper or lower dvh estimate
                    return(0);
                }
                MyDVHData.DVHPoint[] points = dvh.CurveData;
                for (int i = 0; i < points.Count(); i++)
                {
                    if (points[i].Dose > dose)
                    {
                        if (i == 0)
                        {
                            volume = points[0].Volume;
                            break;
                        }

                        //interpolate volume
                        volume = points[i - 1].Volume + (points[i].Volume - points[i - 1].Volume) *
                                 (dose - points[i - 1].Dose) / (points[i].Dose - points[i - 1].Dose);
                        break;
                    }
                }

                return(volume);
            }
            else
            {
                return(0);
            }
        }