fullRO_mergeBeams.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. function fullRO_mergeBeams(Geometry)
  2. % this function loops through a full RO folder and merges all the beamlets
  3. if isfield(Geometry, 'num_batches')
  4. str = num2str(obj.handles.hSVPS.Geometry.num_batches);
  5. else
  6. str = input('Enter num of beam batches: ','s');
  7. end
  8. % get the full RO folder
  9. beamlet_dir = uigetdir([Geometry.patient_dir ], 'Select full RO folder' );
  10. if beamlet_dir == 0
  11. disp('no file selected, aborting')
  12. return
  13. end
  14. % loop through all scenario folders
  15. files = dir(beamlet_dir);
  16. % Get a logical vector that tells which is a directory.
  17. dirFlags = [files.isdir];
  18. % Extract only those that are directories.
  19. scenarioList = files(dirFlags);
  20. idxList = [1:numel(scenarioList)];
  21. for i = 3:numel(idxList);
  22. scenario_i = idxList(i);
  23. scenario_path = [scenarioList(scenario_i).folder, '\', scenarioList(scenario_i).name];
  24. merge_beamlets(str2double(str), scenario_path);
  25. disp(['Scenario ' num2str(i) ' merged!'])
  26. end
  27. disp('All scenario beamlets merged!')
  28. end