Ejemplo n.º 1
0
 public ObjectiveItem(string StructureId_init, ObjectiveDefinition OPO = null)
 {
     StructureId = StructureId_init;
     if (OPO != null)
     {
         ObjectiveDefinitions.Add(OPO);
     }
 }
Ejemplo n.º 2
0
        public Task <List <Controls.ObjectiveDefinition> > GetObjectiveItems()
        {
            return(A.ExecuteAsync(new Func <PlanSetup, List <Controls.ObjectiveDefinition> >((p) =>
            {
                var L = new List <Controls.ObjectiveDefinition>();
                for (int c = 0; c < p.OptimizationSetup.Objectives.Count(); c++)
                {
                    var OD = new Controls.ObjectiveDefinition();
                    var OP = p.OptimizationSetup.Objectives.ToList()[c];
                    switch (OP)
                    {
                    case OptimizationPointObjective OPO:
                        OD.StructureId = OPO.StructureId;
                        OD.Dose = OPO.Dose.Dose;
                        OD.Priority = OPO.Priority;
                        OD.Volume = OPO.Volume;
                        OD.DvhType = Dvh_Types.V;
                        if (p.IsDoseValid)
                        {
                            OD.ResultDose = p.GetDoseAtVolume(OPO.Structure, OD.Volume, VolumePresentation.Relative, DoseValuePresentation.Absolute).Dose;
                            OD.ResultVolume = p.GetVolumeAtDose(OPO.Structure, OPO.Dose, VolumePresentation.Relative);
                        }
                        switch (OPO.Operator)
                        {
                        case OptimizationObjectiveOperator.Lower:
                            OD.Type = ReferenceTypes.Lower;
                            OD.DoseDifference = -(OD.ResultDose - OD.Dose);
                            OD.VolDifference = -(OD.ResultVolume - OD.Volume);
                            break;

                        case OptimizationObjectiveOperator.Upper:
                            OD.Type = ReferenceTypes.Upper;
                            OD.DoseDifference = (OD.ResultDose - OD.Dose);
                            OD.VolDifference = (OD.ResultVolume - OD.Volume);
                            break;
                        }
                        L.Add(OD);
                        break;

                    case OptimizationMeanDoseObjective OMO:
                        OD.StructureId = OMO.StructureId;
                        OD.Type = ReferenceTypes.Upper;
                        OD.DvhType = Dvh_Types.M;
                        OD.Dose = OMO.Dose.Dose;
                        OD.Priority = OMO.Priority;
                        OD.Volume = double.NaN;
                        if (p.IsDoseValid)
                        {
                            OD.ResultDose = p.GetDVHCumulativeData(OMO.Structure, DoseValuePresentation.Absolute, VolumePresentation.Relative, 0.1).MeanDose.Dose;
                            OD.DoseDifference = OD.ResultDose - OD.Dose;
                        }
                        L.Add(OD);
                        break;

                    default:
                        L.Add(OD);
                        break;
                    }
                }
                return L;
            }), p));
        }