if platform == 'darwin': is_hpc = False else: is_hpc = True # # Initial checks # # Check that bids directory is not empty(TODO) project_root = args.in_dir[0] print(project_root) layout = bids.layout.BIDSLayout([(project_root, 'bids')], exclude='derivatives/') assert len(layout.get_subjects()) > 0, "No subjects in directory!" # Create img list files = layout.get(extensions='.nii.gz', modality='anat') n_total_jobs = int(args.num_threads[0]) if not args.histmatch: assert args.template_file is None and not args.template_norm, "Unnecessary template if not histmatch" if args.histmatch: assert args.template_file is not None, "Need template for histogram matching" if args.template_file is not None: assert os.path.exists(args.template_file[0]), "Template file not found"
if platform == 'darwin': is_hpc = False else: is_hpc = True # # Initial checks # os.environ["ANTSPATH"] = "/homedtic/gmarti/LIB/ANTsbin/bin" os.environ["ANTSSCRIPTS"] = "/homedtic/gmarti/LIB/ANTs/Scripts" # Check that bids directory is not empty(TODO) project_root = args.in_dir[0] layout = bids.layout.BIDSLayout([(project_root, 'bids')], exclude='derivatives/') assert len(layout.get_subjects()) > 0, "No subjects in directory!" # Create img list files = layout.get(extensions='.nii.gz', modality='anat', session='M00') # Keep only the baselines and the files from the subject_file df_subjects = pd.read_csv(args.subject_file[0]) files_true = [x for x in layout.get_subjects() if str(x[4:7] + "_S_" + x[8:12]) in df_subjects.PTID.values] print(len(files)) print(len(files_true)) # create output directory out_dir = args.output_path[0] if not os.path.exists(out_dir): os.makedirs(out_dir)