From 311182349c3dcd81033b1675f2c84397065f743b Mon Sep 17 00:00:00 2001 From: Alexander Li Cohen Date: Wed, 25 Jan 2017 17:01:20 -0500 Subject: [PATCH 1/3] Added acq_labels for the T2/Flair --- run.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/run.py b/run.py index d85a215..26f8a8e 100755 --- a/run.py +++ b/run.py @@ -53,6 +53,7 @@ def run(command, env={}, ignore_errors=False): parser.add_argument('--license_key', help='FreeSurfer license key - letters and numbers after "*" in the email you received after registration. To register (for free) visit https://surfer.nmr.mgh.harvard.edu/registration.html', required=True) parser.add_argument('--acquisition_label', help='If the dataset contains multiple T1 weighted images from different acquisitions which one should be used? Corresponds to "acq-"') +parser.add_argument('--refine_pial_acquisition_label', help='If the dataset contains multiple T2 or FLAIR weighted images from different acquisitions which one should be used? Corresponds to "acq-"') parser.add_argument('--multiple_sessions', help='For datasets with multiday sessions where you do not want to ' 'use the longitudinal pipeline, i.e., sessions were back-to-back, ' 'set this to multiday, otherwise sessions with T1w data will be ' @@ -80,6 +81,12 @@ def run(command, env={}, ignore_errors=False): else: acq_tpl = "*" +if args.refine_pial_acquisition_label: + acq_t2 = "*acq-%s*" % args.refine_pial_acquisition_label +else: + acq_t2 = "*" + + subjects_to_analyze = [] # only for a subset of subjects if args.participant_label: @@ -138,10 +145,10 @@ def run(command, env={}, ignore_errors=False): T2s = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "ses-%s"%session_label, "anat", - "*_T2w.nii*")) + "*%s_T2w.nii*"%acq_t2)) FLAIRs = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "ses-%s"%session_label, "anat", - "*_FLAIR.nii*")) + "*%s_FLAIR.nii*"%acq_t2)) if args.refine_pial == "T2": for T2 in T2s: if max(nibabel.load(T2).header.get_zooms()) < 1.2: @@ -236,12 +243,12 @@ def run(command, env={}, ignore_errors=False): "sub-%s"%subject_label, "ses-*", "anat", - "*_T2w.nii*")) + "*%s_T2w.nii*"%acq_t2)) FLAIRs = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "ses-*", "anat", - "*_FLAIR.nii*")) + "*%s_FLAIR.nii*"%acq_t2)) if args.refine_pial == "T2": for T2 in T2s: if max(nibabel.load(T2).header.get_zooms()) < 1.2: @@ -290,9 +297,9 @@ def run(command, env={}, ignore_errors=False): input_args += " -hires" input_args += " -i %s"%T1 T2s = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "anat", - "*_T2w.nii*")) + "*%s_T2w.nii*"%acq_t2)) FLAIRs = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "anat", - "*_FLAIR.nii*")) + "*%s_FLAIR.nii*"%acq_t2)) if args.refine_pial == "T2": for T2 in T2s: if max(nibabel.load(T2).header.get_zooms()) < 1.2: From bf4e0106fb2a5336cf9dbaacd9f9e4d20e913d0b Mon Sep 17 00:00:00 2001 From: Alexander Li Cohen Date: Wed, 25 Jan 2017 17:09:13 -0500 Subject: [PATCH 2/3] Fixed typo: autorecon-pial, not autorecon2-pial --- run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.py b/run.py index 26f8a8e..25af79a 100755 --- a/run.py +++ b/run.py @@ -45,7 +45,7 @@ def run(command, env={}, ignore_errors=False): parser.add_argument('--n_cpus', help='Number of CPUs/cores available to use.', default=1, type=int) parser.add_argument('--stages', help='Autorecon stages to run.', - choices=["autorecon1", "autorecon2", "autorecon2-cp", "autorecon2-wm", "autorecon2-pial", "autorecon3", "autorecon-all", "all"], + choices=["autorecon1", "autorecon2", "autorecon2-cp", "autorecon2-wm", "autorecon-pial", "autorecon3", "autorecon-all", "all"], default=["autorecon-all"], nargs="+") parser.add_argument('--template_name', help='Name for the custom group level template generated for this dataset', From f0bdc1d8a3e7de0e2a108fe0d48b16c01274e237 Mon Sep 17 00:00:00 2001 From: Alexander Li Cohen Date: Mon, 30 Jan 2017 09:57:05 -0500 Subject: [PATCH 3/3] updated README to match changes and typo --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8154c84..3e31678 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ This App has the following command line arguments: analyzed. Multiple participants can be specified with a space separated list. --n_cpus N_CPUS Number of CPUs/cores available to use. (Default is 1) - --stages {all,autorecon1,autorecon2,autorecon2-cp,autorecon2-wm,autorecon2-pial,autorecon3,autorecon-all} + --stages {all,autorecon1,autorecon2,autorecon2-cp,autorecon2-wm,autorecon-pial,autorecon3,autorecon-all} Recon-all stages to run. (Default is autorecon-all) --template_name TEMPLATE_NAME Name for the custom group level template generated @@ -82,10 +82,14 @@ This App has the following command line arguments: (resolution <1.2mm isovolumetric). If you want to ignore these, specify None or T1only to generate surfaces on the T1 alone. - --hires_mode {auto,enable,disable} - Submilimiter (high resolution) processing. 'auto' - - use only if <1.0mm data detected, 'enable' - force on, - 'disable' - force off + --refine_pial_acquisition_label ACQUISITION_LABEL + If the dataset contains multiple T2 or FLAIR weighted + images from different acquisitions which one should be + used? Corresponds to "acq-" + --hires_mode {auto,enable,disable} + Submilimiter (high resolution) processing. 'auto' - + use only if <1.0mm data detected, 'enable' - force on, + 'disable' - force off To run it in participant level mode (for one participant):