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,673 @@
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
+ DWIBIASCORRECT_METADATA = Metadata(
9
+ id="b6c72322d3d00ba26448970257e9f0b213c34953.boutiques",
10
+ name="dwibiascorrect",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _DwibiascorrectFslgradParamsDictNoTag = typing.TypedDict('_DwibiascorrectFslgradParamsDictNoTag', {
17
+ "bvecs": InputPathType,
18
+ "bvals": InputPathType,
19
+ })
20
+ DwibiascorrectFslgradParamsDictTagged = typing.TypedDict('DwibiascorrectFslgradParamsDictTagged', {
21
+ "@type": typing.Literal["fslgrad"],
22
+ "bvecs": InputPathType,
23
+ "bvals": InputPathType,
24
+ })
25
+ DwibiascorrectFslgradParamsDict = _DwibiascorrectFslgradParamsDictNoTag | DwibiascorrectFslgradParamsDictTagged
26
+
27
+
28
+ _DwibiascorrectConfigParamsDictNoTag = typing.TypedDict('_DwibiascorrectConfigParamsDictNoTag', {
29
+ "key": str,
30
+ "value": str,
31
+ })
32
+ DwibiascorrectConfigParamsDictTagged = typing.TypedDict('DwibiascorrectConfigParamsDictTagged', {
33
+ "@type": typing.Literal["config"],
34
+ "key": str,
35
+ "value": str,
36
+ })
37
+ DwibiascorrectConfigParamsDict = _DwibiascorrectConfigParamsDictNoTag | DwibiascorrectConfigParamsDictTagged
38
+
39
+
40
+ _DwibiascorrectParamsDictNoTag = typing.TypedDict('_DwibiascorrectParamsDictNoTag', {
41
+ "algorithm": str,
42
+ "input_image": InputPathType,
43
+ "output_image": str,
44
+ "grad": typing.NotRequired[InputPathType | None],
45
+ "fslgrad": typing.NotRequired[DwibiascorrectFslgradParamsDict | None],
46
+ "mask_image": typing.NotRequired[InputPathType | None],
47
+ "bias_image": typing.NotRequired[InputPathType | 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[DwibiascorrectConfigParamsDict] | None],
57
+ "help": bool,
58
+ "version": bool,
59
+ "ants_b": typing.NotRequired[str | None],
60
+ "ants_c": typing.NotRequired[str | None],
61
+ "ants_s": typing.NotRequired[str | None],
62
+ })
63
+ DwibiascorrectParamsDictTagged = typing.TypedDict('DwibiascorrectParamsDictTagged', {
64
+ "@type": typing.Literal["mrtrix/dwibiascorrect"],
65
+ "algorithm": str,
66
+ "input_image": InputPathType,
67
+ "output_image": str,
68
+ "grad": typing.NotRequired[InputPathType | None],
69
+ "fslgrad": typing.NotRequired[DwibiascorrectFslgradParamsDict | None],
70
+ "mask_image": typing.NotRequired[InputPathType | None],
71
+ "bias_image": typing.NotRequired[InputPathType | None],
72
+ "nocleanup": bool,
73
+ "scratch_dir": typing.NotRequired[InputPathType | None],
74
+ "continue_scratch_dir": typing.NotRequired[list[InputPathType] | None],
75
+ "info": bool,
76
+ "quiet": bool,
77
+ "debug": bool,
78
+ "force": bool,
79
+ "nthreads": typing.NotRequired[float | None],
80
+ "config": typing.NotRequired[list[DwibiascorrectConfigParamsDict] | None],
81
+ "help": bool,
82
+ "version": bool,
83
+ "ants_b": typing.NotRequired[str | None],
84
+ "ants_c": typing.NotRequired[str | None],
85
+ "ants_s": typing.NotRequired[str | None],
86
+ })
87
+ DwibiascorrectParamsDict = _DwibiascorrectParamsDictNoTag | DwibiascorrectParamsDictTagged
88
+
89
+
90
+ def dwibiascorrect_fslgrad(
91
+ bvecs: InputPathType,
92
+ bvals: InputPathType,
93
+ ) -> DwibiascorrectFslgradParamsDictTagged:
94
+ """
95
+ Build parameters.
96
+
97
+ Args:
98
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
99
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
100
+ scheme is present in the input image header, the data provided with\
101
+ this option will be instead used.
102
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
103
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
104
+ scheme is present in the input image header, the data provided with\
105
+ this option will be instead used.
106
+ Returns:
107
+ Parameter dictionary
108
+ """
109
+ params = {
110
+ "@type": "fslgrad",
111
+ "bvecs": bvecs,
112
+ "bvals": bvals,
113
+ }
114
+ return params
115
+
116
+
117
+ def dwibiascorrect_fslgrad_validate(
118
+ params: typing.Any,
119
+ ) -> None:
120
+ """
121
+ Validate parameters. Throws an error if `params` is not a valid
122
+ `DwibiascorrectFslgradParamsDict` object.
123
+
124
+ Args:
125
+ params: The parameters object to validate.
126
+ """
127
+ if params is None or not isinstance(params, dict):
128
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
129
+ if params.get("bvecs", None) is None:
130
+ raise StyxValidationError("`bvecs` must not be None")
131
+ if not isinstance(params["bvecs"], (pathlib.Path, str)):
132
+ raise StyxValidationError(f'`bvecs` has the wrong type: Received `{type(params.get("bvecs", None))}` expected `InputPathType`')
133
+ if params.get("bvals", None) is None:
134
+ raise StyxValidationError("`bvals` must not be None")
135
+ if not isinstance(params["bvals"], (pathlib.Path, str)):
136
+ raise StyxValidationError(f'`bvals` has the wrong type: Received `{type(params.get("bvals", None))}` expected `InputPathType`')
137
+
138
+
139
+ def dwibiascorrect_fslgrad_cargs(
140
+ params: DwibiascorrectFslgradParamsDict,
141
+ execution: Execution,
142
+ ) -> list[str]:
143
+ """
144
+ Build command-line arguments from parameters.
145
+
146
+ Args:
147
+ params: The parameters.
148
+ execution: The execution object for resolving input paths.
149
+ Returns:
150
+ Command-line arguments.
151
+ """
152
+ cargs = []
153
+ cargs.append("-fslgrad")
154
+ cargs.append(execution.input_file(params.get("bvecs", None)))
155
+ cargs.append(execution.input_file(params.get("bvals", None)))
156
+ return cargs
157
+
158
+
159
+ def dwibiascorrect_config(
160
+ key: str,
161
+ value: str,
162
+ ) -> DwibiascorrectConfigParamsDictTagged:
163
+ """
164
+ Build parameters.
165
+
166
+ Args:
167
+ key: temporarily set the value of an MRtrix config file entry.
168
+ value: temporarily set the value of an MRtrix config file entry.
169
+ Returns:
170
+ Parameter dictionary
171
+ """
172
+ params = {
173
+ "@type": "config",
174
+ "key": key,
175
+ "value": value,
176
+ }
177
+ return params
178
+
179
+
180
+ def dwibiascorrect_config_validate(
181
+ params: typing.Any,
182
+ ) -> None:
183
+ """
184
+ Validate parameters. Throws an error if `params` is not a valid
185
+ `DwibiascorrectConfigParamsDict` object.
186
+
187
+ Args:
188
+ params: The parameters object to validate.
189
+ """
190
+ if params is None or not isinstance(params, dict):
191
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
192
+ if params.get("key", None) is None:
193
+ raise StyxValidationError("`key` must not be None")
194
+ if not isinstance(params["key"], str):
195
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
196
+ if params.get("value", None) is None:
197
+ raise StyxValidationError("`value` must not be None")
198
+ if not isinstance(params["value"], str):
199
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
200
+
201
+
202
+ def dwibiascorrect_config_cargs(
203
+ params: DwibiascorrectConfigParamsDict,
204
+ execution: Execution,
205
+ ) -> list[str]:
206
+ """
207
+ Build command-line arguments from parameters.
208
+
209
+ Args:
210
+ params: The parameters.
211
+ execution: The execution object for resolving input paths.
212
+ Returns:
213
+ Command-line arguments.
214
+ """
215
+ cargs = []
216
+ cargs.append("-config")
217
+ cargs.append(params.get("key", None))
218
+ cargs.append(params.get("value", None))
219
+ return cargs
220
+
221
+
222
+ class DwibiascorrectOutputs(typing.NamedTuple):
223
+ """
224
+ Output object returned when calling `DwibiascorrectParamsDict(...)`.
225
+ """
226
+ root: OutputPathType
227
+ """Output root folder. This is the root folder for all outputs."""
228
+ output_image_file: OutputPathType
229
+ """File containing the corrected image series"""
230
+ bias_image_file: OutputPathType | None
231
+ """File containing the estimated bias field"""
232
+
233
+
234
+ def dwibiascorrect_params(
235
+ algorithm: str,
236
+ input_image: InputPathType,
237
+ output_image: str,
238
+ grad: InputPathType | None = None,
239
+ fslgrad: DwibiascorrectFslgradParamsDict | None = None,
240
+ mask_image: InputPathType | None = None,
241
+ bias_image: InputPathType | None = None,
242
+ nocleanup: bool = False,
243
+ scratch_dir: InputPathType | None = None,
244
+ continue_scratch_dir: list[InputPathType] | None = None,
245
+ info: bool = False,
246
+ quiet: bool = False,
247
+ debug: bool = False,
248
+ force: bool = False,
249
+ nthreads: float | None = None,
250
+ config: list[DwibiascorrectConfigParamsDict] | None = None,
251
+ help_: bool = False,
252
+ version: bool = False,
253
+ ants_b: str | None = None,
254
+ ants_c: str | None = None,
255
+ ants_s: str | None = None,
256
+ ) -> DwibiascorrectParamsDictTagged:
257
+ """
258
+ Build parameters.
259
+
260
+ Args:
261
+ algorithm: Select the algorithm to be used for bias correction. Options\
262
+ are: ants, fsl.
263
+ input_image: The input image series to be corrected.
264
+ output_image: The output corrected image series.
265
+ grad: Provide the diffusion gradient table in MRtrix format.
266
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
267
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
268
+ scheme is present in the input image header, the data provided with\
269
+ this option will be instead used.
270
+ mask_image: Manually provide a mask image for bias field estimation.
271
+ bias_image: Output the estimated bias field.
272
+ nocleanup: Do not delete intermediate files during script execution,\
273
+ and do not delete scratch directory at script completion.
274
+ scratch_dir: Manually specify the path in which to generate the scratch\
275
+ directory.
276
+ continue_scratch_dir: Continue the script from a previous execution;\
277
+ must provide the scratch directory path.
278
+ info: Display information messages.
279
+ quiet: Do not display information messages or progress status.
280
+ debug: Display debugging messages.
281
+ force: Force overwrite of output files.
282
+ nthreads: Use this number of threads in multi-threaded applications\
283
+ (set to 0 to disable multi-threading).
284
+ config: temporarily set the value of an MRtrix config file entry.
285
+ help_: Display help information and exit.
286
+ version: Display version information and exit.
287
+ ants_b: N4BiasFieldCorrection option -b (initial mesh resolution in mm,\
288
+ spline order).
289
+ ants_c: N4BiasFieldCorrection option -c (number of iterations,\
290
+ convergence threshold).
291
+ ants_s: N4BiasFieldCorrection option -s (shrink-factor applied to\
292
+ spatial dimensions).
293
+ Returns:
294
+ Parameter dictionary
295
+ """
296
+ params = {
297
+ "@type": "mrtrix/dwibiascorrect",
298
+ "algorithm": algorithm,
299
+ "input_image": input_image,
300
+ "output_image": output_image,
301
+ "nocleanup": nocleanup,
302
+ "info": info,
303
+ "quiet": quiet,
304
+ "debug": debug,
305
+ "force": force,
306
+ "help": help_,
307
+ "version": version,
308
+ }
309
+ if grad is not None:
310
+ params["grad"] = grad
311
+ if fslgrad is not None:
312
+ params["fslgrad"] = fslgrad
313
+ if mask_image is not None:
314
+ params["mask_image"] = mask_image
315
+ if bias_image is not None:
316
+ params["bias_image"] = bias_image
317
+ if scratch_dir is not None:
318
+ params["scratch_dir"] = scratch_dir
319
+ if continue_scratch_dir is not None:
320
+ params["continue_scratch_dir"] = continue_scratch_dir
321
+ if nthreads is not None:
322
+ params["nthreads"] = nthreads
323
+ if config is not None:
324
+ params["config"] = config
325
+ if ants_b is not None:
326
+ params["ants_b"] = ants_b
327
+ if ants_c is not None:
328
+ params["ants_c"] = ants_c
329
+ if ants_s is not None:
330
+ params["ants_s"] = ants_s
331
+ return params
332
+
333
+
334
+ def dwibiascorrect_validate(
335
+ params: typing.Any,
336
+ ) -> None:
337
+ """
338
+ Validate parameters. Throws an error if `params` is not a valid
339
+ `DwibiascorrectParamsDict` object.
340
+
341
+ Args:
342
+ params: The parameters object to validate.
343
+ """
344
+ if params is None or not isinstance(params, dict):
345
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
346
+ if params.get("algorithm", None) is None:
347
+ raise StyxValidationError("`algorithm` must not be None")
348
+ if not isinstance(params["algorithm"], str):
349
+ raise StyxValidationError(f'`algorithm` has the wrong type: Received `{type(params.get("algorithm", None))}` expected `str`')
350
+ if params.get("input_image", None) is None:
351
+ raise StyxValidationError("`input_image` must not be None")
352
+ if not isinstance(params["input_image"], (pathlib.Path, str)):
353
+ raise StyxValidationError(f'`input_image` has the wrong type: Received `{type(params.get("input_image", None))}` expected `InputPathType`')
354
+ if params.get("output_image", None) is None:
355
+ raise StyxValidationError("`output_image` must not be None")
356
+ if not isinstance(params["output_image"], str):
357
+ raise StyxValidationError(f'`output_image` has the wrong type: Received `{type(params.get("output_image", None))}` expected `str`')
358
+ if params.get("grad", None) is not None:
359
+ if not isinstance(params["grad"], (pathlib.Path, str)):
360
+ raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
361
+ if params.get("fslgrad", None) is not None:
362
+ dwibiascorrect_fslgrad_validate(params["fslgrad"])
363
+ if params.get("mask_image", None) is not None:
364
+ if not isinstance(params["mask_image"], (pathlib.Path, str)):
365
+ raise StyxValidationError(f'`mask_image` has the wrong type: Received `{type(params.get("mask_image", None))}` expected `InputPathType | None`')
366
+ if params.get("bias_image", None) is not None:
367
+ if not isinstance(params["bias_image"], (pathlib.Path, str)):
368
+ raise StyxValidationError(f'`bias_image` has the wrong type: Received `{type(params.get("bias_image", None))}` expected `InputPathType | None`')
369
+ if params.get("nocleanup", False) is None:
370
+ raise StyxValidationError("`nocleanup` must not be None")
371
+ if not isinstance(params["nocleanup"], bool):
372
+ raise StyxValidationError(f'`nocleanup` has the wrong type: Received `{type(params.get("nocleanup", False))}` expected `bool`')
373
+ if params.get("scratch_dir", None) is not None:
374
+ if not isinstance(params["scratch_dir"], (pathlib.Path, str)):
375
+ raise StyxValidationError(f'`scratch_dir` has the wrong type: Received `{type(params.get("scratch_dir", None))}` expected `InputPathType | None`')
376
+ if params.get("continue_scratch_dir", None) is not None:
377
+ if not isinstance(params["continue_scratch_dir"], list):
378
+ raise StyxValidationError(f'`continue_scratch_dir` has the wrong type: Received `{type(params.get("continue_scratch_dir", None))}` expected `list[InputPathType] | None`')
379
+ if len(params["continue_scratch_dir"]) != 2:
380
+ raise StyxValidationError("Parameter `continue_scratch_dir` must contain exactly 2 elements")
381
+ for e in params["continue_scratch_dir"]:
382
+ if not isinstance(e, (pathlib.Path, str)):
383
+ raise StyxValidationError(f'`continue_scratch_dir` has the wrong type: Received `{type(params.get("continue_scratch_dir", None))}` expected `list[InputPathType] | None`')
384
+ if params.get("info", False) is None:
385
+ raise StyxValidationError("`info` must not be None")
386
+ if not isinstance(params["info"], bool):
387
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
388
+ if params.get("quiet", False) is None:
389
+ raise StyxValidationError("`quiet` must not be None")
390
+ if not isinstance(params["quiet"], bool):
391
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
392
+ if params.get("debug", False) is None:
393
+ raise StyxValidationError("`debug` must not be None")
394
+ if not isinstance(params["debug"], bool):
395
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
396
+ if params.get("force", False) is None:
397
+ raise StyxValidationError("`force` must not be None")
398
+ if not isinstance(params["force"], bool):
399
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
400
+ if params.get("nthreads", None) is not None:
401
+ if not isinstance(params["nthreads"], (float, int)):
402
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `float | None`')
403
+ if params.get("config", None) is not None:
404
+ if not isinstance(params["config"], list):
405
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[DwibiascorrectConfigParamsDict] | None`')
406
+ for e in params["config"]:
407
+ dwibiascorrect_config_validate(e)
408
+ if params.get("help", False) is None:
409
+ raise StyxValidationError("`help` must not be None")
410
+ if not isinstance(params["help"], bool):
411
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
412
+ if params.get("version", False) is None:
413
+ raise StyxValidationError("`version` must not be None")
414
+ if not isinstance(params["version"], bool):
415
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
416
+ if params.get("ants_b", None) is not None:
417
+ if not isinstance(params["ants_b"], str):
418
+ raise StyxValidationError(f'`ants_b` has the wrong type: Received `{type(params.get("ants_b", None))}` expected `str | None`')
419
+ if params.get("ants_c", None) is not None:
420
+ if not isinstance(params["ants_c"], str):
421
+ raise StyxValidationError(f'`ants_c` has the wrong type: Received `{type(params.get("ants_c", None))}` expected `str | None`')
422
+ if params.get("ants_s", None) is not None:
423
+ if not isinstance(params["ants_s"], str):
424
+ raise StyxValidationError(f'`ants_s` has the wrong type: Received `{type(params.get("ants_s", None))}` expected `str | None`')
425
+
426
+
427
+ def dwibiascorrect_cargs(
428
+ params: DwibiascorrectParamsDict,
429
+ execution: Execution,
430
+ ) -> list[str]:
431
+ """
432
+ Build command-line arguments from parameters.
433
+
434
+ Args:
435
+ params: The parameters.
436
+ execution: The execution object for resolving input paths.
437
+ Returns:
438
+ Command-line arguments.
439
+ """
440
+ cargs = []
441
+ cargs.append("dwibiascorrect")
442
+ cargs.append(params.get("algorithm", None))
443
+ cargs.append(execution.input_file(params.get("input_image", None)))
444
+ cargs.append(params.get("output_image", None))
445
+ if params.get("grad", None) is not None:
446
+ cargs.extend([
447
+ "-grad",
448
+ execution.input_file(params.get("grad", None))
449
+ ])
450
+ if params.get("fslgrad", None) is not None:
451
+ cargs.extend(dwibiascorrect_fslgrad_cargs(params.get("fslgrad", None), execution))
452
+ if params.get("mask_image", None) is not None:
453
+ cargs.extend([
454
+ "-mask",
455
+ execution.input_file(params.get("mask_image", None))
456
+ ])
457
+ if params.get("bias_image", None) is not None:
458
+ cargs.extend([
459
+ "-bias",
460
+ execution.input_file(params.get("bias_image", None))
461
+ ])
462
+ if params.get("nocleanup", False):
463
+ cargs.append("-nocleanup")
464
+ if params.get("scratch_dir", None) is not None:
465
+ cargs.extend([
466
+ "-scratch",
467
+ execution.input_file(params.get("scratch_dir", None))
468
+ ])
469
+ if params.get("continue_scratch_dir", None) is not None:
470
+ cargs.extend([
471
+ "-continue",
472
+ *[execution.input_file(f) for f in params.get("continue_scratch_dir", None)]
473
+ ])
474
+ if params.get("info", False):
475
+ cargs.append("-info")
476
+ if params.get("quiet", False):
477
+ cargs.append("-quiet")
478
+ if params.get("debug", False):
479
+ cargs.append("-debug")
480
+ if params.get("force", False):
481
+ cargs.append("-force")
482
+ if params.get("nthreads", None) is not None:
483
+ cargs.extend([
484
+ "-nthreads",
485
+ str(params.get("nthreads", None))
486
+ ])
487
+ if params.get("config", None) is not None:
488
+ cargs.extend([a for c in [dwibiascorrect_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
489
+ if params.get("help", False):
490
+ cargs.append("-help")
491
+ if params.get("version", False):
492
+ cargs.append("-version")
493
+ if params.get("ants_b", None) is not None:
494
+ cargs.extend([
495
+ "-ants.b",
496
+ params.get("ants_b", None)
497
+ ])
498
+ if params.get("ants_c", None) is not None:
499
+ cargs.extend([
500
+ "-ants.c",
501
+ params.get("ants_c", None)
502
+ ])
503
+ if params.get("ants_s", None) is not None:
504
+ cargs.extend([
505
+ "-ants.s",
506
+ params.get("ants_s", None)
507
+ ])
508
+ return cargs
509
+
510
+
511
+ def dwibiascorrect_outputs(
512
+ params: DwibiascorrectParamsDict,
513
+ execution: Execution,
514
+ ) -> DwibiascorrectOutputs:
515
+ """
516
+ Build outputs object containing output file paths and possibly stdout/stderr.
517
+
518
+ Args:
519
+ params: The parameters.
520
+ execution: The execution object for resolving input paths.
521
+ Returns:
522
+ Outputs object.
523
+ """
524
+ ret = DwibiascorrectOutputs(
525
+ root=execution.output_file("."),
526
+ output_image_file=execution.output_file(params.get("output_image", None)),
527
+ bias_image_file=execution.output_file(pathlib.Path(params.get("bias_image", None)).name) if (params.get("bias_image") is not None) else None,
528
+ )
529
+ return ret
530
+
531
+
532
+ def dwibiascorrect_execute(
533
+ params: DwibiascorrectParamsDict,
534
+ runner: Runner | None = None,
535
+ ) -> DwibiascorrectOutputs:
536
+ """
537
+ dwibiascorrect
538
+
539
+ Perform B1 field inhomogeneity correction for a DWI volume series using
540
+ either ANTs or FSL.
541
+
542
+ Author: MRTrix3 Developers
543
+
544
+ URL: https://www.mrtrix.org/
545
+
546
+ Args:
547
+ params: The parameters.
548
+ runner: Command runner.
549
+ Returns:
550
+ NamedTuple of outputs (described in `DwibiascorrectOutputs`).
551
+ """
552
+ dwibiascorrect_validate(params)
553
+ runner = runner or get_global_runner()
554
+ execution = runner.start_execution(DWIBIASCORRECT_METADATA)
555
+ params = execution.params(params)
556
+ cargs = dwibiascorrect_cargs(params, execution)
557
+ ret = dwibiascorrect_outputs(params, execution)
558
+ execution.run(cargs)
559
+ return ret
560
+
561
+
562
+ def dwibiascorrect(
563
+ algorithm: str,
564
+ input_image: InputPathType,
565
+ output_image: str,
566
+ grad: InputPathType | None = None,
567
+ fslgrad: DwibiascorrectFslgradParamsDict | None = None,
568
+ mask_image: InputPathType | None = None,
569
+ bias_image: InputPathType | None = None,
570
+ nocleanup: bool = False,
571
+ scratch_dir: InputPathType | None = None,
572
+ continue_scratch_dir: list[InputPathType] | None = None,
573
+ info: bool = False,
574
+ quiet: bool = False,
575
+ debug: bool = False,
576
+ force: bool = False,
577
+ nthreads: float | None = None,
578
+ config: list[DwibiascorrectConfigParamsDict] | None = None,
579
+ help_: bool = False,
580
+ version: bool = False,
581
+ ants_b: str | None = None,
582
+ ants_c: str | None = None,
583
+ ants_s: str | None = None,
584
+ runner: Runner | None = None,
585
+ ) -> DwibiascorrectOutputs:
586
+ """
587
+ dwibiascorrect
588
+
589
+ Perform B1 field inhomogeneity correction for a DWI volume series using
590
+ either ANTs or FSL.
591
+
592
+ Author: MRTrix3 Developers
593
+
594
+ URL: https://www.mrtrix.org/
595
+
596
+ Args:
597
+ algorithm: Select the algorithm to be used for bias correction. Options\
598
+ are: ants, fsl.
599
+ input_image: The input image series to be corrected.
600
+ output_image: The output corrected image series.
601
+ grad: Provide the diffusion gradient table in MRtrix format.
602
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
603
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
604
+ scheme is present in the input image header, the data provided with\
605
+ this option will be instead used.
606
+ mask_image: Manually provide a mask image for bias field estimation.
607
+ bias_image: Output the estimated bias field.
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
+ ants_b: N4BiasFieldCorrection option -b (initial mesh resolution in mm,\
624
+ spline order).
625
+ ants_c: N4BiasFieldCorrection option -c (number of iterations,\
626
+ convergence threshold).
627
+ ants_s: N4BiasFieldCorrection option -s (shrink-factor applied to\
628
+ spatial dimensions).
629
+ runner: Command runner.
630
+ Returns:
631
+ NamedTuple of outputs (described in `DwibiascorrectOutputs`).
632
+ """
633
+ params = dwibiascorrect_params(
634
+ algorithm=algorithm,
635
+ input_image=input_image,
636
+ output_image=output_image,
637
+ grad=grad,
638
+ fslgrad=fslgrad,
639
+ mask_image=mask_image,
640
+ bias_image=bias_image,
641
+ nocleanup=nocleanup,
642
+ scratch_dir=scratch_dir,
643
+ continue_scratch_dir=continue_scratch_dir,
644
+ info=info,
645
+ quiet=quiet,
646
+ debug=debug,
647
+ force=force,
648
+ nthreads=nthreads,
649
+ config=config,
650
+ help_=help_,
651
+ version=version,
652
+ ants_b=ants_b,
653
+ ants_c=ants_c,
654
+ ants_s=ants_s,
655
+ )
656
+ return dwibiascorrect_execute(params, runner)
657
+
658
+
659
+ __all__ = [
660
+ "DWIBIASCORRECT_METADATA",
661
+ "DwibiascorrectConfigParamsDict",
662
+ "DwibiascorrectConfigParamsDictTagged",
663
+ "DwibiascorrectFslgradParamsDict",
664
+ "DwibiascorrectFslgradParamsDictTagged",
665
+ "DwibiascorrectOutputs",
666
+ "DwibiascorrectParamsDict",
667
+ "DwibiascorrectParamsDictTagged",
668
+ "dwibiascorrect",
669
+ "dwibiascorrect_config",
670
+ "dwibiascorrect_execute",
671
+ "dwibiascorrect_fslgrad",
672
+ "dwibiascorrect_params",
673
+ ]