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,879 @@
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
+ DWI2FOD_METADATA = Metadata(
9
+ id="9a7e655a0db0138d987e71f2ed64a274b8c286e0.boutiques",
10
+ name="dwi2fod",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ Dwi2fodFslgradParameters = typing.TypedDict('Dwi2fodFslgradParameters', {
17
+ "__STYX_TYPE__": typing.Literal["fslgrad"],
18
+ "bvecs": InputPathType,
19
+ "bvals": InputPathType,
20
+ })
21
+
22
+
23
+ Dwi2fodVariousStringParameters = typing.TypedDict('Dwi2fodVariousStringParameters', {
24
+ "__STYX_TYPE__": typing.Literal["VariousString"],
25
+ "obj": str,
26
+ })
27
+
28
+
29
+ Dwi2fodVariousFileParameters = typing.TypedDict('Dwi2fodVariousFileParameters', {
30
+ "__STYX_TYPE__": typing.Literal["VariousFile"],
31
+ "obj": InputPathType,
32
+ })
33
+
34
+
35
+ Dwi2fodConfigParameters = typing.TypedDict('Dwi2fodConfigParameters', {
36
+ "__STYX_TYPE__": typing.Literal["config"],
37
+ "key": str,
38
+ "value": str,
39
+ })
40
+
41
+
42
+ Dwi2fodResponseOdfParameters = typing.TypedDict('Dwi2fodResponseOdfParameters', {
43
+ "__STYX_TYPE__": typing.Literal["response_odf"],
44
+ "response": InputPathType,
45
+ "odf": str,
46
+ })
47
+
48
+
49
+ Dwi2fodParameters = typing.TypedDict('Dwi2fodParameters', {
50
+ "__STYX_TYPE__": typing.Literal["dwi2fod"],
51
+ "grad": typing.NotRequired[InputPathType | None],
52
+ "fslgrad": typing.NotRequired[Dwi2fodFslgradParameters | None],
53
+ "shells": typing.NotRequired[list[float] | None],
54
+ "directions": typing.NotRequired[InputPathType | None],
55
+ "lmax": typing.NotRequired[list[int] | None],
56
+ "mask": typing.NotRequired[InputPathType | None],
57
+ "filter": typing.NotRequired[InputPathType | None],
58
+ "neg_lambda": typing.NotRequired[float | None],
59
+ "norm_lambda": typing.NotRequired[float | None],
60
+ "threshold": typing.NotRequired[float | None],
61
+ "niter": typing.NotRequired[int | None],
62
+ "norm_lambda_1": typing.NotRequired[float | None],
63
+ "neg_lambda_1": typing.NotRequired[float | None],
64
+ "predicted_signal": typing.NotRequired[str | None],
65
+ "strides": typing.NotRequired[typing.Union[Dwi2fodVariousStringParameters, Dwi2fodVariousFileParameters] | None],
66
+ "info": bool,
67
+ "quiet": bool,
68
+ "debug": bool,
69
+ "force": bool,
70
+ "nthreads": typing.NotRequired[int | None],
71
+ "config": typing.NotRequired[list[Dwi2fodConfigParameters] | None],
72
+ "help": bool,
73
+ "version": bool,
74
+ "algorithm": str,
75
+ "dwi": InputPathType,
76
+ "response_odf": list[Dwi2fodResponseOdfParameters],
77
+ })
78
+
79
+
80
+ def dyn_cargs(
81
+ t: str,
82
+ ) -> typing.Any:
83
+ """
84
+ Get build cargs function by command type.
85
+
86
+ Args:
87
+ t: Command type.
88
+ Returns:
89
+ Build cargs function.
90
+ """
91
+ return {
92
+ "dwi2fod": dwi2fod_cargs,
93
+ "fslgrad": dwi2fod_fslgrad_cargs,
94
+ "VariousString": dwi2fod_various_string_cargs,
95
+ "VariousFile": dwi2fod_various_file_cargs,
96
+ "config": dwi2fod_config_cargs,
97
+ "response_odf": dwi2fod_response_odf_cargs,
98
+ }.get(t)
99
+
100
+
101
+ def dyn_outputs(
102
+ t: str,
103
+ ) -> typing.Any:
104
+ """
105
+ Get build outputs function by command type.
106
+
107
+ Args:
108
+ t: Command type.
109
+ Returns:
110
+ Build outputs function.
111
+ """
112
+ return {
113
+ "dwi2fod": dwi2fod_outputs,
114
+ "response_odf": dwi2fod_response_odf_outputs,
115
+ }.get(t)
116
+
117
+
118
+ def dwi2fod_fslgrad_params(
119
+ bvecs: InputPathType,
120
+ bvals: InputPathType,
121
+ ) -> Dwi2fodFslgradParameters:
122
+ """
123
+ Build parameters.
124
+
125
+ Args:
126
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
127
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
128
+ scheme is present in the input image header, the data provided with\
129
+ this option will be instead used.
130
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
131
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
132
+ scheme is present in the input image header, the data provided with\
133
+ this option will be instead used.
134
+ Returns:
135
+ Parameter dictionary
136
+ """
137
+ params = {
138
+ "__STYXTYPE__": "fslgrad",
139
+ "bvecs": bvecs,
140
+ "bvals": bvals,
141
+ }
142
+ return params
143
+
144
+
145
+ def dwi2fod_fslgrad_cargs(
146
+ params: Dwi2fodFslgradParameters,
147
+ execution: Execution,
148
+ ) -> list[str]:
149
+ """
150
+ Build command-line arguments from parameters.
151
+
152
+ Args:
153
+ params: The parameters.
154
+ execution: The execution object for resolving input paths.
155
+ Returns:
156
+ Command-line arguments.
157
+ """
158
+ cargs = []
159
+ cargs.append("-fslgrad")
160
+ cargs.append(execution.input_file(params.get("bvecs")))
161
+ cargs.append(execution.input_file(params.get("bvals")))
162
+ return cargs
163
+
164
+
165
+ def dwi2fod_various_string_params(
166
+ obj: str,
167
+ ) -> Dwi2fodVariousStringParameters:
168
+ """
169
+ Build parameters.
170
+
171
+ Args:
172
+ obj: String object.
173
+ Returns:
174
+ Parameter dictionary
175
+ """
176
+ params = {
177
+ "__STYXTYPE__": "VariousString",
178
+ "obj": obj,
179
+ }
180
+ return params
181
+
182
+
183
+ def dwi2fod_various_string_cargs(
184
+ params: Dwi2fodVariousStringParameters,
185
+ execution: Execution,
186
+ ) -> list[str]:
187
+ """
188
+ Build command-line arguments from parameters.
189
+
190
+ Args:
191
+ params: The parameters.
192
+ execution: The execution object for resolving input paths.
193
+ Returns:
194
+ Command-line arguments.
195
+ """
196
+ cargs = []
197
+ cargs.append(params.get("obj"))
198
+ return cargs
199
+
200
+
201
+ def dwi2fod_various_file_params(
202
+ obj: InputPathType,
203
+ ) -> Dwi2fodVariousFileParameters:
204
+ """
205
+ Build parameters.
206
+
207
+ Args:
208
+ obj: File object.
209
+ Returns:
210
+ Parameter dictionary
211
+ """
212
+ params = {
213
+ "__STYXTYPE__": "VariousFile",
214
+ "obj": obj,
215
+ }
216
+ return params
217
+
218
+
219
+ def dwi2fod_various_file_cargs(
220
+ params: Dwi2fodVariousFileParameters,
221
+ execution: Execution,
222
+ ) -> list[str]:
223
+ """
224
+ Build command-line arguments from parameters.
225
+
226
+ Args:
227
+ params: The parameters.
228
+ execution: The execution object for resolving input paths.
229
+ Returns:
230
+ Command-line arguments.
231
+ """
232
+ cargs = []
233
+ cargs.append(execution.input_file(params.get("obj")))
234
+ return cargs
235
+
236
+
237
+ def dwi2fod_config_params(
238
+ key: str,
239
+ value: str,
240
+ ) -> Dwi2fodConfigParameters:
241
+ """
242
+ Build parameters.
243
+
244
+ Args:
245
+ key: temporarily set the value of an MRtrix config file entry.
246
+ value: temporarily set the value of an MRtrix config file entry.
247
+ Returns:
248
+ Parameter dictionary
249
+ """
250
+ params = {
251
+ "__STYXTYPE__": "config",
252
+ "key": key,
253
+ "value": value,
254
+ }
255
+ return params
256
+
257
+
258
+ def dwi2fod_config_cargs(
259
+ params: Dwi2fodConfigParameters,
260
+ execution: Execution,
261
+ ) -> list[str]:
262
+ """
263
+ Build command-line arguments from parameters.
264
+
265
+ Args:
266
+ params: The parameters.
267
+ execution: The execution object for resolving input paths.
268
+ Returns:
269
+ Command-line arguments.
270
+ """
271
+ cargs = []
272
+ cargs.append("-config")
273
+ cargs.append(params.get("key"))
274
+ cargs.append(params.get("value"))
275
+ return cargs
276
+
277
+
278
+ class Dwi2fodResponseOdfOutputs(typing.NamedTuple):
279
+ """
280
+ Output object returned when calling `list[Dwi2fodResponseOdfParameters](...)`.
281
+ """
282
+ root: OutputPathType
283
+ """Output root folder. This is the root folder for all outputs."""
284
+ odf: OutputPathType
285
+ """output ODF image"""
286
+
287
+
288
+ def dwi2fod_response_odf_params(
289
+ response: InputPathType,
290
+ odf: str,
291
+ ) -> Dwi2fodResponseOdfParameters:
292
+ """
293
+ Build parameters.
294
+
295
+ Args:
296
+ response: input tissue response.
297
+ odf: output ODF image.
298
+ Returns:
299
+ Parameter dictionary
300
+ """
301
+ params = {
302
+ "__STYXTYPE__": "response_odf",
303
+ "response": response,
304
+ "odf": odf,
305
+ }
306
+ return params
307
+
308
+
309
+ def dwi2fod_response_odf_cargs(
310
+ params: Dwi2fodResponseOdfParameters,
311
+ execution: Execution,
312
+ ) -> list[str]:
313
+ """
314
+ Build command-line arguments from parameters.
315
+
316
+ Args:
317
+ params: The parameters.
318
+ execution: The execution object for resolving input paths.
319
+ Returns:
320
+ Command-line arguments.
321
+ """
322
+ cargs = []
323
+ cargs.append(execution.input_file(params.get("response")))
324
+ cargs.append(params.get("odf"))
325
+ return cargs
326
+
327
+
328
+ def dwi2fod_response_odf_outputs(
329
+ params: Dwi2fodResponseOdfParameters,
330
+ execution: Execution,
331
+ ) -> Dwi2fodResponseOdfOutputs:
332
+ """
333
+ Build outputs object containing output file paths and possibly stdout/stderr.
334
+
335
+ Args:
336
+ params: The parameters.
337
+ execution: The execution object for resolving input paths.
338
+ Returns:
339
+ Outputs object.
340
+ """
341
+ ret = Dwi2fodResponseOdfOutputs(
342
+ root=execution.output_file("."),
343
+ odf=execution.output_file(params.get("odf")),
344
+ )
345
+ return ret
346
+
347
+
348
+ class Dwi2fodOutputs(typing.NamedTuple):
349
+ """
350
+ Output object returned when calling `dwi2fod(...)`.
351
+ """
352
+ root: OutputPathType
353
+ """Output root folder. This is the root folder for all outputs."""
354
+ predicted_signal: OutputPathType | None
355
+ """output the predicted dwi image. """
356
+ response_odf: list[Dwi2fodResponseOdfOutputs]
357
+ """Outputs from `dwi2fod_response_odf_outputs`.This is a list of outputs
358
+ with the same length and order as the inputs."""
359
+
360
+
361
+ def dwi2fod_params(
362
+ algorithm: str,
363
+ dwi: InputPathType,
364
+ response_odf: list[Dwi2fodResponseOdfParameters],
365
+ grad: InputPathType | None = None,
366
+ fslgrad: Dwi2fodFslgradParameters | None = None,
367
+ shells: list[float] | None = None,
368
+ directions: InputPathType | None = None,
369
+ lmax: list[int] | None = None,
370
+ mask: InputPathType | None = None,
371
+ filter_: InputPathType | None = None,
372
+ neg_lambda: float | None = None,
373
+ norm_lambda: float | None = None,
374
+ threshold: float | None = None,
375
+ niter: int | None = None,
376
+ norm_lambda_1: float | None = None,
377
+ neg_lambda_1: float | None = None,
378
+ predicted_signal: str | None = None,
379
+ strides: typing.Union[Dwi2fodVariousStringParameters, Dwi2fodVariousFileParameters] | None = None,
380
+ info: bool = False,
381
+ quiet: bool = False,
382
+ debug: bool = False,
383
+ force: bool = False,
384
+ nthreads: int | None = None,
385
+ config: list[Dwi2fodConfigParameters] | None = None,
386
+ help_: bool = False,
387
+ version: bool = False,
388
+ ) -> Dwi2fodParameters:
389
+ """
390
+ Build parameters.
391
+
392
+ Args:
393
+ algorithm: the algorithm to use for FOD estimation. (options are:\
394
+ csd,msmt_csd).
395
+ dwi: the input diffusion-weighted image.
396
+ response_odf: pairs of input tissue response and output ODF images.
397
+ grad: Provide the diffusion-weighted gradient scheme used in the\
398
+ acquisition in a text file. This should be supplied as a 4xN text file\
399
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
400
+ the direction of the applied gradient, and b gives the b-value in units\
401
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
402
+ header, the data provided with this option will be instead used.
403
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
404
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
405
+ scheme is present in the input image header, the data provided with\
406
+ this option will be instead used.
407
+ shells: specify one or more b-values to use during processing, as a\
408
+ comma-separated list of the desired approximate b-values (b-values are\
409
+ clustered to allow for small deviations). Note that some commands are\
410
+ incompatible with multiple b-values, and will report an error if more\
411
+ than one b-value is provided.\
412
+ WARNING: note that, even though the b=0 volumes are never referred\
413
+ to as shells in the literature, they still have to be explicitly\
414
+ included in the list of b-values as provided to the -shell option!\
415
+ Several algorithms which include the b=0 volumes in their\
416
+ computations may otherwise return an undesired result.
417
+ directions: specify the directions over which to apply the\
418
+ non-negativity constraint (by default, the built-in 300 direction set\
419
+ is used). These should be supplied as a text file containing [ az el ]\
420
+ pairs for the directions.
421
+ lmax: the maximum spherical harmonic order for the output FOD(s).For\
422
+ algorithms with multiple outputs, this should be provided as a\
423
+ comma-separated list of integers, one for each output image; for\
424
+ single-output algorithms, only a single integer should be provided. If\
425
+ omitted, the command will use the lmax of the corresponding response\
426
+ function (i.e based on its number of coefficients), up to a maximum of\
427
+ 8.
428
+ mask: only perform computation within the specified binary brain mask\
429
+ image.
430
+ filter_: the linear frequency filtering parameters used for the initial\
431
+ linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). These\
432
+ should be supplied as a text file containing the filtering coefficients\
433
+ for each even harmonic order.
434
+ neg_lambda: the regularisation parameter lambda that controls the\
435
+ strength of the non-negativity constraint (default = 1).
436
+ norm_lambda: the regularisation parameter lambda that controls the\
437
+ strength of the constraint on the norm of the solution (default = 1).
438
+ threshold: the threshold below which the amplitude of the FOD is\
439
+ assumed to be zero, expressed as an absolute amplitude (default = 0).
440
+ niter: the maximum number of iterations to perform for each voxel\
441
+ (default = 50). Use '-niter 0' for a linear unconstrained spherical\
442
+ deconvolution.
443
+ norm_lambda_1: the regularisation parameter lambda that controls the\
444
+ strength of the constraint on the norm of the solution (default =\
445
+ 1e-10).
446
+ neg_lambda_1: the regularisation parameter lambda that controls the\
447
+ strength of the non-negativity constraint (default = 1e-10).
448
+ predicted_signal: output the predicted dwi image.
449
+ strides: specify the strides of the output data in memory; either as a\
450
+ comma-separated list of (signed) integers, or as a template image from\
451
+ which the strides shall be extracted and used. The actual strides\
452
+ produced will depend on whether the output image format can support it.
453
+ info: display information messages.
454
+ quiet: do not display information messages or progress status;\
455
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
456
+ environment variable to a non-empty string.
457
+ debug: display debugging messages.
458
+ force: force overwrite of output files (caution: using the same file as\
459
+ input and output might cause unexpected behaviour).
460
+ nthreads: use this number of threads in multi-threaded applications\
461
+ (set to 0 to disable multi-threading).
462
+ config: temporarily set the value of an MRtrix config file entry.
463
+ help_: display this information page and exit.
464
+ version: display version information and exit.
465
+ Returns:
466
+ Parameter dictionary
467
+ """
468
+ params = {
469
+ "__STYXTYPE__": "dwi2fod",
470
+ "info": info,
471
+ "quiet": quiet,
472
+ "debug": debug,
473
+ "force": force,
474
+ "help": help_,
475
+ "version": version,
476
+ "algorithm": algorithm,
477
+ "dwi": dwi,
478
+ "response_odf": response_odf,
479
+ }
480
+ if grad is not None:
481
+ params["grad"] = grad
482
+ if fslgrad is not None:
483
+ params["fslgrad"] = fslgrad
484
+ if shells is not None:
485
+ params["shells"] = shells
486
+ if directions is not None:
487
+ params["directions"] = directions
488
+ if lmax is not None:
489
+ params["lmax"] = lmax
490
+ if mask is not None:
491
+ params["mask"] = mask
492
+ if filter_ is not None:
493
+ params["filter"] = filter_
494
+ if neg_lambda is not None:
495
+ params["neg_lambda"] = neg_lambda
496
+ if norm_lambda is not None:
497
+ params["norm_lambda"] = norm_lambda
498
+ if threshold is not None:
499
+ params["threshold"] = threshold
500
+ if niter is not None:
501
+ params["niter"] = niter
502
+ if norm_lambda_1 is not None:
503
+ params["norm_lambda_1"] = norm_lambda_1
504
+ if neg_lambda_1 is not None:
505
+ params["neg_lambda_1"] = neg_lambda_1
506
+ if predicted_signal is not None:
507
+ params["predicted_signal"] = predicted_signal
508
+ if strides is not None:
509
+ params["strides"] = strides
510
+ if nthreads is not None:
511
+ params["nthreads"] = nthreads
512
+ if config is not None:
513
+ params["config"] = config
514
+ return params
515
+
516
+
517
+ def dwi2fod_cargs(
518
+ params: Dwi2fodParameters,
519
+ execution: Execution,
520
+ ) -> list[str]:
521
+ """
522
+ Build command-line arguments from parameters.
523
+
524
+ Args:
525
+ params: The parameters.
526
+ execution: The execution object for resolving input paths.
527
+ Returns:
528
+ Command-line arguments.
529
+ """
530
+ cargs = []
531
+ cargs.append("dwi2fod")
532
+ if params.get("grad") is not None:
533
+ cargs.extend([
534
+ "-grad",
535
+ execution.input_file(params.get("grad"))
536
+ ])
537
+ if params.get("fslgrad") is not None:
538
+ cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
539
+ if params.get("shells") is not None:
540
+ cargs.extend([
541
+ "-shells",
542
+ ",".join(map(str, params.get("shells")))
543
+ ])
544
+ if params.get("directions") is not None:
545
+ cargs.extend([
546
+ "-directions",
547
+ execution.input_file(params.get("directions"))
548
+ ])
549
+ if params.get("lmax") is not None:
550
+ cargs.extend([
551
+ "-lmax",
552
+ ",".join(map(str, params.get("lmax")))
553
+ ])
554
+ if params.get("mask") is not None:
555
+ cargs.extend([
556
+ "-mask",
557
+ execution.input_file(params.get("mask"))
558
+ ])
559
+ if params.get("filter") is not None:
560
+ cargs.extend([
561
+ "-filter",
562
+ execution.input_file(params.get("filter"))
563
+ ])
564
+ if params.get("neg_lambda") is not None:
565
+ cargs.extend([
566
+ "-neg_lambda",
567
+ str(params.get("neg_lambda"))
568
+ ])
569
+ if params.get("norm_lambda") is not None:
570
+ cargs.extend([
571
+ "-norm_lambda",
572
+ str(params.get("norm_lambda"))
573
+ ])
574
+ if params.get("threshold") is not None:
575
+ cargs.extend([
576
+ "-threshold",
577
+ str(params.get("threshold"))
578
+ ])
579
+ if params.get("niter") is not None:
580
+ cargs.extend([
581
+ "-niter",
582
+ str(params.get("niter"))
583
+ ])
584
+ if params.get("norm_lambda_1") is not None:
585
+ cargs.extend([
586
+ "-norm_lambda",
587
+ str(params.get("norm_lambda_1"))
588
+ ])
589
+ if params.get("neg_lambda_1") is not None:
590
+ cargs.extend([
591
+ "-neg_lambda",
592
+ str(params.get("neg_lambda_1"))
593
+ ])
594
+ if params.get("predicted_signal") is not None:
595
+ cargs.extend([
596
+ "-predicted_signal",
597
+ params.get("predicted_signal")
598
+ ])
599
+ if params.get("strides") is not None:
600
+ cargs.extend([
601
+ "-strides",
602
+ *dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
603
+ ])
604
+ if params.get("info"):
605
+ cargs.append("-info")
606
+ if params.get("quiet"):
607
+ cargs.append("-quiet")
608
+ if params.get("debug"):
609
+ cargs.append("-debug")
610
+ if params.get("force"):
611
+ cargs.append("-force")
612
+ if params.get("nthreads") is not None:
613
+ cargs.extend([
614
+ "-nthreads",
615
+ str(params.get("nthreads"))
616
+ ])
617
+ if params.get("config") is not None:
618
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
619
+ if params.get("help"):
620
+ cargs.append("-help")
621
+ if params.get("version"):
622
+ cargs.append("-version")
623
+ cargs.append(params.get("algorithm"))
624
+ cargs.append(execution.input_file(params.get("dwi")))
625
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("response_odf")] for a in c])
626
+ return cargs
627
+
628
+
629
+ def dwi2fod_outputs(
630
+ params: Dwi2fodParameters,
631
+ execution: Execution,
632
+ ) -> Dwi2fodOutputs:
633
+ """
634
+ Build outputs object containing output file paths and possibly stdout/stderr.
635
+
636
+ Args:
637
+ params: The parameters.
638
+ execution: The execution object for resolving input paths.
639
+ Returns:
640
+ Outputs object.
641
+ """
642
+ ret = Dwi2fodOutputs(
643
+ root=execution.output_file("."),
644
+ predicted_signal=execution.output_file(params.get("predicted_signal")) if (params.get("predicted_signal") is not None) else None,
645
+ response_odf=[dyn_outputs(i["__STYXTYPE__"])(i, execution) if dyn_outputs(i["__STYXTYPE__"]) else None for i in params.get("response_odf")],
646
+ )
647
+ return ret
648
+
649
+
650
+ def dwi2fod_execute(
651
+ params: Dwi2fodParameters,
652
+ execution: Execution,
653
+ ) -> Dwi2fodOutputs:
654
+ """
655
+ Estimate fibre orientation distributions from diffusion data using spherical
656
+ deconvolution.
657
+
658
+ The spherical harmonic coefficients are stored according the conventions
659
+ described the main documentation, which can be found at the following link:
660
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
661
+
662
+ References:
663
+
664
+ * If using csd algorithm:
665
+ Tournier, J.-D.; Calamante, F. & Connelly, A. Robust determination of the
666
+ fibre orientation distribution in diffusion MRI: Non-negativity constrained
667
+ super-resolved spherical deconvolution. NeuroImage, 2007, 35, 1459-1472
668
+
669
+ * If using msmt_csd algorithm:
670
+ Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J.
671
+ Multi-tissue constrained spherical deconvolution for improved analysis of
672
+ multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426
673
+
674
+ Tournier, J.-D.; Calamante, F., Gadian, D.G. & Connelly, A. Direct
675
+ estimation of the fiber orientation density function from diffusion-weighted
676
+ MRI data using spherical deconvolution. NeuroImage, 2004, 23, 1176-1185.
677
+
678
+ Author: MRTrix3 Developers
679
+
680
+ URL: https://www.mrtrix.org/
681
+
682
+ Args:
683
+ params: The parameters.
684
+ execution: The execution object.
685
+ Returns:
686
+ NamedTuple of outputs (described in `Dwi2fodOutputs`).
687
+ """
688
+ params = execution.params(params)
689
+ cargs = dwi2fod_cargs(params, execution)
690
+ ret = dwi2fod_outputs(params, execution)
691
+ execution.run(cargs)
692
+ return ret
693
+
694
+
695
+ def dwi2fod(
696
+ algorithm: str,
697
+ dwi: InputPathType,
698
+ response_odf: list[Dwi2fodResponseOdfParameters],
699
+ grad: InputPathType | None = None,
700
+ fslgrad: Dwi2fodFslgradParameters | None = None,
701
+ shells: list[float] | None = None,
702
+ directions: InputPathType | None = None,
703
+ lmax: list[int] | None = None,
704
+ mask: InputPathType | None = None,
705
+ filter_: InputPathType | None = None,
706
+ neg_lambda: float | None = None,
707
+ norm_lambda: float | None = None,
708
+ threshold: float | None = None,
709
+ niter: int | None = None,
710
+ norm_lambda_1: float | None = None,
711
+ neg_lambda_1: float | None = None,
712
+ predicted_signal: str | None = None,
713
+ strides: typing.Union[Dwi2fodVariousStringParameters, Dwi2fodVariousFileParameters] | None = None,
714
+ info: bool = False,
715
+ quiet: bool = False,
716
+ debug: bool = False,
717
+ force: bool = False,
718
+ nthreads: int | None = None,
719
+ config: list[Dwi2fodConfigParameters] | None = None,
720
+ help_: bool = False,
721
+ version: bool = False,
722
+ runner: Runner | None = None,
723
+ ) -> Dwi2fodOutputs:
724
+ """
725
+ Estimate fibre orientation distributions from diffusion data using spherical
726
+ deconvolution.
727
+
728
+ The spherical harmonic coefficients are stored according the conventions
729
+ described the main documentation, which can be found at the following link:
730
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
731
+
732
+ References:
733
+
734
+ * If using csd algorithm:
735
+ Tournier, J.-D.; Calamante, F. & Connelly, A. Robust determination of the
736
+ fibre orientation distribution in diffusion MRI: Non-negativity constrained
737
+ super-resolved spherical deconvolution. NeuroImage, 2007, 35, 1459-1472
738
+
739
+ * If using msmt_csd algorithm:
740
+ Jeurissen, B; Tournier, J-D; Dhollander, T; Connelly, A & Sijbers, J.
741
+ Multi-tissue constrained spherical deconvolution for improved analysis of
742
+ multi-shell diffusion MRI data. NeuroImage, 2014, 103, 411-426
743
+
744
+ Tournier, J.-D.; Calamante, F., Gadian, D.G. & Connelly, A. Direct
745
+ estimation of the fiber orientation density function from diffusion-weighted
746
+ MRI data using spherical deconvolution. NeuroImage, 2004, 23, 1176-1185.
747
+
748
+ Author: MRTrix3 Developers
749
+
750
+ URL: https://www.mrtrix.org/
751
+
752
+ Args:
753
+ algorithm: the algorithm to use for FOD estimation. (options are:\
754
+ csd,msmt_csd).
755
+ dwi: the input diffusion-weighted image.
756
+ response_odf: pairs of input tissue response and output ODF images.
757
+ grad: Provide the diffusion-weighted gradient scheme used in the\
758
+ acquisition in a text file. This should be supplied as a 4xN text file\
759
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
760
+ the direction of the applied gradient, and b gives the b-value in units\
761
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
762
+ header, the data provided with this option will be instead used.
763
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
764
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
765
+ scheme is present in the input image header, the data provided with\
766
+ this option will be instead used.
767
+ shells: specify one or more b-values to use during processing, as a\
768
+ comma-separated list of the desired approximate b-values (b-values are\
769
+ clustered to allow for small deviations). Note that some commands are\
770
+ incompatible with multiple b-values, and will report an error if more\
771
+ than one b-value is provided.\
772
+ WARNING: note that, even though the b=0 volumes are never referred\
773
+ to as shells in the literature, they still have to be explicitly\
774
+ included in the list of b-values as provided to the -shell option!\
775
+ Several algorithms which include the b=0 volumes in their\
776
+ computations may otherwise return an undesired result.
777
+ directions: specify the directions over which to apply the\
778
+ non-negativity constraint (by default, the built-in 300 direction set\
779
+ is used). These should be supplied as a text file containing [ az el ]\
780
+ pairs for the directions.
781
+ lmax: the maximum spherical harmonic order for the output FOD(s).For\
782
+ algorithms with multiple outputs, this should be provided as a\
783
+ comma-separated list of integers, one for each output image; for\
784
+ single-output algorithms, only a single integer should be provided. If\
785
+ omitted, the command will use the lmax of the corresponding response\
786
+ function (i.e based on its number of coefficients), up to a maximum of\
787
+ 8.
788
+ mask: only perform computation within the specified binary brain mask\
789
+ image.
790
+ filter_: the linear frequency filtering parameters used for the initial\
791
+ linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). These\
792
+ should be supplied as a text file containing the filtering coefficients\
793
+ for each even harmonic order.
794
+ neg_lambda: the regularisation parameter lambda that controls the\
795
+ strength of the non-negativity constraint (default = 1).
796
+ norm_lambda: the regularisation parameter lambda that controls the\
797
+ strength of the constraint on the norm of the solution (default = 1).
798
+ threshold: the threshold below which the amplitude of the FOD is\
799
+ assumed to be zero, expressed as an absolute amplitude (default = 0).
800
+ niter: the maximum number of iterations to perform for each voxel\
801
+ (default = 50). Use '-niter 0' for a linear unconstrained spherical\
802
+ deconvolution.
803
+ norm_lambda_1: the regularisation parameter lambda that controls the\
804
+ strength of the constraint on the norm of the solution (default =\
805
+ 1e-10).
806
+ neg_lambda_1: the regularisation parameter lambda that controls the\
807
+ strength of the non-negativity constraint (default = 1e-10).
808
+ predicted_signal: output the predicted dwi image.
809
+ strides: specify the strides of the output data in memory; either as a\
810
+ comma-separated list of (signed) integers, or as a template image from\
811
+ which the strides shall be extracted and used. The actual strides\
812
+ produced will depend on whether the output image format can support it.
813
+ info: display information messages.
814
+ quiet: do not display information messages or progress status;\
815
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
816
+ environment variable to a non-empty string.
817
+ debug: display debugging messages.
818
+ force: force overwrite of output files (caution: using the same file as\
819
+ input and output might cause unexpected behaviour).
820
+ nthreads: use this number of threads in multi-threaded applications\
821
+ (set to 0 to disable multi-threading).
822
+ config: temporarily set the value of an MRtrix config file entry.
823
+ help_: display this information page and exit.
824
+ version: display version information and exit.
825
+ runner: Command runner.
826
+ Returns:
827
+ NamedTuple of outputs (described in `Dwi2fodOutputs`).
828
+ """
829
+ runner = runner or get_global_runner()
830
+ execution = runner.start_execution(DWI2FOD_METADATA)
831
+ params = dwi2fod_params(
832
+ grad=grad,
833
+ fslgrad=fslgrad,
834
+ shells=shells,
835
+ directions=directions,
836
+ lmax=lmax,
837
+ mask=mask,
838
+ filter_=filter_,
839
+ neg_lambda=neg_lambda,
840
+ norm_lambda=norm_lambda,
841
+ threshold=threshold,
842
+ niter=niter,
843
+ norm_lambda_1=norm_lambda_1,
844
+ neg_lambda_1=neg_lambda_1,
845
+ predicted_signal=predicted_signal,
846
+ strides=strides,
847
+ info=info,
848
+ quiet=quiet,
849
+ debug=debug,
850
+ force=force,
851
+ nthreads=nthreads,
852
+ config=config,
853
+ help_=help_,
854
+ version=version,
855
+ algorithm=algorithm,
856
+ dwi=dwi,
857
+ response_odf=response_odf,
858
+ )
859
+ return dwi2fod_execute(params, execution)
860
+
861
+
862
+ __all__ = [
863
+ "DWI2FOD_METADATA",
864
+ "Dwi2fodConfigParameters",
865
+ "Dwi2fodFslgradParameters",
866
+ "Dwi2fodOutputs",
867
+ "Dwi2fodParameters",
868
+ "Dwi2fodResponseOdfOutputs",
869
+ "Dwi2fodResponseOdfParameters",
870
+ "Dwi2fodVariousFileParameters",
871
+ "Dwi2fodVariousStringParameters",
872
+ "dwi2fod",
873
+ "dwi2fod_config_params",
874
+ "dwi2fod_fslgrad_params",
875
+ "dwi2fod_params",
876
+ "dwi2fod_response_odf_params",
877
+ "dwi2fod_various_file_params",
878
+ "dwi2fod_various_string_params",
879
+ ]