Exemplo n.º 1
0
        /// <summary>
        /// Run IMRT optimization for a given plan.
        /// </summary>
        public static void Optimize(ExternalPlanSetup plan)
        {
            plan.SetCalculationModel(CalculationType.PhotonIMRTOptimization, OptimizationAlgorithm);
            var opt = new OptimizationOptionsIMRT(NumberOfIterationsForIMRTOptimization,
                                                  OptimizationOption.RestartOptimization, OptimizationConvergenceOption.TerminateIfConverged, MlcId);

            Trace.WriteLine("\nOptimizing...\n");
            var res = plan.Optimize(opt);

            if (!res.Success)
            {
                var message = string.Format("Optimization failed for plan '{0}'", plan.Id);
                throw new Exception(message);
            }

            plan.SetCalculationModel(CalculationType.PhotonVolumeDose, DoseCalculationAlgorithm);
            plan.SetCalculationModel(CalculationType.PhotonLeafMotions, LeafMotionCalculator);

            Trace.WriteLine("\nCalculating leaf motions...\n");

            var calcRes = plan.CalculateLeafMotions();

            if (!res.Success)
            {
                var message = string.Format("Leaf motion calculation failed for plan '{0}'. Output:\n{1}", plan.Id, calcRes);
                throw new Exception(message);
            }
        }
Exemplo n.º 2
0
        public OptimizerResult Optimize(OptimizationOptionsIMRT options)
        {
            var local  = this;
            var retVal = X.Instance.CurrentContext.GetValue(sc =>
            {
                return(new OptimizerResult(local._client.Optimize(options)));
            });

            return(retVal);
        }
Exemplo n.º 3
0
        public static string optimizarIMRT(ExternalPlanSetup plan)
        {
            var watch = Stopwatch.StartNew();

            plan.SetCalculationModel(CalculationType.PhotonIMRTOptimization, Configuracion.OptimizationAlgorithm);
            var opt = new OptimizationOptionsIMRT(2500, OptimizationOption.RestartOptimization, OptimizationConvergenceOption.TerminateIfConverged, Configuracion.MlcId);
            var res = plan.Optimize(opt);

            if (!res.Success)
            {
                return(string.Format("Falló la optimización para el plan '{0}'", plan.Id));
            }
            else
            {
                watch.Stop();
                var elapsedMs = watch.ElapsedMilliseconds;
                return(string.Format("Finalizó la optimización para el plan '{0}'. Demoró " + elapsedMs.ToString() + "ms", plan.Id));
            }
        }