Skip to content

Commit 22ff22b

Browse files
NicolasGensollentclose
authored andcommitted
FIX: Use equal-separated option value pairs in eddy (#67)
1 parent 9838723 commit 22ff22b

File tree

1 file changed

+87
-34
lines changed

1 file changed

+87
-34
lines changed

src/pydra/tasks/fsl/eddy/eddy.py

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
... fieldmap_image="fieldmap.nii",
1818
... )
1919
>>> task.cmdline # doctest: +ELLIPSIS
20-
'eddy --imain input.nii --mask brain.nii --acqp params.txt --index index.txt \
21-
--bvecs input.bvec --bvals input.bval --field fieldmap.nii --out eddy ...'
20+
'eddy --imain=input.nii --mask=brain.nii --acqp=params.txt --index=index.txt \
21+
--bvecs=input.bvec --bvals=input.bval --field=fieldmap.nii --out=eddy ...'
2222
"""
2323

2424
__all__ = ["Eddy"]
@@ -37,41 +37,59 @@ class EddySpec(ShellSpec):
3737

3838
# Parameters that specify input files.
3939
input_image: PathLike = field(
40-
metadata={"help_string": "input image as a 4D volume", "mandatory": True, "argstr": "--imain"}
40+
metadata={
41+
"help_string": "input image as a 4D volume",
42+
"mandatory": True,
43+
"argstr": "--imain={input_image}",
44+
}
4145
)
4246

4347
brain_mask: PathLike = field(
44-
metadata={"help_string": "brain mask as a single volume image", "mandatory": True, "argstr": "--mask"}
48+
metadata={
49+
"help_string": "brain mask as a single volume image",
50+
"mandatory": True,
51+
"argstr": "--mask={brain_mask}",
52+
}
4553
)
4654

4755
encoding_file: PathLike = field(
4856
metadata={
4957
"help_string": "acquisition parameters for the diffusion protocol",
5058
"mandatory": True,
51-
"argstr": "--acqp",
59+
"argstr": "--acqp={encoding_file}",
5260
}
5361
)
5462

5563
index_file: PathLike = field(
5664
metadata={
5765
"help_string": "mapping from volume index to encoding parameters",
5866
"mandatory": True,
59-
"argstr": "--index",
67+
"argstr": "--index={index_file}",
6068
}
6169
)
6270

6371
bvec_file: PathLike = field(
64-
metadata={"help_string": "diffusion directions", "mandatory": True, "argstr": "--bvecs"}
72+
metadata={
73+
"help_string": "diffusion directions",
74+
"mandatory": True,
75+
"argstr": "--bvecs={bvec_file}",
76+
}
6577
)
6678

67-
bval_file: PathLike = field(metadata={"help_string": "diffusion weighting", "mandatory": True, "argstr": "--bvals"})
79+
bval_file: PathLike = field(
80+
metadata={
81+
"help_string": "diffusion weighting",
82+
"mandatory": True,
83+
"argstr": "--bvals={bval_file}",
84+
}
85+
)
6886

69-
fieldmap_image: PathLike = field(metadata={"help_string": "fieldmap image", "argstr": "--field"})
87+
fieldmap_image: PathLike = field(metadata={"help_string": "fieldmap image", "argstr": "--field={fieldmap_image}"})
7088

7189
fieldmap_matrix: PathLike = field(
7290
metadata={
7391
"help_string": "rigid-body transformation matrix from fieldmap to first input volume",
74-
"argstr": "--field_mat",
92+
"argstr": "--field_mat={fieldmap_matrix}",
7593
"requires": {"fieldmap_image"},
7694
}
7795
)
@@ -82,15 +100,19 @@ class EddySpec(ShellSpec):
82100

83101
# Parameters specifying names of output-files.
84102
output_basename: str = field(
85-
default="eddy", metadata={"help_string": "basename for output files", "argstr": "--out"}
103+
default="eddy",
104+
metadata={
105+
"help_string": "basename for output files",
106+
"argstr": "--out={output_basename}",
107+
},
86108
)
87109

88110
# Parameters specifying how eddy should be run.
89111
first_level_model: str = field(
90112
default="quadratic",
91113
metadata={
92114
"help_string": "model for the magnetic field generated by Eddy currents",
93-
"argstr": "--flm",
115+
"argstr": "--flm={first_level_model}",
94116
"allowed_values": {"movement", "linear", "quadratic", "cubic"},
95117
},
96118
)
@@ -99,7 +121,7 @@ class EddySpec(ShellSpec):
99121
default="none",
100122
metadata={
101123
"help_string": "model for how diffusion gradients generate Eddy currents",
102-
"argstr": "--slm",
124+
"argstr": "--slm={second_level_model}",
103125
"allowed_values": {"none", "linear", "quadratic"},
104126
},
105127
)
@@ -108,12 +130,16 @@ class EddySpec(ShellSpec):
108130
default=0,
109131
metadata={
110132
"help_string": "filter width used for pre-conditioning data prior to estimating distortions",
111-
"argstr": "--fwhm",
133+
"argstr": "--fwhm={fwhm}",
112134
},
113135
)
114136

115137
num_iterations: int = field(
116-
default=5, metadata={"help_string": "number of iterations for eddy", "argstr": "--niter"}
138+
default=5,
139+
metadata={
140+
"help_string": "number of iterations for eddy",
141+
"argstr": "--niter={num_iterations}",
142+
},
117143
)
118144

119145
fill_empty_planes: bool = field(metadata={"help_string": "detect and fill empty planes", "argstr": "--fep"})
@@ -122,23 +148,34 @@ class EddySpec(ShellSpec):
122148
default="spline",
123149
metadata={
124150
"help_string": "interpolation method for the estimation phase",
125-
"argstr": "--interp",
151+
"argstr": "--interp={interpolation}",
126152
"allowed_values": {"spline", "trilinear"},
127153
},
128154
)
129155

130156
resampling: str = field(
131157
default="jac",
132-
metadata={"help_string": "final resampling strategy", "argstr": "--resamp", "allowed_values": {"jac", "lsr"}},
158+
metadata={
159+
"help_string": "final resampling strategy",
160+
"argstr": "--resamp={resampling}",
161+
"allowed_values": {"jac", "lsr"},
162+
},
133163
)
134164

135165
num_voxels: int = field(
136166
default=1000,
137-
metadata={"help_string": "number of voxels to use for GP hyperparameter estimation", "argstr": "--nvoxhp"},
167+
metadata={
168+
"help_string": "number of voxels to use for GP hyperparameter estimation",
169+
"argstr": "--nvoxhp={num_voxels}",
170+
},
138171
)
139172

140173
fudge_factor: int = field(
141-
default=10, metadata={"help_string": "fudge factor for Q-space smoothing during estimation", "argstr": "--ff"}
174+
default=10,
175+
metadata={
176+
"help_string": "fudge factor for Q-space smoothing during estimation",
177+
"argstr": "--ff={fudge_factor}",
178+
},
142179
)
143180

144181
# Parameters for outlier replacement (ol)
@@ -147,67 +184,81 @@ class EddySpec(ShellSpec):
147184
outlier_num_stdevs: int = field(
148185
metadata={
149186
"help_string": "number of times off the standard deviation to qualify as outlier",
150-
"argstr": "--ol_nstd",
187+
"argstr": "--ol_nstd={outlier_num_stdevs}",
151188
"requires": {"replace_outliers"},
152189
}
153190
)
154191

155192
outlier_num_voxels: int = field(
156193
metadata={
157194
"help_string": "minimum number of voxels in a slice to qualify for outlier detection",
158-
"argstr": "--ol_nvox",
195+
"argstr": "--ol_nvox={outlier_num_voxels}",
159196
"requires": {"replace_outliers"},
160197
}
161198
)
162199

163200
outlier_type: str = field(
164201
metadata={
165202
"help_string": "type of outliers detected",
166-
"argstr": "--ol_type",
203+
"argstr": "--ol_type={outlier_type}",
167204
"allowed_values": {"both", "gw", "sw"},
168205
"requires": {"replace_outliers"},
169206
}
170207
)
171208

172-
multiband_factor: int = field(metadata={"help_string": "multiband factor", "argstr": "--mb"})
209+
multiband_factor: int = field(metadata={"help_string": "multiband factor", "argstr": "--mb={multiband_factor}"})
173210

174211
multiband_offset: int = field(
175-
metadata={"help_string": "multiband slice offset", "argstr": "--mb_offs", "requires": {"multiband_factor"}}
212+
metadata={
213+
"help_string": "multiband slice offset",
214+
"argstr": "--mb_offs={multiband_offset}",
215+
"requires": {"multiband_factor"},
216+
}
176217
)
177218

178219
# Parameters for intra-volume movement correction (s2v)
179220
movement_prediction_order: int = field(
180-
default=0, metadata={"help_string": "order of movement prediction model", "argstr": "--mporder"}
221+
default=0,
222+
metadata={
223+
"help_string": "order of movement prediction model",
224+
"argstr": "--mporder={movement_prediction_order}",
225+
},
181226
)
182227

183228
s2v_num_iterations: int = field(
184-
metadata={"help_string": "number of iterations for s2v movement estimation", "argstr": "--s2v_niter"}
229+
metadata={
230+
"help_string": "number of iterations for s2v movement estimation",
231+
"argstr": "--s2v_niter={s2v_num_iterations}",
232+
}
185233
)
186234

187235
s2v_lambda: float = field(
188-
metadata={"help_string": "weighting of regularization for s2v movement estimation", "argstr": "--s2v_lambda"}
236+
metadata={
237+
"help_string": "weighting of regularization for s2v movement estimation",
238+
"argstr": "--s2v_lambda={s2v_lambda}",
239+
}
189240
)
190241

191242
s2v_interpolation: str = field(
192243
metadata={
193244
"help_string": "interpolation method for s2v movement estimation.",
194-
"argstr": "--s2v_interp",
245+
"argstr": "--s2v_interp={s2v_interpolation}",
195246
"allowed_values": {"spline", "trilinear"},
196247
}
197248
)
198249

199250
slice_grouping_file: PathLike = field(
200251
metadata={
201252
"help_string": "file containing slice grouping information",
202-
"argstr": "--slspec",
253+
"argstr": "--slspec={slice_grouping_file}",
203254
"xor": {"slice_timing_file"},
204255
}
205256
)
206257

207258
slice_timing_file: PathLike = field(
208259
metadata={
209260
"help_string": "file containing slice timing information",
210-
"argstr": "--json",
261+
"argstr": "--json={slice_timing_file}",
211262
"xor": {"slice_grouping_file"},
212263
}
213264
)
@@ -223,23 +274,23 @@ class EddySpec(ShellSpec):
223274
mbs_num_iterations: int = field(
224275
metadata={
225276
"help_string": "number of iterations for MBS field estimation",
226-
"argstr": "--mbs_niter",
277+
"argstr": "--mbs_niter={mbs_num_iterations}",
227278
"requires": {"estimate_move_by_susceptibility"},
228279
}
229280
)
230281

231282
mbs_lambda: int = field(
232283
metadata={
233284
"help_string": "weighting of regularization for MBS field estimation",
234-
"argstr": "--mbs_lambda",
285+
"argstr": "--mbs_lambda={mbs_lambda}",
235286
"requires": {"estimate_move_by_susceptibility"},
236287
}
237288
)
238289

239290
mbs_knot_spacing: int = field(
240291
metadata={
241292
"help_string": "knot-spacing for MBS field estimation",
242-
"argstr": "--mbs_ksp",
293+
"argstr": "--mbs_ksp={mbs_knot_spacing}",
243294
"requires": {"estimate_move_by_susceptibility"},
244295
}
245296
)
@@ -249,7 +300,9 @@ class EddySpec(ShellSpec):
249300
metadata={"help_string": "bypass checks for data shelling", "argstr": "--data_is_shelled"}
250301
)
251302

252-
random_seed: int = field(metadata={"help_string": "random seed for voxel selection", "argstr": "--initrand"})
303+
random_seed: int = field(
304+
metadata={"help_string": "random seed for voxel selection", "argstr": "--initrand={random_seed}"}
305+
)
253306

254307
save_cnr_maps: bool = field(metadata={"help_string": "save shell-wise CNR maps", "argstr": "--cnr_maps"})
255308

0 commit comments

Comments
 (0)