Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit c63646b

Browse files
authored
Merge pull request #40 from richford/cli-params
Cli params for eddy_niter and slice_outlier_threshold
2 parents 585e650 + 950f231 commit c63646b

File tree

3 files changed

+166
-107
lines changed

3 files changed

+166
-107
lines changed

dmriprep/cli.py

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,40 @@
1010

1111

1212
@click.command()
13-
@click.option('--participant-label', help="The label(s) of the participant(s) that should be"
14-
"analyzed. The label corresponds to"
15-
"sub-<participant_label> from the BIDS spec (so it does"
16-
"not include 'sub-'). If this parameter is not provided"
17-
"all subjects will be analyzed. Multiple participants"
18-
"can be specified with a space separated list.",
19-
default=None
20-
)
13+
@click.option('--participant-label',
14+
help="The label(s) of the participant(s) that should be"
15+
"analyzed. The label corresponds to"
16+
"sub-<participant_label> from the BIDS spec (so it does"
17+
"not include 'sub-'). If this parameter is not provided"
18+
"all subjects will be analyzed. Multiple participants"
19+
"can be specified with a space separated list.",
20+
default=None)
21+
@click.option('--eddy-niter',
22+
help="Fixed number of eddy iterations. See "
23+
"https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide"
24+
"#A--niter",
25+
default=5, type=(int))
26+
@click.option('--slice-outlier-threshold',
27+
help="Number of allowed outlier slices per volume. "
28+
"If this is exceeded the volume is dropped from analysis. "
29+
"If an int is provided, it is treated as number of allowed "
30+
"outlier slices. If a float between 0 and 1 "
31+
"(exclusive) is provided, it is treated the fraction of "
32+
"allowed outlier slices.",
33+
default=0.02)
2134
@click.argument('bids_dir',
2235
)
2336
@click.argument('output_dir',
2437
)
2538
@click.argument('analysis_level',
2639
type=click.Choice(['participant', 'group']),
2740
default='participant')
28-
def main(participant_label, bids_dir, output_dir, analysis_level="participant"):
41+
def main(participant_label, bids_dir, output_dir,
42+
eddy_niter=5, slice_outlier_threshold=0.02,
43+
analysis_level="participant"):
2944
"""
30-
BIDS_DIR: The directory with the input dataset formatted according to the BIDS standard.
45+
BIDS_DIR: The directory with the input dataset formatted according to
46+
the BIDS standard.
3147
3248
OUTPUT_DIR: The directory where the output files should be stored.
3349
If you are running a group level analysis, this folder
@@ -38,16 +54,18 @@ def main(participant_label, bids_dir, output_dir, analysis_level="participant"):
3854
participant level analyses can be run independently
3955
(in parallel).
4056
"""
41-
4257
if analysis_level is not 'participant':
43-
raise NotImplementedError('The only valid analysis level for dmriprep is participant at the moment.')
58+
raise NotImplementedError('The only valid analysis level for dmriprep '
59+
'is participant at the moment.')
4460

4561
inputs = io.get_bids_files(participant_label, bids_dir)
4662

4763
for subject_inputs in inputs:
4864
run.run_dmriprep_pe(**subject_inputs,
4965
working_dir=os.path.join(output_dir, 'scratch'),
50-
out_dir=output_dir)
66+
out_dir=output_dir,
67+
eddy_niter=eddy_niter,
68+
slice_outlier_threshold=slice_outlier_threshold)
5169

5270
return 0
5371

0 commit comments

Comments
 (0)