

% part 2 of the getting perturbed image 

patientData_path= 'C:\010-work\003_localGit\WiscPlan_v2\data\PatientData';

pertNum='16';


merge_beamlets(4, [patientData_path '\perturbed_output']);
target_filename = [patientData_path '\perturbed_output\batch_dose.bin'];

optResultsFile = [patientData_path, '\matlab_files\optResults.mat'];
load(optResultsFile);
D = read_ryan_beamlets([patientData_path '\perturbed_output\batch_dose.bin'],'ryan sum', optResults.weights{end});
G = Geometry;

save(['C:\010-work\003_localGit\WiscPlan_v2\data\PatientData\dosePert_' pertNum], 'D')
save(['C:\010-work\003_localGit\WiscPlan_v2\data\PatientData\geomPert_' pertNum], 'G')

disp('Perturbed dose saved')