|
@@ -1,15 +1,17 @@
|
|
|
|
|
|
|
|
|
|
-% [D_full, w_fin, Geometry, optGoal] = NLP_beamlet_optimizer;
|
|
|
|
-% orthoslice(D_full, [0,70])
|
|
|
|
-% colorwash(Geometry.data, D_full, [500, 1500], [0,70])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+% colorwash(Geometry.data, D_full, [500, 1500], [0,70])
|
|
|
|
+% orthoslice(D_full, [0,70])
|
|
|
|
+
|
|
function [D_full, w_fin, Geometry, optGoal] = NLP_beamlet_optimizer
|
|
function [D_full, w_fin, Geometry, optGoal] = NLP_beamlet_optimizer
|
|
% This function performs the beamlet optimization
|
|
% This function performs the beamlet optimization
|
|
% Inputs: none. Still needs to find "Geometry" and "beamlets" from Wiscplan
|
|
% Inputs: none. Still needs to find "Geometry" and "beamlets" from Wiscplan
|
|
% Outputs: full dose image dose: D_full, optimal beamlet weights: w_fin
|
|
% Outputs: full dose image dose: D_full, optimal beamlet weights: w_fin
|
|
-%
|
|
|
|
|
|
+%
|
|
|
|
+% [D_full, w_fin, Geometry, optGoal] = NLP_beamlet_optimizer;
|
|
|
|
+%
|
|
% Made by Peter Ferjancic 1. May 2018
|
|
% Made by Peter Ferjancic 1. May 2018
|
|
% Last updated: 14. August 2018
|
|
% Last updated: 14. August 2018
|
|
% Inspired by Ana Barrigan's REGGUI optimization procedures
|
|
% Inspired by Ana Barrigan's REGGUI optimization procedures
|
|
@@ -123,6 +125,7 @@ fprintf('\n running initial optimizer:')
|
|
% -- GET FULL BEAM WEIGHTS --
|
|
% -- GET FULL BEAM WEIGHTS --
|
|
tic
|
|
tic
|
|
w_beam = fmincon(fun1,w0_beams,A,b,Aeq,beq,lb_beam,ub,nonlcon,options);
|
|
w_beam = fmincon(fun1,w0_beams,A,b,Aeq,beq,lb_beam,ub,nonlcon,options);
|
|
|
|
+fprintf(' done!:')
|
|
% t=toc;
|
|
% t=toc;
|
|
% disp(['Optimization time for beams = ',num2str(t)]);
|
|
% disp(['Optimization time for beams = ',num2str(t)]);
|
|
|
|
|
|
@@ -137,7 +140,9 @@ w_beamlets = w_beamlets + (2*rand(size(w_beamlets))-1) *0.1 .*w_beamlets; % smal
|
|
% -- GET FULL BEAMLET WEIGHTS --
|
|
% -- GET FULL BEAMLET WEIGHTS --
|
|
options.MaxFunctionEvaluations = N_fcallback2;
|
|
options.MaxFunctionEvaluations = N_fcallback2;
|
|
% tic
|
|
% tic
|
|
|
|
+fprintf('\n running full optimizer:')
|
|
w_fin = fmincon(fun2,w_beamlets,A,b,Aeq,beq,lb,ub,nonlcon,options);
|
|
w_fin = fmincon(fun2,w_beamlets,A,b,Aeq,beq,lb,ub,nonlcon,options);
|
|
|
|
+fprintf(' done!:')
|
|
t=toc;
|
|
t=toc;
|
|
disp(['Optimization time for beamlets = ',num2str(t)]);
|
|
disp(['Optimization time for beamlets = ',num2str(t)]);
|
|
|
|
|
|
@@ -337,10 +342,10 @@ function optGoal = make_robust_optGoal(optGoal, RO_params, beamlets);
|
|
|
|
|
|
if isfield(optGoal{goal_i}, 'target_alpha')
|
|
if isfield(optGoal{goal_i}, 'target_alpha')
|
|
target = double(optGoal{goal_i}.target_alpha * targetIn(ROI_idx));
|
|
target = double(optGoal{goal_i}.target_alpha * targetIn(ROI_idx));
|
|
- disp('exists')
|
|
|
|
|
|
+% disp('exists')
|
|
else
|
|
else
|
|
target = ones(numel(ROI_idx), 1) * optGoal{goal_i}.D_final;
|
|
target = ones(numel(ROI_idx), 1) * optGoal{goal_i}.D_final;
|
|
- disp('not exists')
|
|
|
|
|
|
+% disp('not exists')
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|