niwrap-mrtrix 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of niwrap-mrtrix might be problematic. Click here for more details.

Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +130 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +453 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +362 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +423 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +347 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +530 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +351 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +344 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +336 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +382 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +351 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +546 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +413 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +427 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +316 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +353 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +394 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +373 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +498 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +772 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +580 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +404 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +592 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +441 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +356 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
  117. niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,1295 @@
1
+ # This file was auto generated by Styx.
2
+ # Do not edit this file directly.
3
+
4
+ import typing
5
+ import pathlib
6
+ from styxdefs import *
7
+
8
+ DWI2RESPONSE_METADATA = Metadata(
9
+ id="783031dadad04a0c0a13f937e1015a6d4ff7ac7f.boutiques",
10
+ name="dwi2response",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ Dwi2responseDhollanderParameters = typing.TypedDict('Dwi2responseDhollanderParameters', {
17
+ "__STYX_TYPE__": typing.Literal["dhollander"],
18
+ "input": InputPathType,
19
+ "out_sfwm": str,
20
+ "out_gm": str,
21
+ "out_csf": str,
22
+ "erode": typing.NotRequired[int | None],
23
+ "fa": typing.NotRequired[float | None],
24
+ "sfwm": typing.NotRequired[float | None],
25
+ "gm": typing.NotRequired[float | None],
26
+ "csf": typing.NotRequired[float | None],
27
+ "wm_algo": typing.NotRequired[typing.Literal["fa", "tax", "tournier"] | None],
28
+ })
29
+
30
+
31
+ Dwi2responseFaParameters = typing.TypedDict('Dwi2responseFaParameters', {
32
+ "__STYX_TYPE__": typing.Literal["fa"],
33
+ "input": InputPathType,
34
+ "output": str,
35
+ "erode": typing.NotRequired[int | None],
36
+ "number": typing.NotRequired[int | None],
37
+ "threshold": typing.NotRequired[float | None],
38
+ })
39
+
40
+
41
+ Dwi2responseManualParameters = typing.TypedDict('Dwi2responseManualParameters', {
42
+ "__STYX_TYPE__": typing.Literal["manual"],
43
+ "input": InputPathType,
44
+ "in_voxels": InputPathType,
45
+ "output": str,
46
+ "dirs": typing.NotRequired[InputPathType | None],
47
+ })
48
+
49
+
50
+ Dwi2responseMsmt5ttParameters = typing.TypedDict('Dwi2responseMsmt5ttParameters', {
51
+ "__STYX_TYPE__": typing.Literal["msmt_5tt"],
52
+ "input": InputPathType,
53
+ "in_5tt": InputPathType,
54
+ "out_wm": str,
55
+ "out_gm": str,
56
+ "out_csf": str,
57
+ "dirs": typing.NotRequired[InputPathType | None],
58
+ "fa": typing.NotRequired[float | None],
59
+ "pvf": typing.NotRequired[float | None],
60
+ "wm_algo": typing.NotRequired[typing.Literal["fa", "tax", "tournier"] | None],
61
+ "sfwm_fa_threshold": typing.NotRequired[float | None],
62
+ })
63
+
64
+
65
+ Dwi2responseTaxParameters = typing.TypedDict('Dwi2responseTaxParameters', {
66
+ "__STYX_TYPE__": typing.Literal["tax"],
67
+ "input": InputPathType,
68
+ "output": str,
69
+ "peak_ratio": typing.NotRequired[float | None],
70
+ "max_iters": typing.NotRequired[int | None],
71
+ "convergence": typing.NotRequired[float | None],
72
+ })
73
+
74
+
75
+ Dwi2responseTournierParameters = typing.TypedDict('Dwi2responseTournierParameters', {
76
+ "__STYX_TYPE__": typing.Literal["tournier"],
77
+ "input": InputPathType,
78
+ "output": str,
79
+ "number": typing.NotRequired[int | None],
80
+ "iter_voxels": typing.NotRequired[int | None],
81
+ "dilate": typing.NotRequired[int | None],
82
+ "max_iters": typing.NotRequired[int | None],
83
+ })
84
+
85
+
86
+ Dwi2responseFslgradParameters = typing.TypedDict('Dwi2responseFslgradParameters', {
87
+ "__STYX_TYPE__": typing.Literal["fslgrad"],
88
+ "bvecs": InputPathType,
89
+ "bvals": InputPathType,
90
+ })
91
+
92
+
93
+ Dwi2responseConfigParameters = typing.TypedDict('Dwi2responseConfigParameters', {
94
+ "__STYX_TYPE__": typing.Literal["config"],
95
+ "key": str,
96
+ "value": str,
97
+ })
98
+
99
+
100
+ Dwi2responseParameters = typing.TypedDict('Dwi2responseParameters', {
101
+ "__STYX_TYPE__": typing.Literal["dwi2response"],
102
+ "algorithm": typing.Union[Dwi2responseDhollanderParameters, Dwi2responseFaParameters, Dwi2responseManualParameters, Dwi2responseMsmt5ttParameters, Dwi2responseTaxParameters, Dwi2responseTournierParameters],
103
+ "grad": typing.NotRequired[InputPathType | None],
104
+ "fslgrad": typing.NotRequired[Dwi2responseFslgradParameters | None],
105
+ "mask": typing.NotRequired[InputPathType | None],
106
+ "voxels": typing.NotRequired[str | None],
107
+ "shells": typing.NotRequired[list[int] | None],
108
+ "lmax": typing.NotRequired[list[int] | None],
109
+ "nocleanup": bool,
110
+ "scratch": typing.NotRequired[str | None],
111
+ "continue": typing.NotRequired[str | None],
112
+ "info": bool,
113
+ "quiet": bool,
114
+ "debug": bool,
115
+ "force": bool,
116
+ "nthreads": typing.NotRequired[int | None],
117
+ "config": typing.NotRequired[list[Dwi2responseConfigParameters] | None],
118
+ "help": bool,
119
+ "version": bool,
120
+ })
121
+
122
+
123
+ def dyn_cargs(
124
+ t: str,
125
+ ) -> typing.Any:
126
+ """
127
+ Get build cargs function by command type.
128
+
129
+ Args:
130
+ t: Command type.
131
+ Returns:
132
+ Build cargs function.
133
+ """
134
+ return {
135
+ "dwi2response": dwi2response_cargs,
136
+ "dhollander": dwi2response_dhollander_cargs,
137
+ "fa": dwi2response_fa_cargs,
138
+ "manual": dwi2response_manual_cargs,
139
+ "msmt_5tt": dwi2response_msmt_5tt_cargs,
140
+ "tax": dwi2response_tax_cargs,
141
+ "tournier": dwi2response_tournier_cargs,
142
+ "fslgrad": dwi2response_fslgrad_cargs,
143
+ "config": dwi2response_config_cargs,
144
+ }.get(t)
145
+
146
+
147
+ def dyn_outputs(
148
+ t: str,
149
+ ) -> typing.Any:
150
+ """
151
+ Get build outputs function by command type.
152
+
153
+ Args:
154
+ t: Command type.
155
+ Returns:
156
+ Build outputs function.
157
+ """
158
+ return {
159
+ "dwi2response": dwi2response_outputs,
160
+ "dhollander": dwi2response_dhollander_outputs,
161
+ "fa": dwi2response_fa_outputs,
162
+ "manual": dwi2response_manual_outputs,
163
+ "msmt_5tt": dwi2response_msmt_5tt_outputs,
164
+ "tax": dwi2response_tax_outputs,
165
+ "tournier": dwi2response_tournier_outputs,
166
+ }.get(t)
167
+
168
+
169
+ class Dwi2responseDhollanderOutputs(typing.NamedTuple):
170
+ """
171
+ Output object returned when calling `Dwi2responseDhollanderParameters(...)`.
172
+ """
173
+ root: OutputPathType
174
+ """Output root folder. This is the root folder for all outputs."""
175
+ out_sfwm: OutputPathType
176
+ """Output single-fibre WM response function text file"""
177
+ out_gm: OutputPathType
178
+ """Output GM response function text file"""
179
+ out_csf: OutputPathType
180
+ """Output CSF response function text file"""
181
+
182
+
183
+ def dwi2response_dhollander_params(
184
+ input_: InputPathType,
185
+ out_sfwm: str,
186
+ out_gm: str,
187
+ out_csf: str,
188
+ erode: int | None = None,
189
+ fa: float | None = None,
190
+ sfwm: float | None = None,
191
+ gm: float | None = None,
192
+ csf: float | None = None,
193
+ wm_algo: typing.Literal["fa", "tax", "tournier"] | None = None,
194
+ ) -> Dwi2responseDhollanderParameters:
195
+ """
196
+ Build parameters.
197
+
198
+ Args:
199
+ input_: Input DWI dataset.
200
+ out_sfwm: Output single-fibre WM response function text file.
201
+ out_gm: Output GM response function text file.
202
+ out_csf: Output CSF response function text file.
203
+ erode: Number of erosion passes to apply to initial (whole brain) mask.\
204
+ Set to 0 to not erode the brain mask. (default: 3).
205
+ fa: FA threshold for crude WM versus GM-CSF separation. (default: 0.2).
206
+ sfwm: Final number of single-fibre WM voxels to select, as a percentage\
207
+ of refined WM. (default: 0.5 per cent).
208
+ gm: Final number of GM voxels to select, as a percentage of refined GM.\
209
+ (default: 2 per cent).
210
+ csf: Final number of CSF voxels to select, as a percentage of refined\
211
+ CSF. (default: 10 per cent).
212
+ wm_algo: Use external dwi2response algorithm for WM single-fibre voxel\
213
+ selection (options: fa, tax, tournier) (default: built-in Dhollander\
214
+ 2019).
215
+ Returns:
216
+ Parameter dictionary
217
+ """
218
+ params = {
219
+ "__STYXTYPE__": "dhollander",
220
+ "input": input_,
221
+ "out_sfwm": out_sfwm,
222
+ "out_gm": out_gm,
223
+ "out_csf": out_csf,
224
+ }
225
+ if erode is not None:
226
+ params["erode"] = erode
227
+ if fa is not None:
228
+ params["fa"] = fa
229
+ if sfwm is not None:
230
+ params["sfwm"] = sfwm
231
+ if gm is not None:
232
+ params["gm"] = gm
233
+ if csf is not None:
234
+ params["csf"] = csf
235
+ if wm_algo is not None:
236
+ params["wm_algo"] = wm_algo
237
+ return params
238
+
239
+
240
+ def dwi2response_dhollander_cargs(
241
+ params: Dwi2responseDhollanderParameters,
242
+ execution: Execution,
243
+ ) -> list[str]:
244
+ """
245
+ Build command-line arguments from parameters.
246
+
247
+ Args:
248
+ params: The parameters.
249
+ execution: The execution object for resolving input paths.
250
+ Returns:
251
+ Command-line arguments.
252
+ """
253
+ cargs = []
254
+ cargs.append("dhollander")
255
+ cargs.append(execution.input_file(params.get("input")))
256
+ cargs.append(params.get("out_sfwm"))
257
+ cargs.append(params.get("out_gm"))
258
+ cargs.append(params.get("out_csf"))
259
+ if params.get("erode") is not None:
260
+ cargs.extend([
261
+ "-erode",
262
+ str(params.get("erode"))
263
+ ])
264
+ if params.get("fa") is not None:
265
+ cargs.extend([
266
+ "-fa",
267
+ str(params.get("fa"))
268
+ ])
269
+ if params.get("sfwm") is not None:
270
+ cargs.extend([
271
+ "-sfwm",
272
+ str(params.get("sfwm"))
273
+ ])
274
+ if params.get("gm") is not None:
275
+ cargs.extend([
276
+ "-gm",
277
+ str(params.get("gm"))
278
+ ])
279
+ if params.get("csf") is not None:
280
+ cargs.extend([
281
+ "-csf",
282
+ str(params.get("csf"))
283
+ ])
284
+ if params.get("wm_algo") is not None:
285
+ cargs.extend([
286
+ "-wm_algo",
287
+ params.get("wm_algo")
288
+ ])
289
+ return cargs
290
+
291
+
292
+ def dwi2response_dhollander_outputs(
293
+ params: Dwi2responseDhollanderParameters,
294
+ execution: Execution,
295
+ ) -> Dwi2responseDhollanderOutputs:
296
+ """
297
+ Build outputs object containing output file paths and possibly stdout/stderr.
298
+
299
+ Args:
300
+ params: The parameters.
301
+ execution: The execution object for resolving input paths.
302
+ Returns:
303
+ Outputs object.
304
+ """
305
+ ret = Dwi2responseDhollanderOutputs(
306
+ root=execution.output_file("."),
307
+ out_sfwm=execution.output_file(params.get("out_sfwm")),
308
+ out_gm=execution.output_file(params.get("out_gm")),
309
+ out_csf=execution.output_file(params.get("out_csf")),
310
+ )
311
+ return ret
312
+
313
+
314
+ class Dwi2responseFaOutputs(typing.NamedTuple):
315
+ """
316
+ Output object returned when calling `Dwi2responseFaParameters(...)`.
317
+ """
318
+ root: OutputPathType
319
+ """Output root folder. This is the root folder for all outputs."""
320
+ output: OutputPathType
321
+ """The output response function text file"""
322
+
323
+
324
+ def dwi2response_fa_params(
325
+ input_: InputPathType,
326
+ output: str,
327
+ erode: int | None = None,
328
+ number: int | None = None,
329
+ threshold: float | None = None,
330
+ ) -> Dwi2responseFaParameters:
331
+ """
332
+ Build parameters.
333
+
334
+ Args:
335
+ input_: The input DWI.
336
+ output: The output response function text file.
337
+ erode: Number of brain mask erosion steps to apply prior to threshold\
338
+ (not used if mask is provided manually).
339
+ number: The number of highest-FA voxels to use.
340
+ threshold: Apply a hard FA threshold, rather than selecting the top\
341
+ voxels.
342
+ Returns:
343
+ Parameter dictionary
344
+ """
345
+ params = {
346
+ "__STYXTYPE__": "fa",
347
+ "input": input_,
348
+ "output": output,
349
+ }
350
+ if erode is not None:
351
+ params["erode"] = erode
352
+ if number is not None:
353
+ params["number"] = number
354
+ if threshold is not None:
355
+ params["threshold"] = threshold
356
+ return params
357
+
358
+
359
+ def dwi2response_fa_cargs(
360
+ params: Dwi2responseFaParameters,
361
+ execution: Execution,
362
+ ) -> list[str]:
363
+ """
364
+ Build command-line arguments from parameters.
365
+
366
+ Args:
367
+ params: The parameters.
368
+ execution: The execution object for resolving input paths.
369
+ Returns:
370
+ Command-line arguments.
371
+ """
372
+ cargs = []
373
+ cargs.append("fa")
374
+ cargs.append(execution.input_file(params.get("input")))
375
+ cargs.append(params.get("output"))
376
+ if params.get("erode") is not None:
377
+ cargs.extend([
378
+ "-erode",
379
+ str(params.get("erode"))
380
+ ])
381
+ if params.get("number") is not None:
382
+ cargs.extend([
383
+ "-number",
384
+ str(params.get("number"))
385
+ ])
386
+ if params.get("threshold") is not None:
387
+ cargs.extend([
388
+ "-threshold",
389
+ str(params.get("threshold"))
390
+ ])
391
+ return cargs
392
+
393
+
394
+ def dwi2response_fa_outputs(
395
+ params: Dwi2responseFaParameters,
396
+ execution: Execution,
397
+ ) -> Dwi2responseFaOutputs:
398
+ """
399
+ Build outputs object containing output file paths and possibly stdout/stderr.
400
+
401
+ Args:
402
+ params: The parameters.
403
+ execution: The execution object for resolving input paths.
404
+ Returns:
405
+ Outputs object.
406
+ """
407
+ ret = Dwi2responseFaOutputs(
408
+ root=execution.output_file("."),
409
+ output=execution.output_file(params.get("output")),
410
+ )
411
+ return ret
412
+
413
+
414
+ class Dwi2responseManualOutputs(typing.NamedTuple):
415
+ """
416
+ Output object returned when calling `Dwi2responseManualParameters(...)`.
417
+ """
418
+ root: OutputPathType
419
+ """Output root folder. This is the root folder for all outputs."""
420
+ output: OutputPathType
421
+ """Output response function text file"""
422
+
423
+
424
+ def dwi2response_manual_params(
425
+ input_: InputPathType,
426
+ in_voxels: InputPathType,
427
+ output: str,
428
+ dirs: InputPathType | None = None,
429
+ ) -> Dwi2responseManualParameters:
430
+ """
431
+ Build parameters.
432
+
433
+ Args:
434
+ input_: The input DWI.
435
+ in_voxels: Input voxel selection mask.
436
+ output: Output response function text file.
437
+ dirs: Manually provide the fibre direction in each voxel (a tensor fit\
438
+ will be used otherwise).
439
+ Returns:
440
+ Parameter dictionary
441
+ """
442
+ params = {
443
+ "__STYXTYPE__": "manual",
444
+ "input": input_,
445
+ "in_voxels": in_voxels,
446
+ "output": output,
447
+ }
448
+ if dirs is not None:
449
+ params["dirs"] = dirs
450
+ return params
451
+
452
+
453
+ def dwi2response_manual_cargs(
454
+ params: Dwi2responseManualParameters,
455
+ execution: Execution,
456
+ ) -> list[str]:
457
+ """
458
+ Build command-line arguments from parameters.
459
+
460
+ Args:
461
+ params: The parameters.
462
+ execution: The execution object for resolving input paths.
463
+ Returns:
464
+ Command-line arguments.
465
+ """
466
+ cargs = []
467
+ cargs.append("manual")
468
+ cargs.append(execution.input_file(params.get("input")))
469
+ cargs.append(execution.input_file(params.get("in_voxels")))
470
+ cargs.append(params.get("output"))
471
+ if params.get("dirs") is not None:
472
+ cargs.extend([
473
+ "-dirs",
474
+ execution.input_file(params.get("dirs"))
475
+ ])
476
+ return cargs
477
+
478
+
479
+ def dwi2response_manual_outputs(
480
+ params: Dwi2responseManualParameters,
481
+ execution: Execution,
482
+ ) -> Dwi2responseManualOutputs:
483
+ """
484
+ Build outputs object containing output file paths and possibly stdout/stderr.
485
+
486
+ Args:
487
+ params: The parameters.
488
+ execution: The execution object for resolving input paths.
489
+ Returns:
490
+ Outputs object.
491
+ """
492
+ ret = Dwi2responseManualOutputs(
493
+ root=execution.output_file("."),
494
+ output=execution.output_file(params.get("output")),
495
+ )
496
+ return ret
497
+
498
+
499
+ class Dwi2responseMsmt5ttOutputs(typing.NamedTuple):
500
+ """
501
+ Output object returned when calling `Dwi2responseMsmt5ttParameters(...)`.
502
+ """
503
+ root: OutputPathType
504
+ """Output root folder. This is the root folder for all outputs."""
505
+ out_wm: OutputPathType
506
+ """Output WM response text file"""
507
+ out_gm: OutputPathType
508
+ """Output GM response text file"""
509
+ out_csf: OutputPathType
510
+ """Output CSF response text file"""
511
+
512
+
513
+ def dwi2response_msmt_5tt_params(
514
+ input_: InputPathType,
515
+ in_5tt: InputPathType,
516
+ out_wm: str,
517
+ out_gm: str,
518
+ out_csf: str,
519
+ dirs: InputPathType | None = None,
520
+ fa: float | None = None,
521
+ pvf: float | None = None,
522
+ wm_algo: typing.Literal["fa", "tax", "tournier"] | None = None,
523
+ sfwm_fa_threshold: float | None = None,
524
+ ) -> Dwi2responseMsmt5ttParameters:
525
+ """
526
+ Build parameters.
527
+
528
+ Args:
529
+ input_: The input DWI.
530
+ in_5tt: Input co-registered 5TT image.
531
+ out_wm: Output WM response text file.
532
+ out_gm: Output GM response text file.
533
+ out_csf: Output CSF response text file.
534
+ dirs: Manually provide the fibre direction in each voxel (a tensor fit\
535
+ will be used otherwise).
536
+ fa: Upper fractional anisotropy threshold for GM and CSF voxel\
537
+ selection (default: 0.2).
538
+ pvf: Partial volume fraction threshold for tissue voxel selection\
539
+ (default: 0.95).
540
+ wm_algo: algorithm dwi2response algorithm to use for WM single-fibre\
541
+ voxel selection (options: fa, tax, tournier; default: tournier).
542
+ sfwm_fa_threshold: Sets -wm_algo to fa and allows to specify a hard FA\
543
+ threshold for single-fibre WM voxels, which is passed to the -threshold\
544
+ option of the fa algorithm (warning: overrides -wm_algo option).
545
+ Returns:
546
+ Parameter dictionary
547
+ """
548
+ params = {
549
+ "__STYXTYPE__": "msmt_5tt",
550
+ "input": input_,
551
+ "in_5tt": in_5tt,
552
+ "out_wm": out_wm,
553
+ "out_gm": out_gm,
554
+ "out_csf": out_csf,
555
+ }
556
+ if dirs is not None:
557
+ params["dirs"] = dirs
558
+ if fa is not None:
559
+ params["fa"] = fa
560
+ if pvf is not None:
561
+ params["pvf"] = pvf
562
+ if wm_algo is not None:
563
+ params["wm_algo"] = wm_algo
564
+ if sfwm_fa_threshold is not None:
565
+ params["sfwm_fa_threshold"] = sfwm_fa_threshold
566
+ return params
567
+
568
+
569
+ def dwi2response_msmt_5tt_cargs(
570
+ params: Dwi2responseMsmt5ttParameters,
571
+ execution: Execution,
572
+ ) -> list[str]:
573
+ """
574
+ Build command-line arguments from parameters.
575
+
576
+ Args:
577
+ params: The parameters.
578
+ execution: The execution object for resolving input paths.
579
+ Returns:
580
+ Command-line arguments.
581
+ """
582
+ cargs = []
583
+ cargs.append("msmt_5tt")
584
+ cargs.append(execution.input_file(params.get("input")))
585
+ cargs.append(execution.input_file(params.get("in_5tt")))
586
+ cargs.append(params.get("out_wm"))
587
+ cargs.append(params.get("out_gm"))
588
+ cargs.append(params.get("out_csf"))
589
+ if params.get("dirs") is not None:
590
+ cargs.extend([
591
+ "-dirs",
592
+ execution.input_file(params.get("dirs"))
593
+ ])
594
+ if params.get("fa") is not None:
595
+ cargs.extend([
596
+ "-fa",
597
+ str(params.get("fa"))
598
+ ])
599
+ if params.get("pvf") is not None:
600
+ cargs.extend([
601
+ "-pvf",
602
+ str(params.get("pvf"))
603
+ ])
604
+ if params.get("wm_algo") is not None:
605
+ cargs.extend([
606
+ "-wm_algo",
607
+ params.get("wm_algo")
608
+ ])
609
+ if params.get("sfwm_fa_threshold") is not None:
610
+ cargs.extend([
611
+ "-sfwm_fa_threshold",
612
+ str(params.get("sfwm_fa_threshold"))
613
+ ])
614
+ return cargs
615
+
616
+
617
+ def dwi2response_msmt_5tt_outputs(
618
+ params: Dwi2responseMsmt5ttParameters,
619
+ execution: Execution,
620
+ ) -> Dwi2responseMsmt5ttOutputs:
621
+ """
622
+ Build outputs object containing output file paths and possibly stdout/stderr.
623
+
624
+ Args:
625
+ params: The parameters.
626
+ execution: The execution object for resolving input paths.
627
+ Returns:
628
+ Outputs object.
629
+ """
630
+ ret = Dwi2responseMsmt5ttOutputs(
631
+ root=execution.output_file("."),
632
+ out_wm=execution.output_file(params.get("out_wm")),
633
+ out_gm=execution.output_file(params.get("out_gm")),
634
+ out_csf=execution.output_file(params.get("out_csf")),
635
+ )
636
+ return ret
637
+
638
+
639
+ class Dwi2responseTaxOutputs(typing.NamedTuple):
640
+ """
641
+ Output object returned when calling `Dwi2responseTaxParameters(...)`.
642
+ """
643
+ root: OutputPathType
644
+ """Output root folder. This is the root folder for all outputs."""
645
+ output: OutputPathType
646
+ """The output response function text file"""
647
+
648
+
649
+ def dwi2response_tax_params(
650
+ input_: InputPathType,
651
+ output: str,
652
+ peak_ratio: float | None = None,
653
+ max_iters: int | None = None,
654
+ convergence: float | None = None,
655
+ ) -> Dwi2responseTaxParameters:
656
+ """
657
+ Build parameters.
658
+
659
+ Args:
660
+ input_: The input DWI.
661
+ output: The output response function text file.
662
+ peak_ratio: Second-to-first-peak amplitude ratio threshold.
663
+ max_iters: Maximum number of iterations.
664
+ convergence: Percentile change in any RF coefficient required to\
665
+ continue iterating.
666
+ Returns:
667
+ Parameter dictionary
668
+ """
669
+ params = {
670
+ "__STYXTYPE__": "tax",
671
+ "input": input_,
672
+ "output": output,
673
+ }
674
+ if peak_ratio is not None:
675
+ params["peak_ratio"] = peak_ratio
676
+ if max_iters is not None:
677
+ params["max_iters"] = max_iters
678
+ if convergence is not None:
679
+ params["convergence"] = convergence
680
+ return params
681
+
682
+
683
+ def dwi2response_tax_cargs(
684
+ params: Dwi2responseTaxParameters,
685
+ execution: Execution,
686
+ ) -> list[str]:
687
+ """
688
+ Build command-line arguments from parameters.
689
+
690
+ Args:
691
+ params: The parameters.
692
+ execution: The execution object for resolving input paths.
693
+ Returns:
694
+ Command-line arguments.
695
+ """
696
+ cargs = []
697
+ cargs.append("tax")
698
+ cargs.append(execution.input_file(params.get("input")))
699
+ cargs.append(params.get("output"))
700
+ if params.get("peak_ratio") is not None:
701
+ cargs.extend([
702
+ "-peak_ratio",
703
+ str(params.get("peak_ratio"))
704
+ ])
705
+ if params.get("max_iters") is not None:
706
+ cargs.extend([
707
+ "-max_iters",
708
+ str(params.get("max_iters"))
709
+ ])
710
+ if params.get("convergence") is not None:
711
+ cargs.extend([
712
+ "-convergence",
713
+ str(params.get("convergence"))
714
+ ])
715
+ return cargs
716
+
717
+
718
+ def dwi2response_tax_outputs(
719
+ params: Dwi2responseTaxParameters,
720
+ execution: Execution,
721
+ ) -> Dwi2responseTaxOutputs:
722
+ """
723
+ Build outputs object containing output file paths and possibly stdout/stderr.
724
+
725
+ Args:
726
+ params: The parameters.
727
+ execution: The execution object for resolving input paths.
728
+ Returns:
729
+ Outputs object.
730
+ """
731
+ ret = Dwi2responseTaxOutputs(
732
+ root=execution.output_file("."),
733
+ output=execution.output_file(params.get("output")),
734
+ )
735
+ return ret
736
+
737
+
738
+ class Dwi2responseTournierOutputs(typing.NamedTuple):
739
+ """
740
+ Output object returned when calling `Dwi2responseTournierParameters(...)`.
741
+ """
742
+ root: OutputPathType
743
+ """Output root folder. This is the root folder for all outputs."""
744
+ output: OutputPathType
745
+ """The output response function text file"""
746
+
747
+
748
+ def dwi2response_tournier_params(
749
+ input_: InputPathType,
750
+ output: str,
751
+ number: int | None = None,
752
+ iter_voxels: int | None = None,
753
+ dilate: int | None = None,
754
+ max_iters: int | None = None,
755
+ ) -> Dwi2responseTournierParameters:
756
+ """
757
+ Build parameters.
758
+
759
+ Args:
760
+ input_: The input DWI.
761
+ output: The output response function text file.
762
+ number: Number of single-fibre voxels to use when calculating response\
763
+ function.
764
+ iter_voxels: Number of single-fibre voxels to select when preparing for\
765
+ the next iteration (default = 10 x value given in -number).
766
+ dilate: Number of mask dilation steps to apply when deriving voxel mask\
767
+ to test in the next iteration.
768
+ max_iters: Maximum number of iterations.
769
+ Returns:
770
+ Parameter dictionary
771
+ """
772
+ params = {
773
+ "__STYXTYPE__": "tournier",
774
+ "input": input_,
775
+ "output": output,
776
+ }
777
+ if number is not None:
778
+ params["number"] = number
779
+ if iter_voxels is not None:
780
+ params["iter_voxels"] = iter_voxels
781
+ if dilate is not None:
782
+ params["dilate"] = dilate
783
+ if max_iters is not None:
784
+ params["max_iters"] = max_iters
785
+ return params
786
+
787
+
788
+ def dwi2response_tournier_cargs(
789
+ params: Dwi2responseTournierParameters,
790
+ execution: Execution,
791
+ ) -> list[str]:
792
+ """
793
+ Build command-line arguments from parameters.
794
+
795
+ Args:
796
+ params: The parameters.
797
+ execution: The execution object for resolving input paths.
798
+ Returns:
799
+ Command-line arguments.
800
+ """
801
+ cargs = []
802
+ cargs.append("tournier")
803
+ cargs.append(execution.input_file(params.get("input")))
804
+ cargs.append(params.get("output"))
805
+ if params.get("number") is not None:
806
+ cargs.extend([
807
+ "-number",
808
+ str(params.get("number"))
809
+ ])
810
+ if params.get("iter_voxels") is not None:
811
+ cargs.extend([
812
+ "-iter_voxels",
813
+ str(params.get("iter_voxels"))
814
+ ])
815
+ if params.get("dilate") is not None:
816
+ cargs.extend([
817
+ "-dilate",
818
+ str(params.get("dilate"))
819
+ ])
820
+ if params.get("max_iters") is not None:
821
+ cargs.extend([
822
+ "-max_iters",
823
+ str(params.get("max_iters"))
824
+ ])
825
+ return cargs
826
+
827
+
828
+ def dwi2response_tournier_outputs(
829
+ params: Dwi2responseTournierParameters,
830
+ execution: Execution,
831
+ ) -> Dwi2responseTournierOutputs:
832
+ """
833
+ Build outputs object containing output file paths and possibly stdout/stderr.
834
+
835
+ Args:
836
+ params: The parameters.
837
+ execution: The execution object for resolving input paths.
838
+ Returns:
839
+ Outputs object.
840
+ """
841
+ ret = Dwi2responseTournierOutputs(
842
+ root=execution.output_file("."),
843
+ output=execution.output_file(params.get("output")),
844
+ )
845
+ return ret
846
+
847
+
848
+ def dwi2response_fslgrad_params(
849
+ bvecs: InputPathType,
850
+ bvals: InputPathType,
851
+ ) -> Dwi2responseFslgradParameters:
852
+ """
853
+ Build parameters.
854
+
855
+ Args:
856
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
857
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
858
+ scheme is present in the input image header, the data provided with\
859
+ this option will be instead used.
860
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
861
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
862
+ scheme is present in the input image header, the data provided with\
863
+ this option will be instead used.
864
+ Returns:
865
+ Parameter dictionary
866
+ """
867
+ params = {
868
+ "__STYXTYPE__": "fslgrad",
869
+ "bvecs": bvecs,
870
+ "bvals": bvals,
871
+ }
872
+ return params
873
+
874
+
875
+ def dwi2response_fslgrad_cargs(
876
+ params: Dwi2responseFslgradParameters,
877
+ execution: Execution,
878
+ ) -> list[str]:
879
+ """
880
+ Build command-line arguments from parameters.
881
+
882
+ Args:
883
+ params: The parameters.
884
+ execution: The execution object for resolving input paths.
885
+ Returns:
886
+ Command-line arguments.
887
+ """
888
+ cargs = []
889
+ cargs.append("-fslgrad")
890
+ cargs.append(execution.input_file(params.get("bvecs")))
891
+ cargs.append(execution.input_file(params.get("bvals")))
892
+ return cargs
893
+
894
+
895
+ def dwi2response_config_params(
896
+ key: str,
897
+ value: str,
898
+ ) -> Dwi2responseConfigParameters:
899
+ """
900
+ Build parameters.
901
+
902
+ Args:
903
+ key: temporarily set the value of an MRtrix config file entry.
904
+ value: temporarily set the value of an MRtrix config file entry.
905
+ Returns:
906
+ Parameter dictionary
907
+ """
908
+ params = {
909
+ "__STYXTYPE__": "config",
910
+ "key": key,
911
+ "value": value,
912
+ }
913
+ return params
914
+
915
+
916
+ def dwi2response_config_cargs(
917
+ params: Dwi2responseConfigParameters,
918
+ execution: Execution,
919
+ ) -> list[str]:
920
+ """
921
+ Build command-line arguments from parameters.
922
+
923
+ Args:
924
+ params: The parameters.
925
+ execution: The execution object for resolving input paths.
926
+ Returns:
927
+ Command-line arguments.
928
+ """
929
+ cargs = []
930
+ cargs.append("-config")
931
+ cargs.append(params.get("key"))
932
+ cargs.append(params.get("value"))
933
+ return cargs
934
+
935
+
936
+ class Dwi2responseOutputs(typing.NamedTuple):
937
+ """
938
+ Output object returned when calling `dwi2response(...)`.
939
+ """
940
+ root: OutputPathType
941
+ """Output root folder. This is the root folder for all outputs."""
942
+ algorithm: typing.Union[Dwi2responseDhollanderOutputs, Dwi2responseFaOutputs, Dwi2responseManualOutputs, Dwi2responseMsmt5ttOutputs, Dwi2responseTaxOutputs, Dwi2responseTournierOutputs]
943
+ """Outputs from `Dwi2responseDhollanderParameters` or
944
+ `Dwi2responseFaParameters` or `Dwi2responseManualParameters` or
945
+ `Dwi2responseMsmt5ttParameters` or `Dwi2responseTaxParameters` or
946
+ `Dwi2responseTournierParameters`."""
947
+
948
+
949
+ def dwi2response_params(
950
+ algorithm: typing.Union[Dwi2responseDhollanderParameters, Dwi2responseFaParameters, Dwi2responseManualParameters, Dwi2responseMsmt5ttParameters, Dwi2responseTaxParameters, Dwi2responseTournierParameters],
951
+ grad: InputPathType | None = None,
952
+ fslgrad: Dwi2responseFslgradParameters | None = None,
953
+ mask: InputPathType | None = None,
954
+ voxels: str | None = None,
955
+ shells: list[int] | None = None,
956
+ lmax: list[int] | None = None,
957
+ nocleanup: bool = False,
958
+ scratch: str | None = None,
959
+ continue_: str | None = None,
960
+ info: bool = False,
961
+ quiet: bool = False,
962
+ debug: bool = False,
963
+ force: bool = False,
964
+ nthreads: int | None = None,
965
+ config: list[Dwi2responseConfigParameters] | None = None,
966
+ help_: bool = False,
967
+ version: bool = False,
968
+ ) -> Dwi2responseParameters:
969
+ """
970
+ Build parameters.
971
+
972
+ Args:
973
+ algorithm: Select the algorithm to be used to complete the script\
974
+ operation; additional details and options become available once an\
975
+ algorithm is nominated. Options are: dhollander, fa, manual, msmt_5tt,\
976
+ tax, tournier.
977
+ grad: Provide the diffusion gradient table in MRtrix format.
978
+ fslgrad: Provide the diffusion gradient table in FSL bvecs/bvals format.
979
+ mask: Only process voxels within the specified binary brain mask image.
980
+ voxels: Output an image showing the final voxel selection(s).
981
+ shells: b-value(s) to use in response function estimation\
982
+ (comma-separated list in case of multiple b-values, b=0 must be\
983
+ included explicitly).
984
+ lmax: maximum harmonic degree(s) for response function estimation\
985
+ (comma-separated list in case of multiple b-values).
986
+ nocleanup: do not delete intermediate files during script execution,\
987
+ and do not delete scratch directory at script completion.
988
+ scratch: manually specify the path in which to generate the scratch\
989
+ directory.
990
+ continue_: continue the script from a previous execution; must provide\
991
+ the scratch directory path, and the name of the last\
992
+ successfully-generated file.
993
+ info: display information messages.
994
+ quiet: do not display information messages or progress status;\
995
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
996
+ environment variable to a non-empty string.
997
+ debug: display debugging messages.
998
+ force: force overwrite of output files (caution: using the same file as\
999
+ input and output might cause unexpected behaviour).
1000
+ nthreads: use this number of threads in multi-threaded applications\
1001
+ (set to 0 to disable multi-threading).
1002
+ config: temporarily set the value of an MRtrix config file entry.
1003
+ help_: display this information page and exit.
1004
+ version: display version information and exit.
1005
+ Returns:
1006
+ Parameter dictionary
1007
+ """
1008
+ params = {
1009
+ "__STYXTYPE__": "dwi2response",
1010
+ "algorithm": algorithm,
1011
+ "nocleanup": nocleanup,
1012
+ "info": info,
1013
+ "quiet": quiet,
1014
+ "debug": debug,
1015
+ "force": force,
1016
+ "help": help_,
1017
+ "version": version,
1018
+ }
1019
+ if grad is not None:
1020
+ params["grad"] = grad
1021
+ if fslgrad is not None:
1022
+ params["fslgrad"] = fslgrad
1023
+ if mask is not None:
1024
+ params["mask"] = mask
1025
+ if voxels is not None:
1026
+ params["voxels"] = voxels
1027
+ if shells is not None:
1028
+ params["shells"] = shells
1029
+ if lmax is not None:
1030
+ params["lmax"] = lmax
1031
+ if scratch is not None:
1032
+ params["scratch"] = scratch
1033
+ if continue_ is not None:
1034
+ params["continue"] = continue_
1035
+ if nthreads is not None:
1036
+ params["nthreads"] = nthreads
1037
+ if config is not None:
1038
+ params["config"] = config
1039
+ return params
1040
+
1041
+
1042
+ def dwi2response_cargs(
1043
+ params: Dwi2responseParameters,
1044
+ execution: Execution,
1045
+ ) -> list[str]:
1046
+ """
1047
+ Build command-line arguments from parameters.
1048
+
1049
+ Args:
1050
+ params: The parameters.
1051
+ execution: The execution object for resolving input paths.
1052
+ Returns:
1053
+ Command-line arguments.
1054
+ """
1055
+ cargs = []
1056
+ cargs.append("dwi2response")
1057
+ cargs.extend(dyn_cargs(params.get("algorithm")["__STYXTYPE__"])(params.get("algorithm"), execution))
1058
+ if params.get("grad") is not None:
1059
+ cargs.extend([
1060
+ "-grad",
1061
+ execution.input_file(params.get("grad"))
1062
+ ])
1063
+ if params.get("fslgrad") is not None:
1064
+ cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
1065
+ if params.get("mask") is not None:
1066
+ cargs.extend([
1067
+ "-mask",
1068
+ execution.input_file(params.get("mask"))
1069
+ ])
1070
+ if params.get("voxels") is not None:
1071
+ cargs.extend([
1072
+ "-voxels",
1073
+ params.get("voxels")
1074
+ ])
1075
+ if params.get("shells") is not None:
1076
+ cargs.extend([
1077
+ "-shells",
1078
+ ",".join(map(str, params.get("shells")))
1079
+ ])
1080
+ if params.get("lmax") is not None:
1081
+ cargs.extend([
1082
+ "-lmax",
1083
+ ",".join(map(str, params.get("lmax")))
1084
+ ])
1085
+ if params.get("nocleanup"):
1086
+ cargs.append("-nocleanup")
1087
+ if params.get("scratch") is not None:
1088
+ cargs.extend([
1089
+ "-scratch",
1090
+ params.get("scratch")
1091
+ ])
1092
+ if params.get("continue") is not None:
1093
+ cargs.extend([
1094
+ "-continue",
1095
+ params.get("continue")
1096
+ ])
1097
+ if params.get("info"):
1098
+ cargs.append("-info")
1099
+ if params.get("quiet"):
1100
+ cargs.append("-quiet")
1101
+ if params.get("debug"):
1102
+ cargs.append("-debug")
1103
+ if params.get("force"):
1104
+ cargs.append("-force")
1105
+ if params.get("nthreads") is not None:
1106
+ cargs.extend([
1107
+ "-nthreads",
1108
+ str(params.get("nthreads"))
1109
+ ])
1110
+ if params.get("config") is not None:
1111
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
1112
+ if params.get("help"):
1113
+ cargs.append("-help")
1114
+ if params.get("version"):
1115
+ cargs.append("-version")
1116
+ return cargs
1117
+
1118
+
1119
+ def dwi2response_outputs(
1120
+ params: Dwi2responseParameters,
1121
+ execution: Execution,
1122
+ ) -> Dwi2responseOutputs:
1123
+ """
1124
+ Build outputs object containing output file paths and possibly stdout/stderr.
1125
+
1126
+ Args:
1127
+ params: The parameters.
1128
+ execution: The execution object for resolving input paths.
1129
+ Returns:
1130
+ Outputs object.
1131
+ """
1132
+ ret = Dwi2responseOutputs(
1133
+ root=execution.output_file("."),
1134
+ algorithm=dyn_outputs(params.get("algorithm")["__STYXTYPE__"])(params.get("algorithm"), execution),
1135
+ )
1136
+ return ret
1137
+
1138
+
1139
+ def dwi2response_execute(
1140
+ params: Dwi2responseParameters,
1141
+ execution: Execution,
1142
+ ) -> Dwi2responseOutputs:
1143
+ """
1144
+ Estimate response function(s) for spherical deconvolution.
1145
+ dwi2response offers different algorithms for performing various types of
1146
+ response function estimation. The name of the algorithm must appear as the
1147
+ first argument on the command-line after ‘dwi2response’. The subsequent
1148
+ arguments and options depend on the particular algorithm being invoked.
1149
+ Each algorithm available has its own help page, including necessary
1150
+ references; e.g. to see the help page of the 'fa' algorithm, type
1151
+ 'dwi2response fa'.
1152
+
1153
+ Author: MRTrix3 Developers
1154
+
1155
+ URL: https://www.mrtrix.org/
1156
+
1157
+ Args:
1158
+ params: The parameters.
1159
+ execution: The execution object.
1160
+ Returns:
1161
+ NamedTuple of outputs (described in `Dwi2responseOutputs`).
1162
+ """
1163
+ params = execution.params(params)
1164
+ cargs = dwi2response_cargs(params, execution)
1165
+ ret = dwi2response_outputs(params, execution)
1166
+ execution.run(cargs)
1167
+ return ret
1168
+
1169
+
1170
+ def dwi2response(
1171
+ algorithm: typing.Union[Dwi2responseDhollanderParameters, Dwi2responseFaParameters, Dwi2responseManualParameters, Dwi2responseMsmt5ttParameters, Dwi2responseTaxParameters, Dwi2responseTournierParameters],
1172
+ grad: InputPathType | None = None,
1173
+ fslgrad: Dwi2responseFslgradParameters | None = None,
1174
+ mask: InputPathType | None = None,
1175
+ voxels: str | None = None,
1176
+ shells: list[int] | None = None,
1177
+ lmax: list[int] | None = None,
1178
+ nocleanup: bool = False,
1179
+ scratch: str | None = None,
1180
+ continue_: str | None = None,
1181
+ info: bool = False,
1182
+ quiet: bool = False,
1183
+ debug: bool = False,
1184
+ force: bool = False,
1185
+ nthreads: int | None = None,
1186
+ config: list[Dwi2responseConfigParameters] | None = None,
1187
+ help_: bool = False,
1188
+ version: bool = False,
1189
+ runner: Runner | None = None,
1190
+ ) -> Dwi2responseOutputs:
1191
+ """
1192
+ Estimate response function(s) for spherical deconvolution.
1193
+ dwi2response offers different algorithms for performing various types of
1194
+ response function estimation. The name of the algorithm must appear as the
1195
+ first argument on the command-line after ‘dwi2response’. The subsequent
1196
+ arguments and options depend on the particular algorithm being invoked.
1197
+ Each algorithm available has its own help page, including necessary
1198
+ references; e.g. to see the help page of the 'fa' algorithm, type
1199
+ 'dwi2response fa'.
1200
+
1201
+ Author: MRTrix3 Developers
1202
+
1203
+ URL: https://www.mrtrix.org/
1204
+
1205
+ Args:
1206
+ algorithm: Select the algorithm to be used to complete the script\
1207
+ operation; additional details and options become available once an\
1208
+ algorithm is nominated. Options are: dhollander, fa, manual, msmt_5tt,\
1209
+ tax, tournier.
1210
+ grad: Provide the diffusion gradient table in MRtrix format.
1211
+ fslgrad: Provide the diffusion gradient table in FSL bvecs/bvals format.
1212
+ mask: Only process voxels within the specified binary brain mask image.
1213
+ voxels: Output an image showing the final voxel selection(s).
1214
+ shells: b-value(s) to use in response function estimation\
1215
+ (comma-separated list in case of multiple b-values, b=0 must be\
1216
+ included explicitly).
1217
+ lmax: maximum harmonic degree(s) for response function estimation\
1218
+ (comma-separated list in case of multiple b-values).
1219
+ nocleanup: do not delete intermediate files during script execution,\
1220
+ and do not delete scratch directory at script completion.
1221
+ scratch: manually specify the path in which to generate the scratch\
1222
+ directory.
1223
+ continue_: continue the script from a previous execution; must provide\
1224
+ the scratch directory path, and the name of the last\
1225
+ successfully-generated file.
1226
+ info: display information messages.
1227
+ quiet: do not display information messages or progress status;\
1228
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
1229
+ environment variable to a non-empty string.
1230
+ debug: display debugging messages.
1231
+ force: force overwrite of output files (caution: using the same file as\
1232
+ input and output might cause unexpected behaviour).
1233
+ nthreads: use this number of threads in multi-threaded applications\
1234
+ (set to 0 to disable multi-threading).
1235
+ config: temporarily set the value of an MRtrix config file entry.
1236
+ help_: display this information page and exit.
1237
+ version: display version information and exit.
1238
+ runner: Command runner.
1239
+ Returns:
1240
+ NamedTuple of outputs (described in `Dwi2responseOutputs`).
1241
+ """
1242
+ runner = runner or get_global_runner()
1243
+ execution = runner.start_execution(DWI2RESPONSE_METADATA)
1244
+ params = dwi2response_params(
1245
+ algorithm=algorithm,
1246
+ grad=grad,
1247
+ fslgrad=fslgrad,
1248
+ mask=mask,
1249
+ voxels=voxels,
1250
+ shells=shells,
1251
+ lmax=lmax,
1252
+ nocleanup=nocleanup,
1253
+ scratch=scratch,
1254
+ continue_=continue_,
1255
+ info=info,
1256
+ quiet=quiet,
1257
+ debug=debug,
1258
+ force=force,
1259
+ nthreads=nthreads,
1260
+ config=config,
1261
+ help_=help_,
1262
+ version=version,
1263
+ )
1264
+ return dwi2response_execute(params, execution)
1265
+
1266
+
1267
+ __all__ = [
1268
+ "DWI2RESPONSE_METADATA",
1269
+ "Dwi2responseConfigParameters",
1270
+ "Dwi2responseDhollanderOutputs",
1271
+ "Dwi2responseDhollanderParameters",
1272
+ "Dwi2responseFaOutputs",
1273
+ "Dwi2responseFaParameters",
1274
+ "Dwi2responseFslgradParameters",
1275
+ "Dwi2responseManualOutputs",
1276
+ "Dwi2responseManualParameters",
1277
+ "Dwi2responseMsmt5ttOutputs",
1278
+ "Dwi2responseMsmt5ttParameters",
1279
+ "Dwi2responseOutputs",
1280
+ "Dwi2responseParameters",
1281
+ "Dwi2responseTaxOutputs",
1282
+ "Dwi2responseTaxParameters",
1283
+ "Dwi2responseTournierOutputs",
1284
+ "Dwi2responseTournierParameters",
1285
+ "dwi2response",
1286
+ "dwi2response_config_params",
1287
+ "dwi2response_dhollander_params",
1288
+ "dwi2response_fa_params",
1289
+ "dwi2response_fslgrad_params",
1290
+ "dwi2response_manual_params",
1291
+ "dwi2response_msmt_5tt_params",
1292
+ "dwi2response_params",
1293
+ "dwi2response_tax_params",
1294
+ "dwi2response_tournier_params",
1295
+ ]