Skip to content

Commit

Permalink
Merge pull request #42 from niniko1997/master
Browse files Browse the repository at this point in the history
-3T flag option
  • Loading branch information
chrisgorgo authored Aug 1, 2018
2 parents b63b6ce + 7530906 commit 1d071d6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This App has the following command line arguments:
[--measurements {area,volume,thickness,thicknessstd,meancurv,gauscurv,foldind,curvind}
[{area,volume,thickness,thicknessstd,meancurv,gauscurv,foldind,curvind} ...]]
[-v] [--bids_validator_config BIDS_VALIDATOR_CONFIG]
[--skip_bids_validator]
[--skip_bids_validator] [--3T {true,false}]
bids_dir output_dir {participant,group1,group2}

FreeSurfer recon-all + custom template generation.
Expand Down Expand Up @@ -127,6 +127,9 @@ This App has the following command line arguments:
info
--skip_bids_validator
skips bids validation
--3T {true,false} enables the two 3T specific options that recon-all
supports: nu intensity correction params, and the
special schwartz atlas

#### Participant level
To run it in participant level mode (for one participant):
Expand Down
27 changes: 27 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ def run(command, env={}, ignore_errors=False):
parser.add_argument('--skip_bids_validator',
help='skips bids validation',
action='store_true')
parser.add_argument('--3T',
help='enables the two 3T specific options that recon-all supports: nu intensity correction params, and the special schwartz atlas',
choices = ['true', 'false'],
default = 'true')
args = parser.parse_args()


three_T = vars(args)['3T']

if args.bids_validator_config:
run("bids-validator --config {config} {bids_dir}".format(
config=args.bids_validator_config,
Expand All @@ -120,6 +127,7 @@ def run(command, env={}, ignore_errors=False):
else:
acq_tpl = "*"


# if there are session folders, check if study is truly longitudinal by
# searching for the first subject with more than one valid sessions
multi_session_study = False
Expand Down Expand Up @@ -200,6 +208,10 @@ def run(command, env={}, ignore_errors=False):
"anat",
"%s_T1w.nii*" % acq_tpl))
input_args = ""

if three_T == 'true':
input_args += " -3T"

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"
Expand All @@ -224,6 +236,8 @@ 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,
Expand Down Expand Up @@ -254,6 +268,7 @@ def run(command, env={}, ignore_errors=False):
input_args = " ".join(["-tp %s" % tp for tp in timepoints])
fsid = "sub-%s" % subject_label
stages = " ".join(["-" + stage for stage in args.stages])

cmd = "recon-all -base %s -sd %s %s %s -openmp %d" % (fsid,
output_dir,
input_args,
Expand All @@ -280,6 +295,7 @@ 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,
Expand All @@ -305,6 +321,10 @@ def run(command, env={}, ignore_errors=False):
"anat",
"%s_T1w.nii*" % acq_tpl))
input_args = ""

if three_T == 'true':
input_args += " -3T"

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"
Expand Down Expand Up @@ -333,6 +353,7 @@ 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,
Expand Down Expand Up @@ -369,7 +390,12 @@ def run(command, env={}, ignore_errors=False):
if not T1s:
print("No T1w nii files found for subject %s. Skipping subject." % subject_label)
continue

input_args = ""

if three_T == 'true':
input_args += " -3T"

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"
Expand All @@ -391,6 +417,7 @@ 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,
Expand Down

0 comments on commit 1d071d6

Please sign in to comment.