diff --git a/modules/workflows/ModalityGrouping.py b/modules/workflows/ModalityGrouping.py index 0aa6015..4d1cf1e 100644 --- a/modules/workflows/ModalityGrouping.py +++ b/modules/workflows/ModalityGrouping.py @@ -6,7 +6,7 @@ def modality_split(cold_extraction_path, modality_split_path): # iterating through all the files in cold extraction - for root, files in os.walk(cold_extraction_path): + for root, dirs, files in os.walk(cold_extraction_path): for file in files: if file.endswith('.dcm'): dcm_filename = root+'/'+file @@ -15,11 +15,12 @@ def modality_split(cold_extraction_path, modality_split_path): dcm_file = pyd.dcmread(dcm_filename) dcm_modality = dcm_file.Modality - print (dcm_modality, dcm_only_folder) + # print (dcm_modality, dcm_only_folder) isExist = os.path.exists(modality_split_path+str(dcm_modality)+'/'+str(dcm_only_folder)) if not isExist: os.makedirs(modality_split_path+str(dcm_modality)+'/'+str(dcm_only_folder)) - shutil.copy2(src=cold_extraction_path+str(dcm_path), dst=modality_split_path+str(dcm_modality)+'/'+str(dcm_only_folder)+'/'+str(dcm_path.split('/')[-1])) + print (cold_extraction_path+str(dcm_path), modality_split_path+str(dcm_modality)+'/'+str(dcm_only_folder)+'/'+str(dcm_path.split('/')[-1])) + shutil.copy2(src=cold_extraction_path+str(dcm_path), dst=modality_split_path+str(dcm_modality)+'/'+str(dcm_only_folder)+'/'+str(dcm_path.split('/')[-1])) if __name__ == "__main__": cold_extraction_path = sys.argv[1]