Skip to content

Commit 230da75

Browse files
authored
Merge branch 'master' into long
2 parents 5e8aaa5 + 1b991ab commit 230da75

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This App has the following command line arguments:
5959
analyzed. Multiple participants can be specified with
6060
a space separated list.
6161
--n_cpus N_CPUS Number of CPUs/cores available to use. (Default is 1)
62-
--stages {all,autorecon1,autorecon2,autorecon2-cp,autorecon2-wm,autorecon2-pial,autorecon3,autorecon-all}
62+
--stages {all,autorecon1,autorecon2,autorecon2-cp,autorecon2-wm,autorecon-pial,autorecon3,autorecon-all}
6363
Recon-all stages to run. (Default is autorecon-all)
6464
--template_name TEMPLATE_NAME
6565
Name for the custom group level template generated
@@ -82,10 +82,14 @@ This App has the following command line arguments:
8282
(resolution <1.2mm isovolumetric). If you want to
8383
ignore these, specify None or T1only to generate
8484
surfaces on the T1 alone.
85-
--hires_mode {auto,enable,disable}
86-
Submilimiter (high resolution) processing. 'auto' -
87-
use only if <1.0mm data detected, 'enable' - force on,
88-
'disable' - force off
85+
--refine_pial_acquisition_label ACQUISITION_LABEL
86+
If the dataset contains multiple T2 or FLAIR weighted
87+
images from different acquisitions which one should be
88+
used? Corresponds to "acq-<acquisition_label>"
89+
--hires_mode {auto,enable,disable}
90+
Submilimiter (high resolution) processing. 'auto' -
91+
use only if <1.0mm data detected, 'enable' - force on,
92+
'disable' - force off
8993

9094
To run it in participant level mode (for one participant):
9195

run.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ def run(command, env={}, ignore_errors=False):
4545
parser.add_argument('--n_cpus', help='Number of CPUs/cores available to use.',
4646
default=1, type=int)
4747
parser.add_argument('--stages', help='Autorecon stages to run.',
48-
choices=["autorecon1", "autorecon2", "autorecon2-cp", "autorecon2-wm", "autorecon2-pial", "autorecon3", "autorecon-all", "all"],
48+
choices=["autorecon1", "autorecon2", "autorecon2-cp", "autorecon2-wm", "autorecon-pial", "autorecon3", "autorecon-all", "all"],
4949
default=["autorecon-all"],
5050
nargs="+")
5151
parser.add_argument('--template_name', help='Name for the custom group level template generated for this dataset',
5252
default="average")
5353
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',
5454
required=True)
5555
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-<acquisition_label>"')
56+
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-<acquisition_label>"')
5657
parser.add_argument('--multiple_sessions', help='For datasets with multiday sessions where you do not want to '
5758
'use the longitudinal pipeline, i.e., sessions were back-to-back, '
5859
'set this to multiday, otherwise sessions with T1w data will be '
@@ -105,6 +106,10 @@ def run(command, env={}, ignore_errors=False):
105106
else:
106107
longitudinal_study = False
107108

109+
if args.refine_pial_acquisition_label:
110+
acq_t2 = "*acq-%s*" % args.refine_pial_acquisition_label
111+
else:
112+
acq_t2 = "*"
108113

109114
subjects_to_analyze = []
110115
# only for a subset of subjects
@@ -151,10 +156,10 @@ def run(command, env={}, ignore_errors=False):
151156

152157
T2s = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label,
153158
"ses-%s"%session_label, "anat",
154-
"*_T2w.nii*"))
159+
"*%s_T2w.nii*"%acq_t2))
155160
FLAIRs = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label,
156161
"ses-%s"%session_label, "anat",
157-
"*_FLAIR.nii*"))
162+
"*%s_FLAIR.nii*"%acq_t2))
158163
if args.refine_pial == "T2":
159164
for T2 in T2s:
160165
if max(nibabel.load(T2).header.get_zooms()) < 1.2:
@@ -249,12 +254,12 @@ def run(command, env={}, ignore_errors=False):
249254
"sub-%s"%subject_label,
250255
"ses-*",
251256
"anat",
252-
"*_T2w.nii*"))
257+
"*%s_T2w.nii*"%acq_t2))
253258
FLAIRs = glob(os.path.join(args.bids_dir,
254259
"sub-%s"%subject_label,
255260
"ses-*",
256261
"anat",
257-
"*_FLAIR.nii*"))
262+
"*%s_FLAIR.nii*"%acq_t2))
258263
if args.refine_pial == "T2":
259264
for T2 in T2s:
260265
if max(nibabel.load(T2).header.get_zooms()) < 1.2:
@@ -303,9 +308,9 @@ def run(command, env={}, ignore_errors=False):
303308
input_args += " -hires"
304309
input_args += " -i %s"%T1
305310
T2s = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "anat",
306-
"*_T2w.nii*"))
311+
"*%s_T2w.nii*"%acq_t2))
307312
FLAIRs = glob(os.path.join(args.bids_dir, "sub-%s"%subject_label, "anat",
308-
"*_FLAIR.nii*"))
313+
"*%s_FLAIR.nii*"%acq_t2))
309314
if args.refine_pial == "T2":
310315
for T2 in T2s:
311316
if max(nibabel.load(T2).header.get_zooms()) < 1.2:

0 commit comments

Comments
 (0)