|
@@ -55,7 +55,7 @@ ypmax = 1.25;
|
|
|
% executable_path = 'C:\010-work\003_localGit\WiscPlan_v2\WiscPlanPhotonkV125\WiscPlanEXE\RyanCsphoton.x86.exe';
|
|
|
|
|
|
executable_path = mfilename('fullpath');
|
|
|
-executable_path = [executable_path(1:end-37), 'WiscPlanEXE\RyanCsphoton.x86.exe']
|
|
|
+executable_path = [fileparts(fileparts(executable_path)), '\WiscPlanEXE\RyanCsphoton.x86.exe']
|
|
|
|
|
|
kernel_file = 'Kernels.mat';
|
|
|
geometry_file = fullfile(patient_dir, 'matlab_files\Geometry.mat');
|
|
@@ -101,142 +101,141 @@ Nphi = Nrot * N_angles; % Grozomah
|
|
|
|
|
|
phi = [0:Nphi-1]/Nphi *2*pi*Nrot;
|
|
|
|
|
|
-condor_folder = patient_dir;
|
|
|
-winxp_folder = 'winxp';
|
|
|
-
|
|
|
-% create names for condor input and output folders
|
|
|
-input_folder = '.';
|
|
|
-output_folder = '.';
|
|
|
-
|
|
|
-% name of the convolution/superposition executable, which will be in the
|
|
|
-% 'code' folder of each respective run type folder
|
|
|
-condor_exectuable_name = 'convolutionCondor'; % relative path on the cluster where code will be
|
|
|
-winxp_executable_name = 'convolution.exe';
|
|
|
-matlab_executable_name = 'convolution_mex'; % name of the Matlab version of the dose calculation code
|
|
|
-
|
|
|
-% set the beam parameters, assuming a helical beam trajectory
|
|
|
-% folders that will be inside the 'input' folder
|
|
|
-beamspec_folder = 'beamspecfiles'; % directory where beam files will be stored
|
|
|
-beamspec_batches_folder = 'beamspecbatches';
|
|
|
-beamspec_batch_base_name = 'beamspecbatch'; % base name for a beamlet batch file
|
|
|
-kernel_folder = 'kernelfiles'; % folder where kernel information will be saved
|
|
|
-kernel_filenames_condor = 'kernelFilenamesCondor.txt';
|
|
|
-kernel_filenames_winxp = 'kernelFilenamesWinXP.txt';
|
|
|
-
|
|
|
-% output folders
|
|
|
-beamlet_batch_base_name = 'beamletbatch'; % base name for a dose batch file
|
|
|
-
|
|
|
-geometry_header_filename = 'geometryHeader.txt';
|
|
|
-geometry_density_filename = 'density.bin'; % save the density, not the Hounsfield units!
|
|
|
-
|
|
|
-% end of user-defined parameters
|
|
|
+%% account for beamlet shift
|
|
|
+for scenario_i = 1:numel(OptGoals.sss_scene_list)
|
|
|
+ patient_dir = [beamlet_dir '\scenario' num2str(scenario_i)];
|
|
|
+ mkdir(patient_dir)
|
|
|
+ condor_folder = patient_dir;
|
|
|
+ winxp_folder = 'winxp';
|
|
|
+
|
|
|
+ % create names for condor input and output folders
|
|
|
+ input_folder = '.';
|
|
|
+ output_folder = '.';
|
|
|
+
|
|
|
+ % name of the convolution/superposition executable, which will be in the
|
|
|
+ % 'code' folder of each respective run type folder
|
|
|
+ condor_exectuable_name = 'convolutionCondor'; % relative path on the cluster where code will be
|
|
|
+ winxp_executable_name = 'convolution.exe';
|
|
|
+ matlab_executable_name = 'convolution_mex'; % name of the Matlab version of the dose calculation code
|
|
|
+
|
|
|
+ % set the beam parameters, assuming a helical beam trajectory
|
|
|
+ % folders that will be inside the 'input' folder
|
|
|
+ beamspec_folder = 'beamspecfiles'; % directory where beam files will be stored
|
|
|
+ beamspec_batches_folder = 'beamspecbatches';
|
|
|
+ beamspec_batch_base_name = 'beamspecbatch'; % base name for a beamlet batch file
|
|
|
+ kernel_folder = 'kernelfiles'; % folder where kernel information will be saved
|
|
|
+ kernel_filenames_condor = 'kernelFilenamesCondor.txt';
|
|
|
+ kernel_filenames_winxp = 'kernelFilenamesWinXP.txt';
|
|
|
+
|
|
|
+ % output folders
|
|
|
+ beamlet_batch_base_name = 'beamletbatch'; % base name for a dose batch file
|
|
|
+
|
|
|
+ geometry_header_filename = 'geometryHeader.txt';
|
|
|
+ geometry_density_filename = 'density.bin'; % save the density, not the Hounsfield units!
|
|
|
+
|
|
|
+ % end of user-defined parameters
|
|
|
+
|
|
|
+ % check the validity of the user-defined variables
|
|
|
+ if xpmin >= xpmax
|
|
|
+ error('xpmin must be less than xpmax.');
|
|
|
+ end
|
|
|
+ if ypmin >= ypmax
|
|
|
+ error('ypmin must be less than ypmax.');b
|
|
|
+ end
|
|
|
|
|
|
-% check the validity of the user-defined variables
|
|
|
-if xpmin >= xpmax
|
|
|
- error('xpmin must be less than xpmax.');
|
|
|
-end
|
|
|
-if ypmin >= ypmax
|
|
|
- error('ypmin must be less than ypmax.');b
|
|
|
-end
|
|
|
+ % if phimin > phimax
|
|
|
+ % error('phimin must be less than or equal to phimax.');
|
|
|
+ % end
|
|
|
|
|
|
-% if phimin > phimax
|
|
|
-% error('phimin must be less than or equal to phimax.');
|
|
|
-% end
|
|
|
+ if Mxp <= 0 || Nyp <= 0 || Nphi <= 0
|
|
|
+ error('Mxp, Nyp, and Nphi must be greater than zero.');
|
|
|
+ end
|
|
|
|
|
|
-if Mxp <= 0 || Nyp <= 0 || Nphi <= 0
|
|
|
- error('Mxp, Nyp, and Nphi must be greater than zero.');
|
|
|
-end
|
|
|
+ if SAD < 50
|
|
|
+ error('It is recommended that the SAD be greater than 50 cm.');
|
|
|
+ end
|
|
|
|
|
|
-if SAD < 50
|
|
|
- error('It is recommended that the SAD be greater than 50 cm.');
|
|
|
-end
|
|
|
+ % the xy plane is perpendicular to the isocenter axis of the linac gantry
|
|
|
|
|
|
-% the xy plane is perpendicular to the isocenter axis of the linac gantry
|
|
|
+ % size of each beam aperture, making them vectors so extension to
|
|
|
+ % non-uniform aperture sizes becomes obvious
|
|
|
+ del_xp = (xpmax - xpmin)/Mxp;
|
|
|
+ del_yp = (ypmax - ypmin)/Nyp;
|
|
|
|
|
|
-% size of each beam aperture, making them vectors so extension to
|
|
|
-% non-uniform aperture sizes becomes obvious
|
|
|
-del_xp = (xpmax - xpmin)/Mxp;
|
|
|
-del_yp = (ypmax - ypmin)/Nyp;
|
|
|
+ % Calculate the xp and yp offsets, which lie at the centers of the
|
|
|
+ % apertures.
|
|
|
+ xp = [xpmin:del_xp:xpmax-del_xp] + del_xp/2;
|
|
|
+ yp = [ypmin:del_yp:ypmax-del_yp] + del_yp/2;
|
|
|
|
|
|
-% Calculate the xp and yp offsets, which lie at the centers of the
|
|
|
-% apertures.
|
|
|
-xp = [xpmin:del_xp:xpmax-del_xp] + del_xp/2;
|
|
|
-yp = [ypmin:del_yp:ypmax-del_yp] + del_yp/2;
|
|
|
+ [M,N,Q] = size(Geometry.rhomw);
|
|
|
|
|
|
-[M,N,Q] = size(Geometry.rhomw);
|
|
|
+ START = single(Geometry.start - iso);
|
|
|
+ INC = single(Geometry.voxel_size);
|
|
|
|
|
|
-START = single(Geometry.start - iso);
|
|
|
-INC = single(Geometry.voxel_size);
|
|
|
+ % Grozomah ##
|
|
|
+ % START(1) = START(1)/10;
|
|
|
+ % START(2) = START(2)/10;
|
|
|
+ % INC(1) = INC(1)/10;
|
|
|
+ % INC(2) = INC(2)/10;
|
|
|
|
|
|
-% Grozomah ##
|
|
|
-% START(1) = START(1)/10;
|
|
|
-% START(2) = START(2)/10;
|
|
|
-% INC(1) = INC(1)/10;
|
|
|
-% INC(2) = INC(2)/10;
|
|
|
+ % END= START+[32,32,40].*INC
|
|
|
|
|
|
-% END= START+[32,32,40].*INC
|
|
|
+ % define the tumor mask
|
|
|
+ tumorMask = zeros(size(Geometry.rhomw),'single');
|
|
|
+ tumorMask(Geometry.ROIS{ptvInd}.ind) = 1;
|
|
|
|
|
|
-% define the tumor mask
|
|
|
-tumorMask = zeros(size(Geometry.rhomw),'single');
|
|
|
-tumorMask(Geometry.ROIS{ptvInd}.ind) = 1;
|
|
|
+ BW = bwdist(tumorMask);
|
|
|
+ tumorMaskExp = tumorMask;
|
|
|
+ tumorMaskExp(BW <= 4) = 1;
|
|
|
|
|
|
-BW = bwdist(tumorMask);
|
|
|
-tumorMaskExp = tumorMask;
|
|
|
-tumorMaskExp(BW <= 4) = 1;
|
|
|
+ P = zeros(Mxp,Nphi);
|
|
|
|
|
|
-P = zeros(Mxp,Nphi);
|
|
|
+ fprintf('Checking beam''s eye view ...\n');
|
|
|
+ for p=1:Nphi
|
|
|
+ % ir and jr form the beam's eye view (BEV)
|
|
|
+ ir = [-sin(phi(p)); cos(phi(p)); 0];
|
|
|
+ jr = [0 0 1]';
|
|
|
+ % kr denotes the beam direction
|
|
|
+ kr = [cos(phi(p)); sin(phi(p)); 0];
|
|
|
|
|
|
-fprintf('Checking beam''s eye view ...\n');
|
|
|
-for p=1:Nphi
|
|
|
- % ir and jr form the beam's eye view (BEV)
|
|
|
- ir = [-sin(phi(p)); cos(phi(p)); 0];
|
|
|
- jr = [0 0 1]';
|
|
|
- % kr denotes the beam direction
|
|
|
- kr = [cos(phi(p)); sin(phi(p)); 0];
|
|
|
-
|
|
|
- for m=1:Mxp
|
|
|
- point1 = single(-kr*SAD + [0 0 zBow + pitch*fieldWidth*phi(p)/(2*pi)]'); % source point
|
|
|
- point2 = single(point1 + (SAD*kr + ir*xp(m))*10);
|
|
|
- [indVisited,deffVisited] = singleRaytraceClean(tumorMaskExp,START,INC,point1,point2);
|
|
|
- if ~isempty(indVisited)
|
|
|
- P(m,p) = max(deffVisited);
|
|
|
+ for m=1:Mxp
|
|
|
+ point1 = single(-kr*SAD + [0 0 zBow + pitch*fieldWidth*phi(p)/(2*pi)]'); % source point
|
|
|
+ point2 = single(point1 + (SAD*kr + ir*xp(m))*10);
|
|
|
+ [indVisited,deffVisited] = singleRaytraceClean(tumorMaskExp,START,INC,point1,point2);
|
|
|
+ if ~isempty(indVisited)
|
|
|
+ P(m,p) = max(deffVisited);
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
-end
|
|
|
-fprintf('Finished checking BEV\n');
|
|
|
+ fprintf('Finished checking BEV\n');
|
|
|
|
|
|
-% load data required for the dose calculator
|
|
|
-load(kernel_file);
|
|
|
+ % load data required for the dose calculator
|
|
|
+ load(kernel_file);
|
|
|
|
|
|
-Geometry.rhomw(Geometry.rhomw < 0) = 0;
|
|
|
-Geometry.rhomw(Geometry.rhomw < 0.0013) = 0.0013; % fill blank voxels with air
|
|
|
+ Geometry.rhomw(Geometry.rhomw < 0) = 0;
|
|
|
+ Geometry.rhomw(Geometry.rhomw < 0.0013) = 0.0013; % fill blank voxels with air
|
|
|
|
|
|
-% convert Geometry and kernels to single
|
|
|
-f = fieldnames(Kernels);
|
|
|
-for k=1:length(f)
|
|
|
- if isnumeric(getfield(Kernels,f{k}))
|
|
|
- Kernels = setfield(Kernels,f{k},single(getfield(Kernels,f{k})));
|
|
|
+ % convert Geometry and kernels to single
|
|
|
+ f = fieldnames(Kernels);
|
|
|
+ for k=1:length(f)
|
|
|
+ if isnumeric(getfield(Kernels,f{k}))
|
|
|
+ Kernels = setfield(Kernels,f{k},single(getfield(Kernels,f{k})));
|
|
|
+ end
|
|
|
end
|
|
|
-end
|
|
|
|
|
|
-f = fieldnames(Geometry);
|
|
|
-for k=1:length(f)
|
|
|
- if isnumeric(getfield(Geometry,f{k}))
|
|
|
- Geometry = setfield(Geometry,f{k},single(getfield(Geometry,f{k})));
|
|
|
+ f = fieldnames(Geometry);
|
|
|
+ for k=1:length(f)
|
|
|
+ if isnumeric(getfield(Geometry,f{k}))
|
|
|
+ Geometry = setfield(Geometry,f{k},single(getfield(Geometry,f{k})));
|
|
|
+ end
|
|
|
end
|
|
|
-end
|
|
|
-
|
|
|
-% account for isocenter
|
|
|
-Geometry.start_nominal = single(Geometry.start - iso);
|
|
|
|
|
|
-%% account for beamlet shift
|
|
|
-for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
- disp(OptGoals.sss_scene_list{scenario_i});
|
|
|
+ % account for isocenter
|
|
|
+ Geometry.start_nominal = single(Geometry.start - iso);
|
|
|
|
|
|
% change Condor folder names as appropriate
|
|
|
- condor_folder_scenario = [beamlet_dir '\scenario' num2str(scenario_i)];
|
|
|
- mkdir(condor_folder_scenario)
|
|
|
- patient_dir_scenario = condor_folder_scenario
|
|
|
+
|
|
|
+
|
|
|
|
|
|
% do the isocenter shift
|
|
|
shift = OptGoals.sss_scene_list{scenario_i}; % Y X Z
|
|
@@ -307,97 +306,97 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
% useable form.
|
|
|
if Condor_flag == 1
|
|
|
% delete the old submission file
|
|
|
- err = rmdir(fullfile(condor_folder_scenario,beamspec_batches_folder),'s');
|
|
|
- err = rmdir(fullfile(condor_folder_scenario,kernel_folder),'s');
|
|
|
+ err = rmdir(fullfile(condor_folder,beamspec_batches_folder),'s');
|
|
|
+ err = rmdir(fullfile(condor_folder,kernel_folder),'s');
|
|
|
|
|
|
% create folders where batch information will be sent
|
|
|
- mkdir([condor_folder_scenario '/' input_folder '/' beamspec_batches_folder]);
|
|
|
+ mkdir([condor_folder '/' input_folder '/' beamspec_batches_folder]);
|
|
|
|
|
|
% save the kernels
|
|
|
- save_kernels(Kernels,[condor_folder_scenario '/' input_folder '/' kernel_folder]);
|
|
|
+ save_kernels(Kernels,[condor_folder '/' input_folder '/' kernel_folder]);
|
|
|
fprintf(['Successfully saved Condor kernels to ' input_folder '/' kernel_folder '\n']);
|
|
|
|
|
|
% create kernel filenames files
|
|
|
kernel_filenames_CHTC = 'kernelFilenamesCHTC.txt';
|
|
|
kernel_filenames_condor = 'kernelFilenamesCondor.txt';
|
|
|
- fid = fopen([condor_folder_scenario '/' input_folder '/' kernel_filenames_condor],'w');
|
|
|
- fid2 = fopen([condor_folder_scenario '/' input_folder '/' kernel_filenames_CHTC],'w');
|
|
|
+ fid = fopen([condor_folder '/' input_folder '/' kernel_filenames_condor],'w');
|
|
|
+ fid2 = fopen([condor_folder '/' input_folder '/' kernel_filenames_CHTC],'w');
|
|
|
|
|
|
fprintf(fid,'kernel_header\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/kernel_header.txt\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'kernel_header.txt'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'kernel_header.txt'));
|
|
|
fprintf(fid2,'kernel_header\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'kernel_header.txt');
|
|
|
|
|
|
fprintf(fid,'kernel_radii\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/radii.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'radii.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'radii.bin'));
|
|
|
fprintf(fid2,'kernel_radii\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'radii.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_angles\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/angles.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'angles.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'angles.bin'));
|
|
|
fprintf(fid2,'kernel_angles\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'angles.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_energies\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/energies.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'energies.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'energies.bin'));
|
|
|
fprintf(fid2,'kernel_energies\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'energies.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_primary\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/primary.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'primary.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'primary.bin'));
|
|
|
fprintf(fid2,'kernel_primary\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'primary.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_first_scatter\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/first_scatter.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'first_scatter.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'first_scatter.bin'));
|
|
|
fprintf(fid2,'kernel_first_scatter\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'first_scatter.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_second_scatter\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/second_scatter.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'second_scatter.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'second_scatter.bin'));
|
|
|
fprintf(fid2,'kernel_second_scatter\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'second_scatter.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_multiple_scatter\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/multiple_scatter.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'multiple_scatter.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'multiple_scatter.bin'));
|
|
|
fprintf(fid2,'kernel_multiple_scatter\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'multiple_scatter.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_brem_annih\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/brem_annih.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'brem_annih.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'brem_annih.bin'));
|
|
|
fprintf(fid2,'kernel_brem_annih\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'brem_annih.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_total\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/total.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'total.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'total.bin'));
|
|
|
fprintf(fid2,'kernel_total\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'total.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_fluence\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/fluence.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'fluence.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'fluence.bin'));
|
|
|
fprintf(fid2,'kernel_fluence\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'fluence.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_mu\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/mu.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'mu.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'mu.bin'));
|
|
|
fprintf(fid2,'kernel_mu\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'mu.bin');
|
|
|
|
|
|
fprintf(fid,'kernel_mu_en\n');
|
|
|
% fprintf(fid,['./' input_folder '/' kernel_folder '/mu_en.bin\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,kernel_folder,'mu_en.bin'));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,kernel_folder,'mu_en.bin'));
|
|
|
fprintf(fid2,'kernel_mu_en\n');
|
|
|
fprintf(fid2, '%s/%s\n', kernel_folder,'mu_en.bin');
|
|
|
|
|
@@ -420,25 +419,25 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
beamlet_batches_folder = 'beamletbatches'; % folder where resulting beamlet batches will be stored
|
|
|
|
|
|
if Condor_flag == 1
|
|
|
- mkdir([condor_folder_scenario '/' output_folder '/' beamlet_batches_folder]);
|
|
|
- mkdir([condor_folder_scenario '/' output_folder '/' batch_output_folder]);
|
|
|
+ mkdir([condor_folder '/' output_folder '/' beamlet_batches_folder]);
|
|
|
+ mkdir([condor_folder '/' output_folder '/' batch_output_folder]);
|
|
|
|
|
|
- save_geometry(Geometry,[condor_folder_scenario '/' input_folder '/' geometry_folder],geometry_header_filename,geometry_density_filename);
|
|
|
+ save_geometry(Geometry,[condor_folder '/' input_folder '/' geometry_folder],geometry_header_filename,geometry_density_filename);
|
|
|
fprintf(['Successfully saved Condor geometry to ' input_folder '/' geometry_folder '\n']);
|
|
|
|
|
|
% create geometry filenames files
|
|
|
- fid = fopen([condor_folder_scenario '/' input_folder '/' geometry_filenames_condor],'w');
|
|
|
- fid2 = fopen([condor_folder_scenario '/' input_folder '/' geometry_filenames_CHTC],'w');
|
|
|
+ fid = fopen([condor_folder '/' input_folder '/' geometry_filenames_condor],'w');
|
|
|
+ fid2 = fopen([condor_folder '/' input_folder '/' geometry_filenames_CHTC],'w');
|
|
|
|
|
|
fprintf(fid,'geometry_header\n');
|
|
|
% fprintf(fid,['./' input_folder '/' geometry_folder '/' geometry_header_filename '\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,geometry_folder,geometry_header_filename));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,geometry_folder,geometry_header_filename));
|
|
|
fprintf(fid2,'geometry_header\n');
|
|
|
fprintf(fid2, '%s/%s\n', geometry_folder,'geometryHeader.txt');
|
|
|
|
|
|
fprintf(fid,'geometry_density\n');
|
|
|
% fprintf(fid,['./' input_folder '/' geometry_folder '/' geometry_density_filename '\n']);
|
|
|
- fprintf(fid,'%s\n',fullfile(patient_dir_scenario,input_folder,geometry_folder,geometry_density_filename));
|
|
|
+ fprintf(fid,'%s\n',fullfile(patient_dir,input_folder,geometry_folder,geometry_density_filename));
|
|
|
fprintf(fid2,'geometry_density\n');
|
|
|
fprintf(fid2, '%s/%s\n', geometry_folder,'density.bin');
|
|
|
fclose(fid);
|
|
@@ -446,12 +445,12 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
% write command file
|
|
|
% TODO consistent naming throughout script
|
|
|
for k = 1:numel(batches)
|
|
|
- fid = fopen(fullfile(condor_folder_scenario,sprintf('run%d.cmd',k-1)), 'w');
|
|
|
+ fid = fopen(fullfile(condor_folder,sprintf('run%d.cmd',k-1)), 'w');
|
|
|
fprintf(fid, '"%s" "%s" "%s" "%s" "%s"', executable_path,...
|
|
|
- fullfile(patient_dir_scenario, kernel_filenames_condor),...
|
|
|
- fullfile(patient_dir_scenario, geometry_filenames_condor),...
|
|
|
- fullfile(patient_dir_scenario, 'beamspecbatches', sprintf('beamspecbatch%d.txt',k-1)),...
|
|
|
- fullfile(patient_dir_scenario, sprintf('batch_dose%d_S%d.bin',k-1, scenario_i)));
|
|
|
+ fullfile(patient_dir, kernel_filenames_condor),...
|
|
|
+ fullfile(patient_dir, geometry_filenames_condor),...
|
|
|
+ fullfile(patient_dir, 'beamspecbatches', sprintf('beamspecbatch%d.txt',k-1)),...
|
|
|
+ fullfile(patient_dir, sprintf('batch_dose%d.bin',k-1)));
|
|
|
fclose(fid);
|
|
|
end
|
|
|
|
|
@@ -475,7 +474,7 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
% % write the condor submit file
|
|
|
% beamspec_batch_filename = ['./' input_folder '/' beamspec_batches_folder '/' beamspec_batch_base_name '$(Process).txt'];
|
|
|
% beamlet_batch_filename = ['./' output_folder '/' beamlet_batches_folder '/' beamlet_batch_base_name '$(Process).bin'];
|
|
|
- fid = fopen([condor_folder_scenario '/' condor_submit_file],'w');
|
|
|
+ fid = fopen([condor_folder '/' condor_submit_file],'w');
|
|
|
fprintf(fid,'###############################################################\n');
|
|
|
fprintf(fid,'# Condor submission script for convolution/superposition code\n');
|
|
|
fprintf(fid,'###############################################################\n\n');
|
|
@@ -498,7 +497,7 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
batch = batches{n}; % current batch
|
|
|
|
|
|
if Condor_flag == 1
|
|
|
- save_beamspec_batch(batch,[condor_folder_scenario '/' input_folder '/' beamspec_batches_folder],[beamspec_batch_base_name num2str(n-1) '.txt']);
|
|
|
+ save_beamspec_batch(batch,[condor_folder '/' input_folder '/' beamspec_batches_folder],[beamspec_batch_base_name num2str(n-1) '.txt']);
|
|
|
end
|
|
|
end
|
|
|
|
|
@@ -506,7 +505,7 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
all_beams{1}.Mxp = Mxp;
|
|
|
all_beams{1}.N_angles = N_angles;
|
|
|
all_beams{1}.num_batches = num_batches;
|
|
|
- save([condor_folder_scenario '\all_beams.mat'], 'all_beams');
|
|
|
+ save([condor_folder '\all_beams.mat'], 'all_beams');
|
|
|
% for k = 1:numel(batches)
|
|
|
% system([fullfile(patient_dir,sprintf('run%d.cmd',k-1)) ' &']);
|
|
|
% end
|
|
@@ -533,7 +532,7 @@ for scenario_i = 1 % :numel(OptGoals.sss_scene_list)
|
|
|
|
|
|
if(strcmpi('y',strBeamlet))
|
|
|
for k = 1:numel(batches)
|
|
|
- system([fullfile(patient_dir_scenario,sprintf('run%d.cmd',k-1)) ' &']);
|
|
|
+ system([fullfile(patient_dir,sprintf('run%d.cmd',k-1)) ' &']);
|
|
|
end
|
|
|
end
|
|
|
|