function Geometry=nrrd2ROI(Geometry, patient_dir) %% -----===== Get ROI mask =====----- while true newRoi = questdlg('Do you want to load another ROI?','New ROI','Yes','No','No') switch newRoi case 'Yes' [TRGT_in, TRGT_path, ~] = uigetfile(['C:\010-work\003_localGit\WiscPlan_v2\data\','*.nrrd']); if TRGT_in==0 % no file selected, no change to CT data warning('No file selected!') else [TRGT_img, meta]=nrrdread([TRGT_path, TRGT_in]); end Geometry.ROIS{end+1}.ind = find(TRGT_img>0); str = input('Enter ROI name: \n','s'); Geometry.ROIS{end}.name= str; save(fullfile(patient_dir, 'matlab_files', 'Geometry.mat'), 'Geometry'); case 'No' break end end end