Example #1
0
        // Evaluate covered dose at Volume.
        private string EvaluateCoveredDoseAtVolume(Structure evalStructure, PlanningItem plan, ref List <string> warnings)
        {
            // Covered Dose at Volume DCxcc is equivalent to D(V_tot - x)cc
            double             Vtot       = evalStructure.Volume;
            double             doseEvalPt = (DVHUnit.CompareTo("cc") == 0) ? Vtot - double.Parse(DVHEvalPt) : 100 - double.Parse(DVHEvalPt);
            StructureObjective tmp        = new StructureObjective()
            {
                DVHUnit     = DVHUnit,
                DVHEvalPt   = string.Format("{0:0.00}", doseEvalPt),
                DVHEvalUnit = DVHEvalUnit
            };

            return(tmp.EvaluateDoseAtVolume(evalStructure, plan, ref warnings));
        }
Example #2
0
        // Evaluate conformality index.
        private string EvaluateConformalityIndex(Structure evalStructure, PlanningItem plan, ref List <string> warnings)
        {
            // Conformality index = (Volume of Isodose line) / (Volume of Target)
            string achieved = "";

            // Find body contour. Search first for DicomType == "Body", then DicomType == "External"
            StructureSet ss   = plan.StructureSet;
            Structure    body = (from s in ss.Structures
                                 where s.DicomType.ToUpper().CompareTo("Body".ToUpper()) == 0
                                 select s).FirstOrDefault();

            if ((body == null) || (body.IsEmpty))
            {
                body = (from s in ss.Structures
                        where s.DicomType.ToUpper().CompareTo("External".ToUpper()) == 0
                        select s).FirstOrDefault();
            }
            if ((body == null) || (body.IsEmpty))
            {
                warnings.Add("Body not defined or not found.");
                return(achieved);
            }

            // Create a temporary StructureObjective object to evaluate the volume at dose in the body
            double             V_target = evalStructure.Volume;
            StructureObjective tmp      = new StructureObjective()
            {
                DVHUnit     = DVHUnit,
                DVHEvalPt   = DVHEvalPt,
                DVHEvalUnit = "cc"
            };
            string V_isodose = tmp.EvaluateVolumeAtDose(body, plan, ref warnings);

            if (string.IsNullOrEmpty(V_isodose))
            {
                return(V_isodose);
            }

            double V_isodose_double = double.Parse(Regex.Match(V_isodose, @"^\d*\.?\d*").ToString());
            double achievedDouble   = V_isodose_double / V_target;

            achieved = string.Format("{0:0.00}", achievedDouble);
            return(achieved);
        }
Example #3
0
        // Evaluate covered volume at dose.
        private string EvaluateCoveredVolumeAtDose(Structure evalStructure, PlanningItem plan, ref List <string> warnings)
        {
            // Covered Volume at Dose DVxGy is equivalent to V_tot - VxGy
            double             Vtot = evalStructure.Volume;
            StructureObjective tmp  = new StructureObjective()
            {
                DVHUnit     = DVHUnit,
                DVHEvalPt   = DVHEvalPt,
                DVHEvalUnit = DVHEvalUnit
            };
            string achieved = tmp.EvaluateVolumeAtDose(evalStructure, plan, ref warnings);

            if (string.IsNullOrEmpty(achieved))
            {
                return(achieved);
            }

            double achievedDouble = double.Parse(Regex.Match(achieved, @"^\d*\.?\d*").ToString());

            achievedDouble = (DVHEvalUnit.CompareTo("cc") == 0) ? Vtot - achievedDouble : 100 - achievedDouble;
            achieved       = string.Format("{0:0.00} {1}", achievedDouble, DVHEvalUnit);

            return(achieved);
        }