diff --git a/run.py b/run.py index aace0c0..8d76493 100755 --- a/run.py +++ b/run.py @@ -41,7 +41,7 @@ def run(command, env={}, ignore_errors=False): '(in parallel) using the same output_dir. ' '"group1" creates study specific group template. ' '"group2" exports group stats tables for cortical parcellation, subcortical segmentation ' - 'a table with euler numbers.', + 'a table with euler numbers.', choices=['participant', 'group1', 'group2']) parser.add_argument('--participant_label', help='The label of the participant that should be analyzed. The label ' 'corresponds to sub- from the BIDS spec ' @@ -94,7 +94,7 @@ def run(command, env={}, ignore_errors=False): "curvind"], default=["thickness"], nargs="+") - +parser.add_argument('--qcache', help="Enable qcache", action='store_true') parser.add_argument('-v', '--version', action='version', version='BIDS-App example version {}'.format(__version__)) parser.add_argument('--bids_validator_config', help='JSON file specifying configuration of ' @@ -170,7 +170,8 @@ def run(command, env={}, ignore_errors=False): output_dir = os.path.abspath(args.output_dir) if os.path.exists(args.license_file): - env = {'FS_LICENSE': args.license_file} + absPathLic = os.path.abspath(args.license_file) + env = {'FS_LICENSE': absPathLic} else: raise Exception("Provided license file does not exist") @@ -208,10 +209,13 @@ def run(command, env={}, ignore_errors=False): "anat", "%s_T1w.nii*" % acq_tpl)) input_args = "" - + if three_T == 'true': input_args += " -3T" + if args.qcache: + input_args += ' -qcache' + for T1 in T1s: if (round(max(nibabel.load(T1).header.get_zooms()), 1) < 1.0 and args.hires_mode == "auto") or args.hires_mode == "enable": input_args += " -hires" @@ -237,16 +241,16 @@ def run(command, env={}, ignore_errors=False): fsid = "sub-%s_ses-%s" % (subject_label, session_label) stages = " ".join(["-" + stage for stage in args.stages]) - + cmd = "recon-all -subjid %s -sd %s %s %s -openmp %d" % (fsid, - output_dir, - input_args, - stages, - args.n_cpus) + output_dir, + input_args, + stages, + args.n_cpus) resume_cmd = "recon-all -subjid %s -sd %s %s -openmp %d" % (fsid, - output_dir, - stages, - args.n_cpus) + output_dir, + stages, + args.n_cpus) if os.path.isfile(os.path.join(output_dir, fsid, "scripts/IsRunning.lh+rh")): rmtree(os.path.join(output_dir, fsid)) @@ -270,10 +274,10 @@ def run(command, env={}, ignore_errors=False): stages = " ".join(["-" + stage for stage in args.stages]) cmd = "recon-all -base %s -sd %s %s %s -openmp %d" % (fsid, - output_dir, - input_args, - stages, - args.n_cpus) + output_dir, + input_args, + stages, + args.n_cpus) if os.path.isfile(os.path.join(output_dir, fsid, "scripts/IsRunning.lh+rh")): rmtree(os.path.join(output_dir, fsid)) @@ -295,12 +299,12 @@ def run(command, env={}, ignore_errors=False): # longitudinally process all timepoints fsid = "sub-%s" % subject_label stages = " ".join(["-" + stage for stage in args.stages]) - + cmd = "recon-all -long %s %s -sd %s %s -openmp %d" % (tp, - fsid, - output_dir, - stages, - args.n_cpus) + fsid, + output_dir, + stages, + args.n_cpus) if os.path.isfile(os.path.join(output_dir, tp + ".long." + fsid, "scripts/IsRunning.lh+rh")): rmtree(os.path.join(output_dir, tp + ".long." + fsid)) @@ -323,7 +327,10 @@ def run(command, env={}, ignore_errors=False): input_args = "" if three_T == 'true': - input_args += " -3T" + input_args += " -3T" + + if args.qcache: + input_args += " -qcache" for T1 in T1s: if (round(max(nibabel.load(T1).header.get_zooms()), 1) < 1.0 and args.hires_mode == "auto") or args.hires_mode == "enable": @@ -355,14 +362,14 @@ def run(command, env={}, ignore_errors=False): stages = " ".join(["-" + stage for stage in args.stages]) cmd = "recon-all -subjid %s -sd %s %s %s -openmp %d" % (fsid, - output_dir, - input_args, - stages, - args.n_cpus) + output_dir, + input_args, + stages, + args.n_cpus) resume_cmd = "recon-all -subjid %s -sd %s %s -openmp %d" % (fsid, - output_dir, - stages, - args.n_cpus) + output_dir, + stages, + args.n_cpus) if os.path.isfile(os.path.join(output_dir, fsid, "scripts/IsRunning.lh+rh")): rmtree(os.path.join(output_dir, fsid)) @@ -392,9 +399,12 @@ def run(command, env={}, ignore_errors=False): continue input_args = "" - + if three_T == 'true': - input_args += " -3T" + input_args += " -3T" + + if args.qcache: + input_args += " -qcache" for T1 in T1s: if (round(max(nibabel.load(T1).header.get_zooms()), 1) < 1.0 and args.hires_mode == "auto") or args.hires_mode == "enable": @@ -417,16 +427,16 @@ def run(command, env={}, ignore_errors=False): fsid = "sub-%s" % subject_label stages = " ".join(["-" + stage for stage in args.stages]) - + cmd = "recon-all -subjid %s -sd %s %s %s -openmp %d" % (fsid, - output_dir, - input_args, - stages, - args.n_cpus) + output_dir, + input_args, + stages, + args.n_cpus) resume_cmd = "recon-all -subjid %s -sd %s %s -openmp %d" % (fsid, - output_dir, - stages, - args.n_cpus) + output_dir, + stages, + args.n_cpus) if os.path.isfile(os.path.join(output_dir, fsid, "scripts/IsRunning.lh+rh")): rmtree(os.path.join(output_dir, fsid))