get_perturbed_image_beamlets_p1.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. %% get_peturbed_image_beamlets
  2. patientData_path= 'C:\010-work\003_localGit\WiscPlan_v2\data\PatientData';
  3. load([patientData_path '\matlab_files\Geometry.mat']);
  4. Geometry_old=Geometry;
  5. clear Geometry
  6. % do the data shift
  7. shift=[0, 0];
  8. valShift=1.30;
  9. Geometry.data = imtranslate(Geometry_old.data, shift);
  10. Geometry.rhomw = imtranslate(Geometry_old.rhomw, shift);
  11. Geometry.Smw = imtranslate(Geometry_old.Smw, shift);
  12. Geometry.Fmw2 = imtranslate(Geometry_old.Fmw2, shift);
  13. Geometry.BTV = imtranslate(Geometry_old.BTV, shift);
  14. Geometry.Ring = imtranslate(Geometry_old.Ring, shift);
  15. Geometry.voxel_size = Geometry_old.voxel_size;
  16. Geometry.start = Geometry_old.start;
  17. Geometry.data = valShift*Geometry.data;
  18. Geometry.rhomw = valShift*Geometry.rhomw;
  19. Geometry.Smw = valShift*Geometry.Smw;
  20. Geometry.Fmw2 = valShift*Geometry.Fmw2;
  21. numROI = size(Geometry_old.ROIS, 2);
  22. for i=1:numROI
  23. ind1 = Geometry_old.ROIS{i}.ind;
  24. Geometry.ROIS{i}.name = Geometry_old.ROIS{i}.name;
  25. canvas1 = zeros(size(Geometry.data));
  26. canvas1(ind1)=1;
  27. % canvas2 = imtranslate(canvas1, shift);
  28. canvas2 = canvas1;
  29. ind2=find(canvas2);
  30. Geometry.ROIS{i}.ind = ind2;
  31. end
  32. mkdir([patientData_path '\perturbed_output'])
  33. mkdir([patientData_path '\perturbed_output\kernelfiles'])
  34. copyfile([patientData_path '\kernelfiles\*'], [patientData_path '\perturbed_output\kernelfiles\'])
  35. mkdir([patientData_path '\perturbed_output\matlab_files'])
  36. save([patientData_path '\perturbed_output\matlab_files\Geometry.mat'], 'Geometry')
  37. helicalDosecalcSetup7([patientData_path '\perturbed_output'])
  38. % merge_beamlets(4, [patientData_path '\perturbed_output']);