Ver código fonte

Commit before adding PTV margins, overhaulingdose prescription

pferjancic 6 anos atrás
pai
commit
c5413d998c

+ 11 - 6
WiscPlanPhotonkV125/matlab_frontend/NLP_beamlet_optimizer.m

@@ -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
 % This function performs the beamlet optimization
 % Inputs: none. Still needs to find "Geometry" and "beamlets" from Wiscplan
 % 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
 % Last updated: 14. August 2018
 % Inspired by Ana Barrigan's REGGUI optimization procedures
@@ -123,6 +125,7 @@ fprintf('\n running initial optimizer:')
 % -- GET FULL BEAM WEIGHTS --
 tic
 w_beam = fmincon(fun1,w0_beams,A,b,Aeq,beq,lb_beam,ub,nonlcon,options);
+fprintf('  done!:')
 % t=toc;
 % 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 --
 options.MaxFunctionEvaluations = N_fcallback2;
 % tic
+fprintf('\n running full optimizer:')
 w_fin = fmincon(fun2,w_beamlets,A,b,Aeq,beq,lb,ub,nonlcon,options);
+fprintf('  done!:')
 t=toc;
 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')
                         target = double(optGoal{goal_i}.target_alpha * targetIn(ROI_idx));
-                        disp('exists')
+%                         disp('exists')
                     else
                         target = ones(numel(ROI_idx), 1) * optGoal{goal_i}.D_final;
-                        disp('not exists')
+%                         disp('not exists')
                     end
                     
                     

+ 2 - 3
WiscPlanPhotonkV125/matlab_frontend/helicalDosecalcSetup7.m

@@ -500,10 +500,9 @@ while(1)
     strBeamlet = input('Run beamlet batches dose calculation locally? y/n \n','s');
 end
 
-
+t = datetime('now');
 disp(['Calculating ' num2str(size(all_beams, 2)) ' beamlets in ' num2str(size(batches, 1))...
-    ' batches. '])
-
+    ' batches. Start: ' datestr(t)])
 
 if(strcmpi('y',strBeamlet)) 
     for k = 1:numel(batches)

+ 2 - 0
WiscPlanPhotonkV125/matlab_frontend/lab/RDXTPS_geometry_setup_wizard_ASP.m

@@ -115,6 +115,8 @@ Geometry.ROIS{end}.visible = false;
 %     Geometry.HCRing = xor(Geometry.BTV, Geometry.SBTV);
 % end
 
+%% -----===== PTV creation =====-----
+
 
 %% -----===== Save geometry files =====-----
 waitbar(2/total_num_steps, hWaitbar, 'Step 3: Save geometry files');

BIN
optGoals/gbm_005.mat


+ 9 - 9
optGoals/make_ROI_goals.m

@@ -385,28 +385,28 @@ function optGoal = make_ROI_goals_gbm_005(Geometry, beamlets)
     optGoal={};
     
     % -- START DEFINITION OF GOAL --
-    goal_1.name = 'Target_min';
-    goal_1.ROI_name = Geometry.ROIS{1, 1}.name;
-    ROI_idx = Geometry.ROIS{1, 1}.ind;
+    goal_1.name = 'BTV_min';
+    goal_1.ROI_name = Geometry.ROIS{1, 2}.name;
+    ROI_idx = Geometry.ROIS{1, 2}.ind;
     goal_1.ROI_idx = ROI_idx;
     goal_1.imgDim = size(Geometry.data);
     goal_1.D_final = 60;
     goal_1.function = 'min';
     goal_1.beamlets_pruned = beamlets(ROI_idx, :);
     goal_1.target   = ones(numel(ROI_idx), 1) * goal_1.D_final;
-    goal_1.opt_weight = 20 / numel(ROI_idx); % normalize to volume of target area
+    goal_1.opt_weight = 40 / numel(ROI_idx); % normalize to volume of target area
     goal_1.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot
     % assign target
     optGoal{end+1}=goal_1;
     % -- END DEFINITION OF GOAL --
     
     % -- START DEFINITION OF GOAL --
-    goal_2.name = 'Target_max';
-    goal_2.ROI_name = Geometry.ROIS{1, 1}.name;
-    ROI_idx = Geometry.ROIS{1, 1}.ind;
+    goal_2.name = 'BTV_max';
+    goal_2.ROI_name = Geometry.ROIS{1, 2}.name;
+    ROI_idx = Geometry.ROIS{1, 2}.ind;
     goal_2.ROI_idx = ROI_idx;
     goal_2.imgDim = size(Geometry.data);
-    goal_2.D_final = 61;
+    goal_2.D_final = 62;
     goal_2.function = 'max';
     goal_2.beamlets_pruned = beamlets(ROI_idx, :);
     goal_2.target   = ones(numel(ROI_idx), 1) * goal_2.D_final;
@@ -426,7 +426,7 @@ function optGoal = make_ROI_goals_gbm_005(Geometry, beamlets)
     goal_3.function = 'max_sq';
     goal_3.beamlets_pruned = beamlets(ROI_idx, :);
     goal_3.target   = ones(numel(ROI_idx), 1) * goal_3.D_final;
-    goal_3.opt_weight = 1 / numel(ROI_idx); % normalize to volume of target area
+    goal_3.opt_weight = 7 / numel(ROI_idx); % normalize to volume of target area
     goal_3.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot
     % assign target
     optGoal{end+1}=goal_3;