function make_ROI_goals (Geometry, beamlets, beamlets_joined, patient) % this is a support function for NLP_beamlet_optimizer. It creates the % goals planned for specific patients. switch patient case 'patient' ROI_goals.optGoal = make_ROI_goals_Pat(Geometry, beamlets); ROI_goals.optGoal_beam = make_ROI_goals_Pat(Geometry, beamlets_joined); ROI_goals.optGoal_idx=[1,2]; ROI_goals.targetMinMax_idx=[1,3]; case 'tomoPhantom' ROI_goals.optGoal = make_ROI_goals_Pat2(Geometry, beamlets); ROI_goals.optGoal_beam = make_ROI_goals_Pat2(Geometry, beamlets_joined); ROI_goals.optGoal_idx=[1,3]; ROI_goals.targetMinMax_idx=[1,2]; case 'phantom_HD' ROI_goals.optGoal = make_ROI_goals(Geometry, beamlets); ROI_goals.optGoal_beam = make_ROI_goals(Geometry, beamlets_joined); ROI_goals.optGoal_idx=[1,3]; ROI_goals.targetMinMax_idx=[1,2]; case 'doggo' % optGoal = make_ROI_goals_DOG(Geometry, beamlets); % optGoal_beam = make_ROI_goals_DOG(Geometry, beamlets_joined); ROI_goals.optGoal = make_ROI_goals_DOG_2(Geometry, beamlets); ROI_goals.optGoal_beam = make_ROI_goals_DOG_2(Geometry, beamlets_joined); ROI_goals.optGoal_idx=[1,2]; ROI_goals.targetMinMax_idx=[1,3]; case 'gbm_005' ROI_goals.optGoal = make_ROI_goals_gbm_005(Geometry, beamlets); ROI_goals.optGoal_beam = make_ROI_goals_gbm_005(Geometry, beamlets_joined); ROI_goals.optGoal_idx=[1,3]; % indeces of volumes you want on histogram ROI_goals.targetMinMax_idx=[1,2]; % indeces of limits for min/max target volume otherwise error('invalid case') end save(['C:\010-work\003_localGit\WiscPlan_v2\optGoals\' patient, '.mat'], 'ROI_goals') end % ---- MAKE ROI GOALS ---- % min, max, min_sq, max_sq, LeastSquare, min_perc_Volume, max_perc_Volume function optGoal = make_ROI_goals_Pat(Geometry, beamlets) optGoal={}; % -- START DEFINITION OF GOAL -- goal_1.name = 'Target_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 = 10 / 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, 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 = 65; goal_2.function = 'max'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); goal_2.target = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.opt_weight = 0.8 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'ROI 1_max'; goal_3.ROI_name = Geometry.ROIS{1, 3}.name; ROI_idx = Geometry.ROIS{1, 3}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 10; goal_3.function = 'max'; goal_3.beamlets_pruned = beamlets(ROI_idx, :); goal_3.target = ones(numel(ROI_idx), 1) * goal_3.D_final; goal_3.opt_weight = 2 / 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; % -- END DEFINITION OF GOAL -- end function optGoal = make_ROI_goals_Pat2(Geometry, beamlets) optGoal={}; % -- START DEFINITION OF GOAL -- goal_1.name = 'Target_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 = 62; goal_1.function = 'min'; goal_1.beamlets_pruned = beamlets(ROI_idx, :); goal_1.target_alpha = 1.00; goal_1.target = ones(numel(ROI_idx), 1) * goal_1.D_final; goal_1.opt_weight = 10 / 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, 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 = 63; goal_2.function = 'max'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); goal_1.target_alpha = 1.05; goal_2.target = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.opt_weight = 2 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'ROI 1_max'; goal_3.ROI_name = Geometry.ROIS{1, 3}.name; ROI_idx = Geometry.ROIS{1, 3}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 10; goal_3.function = 'max'; goal_3.beamlets_pruned = beamlets(ROI_idx, :); goal_3.target = ones(numel(ROI_idx), 1) * goal_3.D_final; goal_3.opt_weight = 2 / 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; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_4.name = 'Ring_max'; goal_4.ROI_name = Geometry.ROIS{1, 6}.name; ROI_idx = Geometry.ROIS{1, 6}.ind; goal_4.ROI_idx = ROI_idx; goal_4.imgDim = size(Geometry.data); goal_4.D_final = 56; goal_4.function = 'max_sq'; goal_4.beamlets_pruned = beamlets(ROI_idx, :); goal_4.target = ones(numel(ROI_idx), 1) * goal_4.D_final; goal_4.opt_weight = 1 / numel(ROI_idx); % normalize to volume of target area goal_4.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_4; % -- END DEFINITION OF GOAL -- end function optGoal = make_ROI_goals_DOG(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.ROI_idx = ROI_idx; goal_1.imgDim = size(Geometry.data); goal_1.D_final = 62; goal_1.function = 'min_sq'; goal_1.beamlets_pruned = beamlets(ROI_idx, :); goal_1.target = ones(numel(ROI_idx), 1) * goal_1.D_final; goal_1.opt_weight = 10 / 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 = 'Doggo_max'; goal_2.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_2.ROI_idx = ROI_idx; goal_2.imgDim = size(Geometry.data); goal_2.D_final = 20; goal_2.function = 'max_sq'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); goal_2.target = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.opt_weight = 0.2 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'Target_max'; goal_3.ROI_name = Geometry.ROIS{1, 1}.name; ROI_idx = Geometry.ROIS{1, 1}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 63; 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 = 2 / numel(ROI_idx); % normalize to volume of target area goal_3.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_3; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'Doggo_max2'; goal_3.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 50; 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.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_3; % -- END DEFINITION OF GOAL -- end function optGoal = make_ROI_goals_DOG_2(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.ROI_idx = ROI_idx; goal_1.imgDim = size(Geometry.data); goal_1.D_final = 62; goal_1.function = 'min_sq'; goal_1.beamlets_pruned = beamlets(ROI_idx, :); goal_1.target_alpha = 1.00; goal_1.target = ones(numel(ROI_idx), 1) * goal_1.D_final; goal_1.opt_weight = 10 / 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 = 'Doggo_max'; goal_2.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_2.ROI_idx = ROI_idx; goal_2.imgDim = size(Geometry.data); goal_2.D_final = 20; goal_2.function = 'max_sq'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); goal_2.target = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.opt_weight = 0.2 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'Target_max'; goal_3.ROI_name = Geometry.ROIS{1, 1}.name; ROI_idx = Geometry.ROIS{1, 1}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 63; goal_3.function = 'max_sq'; goal_3.beamlets_pruned = beamlets(ROI_idx, :); goal_3.target_alpha = 1.05; goal_3.target = ones(numel(ROI_idx), 1) * goal_3.D_final; goal_3.opt_weight = 2 / numel(ROI_idx); % normalize to volume of target area goal_3.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_3; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_4.name = 'Doggo_max2'; goal_4.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_4.ROI_idx = ROI_idx; goal_4.imgDim = size(Geometry.data); goal_4.D_final = 50; goal_4.function = 'max_sq'; goal_4.beamlets_pruned = beamlets(ROI_idx, :); goal_4.target = ones(numel(ROI_idx), 1) * goal_4.D_final; goal_4.opt_weight = 1 / numel(ROI_idx); % normalize to volume of target area goal_4.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_4; % -- END DEFINITION OF GOAL -- end function optGoal = make_ROI_goals_DOG_3(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.ROI_idx = ROI_idx; goal_1.imgDim = size(Geometry.data); goal_1.D_final = 62; goal_1.function = 'min_perc_Volume'; goal_1.beamlets_pruned = beamlets(ROI_idx, :); goal_1.target_alpha = 1.00; goal_1.target = ones(numel(ROI_idx), 1) * goal_1.D_final; goal_1.opt_weight = 10 / 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 = 'Doggo_max'; goal_2.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_2.ROI_idx = ROI_idx; goal_2.imgDim = size(Geometry.data); goal_2.D_final = 20; goal_2.function = 'max_sq'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); goal_2.targetImg = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.target = ones(numel(ROI_idx), 1) * goal_2.D_final; goal_2.opt_weight = 0.2 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'Target_max'; goal_3.ROI_name = Geometry.ROIS{1, 1}.name; ROI_idx = Geometry.ROIS{1, 1}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 63; goal_3.function = 'max_perc_Volume'; goal_3.beamlets_pruned = beamlets(ROI_idx, :); goal_3.target_alpha = 1.05; goal_3.target = ones(numel(ROI_idx), 1) * goal_3.D_final; goal_3.opt_weight = 0.5 / numel(ROI_idx); % normalize to volume of target area goal_3.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_3; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_4.name = 'Doggo_max2'; goal_4.ROI_name = Geometry.ROIS{1, 4}.name; ROI_idx = Geometry.ROIS{1, 4}.ind; goal_4.ROI_idx = ROI_idx; goal_4.imgDim = size(Geometry.data); goal_4.D_final = 50; goal_4.function = 'max_sq'; goal_4.beamlets_pruned = beamlets(ROI_idx, :); goal_4.target = ones(numel(ROI_idx), 1) * goal_4.D_final; goal_4.opt_weight = 1 / numel(ROI_idx); % normalize to volume of target area goal_4.dvh_col = [0.2, 0.9, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_4; % -- END DEFINITION OF GOAL -- end function optGoal = make_ROI_goals_gbm_005(Geometry, beamlets) optGoal={}; pathIn = '\\Mpufs5\data_wnx1\_Data\Glioma_aus\FET_FGL005\B1\Processed\'; [minDose, minDose_meta] = nrrdread([pathIn 'RODP_files\FET_FGL005_B1_DP_minDose.nrrd']); [maxDose, maxDose_meta] = nrrdread([pathIn 'RODP_files\FET_FGL005_B1_DP_maxDose.nrrd']); minDose = double(minDose); maxDose = double(maxDose); % -- START DEFINITION OF GOAL -- goal_1.name = 'CTV_min'; goal_1.ROI_name = Geometry.ROIS{1, 1}.name; ROI_idx = Geometry.ROIS{1, 1}.ind; goal_1.ROI_idx = ROI_idx; goal_1.imgDim = size(Geometry.data); goal_1.D_final = minDose(ROI_idx); goal_1.function = 'min'; goal_1.beamlets_pruned = beamlets(ROI_idx, :); % goal_1.target_alpha = 1.00; goal_1.target = 60 % minDose(ROI_idx); 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 = 'CTV_max'; goal_2.ROI_name = Geometry.ROIS{1, 1}.name; ROI_idx = Geometry.ROIS{1, 1}.ind; goal_2.ROI_idx = ROI_idx; goal_2.imgDim = size(Geometry.data); goal_2.D_final = maxDose(ROI_idx); goal_2.function = 'max_sq'; goal_2.beamlets_pruned = beamlets(ROI_idx, :); % goal_1.target_alpha = 1.00; goal_2.target = 60 % maxDose(ROI_idx); goal_2.opt_weight = 2 / numel(ROI_idx); % normalize to volume of target area goal_2.dvh_col = [0.9, 0.2, 0.2]; % color of the final DVH plot % assign target optGoal{end+1}=goal_2; % -- END DEFINITION OF GOAL -- % -- START DEFINITION OF GOAL -- goal_3.name = 'head_max'; goal_3.ROI_name = Geometry.ROIS{1, 2}.name; ROI_idx = Geometry.ROIS{1, 2}.ind; goal_3.ROI_idx = ROI_idx; goal_3.imgDim = size(Geometry.data); goal_3.D_final = 0.1; 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 = 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; % -- END DEFINITION OF GOAL -- end