Ver código fonte

In preparation for CDP patient analysis

pferjancic 6 anos atrás
pai
commit
8f5b8ed2ac

+ 73 - 0
ROI_goals_prep.m

@@ -17,6 +17,15 @@ switch patient
         paths.target_fzy_in  = ['\RODP_files\FET_FGL015_B1_thr2_fuzzyCTV'];
         paths.body_bin_in    = ['\RODP_files\FET_FGL015_B1_head_crop_bin'];
         paths.wiscplan = 'C:\010-work\003_localGit\WiscPlan_v2\data\PatData_ausGli_015';
+        
+    case 'gbm_022'
+        patname = 'FET_FGL022';
+        paths.in = ['\\Mpufs5\data_wnx1\_Data\Glioma_aus\' patname '\B1\Processed'];
+        paths.CT_in = [patname '_B1_CT2FET'];
+        paths.target_bin_in  = ['\RODP_files\' patname '_B1_thr2_binPTV'];
+        paths.target_fzy_in  = ['\RODP_files\' patname '_B1_thr2_fuzzyCTV'];
+        paths.body_bin_in    = ['\RODP_files\' patname '_B1_head_crop_bin'];
+        paths.wiscplan = 'C:\010-work\003_localGit\WiscPlan_v2\data\PatData_ausGli_022';
     otherwise
         error('invalid case')
 end
@@ -38,6 +47,12 @@ switch patient
         ROI_goals.optGoal_beam = make_ROI_goals_gbm_015(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
+        
+    case 'gbm_022'
+        ROI_goals.optGoal = make_ROI_goals_gbm_022(Geometry, beamlets);
+        ROI_goals.optGoal_beam = make_ROI_goals_gbm_022(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
@@ -108,6 +123,64 @@ function optGoal = make_ROI_goals_gbm_015(Geometry, beamlets, minDose, maxDose)
     % -- END DEFINITION OF GOAL --
    
 end
+function optGoal = make_ROI_goals_gbm_022(Geometry, beamlets, minDose, maxDose)
+    optGoal={};
+    
+    DP_dir = '\\Mpufs5\data_wnx1\_Data\Glioma_aus\FET_FGL022\B1\Processed';
+    [minDose, minDose_meta] = nrrdread([DP_dir '\RODP_files\FET_FGL022_B1_thr2_DP_minDose.nrrd']);
+    [maxDose, maxDose_meta] = nrrdread([DP_dir '\RODP_files\FET_FGL022_B1_thr2_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   = minDose(ROI_idx); % 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_2.target   = maxDose(ROI_idx); % 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 = 20;
+    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 = 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
 
 function beamlets = get_beamlets(beamlet_cell_array, numVox);
     wbar1 = waitbar(0, 'Creating beamlet array');

+ 4 - 1
WiscPlanPhotonkV125/matlab_frontend/NLP_beamlet_optimizer.m

@@ -27,6 +27,9 @@ switch patient
     case 'gbm_015'
         patient_dir = 'C:\010-work\003_localGit\WiscPlan_v2\data\PatData_ausGli_015';
         DP_dir = '\\Mpufs5\data_wnx1\_Data\Glioma_aus\FET_FGL015\B1\Processed';
+    case 'gbm_022'
+        patient_dir = 'C:\010-work\003_localGit\WiscPlan_v2\data\PatData_ausGli_022';
+        DP_dir = '\\Mpufs5\data_wnx1\_Data\Glioma_aus\FET_FGL022\B1\Processed';
     otherwise
         error('invalid case')
 end
@@ -125,7 +128,7 @@ NLP_result.weights = w_fin;
 save([patient_dir '\matlab_files\NLP_result.mat'], 'NLP_result');
 
 plot_DVH(D_full, optGoal, optGoal_idx, targetMinMax_idx)
-colorwash(Geometry.data, D_full, [-500, 500], [0, 80]);
+colorwash(Geometry.data, D_full, [-500, 500], [0, 110]);
 % plot_DVH_robust(D_full, optGoal, optGoal_idx)
 end
 

+ 1 - 1
WiscPlanPhotonkV125/matlab_frontend/helicalDosecalcSetup7.m

@@ -44,7 +44,7 @@ ypmax = 0.3125;
 % y-prime points in the z-direction in the CT coordinate system
 
 % Number of beamlets in the BEV for each direction
-Mxp = 20;  % Mxp = 20;  number of leaves;
+Mxp = 20;  % Mxp = 64;  number of leaves;
 Nyp = 1;  % always 1 for Tomo due to binary mlc
 
 

+ 18 - 6
vol_prep.m

@@ -13,11 +13,22 @@ function vol_prep
 close all
 
 %% ---=== INPUT PARAMS ===---
-paths.in = '\\Mpufs5\data_wnx1\_Data\Glioma_aus\FET_FGL015\B1\Processed';
-paths.CT_in = ['FET_FGL015_B1_CT2FET'];
-paths.target_bin_in  = ['FET_FGL015_B1_thr2'];
-paths.target_fzy_in  = ['FET_FGL015_B1_thr2'];
-paths.body_bin_in    = ['FET_FGL015_B1_head'];
+
+patname = 'FET_FGL005';
+% patname = 'FET_FGL015';
+% patname = 'FET_FGL022';
+timepoint = 'B1';
+
+paths.in = ['\\Mpufs5\data_wnx1\_Data\Glioma_aus\' patname '\' timepoint '\Processed'];
+paths.CT_in = [patname '_' timepoint '_CT2FET'];
+paths.target_bin_in  = [ patname '_' timepoint '_seg_thr2.0'];
+paths.target_fzy_in  = [ patname '_' timepoint '_seg_combined'];
+paths.body_bin_in    = [ patname '_' timepoint '_head_crop_bin'];
+
+% paths.target_bin_in  = [patname '_' timepoint '_thr2'];
+% paths.target_fzy_in  = [patname '_' timepoint '_thr2'];
+% paths.body_bin_in    = [patname '_' timepoint '_head'];
+
 
 margins.CTV = 1.0; % GTV->CTV margin, in cm
 margins.PTV = 1.0; % CTV->PTV margin, in cm
@@ -98,8 +109,9 @@ function vol_prep_fuzzy(paths, margins)
 infilt_range = margins.CTV; % range of infiltration, in cm. Should be value of sigma (or 1/3 decay range). Assuming normal infil.
 
 [CT_in, CT_meta] = nrrdread([paths.in '\' paths.CT_in '.nrrd']);
-[GTV_in, GTV_meta] = nrrdread([paths.in '\' paths.target_bin_in '.nrrd']);
+[GTV_in, GTV_meta] = nrrdread([paths.in '\' paths.target_fzy_in '.nrrd']);
 % [body_in, body_meta] = nrrdread([paths.in '\' paths.body_bin_in '.nrrd']);
+colorwash(CT_in, GTV_in,  [-500, 500], [0, 1.2]);
 
 %% Account for infiltration (GTV -> CTV)