private void SetEdgePenaltiesForControlPoints(FieldViewModel field, double[] penalties)
        {
            int i = 0;

            foreach (ControlPointViewModel cp in field.ControlPoints)
            {
                cp.Penalty = penalties[i++];
            }
        }
        public void CalculateEdgePenaltyForField(FieldViewModel field)
        {
            double[] edgePenalties = EdgePenaltyCalculator.
                                     CalculatePerControlPointWeighted(field.Plan.Patient, field.Plan.Plan, field.Beam);

            field.Penalty = edgePenalties.Sum();

            SetEdgePenaltiesForControlPoints(field, edgePenalties);
        }
Пример #3
0
        private LineSeries CreatePenaltySeries(FieldViewModel field)
        {
            LineSeries series = new LineSeries();

            series.Title = field.PlotDisplayName;
            series.Points.AddRange(GetDataPoints(field).OrderBy(s => s.X));
            series.Color = ColorsToUse.NextColor();
            series.TrackerFormatString         = "{0}\n{1}: {2:f6}\n{3}: {4:f6}";
            series.CanTrackerInterpolatePoints = false;
            field.PlotColor = series.Color;
            return(series);
        }
Пример #4
0
        private BoxPlotSeries CreateSeries(FieldViewModel field, int index)
        {
            // A single series may contain multiple boxes,
            // but the problem is that they must all share the same color,
            // so here each series contains a single box,
            // so that each box can have its own color
            BoxPlotSeries series = new BoxPlotSeries();

            series.Items         = new[] { GetBox(field, index) };
            series.MeanThickness = 0.0;
            series.Stroke        = ColorsToUse.NextColor();
            field.PlotColor      = series.Stroke;
            return(series);
        }
Пример #5
0
        private BoxPlotItem GetBox(FieldViewModel field, int index)
        {
            double[] data = field.ControlPoints
                            .OrderBy(cp => cp.Penalty)
                            .Select(cp => cp.Penalty)
                            .ToArray();

            var box = new BoxPlotItem
            {
                X            = index,
                LowerWhisker = data.Quantile(0.02),
                BoxBottom    = data.LowerQuartile(),
                Median       = data.Median(),
                BoxTop       = data.UpperQuartile(),
                UpperWhisker = data.Quantile(0.98)
            };

            box.Outliers = data.Where(d => d <box.LowerWhisker || d> box.UpperWhisker).ToList();

            return(box);
        }
Пример #6
0
 private IEnumerable <DataPoint> GetDataPoints(FieldViewModel field)
 {
     return(from cp in field.ControlPoints
            select new DataPoint(ShiftAngle(cp.GantryAngle), cp.Penalty));
 }