13
13
14
14
# Filter warnings that are visible whenever you import another package that
15
15
# was compiled against an older numpy than is installed.
16
- warnings .filterwarnings (" ignore" , message = " numpy.dtype size changed" )
17
- warnings .filterwarnings (" ignore" , message = " numpy.ufunc size changed" )
16
+ warnings .filterwarnings (' ignore' , message = ' numpy.dtype size changed' )
17
+ warnings .filterwarnings (' ignore' , message = ' numpy.ufunc size changed' )
18
18
19
19
@click .command ()
20
20
# arguments as specified by BIDS-Apps
21
- @click .argument (" bids_dir" , type = click .Path (exists = True , file_okay = False ))
21
+ @click .argument (' bids_dir' , type = click .Path (exists = True , file_okay = False ))
22
22
@click .argument (
23
- " output_dir" , type = click .Path (exists = True , file_okay = False , writable = True )
23
+ ' output_dir' , type = click .Path (exists = True , file_okay = False , writable = True )
24
24
)
25
25
@click .argument (
26
- " analysis_level" , default = " participant" , type = click .Choice ([" participant" , " group" ])
26
+ ' analysis_level' , default = ' participant' , type = click .Choice ([' participant' , ' group' ])
27
27
)
28
28
# optional arguments
29
29
# options for filtering BIDS queries
30
30
@click .option (
31
- " --skip_bids_validation" ,
32
- help = " Assume the input dataset is BIDS compliant and skip the validation" ,
31
+ ' --skip_bids_validation' ,
32
+ help = ' Assume the input dataset is BIDS compliant and skip the validation' ,
33
33
is_flag = True
34
34
)
35
35
@click .option (
36
- " --participant_label" ,
36
+ ' --participant_label' ,
37
37
default = None ,
38
- help = " The label(s) of the participant(s) that should be "
39
- " analyzed. The label corresponds to "
40
- " sub-<participant_label> from the BIDS spec (the ' sub-' "
41
- " prefix can be removed). If this parameter is not provided "
42
- " all subjects will be analyzed. Multiple participants "
43
- " can be specified with a space delimited list."
38
+ help = ' The label(s) of the participant(s) that should be '
39
+ ' analyzed. The label corresponds to '
40
+ ' sub-<participant_label> from the BIDS spec (the " sub-" '
41
+ ' prefix can be removed). If this parameter is not provided '
42
+ ' all subjects will be analyzed. Multiple participants '
43
+ ' can be specified with a space delimited list.'
44
44
)
45
45
# options for prepping dwi scans
46
- # @click.option(
47
- # "--concat_shells",
48
- # default=None,
49
- # help="A space delimited list of acq-<label>",
50
- # )
51
46
@click .option (
52
- "--b0_thresh" ,
47
+ '--concat_dwis' ,
48
+ default = None ,
49
+ help = 'A space delimited list of acq-<label>' ,
50
+ )
51
+ @click .option (
52
+ '--b0_thresh' ,
53
53
default = 5 ,
54
54
show_default = True ,
55
- help = " Threshold for b0 value" ,
55
+ help = ' Threshold for b0 value' ,
56
56
type = click .IntRange (min = 0 , max = 10 ),
57
57
)
58
58
@click .option (
59
- " --output_resolution" ,
60
- help = " The isotropic voxel size in mm the data will be resampled to before eddy." ,
59
+ ' --output_resolution' ,
60
+ help = ' The isotropic voxel size in mm the data will be resampled to before eddy.' ,
61
61
type = float ,
62
62
multiple = True
63
63
)
64
64
# specific options for eddy
65
65
@click .option (
66
- " --omp_nthreads" ,
66
+ ' --omp_nthreads' ,
67
67
default = 1 ,
68
68
show_default = True ,
69
- help = " Maximum number of threads for eddy" ,
69
+ help = ' Maximum number of threads for eddy' ,
70
70
type = int ,
71
71
)
72
72
@click .option (
73
- " --eddy_niter" ,
73
+ ' --eddy_niter' ,
74
74
default = 5 ,
75
75
show_default = True ,
76
- help = " Fixed number of eddy iterations. See "
77
- " https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide"
78
- " #A--niter" ,
76
+ help = ' Fixed number of eddy iterations. See '
77
+ ' https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide'
78
+ ' #A--niter' ,
79
79
type = int ,
80
80
)
81
81
@click .option (
82
- " --bet_dwi" ,
82
+ ' --bet_dwi' ,
83
83
default = 0.3 ,
84
84
show_default = True ,
85
- help = " Fractional intensity threshold for BET on the DWI. "
86
- " A higher value will be more strict; it will cut off more "
87
- " around what it analyzes the brain to be." ,
85
+ help = ' Fractional intensity threshold for BET on the DWI. '
86
+ ' A higher value will be more strict; it will cut off more '
87
+ ' around what it analyzes the brain to be.' ,
88
88
type = click .FloatRange (min = 0 , max = 1 ),
89
89
)
90
90
@click .option (
91
- " --bet_mag" ,
91
+ ' --bet_mag' ,
92
92
default = 0.3 ,
93
93
show_default = True ,
94
- help = " Fractional intensity threshold for BET on the magnitude. "
95
- " A higher value will be more strict; it will cut off more "
96
- " around what it analyzes the brain to be." ,
94
+ help = ' Fractional intensity threshold for BET on the magnitude. '
95
+ ' A higher value will be more strict; it will cut off more '
96
+ ' around what it analyzes the brain to be.' ,
97
97
type = click .FloatRange (min = 0 , max = 1 ),
98
98
)
99
99
@click .option (
100
- " --acqp_file" ,
100
+ ' --acqp_file' ,
101
101
default = None ,
102
- help = " If you want to pass in an acqp file for topup/eddy instead of"
103
- " generating it from the json by default." ,
102
+ help = ' If you want to pass in an acqp file for topup/eddy instead of'
103
+ ' generating it from the json by default.' ,
104
104
type = click .Path (exists = True , dir_okay = False ),
105
105
)
106
106
# workflow configuration
107
107
@click .option (
108
- " --ignore" ,
109
- "-i" ,
110
- help = " Specify which node(s) to skip during the preprocessing of the dwi." ,
111
- type = click .Choice ([" denoise" , " unring" ]),
108
+ ' --ignore' ,
109
+ '-i' ,
110
+ help = ' Specify which node(s) to skip during the preprocessing of the dwi.' ,
111
+ type = click .Choice ([' denoise' , ' unring' , 'fieldmaps' ]),
112
112
multiple = True ,
113
113
)
114
114
@click .option (
115
- " --work_dir" ,
116
- "-w" ,
117
- help = " working directory" ,
115
+ ' --work_dir' ,
116
+ '-w' ,
117
+ help = ' working directory' ,
118
118
type = click .Path (exists = True , file_okay = False , writable = True ),
119
119
)
120
120
@click .option (
121
- " --synb0_dir" ,
121
+ ' --synb0_dir' ,
122
122
default = None ,
123
- help = " If you want to use Synb0-DISCO for preprocessing." ,
123
+ help = ' If you want to use Synb0-DISCO for preprocessing.' ,
124
124
type = click .Path (exists = True , file_okay = False ),
125
125
)
126
126
def main (
@@ -131,6 +131,7 @@ def main(
131
131
skip_bids_validation ,
132
132
work_dir ,
133
133
ignore ,
134
+ concat_dwis ,
134
135
b0_thresh ,
135
136
output_resolution ,
136
137
bet_dwi ,
@@ -152,10 +153,10 @@ def main(
152
153
participant level analyses can be run independently (in parallel).
153
154
"""
154
155
155
- if analysis_level != " participant" :
156
+ if analysis_level != ' participant' :
156
157
raise NotImplementedError (
157
- " The only valid analysis level for dmriprep "
158
- " is participant at the moment."
158
+ ' The only valid analysis level for dmriprep '
159
+ ' is participant at the moment.'
159
160
)
160
161
161
162
layout = BIDSLayout (bids_dir , validate = True )
@@ -169,7 +170,7 @@ def main(
169
170
validate_input_dir (bids_dir , all_subjects , subject_list )
170
171
171
172
if not work_dir :
172
- work_dir = os .path .join (output_dir , " scratch" )
173
+ work_dir = os .path .join (output_dir , ' scratch' )
173
174
174
175
if len (output_resolution ) == 1 :
175
176
output_resolution = output_resolution * 3
@@ -180,6 +181,7 @@ def main(
180
181
output_dir = output_dir ,
181
182
work_dir = work_dir ,
182
183
ignore = list (ignore ),
184
+ concat_dwis = list (concat_dwis ),
183
185
b0_thresh = b0_thresh ,
184
186
output_resolution = output_resolution ,
185
187
bet_dwi = bet_dwi ,
@@ -188,13 +190,13 @@ def main(
188
190
synb0_dir = synb0_dir
189
191
)
190
192
wf .write_graph ()
191
- wf .config [" execution" ][ " remove_unnecessary_outputs" ] = False
192
- wf .config [" execution" ][ " keep_inputs" ] = True
193
- wf .config [" execution" ][ " crashfile_format" ] = " txt"
193
+ wf .config [' execution' ][ ' remove_unnecessary_outputs' ] = False
194
+ wf .config [' execution' ][ ' keep_inputs' ] = True
195
+ wf .config [' execution' ][ ' crashfile_format' ] = ' txt'
194
196
wf .run ()
195
197
196
198
return 0
197
199
198
200
199
- if __name__ == " __main__" :
201
+ if __name__ == ' __main__' :
200
202
sys .exit (main ()) # pragma: no cover
0 commit comments