niwrap-mrtrix 0.8.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.
Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +263 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +527 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +560 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +870 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +583 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +413 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +956 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +552 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +529 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +440 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +514 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +446 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +421 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +436 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +640 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +531 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +1156 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +570 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1774 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +715 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +673 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +570 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +1111 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +665 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +613 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +430 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +435 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +523 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +1179 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +477 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +850 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +455 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +422 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +882 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +435 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +571 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +646 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +426 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +417 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +460 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +418 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +404 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +730 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +422 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +514 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +452 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +485 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +4302 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +467 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +418 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +446 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +930 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +490 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1967 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +535 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +423 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +737 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +971 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +1079 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +494 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +484 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +1282 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +503 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +525 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +2098 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +534 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +666 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1372 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +725 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +403 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +422 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +385 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +844 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +632 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +427 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +481 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +445 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +661 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +727 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +447 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +775 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +684 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1478 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +2733 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +944 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +402 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +1004 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +760 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +497 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +739 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +902 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +550 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +414 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +659 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +421 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +625 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +423 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +414 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +421 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +401 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +420 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +428 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +398 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +432 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +505 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +409 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +513 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +1107 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +736 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +430 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +454 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +556 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +498 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +448 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +425 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +448 -0
  117. niwrap_mrtrix-0.8.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.8.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.8.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,665 @@
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
+ DWIGRADCHECK_METADATA = Metadata(
9
+ id="da91c0d77a46dd23fc98bad56497487a81e19371.boutiques",
10
+ name="dwigradcheck",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _DwigradcheckFslgradParamsDictNoTag = typing.TypedDict('_DwigradcheckFslgradParamsDictNoTag', {
17
+ "bvecs": InputPathType,
18
+ "bvals": InputPathType,
19
+ })
20
+ DwigradcheckFslgradParamsDictTagged = typing.TypedDict('DwigradcheckFslgradParamsDictTagged', {
21
+ "@type": typing.Literal["fslgrad"],
22
+ "bvecs": InputPathType,
23
+ "bvals": InputPathType,
24
+ })
25
+ DwigradcheckFslgradParamsDict = _DwigradcheckFslgradParamsDictNoTag | DwigradcheckFslgradParamsDictTagged
26
+
27
+
28
+ _DwigradcheckExportGradFslParamsDictNoTag = typing.TypedDict('_DwigradcheckExportGradFslParamsDictNoTag', {
29
+ "bvecs_path": str,
30
+ "bvals_path": str,
31
+ })
32
+ DwigradcheckExportGradFslParamsDictTagged = typing.TypedDict('DwigradcheckExportGradFslParamsDictTagged', {
33
+ "@type": typing.Literal["export_grad_fsl"],
34
+ "bvecs_path": str,
35
+ "bvals_path": str,
36
+ })
37
+ DwigradcheckExportGradFslParamsDict = _DwigradcheckExportGradFslParamsDictNoTag | DwigradcheckExportGradFslParamsDictTagged
38
+
39
+
40
+ _DwigradcheckParamsDictNoTag = typing.TypedDict('_DwigradcheckParamsDictNoTag', {
41
+ "input_image": InputPathType,
42
+ "grad": typing.NotRequired[InputPathType | None],
43
+ "fslgrad": typing.NotRequired[DwigradcheckFslgradParamsDict | None],
44
+ "mask_image": typing.NotRequired[InputPathType | None],
45
+ "number": typing.NotRequired[int | None],
46
+ "export_grad_mrtrix": typing.NotRequired[str | None],
47
+ "export_grad_fsl": typing.NotRequired[DwigradcheckExportGradFslParamsDict | None],
48
+ "nocleanup": bool,
49
+ "scratch_dir": typing.NotRequired[InputPathType | None],
50
+ "continue_scratch_dir": typing.NotRequired[list[InputPathType] | None],
51
+ "info": bool,
52
+ "quiet": bool,
53
+ "debug": bool,
54
+ "force": bool,
55
+ "nthreads": typing.NotRequired[float | None],
56
+ "config": typing.NotRequired[list[str] | None],
57
+ "help": bool,
58
+ "version": bool,
59
+ })
60
+ DwigradcheckParamsDictTagged = typing.TypedDict('DwigradcheckParamsDictTagged', {
61
+ "@type": typing.Literal["mrtrix/dwigradcheck"],
62
+ "input_image": InputPathType,
63
+ "grad": typing.NotRequired[InputPathType | None],
64
+ "fslgrad": typing.NotRequired[DwigradcheckFslgradParamsDict | None],
65
+ "mask_image": typing.NotRequired[InputPathType | None],
66
+ "number": typing.NotRequired[int | None],
67
+ "export_grad_mrtrix": typing.NotRequired[str | None],
68
+ "export_grad_fsl": typing.NotRequired[DwigradcheckExportGradFslParamsDict | None],
69
+ "nocleanup": bool,
70
+ "scratch_dir": typing.NotRequired[InputPathType | None],
71
+ "continue_scratch_dir": typing.NotRequired[list[InputPathType] | None],
72
+ "info": bool,
73
+ "quiet": bool,
74
+ "debug": bool,
75
+ "force": bool,
76
+ "nthreads": typing.NotRequired[float | None],
77
+ "config": typing.NotRequired[list[str] | None],
78
+ "help": bool,
79
+ "version": bool,
80
+ })
81
+ DwigradcheckParamsDict = _DwigradcheckParamsDictNoTag | DwigradcheckParamsDictTagged
82
+
83
+
84
+ def dwigradcheck_fslgrad(
85
+ bvecs: InputPathType,
86
+ bvals: InputPathType,
87
+ ) -> DwigradcheckFslgradParamsDictTagged:
88
+ """
89
+ Build parameters.
90
+
91
+ Args:
92
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
93
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
94
+ scheme is present in the input image header, the data provided with\
95
+ this option will be instead used.
96
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
97
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
98
+ scheme is present in the input image header, the data provided with\
99
+ this option will be instead used.
100
+ Returns:
101
+ Parameter dictionary
102
+ """
103
+ params = {
104
+ "@type": "fslgrad",
105
+ "bvecs": bvecs,
106
+ "bvals": bvals,
107
+ }
108
+ return params
109
+
110
+
111
+ def dwigradcheck_fslgrad_validate(
112
+ params: typing.Any,
113
+ ) -> None:
114
+ """
115
+ Validate parameters. Throws an error if `params` is not a valid
116
+ `DwigradcheckFslgradParamsDict` object.
117
+
118
+ Args:
119
+ params: The parameters object to validate.
120
+ """
121
+ if params is None or not isinstance(params, dict):
122
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
123
+ if params.get("bvecs", None) is None:
124
+ raise StyxValidationError("`bvecs` must not be None")
125
+ if not isinstance(params["bvecs"], (pathlib.Path, str)):
126
+ raise StyxValidationError(f'`bvecs` has the wrong type: Received `{type(params.get("bvecs", None))}` expected `InputPathType`')
127
+ if params.get("bvals", None) is None:
128
+ raise StyxValidationError("`bvals` must not be None")
129
+ if not isinstance(params["bvals"], (pathlib.Path, str)):
130
+ raise StyxValidationError(f'`bvals` has the wrong type: Received `{type(params.get("bvals", None))}` expected `InputPathType`')
131
+
132
+
133
+ def dwigradcheck_fslgrad_cargs(
134
+ params: DwigradcheckFslgradParamsDict,
135
+ execution: Execution,
136
+ ) -> list[str]:
137
+ """
138
+ Build command-line arguments from parameters.
139
+
140
+ Args:
141
+ params: The parameters.
142
+ execution: The execution object for resolving input paths.
143
+ Returns:
144
+ Command-line arguments.
145
+ """
146
+ cargs = []
147
+ cargs.append("-fslgrad")
148
+ cargs.append(execution.input_file(params.get("bvecs", None)))
149
+ cargs.append(execution.input_file(params.get("bvals", None)))
150
+ return cargs
151
+
152
+
153
+ class DwigradcheckExportGradFslOutputs(typing.NamedTuple):
154
+ """
155
+ Output object returned when calling `DwigradcheckExportGradFslParamsDict | None(...)`.
156
+ """
157
+ root: OutputPathType
158
+ """Output root folder. This is the root folder for all outputs."""
159
+ bvecs_path: OutputPathType
160
+ """export the diffusion-weighted gradient table to files in FSL (bvecs /
161
+ bvals) format"""
162
+ bvals_path: OutputPathType
163
+ """export the diffusion-weighted gradient table to files in FSL (bvecs /
164
+ bvals) format"""
165
+
166
+
167
+ def dwigradcheck_export_grad_fsl(
168
+ bvecs_path: str,
169
+ bvals_path: str,
170
+ ) -> DwigradcheckExportGradFslParamsDictTagged:
171
+ """
172
+ Build parameters.
173
+
174
+ Args:
175
+ bvecs_path: export the diffusion-weighted gradient table to files in\
176
+ FSL (bvecs / bvals) format.
177
+ bvals_path: export the diffusion-weighted gradient table to files in\
178
+ FSL (bvecs / bvals) format.
179
+ Returns:
180
+ Parameter dictionary
181
+ """
182
+ params = {
183
+ "@type": "export_grad_fsl",
184
+ "bvecs_path": bvecs_path,
185
+ "bvals_path": bvals_path,
186
+ }
187
+ return params
188
+
189
+
190
+ def dwigradcheck_export_grad_fsl_validate(
191
+ params: typing.Any,
192
+ ) -> None:
193
+ """
194
+ Validate parameters. Throws an error if `params` is not a valid
195
+ `DwigradcheckExportGradFslParamsDict` object.
196
+
197
+ Args:
198
+ params: The parameters object to validate.
199
+ """
200
+ if params is None or not isinstance(params, dict):
201
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
202
+ if params.get("bvecs_path", None) is None:
203
+ raise StyxValidationError("`bvecs_path` must not be None")
204
+ if not isinstance(params["bvecs_path"], str):
205
+ raise StyxValidationError(f'`bvecs_path` has the wrong type: Received `{type(params.get("bvecs_path", None))}` expected `str`')
206
+ if params.get("bvals_path", None) is None:
207
+ raise StyxValidationError("`bvals_path` must not be None")
208
+ if not isinstance(params["bvals_path"], str):
209
+ raise StyxValidationError(f'`bvals_path` has the wrong type: Received `{type(params.get("bvals_path", None))}` expected `str`')
210
+
211
+
212
+ def dwigradcheck_export_grad_fsl_cargs(
213
+ params: DwigradcheckExportGradFslParamsDict,
214
+ execution: Execution,
215
+ ) -> list[str]:
216
+ """
217
+ Build command-line arguments from parameters.
218
+
219
+ Args:
220
+ params: The parameters.
221
+ execution: The execution object for resolving input paths.
222
+ Returns:
223
+ Command-line arguments.
224
+ """
225
+ cargs = []
226
+ cargs.append("-export_grad_fsl")
227
+ cargs.append(params.get("bvecs_path", None))
228
+ cargs.append(params.get("bvals_path", None))
229
+ return cargs
230
+
231
+
232
+ def dwigradcheck_export_grad_fsl_outputs(
233
+ params: DwigradcheckExportGradFslParamsDict,
234
+ execution: Execution,
235
+ ) -> DwigradcheckExportGradFslOutputs:
236
+ """
237
+ Build outputs object containing output file paths and possibly stdout/stderr.
238
+
239
+ Args:
240
+ params: The parameters.
241
+ execution: The execution object for resolving input paths.
242
+ Returns:
243
+ Outputs object.
244
+ """
245
+ ret = DwigradcheckExportGradFslOutputs(
246
+ root=execution.output_file("."),
247
+ bvecs_path=execution.output_file(params.get("bvecs_path", None)),
248
+ bvals_path=execution.output_file(params.get("bvals_path", None)),
249
+ )
250
+ return ret
251
+
252
+
253
+ class DwigradcheckOutputs(typing.NamedTuple):
254
+ """
255
+ Output object returned when calling `DwigradcheckParamsDict(...)`.
256
+ """
257
+ root: OutputPathType
258
+ """Output root folder. This is the root folder for all outputs."""
259
+ export_grad_mrtrix: OutputPathType | None
260
+ """export the diffusion-weighted gradient table to file in MRtrix format """
261
+ export_grad_fsl: OutputPathType | None
262
+ """export the diffusion-weighted gradient table to file in FSL format """
263
+ export_grad_fsl_: DwigradcheckExportGradFslOutputs | None
264
+ """Outputs from `dwigradcheck_export_grad_fsl_outputs`."""
265
+
266
+
267
+ def dwigradcheck_params(
268
+ input_image: InputPathType,
269
+ grad: InputPathType | None = None,
270
+ fslgrad: DwigradcheckFslgradParamsDict | None = None,
271
+ mask_image: InputPathType | None = None,
272
+ number: int | None = None,
273
+ export_grad_mrtrix: str | None = None,
274
+ export_grad_fsl: DwigradcheckExportGradFslParamsDict | None = None,
275
+ nocleanup: bool = False,
276
+ scratch_dir: InputPathType | None = None,
277
+ continue_scratch_dir: list[InputPathType] | None = None,
278
+ info: bool = False,
279
+ quiet: bool = False,
280
+ debug: bool = False,
281
+ force: bool = False,
282
+ nthreads: float | None = None,
283
+ config: list[str] | None = None,
284
+ help_: bool = False,
285
+ version: bool = False,
286
+ ) -> DwigradcheckParamsDictTagged:
287
+ """
288
+ Build parameters.
289
+
290
+ Args:
291
+ input_image: The input DWI series to be checked.
292
+ grad: Provide the diffusion gradient table in MRtrix format.
293
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
294
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
295
+ scheme is present in the input image header, the data provided with\
296
+ this option will be instead used.
297
+ mask_image: Provide a brain mask image.
298
+ number: Set the number of tracks to generate for each test.
299
+ export_grad_mrtrix: export the diffusion-weighted gradient table to\
300
+ file in MRtrix format.
301
+ export_grad_fsl: export the diffusion-weighted gradient table to files\
302
+ in FSL (bvecs / bvals) format.
303
+ nocleanup: Do not delete intermediate files during script execution,\
304
+ and do not delete scratch directory at script completion.
305
+ scratch_dir: Manually specify the path in which to generate the scratch\
306
+ directory.
307
+ continue_scratch_dir: Continue the script from a previous execution;\
308
+ must provide the scratch directory path.
309
+ info: Display information messages.
310
+ quiet: Do not display information messages or progress status.
311
+ debug: Display debugging messages.
312
+ force: Force overwrite of output files.
313
+ nthreads: Use this number of threads in multi-threaded applications\
314
+ (set to 0 to disable multi-threading).
315
+ config: Temporarily set the value of an MRtrix config file entry.
316
+ help_: Display help information and exit.
317
+ version: Display version information and exit.
318
+ Returns:
319
+ Parameter dictionary
320
+ """
321
+ params = {
322
+ "@type": "mrtrix/dwigradcheck",
323
+ "input_image": input_image,
324
+ "nocleanup": nocleanup,
325
+ "info": info,
326
+ "quiet": quiet,
327
+ "debug": debug,
328
+ "force": force,
329
+ "help": help_,
330
+ "version": version,
331
+ }
332
+ if grad is not None:
333
+ params["grad"] = grad
334
+ if fslgrad is not None:
335
+ params["fslgrad"] = fslgrad
336
+ if mask_image is not None:
337
+ params["mask_image"] = mask_image
338
+ if number is not None:
339
+ params["number"] = number
340
+ if export_grad_mrtrix is not None:
341
+ params["export_grad_mrtrix"] = export_grad_mrtrix
342
+ if export_grad_fsl is not None:
343
+ params["export_grad_fsl"] = export_grad_fsl
344
+ if scratch_dir is not None:
345
+ params["scratch_dir"] = scratch_dir
346
+ if continue_scratch_dir is not None:
347
+ params["continue_scratch_dir"] = continue_scratch_dir
348
+ if nthreads is not None:
349
+ params["nthreads"] = nthreads
350
+ if config is not None:
351
+ params["config"] = config
352
+ return params
353
+
354
+
355
+ def dwigradcheck_validate(
356
+ params: typing.Any,
357
+ ) -> None:
358
+ """
359
+ Validate parameters. Throws an error if `params` is not a valid
360
+ `DwigradcheckParamsDict` object.
361
+
362
+ Args:
363
+ params: The parameters object to validate.
364
+ """
365
+ if params is None or not isinstance(params, dict):
366
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
367
+ if params.get("input_image", None) is None:
368
+ raise StyxValidationError("`input_image` must not be None")
369
+ if not isinstance(params["input_image"], (pathlib.Path, str)):
370
+ raise StyxValidationError(f'`input_image` has the wrong type: Received `{type(params.get("input_image", None))}` expected `InputPathType`')
371
+ if params.get("grad", None) is not None:
372
+ if not isinstance(params["grad"], (pathlib.Path, str)):
373
+ raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
374
+ if params.get("fslgrad", None) is not None:
375
+ dwigradcheck_fslgrad_validate(params["fslgrad"])
376
+ if params.get("mask_image", None) is not None:
377
+ if not isinstance(params["mask_image"], (pathlib.Path, str)):
378
+ raise StyxValidationError(f'`mask_image` has the wrong type: Received `{type(params.get("mask_image", None))}` expected `InputPathType | None`')
379
+ if params.get("number", None) is not None:
380
+ if not isinstance(params["number"], int):
381
+ raise StyxValidationError(f'`number` has the wrong type: Received `{type(params.get("number", None))}` expected `int | None`')
382
+ if params.get("export_grad_mrtrix", None) is not None:
383
+ if not isinstance(params["export_grad_mrtrix"], str):
384
+ raise StyxValidationError(f'`export_grad_mrtrix` has the wrong type: Received `{type(params.get("export_grad_mrtrix", None))}` expected `str | None`')
385
+ if params.get("export_grad_fsl", None) is not None:
386
+ dwigradcheck_export_grad_fsl_validate(params["export_grad_fsl"])
387
+ if params.get("nocleanup", False) is None:
388
+ raise StyxValidationError("`nocleanup` must not be None")
389
+ if not isinstance(params["nocleanup"], bool):
390
+ raise StyxValidationError(f'`nocleanup` has the wrong type: Received `{type(params.get("nocleanup", False))}` expected `bool`')
391
+ if params.get("scratch_dir", None) is not None:
392
+ if not isinstance(params["scratch_dir"], (pathlib.Path, str)):
393
+ raise StyxValidationError(f'`scratch_dir` has the wrong type: Received `{type(params.get("scratch_dir", None))}` expected `InputPathType | None`')
394
+ if params.get("continue_scratch_dir", None) is not None:
395
+ if not isinstance(params["continue_scratch_dir"], list):
396
+ raise StyxValidationError(f'`continue_scratch_dir` has the wrong type: Received `{type(params.get("continue_scratch_dir", None))}` expected `list[InputPathType] | None`')
397
+ if len(params["continue_scratch_dir"]) != 2:
398
+ raise StyxValidationError("Parameter `continue_scratch_dir` must contain exactly 2 elements")
399
+ for e in params["continue_scratch_dir"]:
400
+ if not isinstance(e, (pathlib.Path, str)):
401
+ raise StyxValidationError(f'`continue_scratch_dir` has the wrong type: Received `{type(params.get("continue_scratch_dir", None))}` expected `list[InputPathType] | None`')
402
+ if params.get("info", False) is None:
403
+ raise StyxValidationError("`info` must not be None")
404
+ if not isinstance(params["info"], bool):
405
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
406
+ if params.get("quiet", False) is None:
407
+ raise StyxValidationError("`quiet` must not be None")
408
+ if not isinstance(params["quiet"], bool):
409
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
410
+ if params.get("debug", False) is None:
411
+ raise StyxValidationError("`debug` must not be None")
412
+ if not isinstance(params["debug"], bool):
413
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
414
+ if params.get("force", False) is None:
415
+ raise StyxValidationError("`force` must not be None")
416
+ if not isinstance(params["force"], bool):
417
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
418
+ if params.get("nthreads", None) is not None:
419
+ if not isinstance(params["nthreads"], (float, int)):
420
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `float | None`')
421
+ if params.get("config", None) is not None:
422
+ if not isinstance(params["config"], list):
423
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[str] | None`')
424
+ for e in params["config"]:
425
+ if not isinstance(e, str):
426
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[str] | None`')
427
+ if params.get("help", False) is None:
428
+ raise StyxValidationError("`help` must not be None")
429
+ if not isinstance(params["help"], bool):
430
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
431
+ if params.get("version", False) is None:
432
+ raise StyxValidationError("`version` must not be None")
433
+ if not isinstance(params["version"], bool):
434
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
435
+
436
+
437
+ def dwigradcheck_cargs(
438
+ params: DwigradcheckParamsDict,
439
+ execution: Execution,
440
+ ) -> list[str]:
441
+ """
442
+ Build command-line arguments from parameters.
443
+
444
+ Args:
445
+ params: The parameters.
446
+ execution: The execution object for resolving input paths.
447
+ Returns:
448
+ Command-line arguments.
449
+ """
450
+ cargs = []
451
+ cargs.append("dwigradcheck")
452
+ cargs.append(execution.input_file(params.get("input_image", None)))
453
+ if params.get("grad", None) is not None:
454
+ cargs.extend([
455
+ "-grad",
456
+ execution.input_file(params.get("grad", None))
457
+ ])
458
+ if params.get("fslgrad", None) is not None:
459
+ cargs.extend(dwigradcheck_fslgrad_cargs(params.get("fslgrad", None), execution))
460
+ if params.get("mask_image", None) is not None:
461
+ cargs.extend([
462
+ "-mask",
463
+ execution.input_file(params.get("mask_image", None))
464
+ ])
465
+ if params.get("number", None) is not None:
466
+ cargs.extend([
467
+ "-number",
468
+ str(params.get("number", None))
469
+ ])
470
+ if params.get("export_grad_mrtrix", None) is not None:
471
+ cargs.extend([
472
+ "-export_grad_mrtrix",
473
+ params.get("export_grad_mrtrix", None)
474
+ ])
475
+ if params.get("export_grad_fsl", None) is not None:
476
+ cargs.extend(dwigradcheck_export_grad_fsl_cargs(params.get("export_grad_fsl", None), execution))
477
+ if params.get("nocleanup", False):
478
+ cargs.append("-nocleanup")
479
+ if params.get("scratch_dir", None) is not None:
480
+ cargs.extend([
481
+ "-scratch",
482
+ execution.input_file(params.get("scratch_dir", None))
483
+ ])
484
+ if params.get("continue_scratch_dir", None) is not None:
485
+ cargs.extend([
486
+ "-continue",
487
+ *[execution.input_file(f) for f in params.get("continue_scratch_dir", None)]
488
+ ])
489
+ if params.get("info", False):
490
+ cargs.append("-info")
491
+ if params.get("quiet", False):
492
+ cargs.append("-quiet")
493
+ if params.get("debug", False):
494
+ cargs.append("-debug")
495
+ if params.get("force", False):
496
+ cargs.append("-force")
497
+ if params.get("nthreads", None) is not None:
498
+ cargs.extend([
499
+ "-nthreads",
500
+ str(params.get("nthreads", None))
501
+ ])
502
+ if params.get("config", None) is not None:
503
+ cargs.extend([
504
+ "-config",
505
+ *params.get("config", None)
506
+ ])
507
+ if params.get("help", False):
508
+ cargs.append("-help")
509
+ if params.get("version", False):
510
+ cargs.append("-version")
511
+ return cargs
512
+
513
+
514
+ def dwigradcheck_outputs(
515
+ params: DwigradcheckParamsDict,
516
+ execution: Execution,
517
+ ) -> DwigradcheckOutputs:
518
+ """
519
+ Build outputs object containing output file paths and possibly stdout/stderr.
520
+
521
+ Args:
522
+ params: The parameters.
523
+ execution: The execution object for resolving input paths.
524
+ Returns:
525
+ Outputs object.
526
+ """
527
+ ret = DwigradcheckOutputs(
528
+ root=execution.output_file("."),
529
+ export_grad_mrtrix=execution.output_file(params.get("export_grad_mrtrix", None)) if (params.get("export_grad_mrtrix") is not None) else None,
530
+ export_grad_fsl=execution.output_file(params.get("export_grad_mrtrix", None)) if (params.get("export_grad_mrtrix") is not None) else None,
531
+ export_grad_fsl_=dwigradcheck_export_grad_fsl_outputs(params.get("export_grad_fsl"), execution) if params.get("export_grad_fsl") else None,
532
+ )
533
+ return ret
534
+
535
+
536
+ def dwigradcheck_execute(
537
+ params: DwigradcheckParamsDict,
538
+ runner: Runner | None = None,
539
+ ) -> DwigradcheckOutputs:
540
+ """
541
+ dwigradcheck
542
+
543
+ Check the orientation of the diffusion gradient table.
544
+
545
+ Author: MRTrix3 Developers
546
+
547
+ URL: https://www.mrtrix.org/
548
+
549
+ Args:
550
+ params: The parameters.
551
+ runner: Command runner.
552
+ Returns:
553
+ NamedTuple of outputs (described in `DwigradcheckOutputs`).
554
+ """
555
+ dwigradcheck_validate(params)
556
+ runner = runner or get_global_runner()
557
+ execution = runner.start_execution(DWIGRADCHECK_METADATA)
558
+ params = execution.params(params)
559
+ cargs = dwigradcheck_cargs(params, execution)
560
+ ret = dwigradcheck_outputs(params, execution)
561
+ execution.run(cargs)
562
+ return ret
563
+
564
+
565
+ def dwigradcheck(
566
+ input_image: InputPathType,
567
+ grad: InputPathType | None = None,
568
+ fslgrad: DwigradcheckFslgradParamsDict | None = None,
569
+ mask_image: InputPathType | None = None,
570
+ number: int | None = None,
571
+ export_grad_mrtrix: str | None = None,
572
+ export_grad_fsl: DwigradcheckExportGradFslParamsDict | None = None,
573
+ nocleanup: bool = False,
574
+ scratch_dir: InputPathType | None = None,
575
+ continue_scratch_dir: list[InputPathType] | None = None,
576
+ info: bool = False,
577
+ quiet: bool = False,
578
+ debug: bool = False,
579
+ force: bool = False,
580
+ nthreads: float | None = None,
581
+ config: list[str] | None = None,
582
+ help_: bool = False,
583
+ version: bool = False,
584
+ runner: Runner | None = None,
585
+ ) -> DwigradcheckOutputs:
586
+ """
587
+ dwigradcheck
588
+
589
+ Check the orientation of the diffusion gradient table.
590
+
591
+ Author: MRTrix3 Developers
592
+
593
+ URL: https://www.mrtrix.org/
594
+
595
+ Args:
596
+ input_image: The input DWI series to be checked.
597
+ grad: Provide the diffusion gradient table in MRtrix format.
598
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
599
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
600
+ scheme is present in the input image header, the data provided with\
601
+ this option will be instead used.
602
+ mask_image: Provide a brain mask image.
603
+ number: Set the number of tracks to generate for each test.
604
+ export_grad_mrtrix: export the diffusion-weighted gradient table to\
605
+ file in MRtrix format.
606
+ export_grad_fsl: export the diffusion-weighted gradient table to files\
607
+ in FSL (bvecs / bvals) format.
608
+ nocleanup: Do not delete intermediate files during script execution,\
609
+ and do not delete scratch directory at script completion.
610
+ scratch_dir: Manually specify the path in which to generate the scratch\
611
+ directory.
612
+ continue_scratch_dir: Continue the script from a previous execution;\
613
+ must provide the scratch directory path.
614
+ info: Display information messages.
615
+ quiet: Do not display information messages or progress status.
616
+ debug: Display debugging messages.
617
+ force: Force overwrite of output files.
618
+ nthreads: Use this number of threads in multi-threaded applications\
619
+ (set to 0 to disable multi-threading).
620
+ config: Temporarily set the value of an MRtrix config file entry.
621
+ help_: Display help information and exit.
622
+ version: Display version information and exit.
623
+ runner: Command runner.
624
+ Returns:
625
+ NamedTuple of outputs (described in `DwigradcheckOutputs`).
626
+ """
627
+ params = dwigradcheck_params(
628
+ input_image=input_image,
629
+ grad=grad,
630
+ fslgrad=fslgrad,
631
+ mask_image=mask_image,
632
+ number=number,
633
+ export_grad_mrtrix=export_grad_mrtrix,
634
+ export_grad_fsl=export_grad_fsl,
635
+ nocleanup=nocleanup,
636
+ scratch_dir=scratch_dir,
637
+ continue_scratch_dir=continue_scratch_dir,
638
+ info=info,
639
+ quiet=quiet,
640
+ debug=debug,
641
+ force=force,
642
+ nthreads=nthreads,
643
+ config=config,
644
+ help_=help_,
645
+ version=version,
646
+ )
647
+ return dwigradcheck_execute(params, runner)
648
+
649
+
650
+ __all__ = [
651
+ "DWIGRADCHECK_METADATA",
652
+ "DwigradcheckExportGradFslOutputs",
653
+ "DwigradcheckExportGradFslParamsDict",
654
+ "DwigradcheckExportGradFslParamsDictTagged",
655
+ "DwigradcheckFslgradParamsDict",
656
+ "DwigradcheckFslgradParamsDictTagged",
657
+ "DwigradcheckOutputs",
658
+ "DwigradcheckParamsDict",
659
+ "DwigradcheckParamsDictTagged",
660
+ "dwigradcheck",
661
+ "dwigradcheck_execute",
662
+ "dwigradcheck_export_grad_fsl",
663
+ "dwigradcheck_fslgrad",
664
+ "dwigradcheck_params",
665
+ ]