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,632 @@
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
+ SH2PEAKS_METADATA = Metadata(
9
+ id="1cf460ab2a2a452d9f75103cade5ef23706312a1.boutiques",
10
+ name="sh2peaks",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _Sh2peaksDirectionParamsDictNoTag = typing.TypedDict('_Sh2peaksDirectionParamsDictNoTag', {
17
+ "phi": float,
18
+ "theta": float,
19
+ })
20
+ Sh2peaksDirectionParamsDictTagged = typing.TypedDict('Sh2peaksDirectionParamsDictTagged', {
21
+ "@type": typing.Literal["direction"],
22
+ "phi": float,
23
+ "theta": float,
24
+ })
25
+ Sh2peaksDirectionParamsDict = _Sh2peaksDirectionParamsDictNoTag | Sh2peaksDirectionParamsDictTagged
26
+
27
+
28
+ _Sh2peaksConfigParamsDictNoTag = typing.TypedDict('_Sh2peaksConfigParamsDictNoTag', {
29
+ "key": str,
30
+ "value": str,
31
+ })
32
+ Sh2peaksConfigParamsDictTagged = typing.TypedDict('Sh2peaksConfigParamsDictTagged', {
33
+ "@type": typing.Literal["config"],
34
+ "key": str,
35
+ "value": str,
36
+ })
37
+ Sh2peaksConfigParamsDict = _Sh2peaksConfigParamsDictNoTag | Sh2peaksConfigParamsDictTagged
38
+
39
+
40
+ _Sh2peaksParamsDictNoTag = typing.TypedDict('_Sh2peaksParamsDictNoTag', {
41
+ "num": typing.NotRequired[int | None],
42
+ "direction": typing.NotRequired[list[Sh2peaksDirectionParamsDict] | None],
43
+ "peaks": typing.NotRequired[InputPathType | None],
44
+ "threshold": typing.NotRequired[float | None],
45
+ "seeds": typing.NotRequired[InputPathType | None],
46
+ "mask": typing.NotRequired[InputPathType | None],
47
+ "fast": bool,
48
+ "info": bool,
49
+ "quiet": bool,
50
+ "debug": bool,
51
+ "force": bool,
52
+ "nthreads": typing.NotRequired[int | None],
53
+ "config": typing.NotRequired[list[Sh2peaksConfigParamsDict] | None],
54
+ "help": bool,
55
+ "version": bool,
56
+ "SH": InputPathType,
57
+ "output": str,
58
+ })
59
+ Sh2peaksParamsDictTagged = typing.TypedDict('Sh2peaksParamsDictTagged', {
60
+ "@type": typing.Literal["mrtrix/sh2peaks"],
61
+ "num": typing.NotRequired[int | None],
62
+ "direction": typing.NotRequired[list[Sh2peaksDirectionParamsDict] | None],
63
+ "peaks": typing.NotRequired[InputPathType | None],
64
+ "threshold": typing.NotRequired[float | None],
65
+ "seeds": typing.NotRequired[InputPathType | None],
66
+ "mask": typing.NotRequired[InputPathType | None],
67
+ "fast": bool,
68
+ "info": bool,
69
+ "quiet": bool,
70
+ "debug": bool,
71
+ "force": bool,
72
+ "nthreads": typing.NotRequired[int | None],
73
+ "config": typing.NotRequired[list[Sh2peaksConfigParamsDict] | None],
74
+ "help": bool,
75
+ "version": bool,
76
+ "SH": InputPathType,
77
+ "output": str,
78
+ })
79
+ Sh2peaksParamsDict = _Sh2peaksParamsDictNoTag | Sh2peaksParamsDictTagged
80
+
81
+
82
+ def sh2peaks_direction(
83
+ phi: float,
84
+ theta: float,
85
+ ) -> Sh2peaksDirectionParamsDictTagged:
86
+ """
87
+ Build parameters.
88
+
89
+ Args:
90
+ phi: the direction of a peak to estimate. The algorithm will attempt to\
91
+ find the same number of peaks as have been specified using this option.
92
+ theta: the direction of a peak to estimate. The algorithm will attempt\
93
+ to find the same number of peaks as have been specified using this\
94
+ option.
95
+ Returns:
96
+ Parameter dictionary
97
+ """
98
+ params = {
99
+ "@type": "direction",
100
+ "phi": phi,
101
+ "theta": theta,
102
+ }
103
+ return params
104
+
105
+
106
+ def sh2peaks_direction_validate(
107
+ params: typing.Any,
108
+ ) -> None:
109
+ """
110
+ Validate parameters. Throws an error if `params` is not a valid
111
+ `Sh2peaksDirectionParamsDict` object.
112
+
113
+ Args:
114
+ params: The parameters object to validate.
115
+ """
116
+ if params is None or not isinstance(params, dict):
117
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
118
+ if params.get("phi", None) is None:
119
+ raise StyxValidationError("`phi` must not be None")
120
+ if not isinstance(params["phi"], (float, int)):
121
+ raise StyxValidationError(f'`phi` has the wrong type: Received `{type(params.get("phi", None))}` expected `float`')
122
+ if params.get("theta", None) is None:
123
+ raise StyxValidationError("`theta` must not be None")
124
+ if not isinstance(params["theta"], (float, int)):
125
+ raise StyxValidationError(f'`theta` has the wrong type: Received `{type(params.get("theta", None))}` expected `float`')
126
+
127
+
128
+ def sh2peaks_direction_cargs(
129
+ params: Sh2peaksDirectionParamsDict,
130
+ execution: Execution,
131
+ ) -> list[str]:
132
+ """
133
+ Build command-line arguments from parameters.
134
+
135
+ Args:
136
+ params: The parameters.
137
+ execution: The execution object for resolving input paths.
138
+ Returns:
139
+ Command-line arguments.
140
+ """
141
+ cargs = []
142
+ cargs.append("-direction")
143
+ cargs.append(str(params.get("phi", None)))
144
+ cargs.append(str(params.get("theta", None)))
145
+ return cargs
146
+
147
+
148
+ def sh2peaks_config(
149
+ key: str,
150
+ value: str,
151
+ ) -> Sh2peaksConfigParamsDictTagged:
152
+ """
153
+ Build parameters.
154
+
155
+ Args:
156
+ key: temporarily set the value of an MRtrix config file entry.
157
+ value: temporarily set the value of an MRtrix config file entry.
158
+ Returns:
159
+ Parameter dictionary
160
+ """
161
+ params = {
162
+ "@type": "config",
163
+ "key": key,
164
+ "value": value,
165
+ }
166
+ return params
167
+
168
+
169
+ def sh2peaks_config_validate(
170
+ params: typing.Any,
171
+ ) -> None:
172
+ """
173
+ Validate parameters. Throws an error if `params` is not a valid
174
+ `Sh2peaksConfigParamsDict` object.
175
+
176
+ Args:
177
+ params: The parameters object to validate.
178
+ """
179
+ if params is None or not isinstance(params, dict):
180
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
181
+ if params.get("key", None) is None:
182
+ raise StyxValidationError("`key` must not be None")
183
+ if not isinstance(params["key"], str):
184
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
185
+ if params.get("value", None) is None:
186
+ raise StyxValidationError("`value` must not be None")
187
+ if not isinstance(params["value"], str):
188
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
189
+
190
+
191
+ def sh2peaks_config_cargs(
192
+ params: Sh2peaksConfigParamsDict,
193
+ execution: Execution,
194
+ ) -> list[str]:
195
+ """
196
+ Build command-line arguments from parameters.
197
+
198
+ Args:
199
+ params: The parameters.
200
+ execution: The execution object for resolving input paths.
201
+ Returns:
202
+ Command-line arguments.
203
+ """
204
+ cargs = []
205
+ cargs.append("-config")
206
+ cargs.append(params.get("key", None))
207
+ cargs.append(params.get("value", None))
208
+ return cargs
209
+
210
+
211
+ class Sh2peaksOutputs(typing.NamedTuple):
212
+ """
213
+ Output object returned when calling `Sh2peaksParamsDict(...)`.
214
+ """
215
+ root: OutputPathType
216
+ """Output root folder. This is the root folder for all outputs."""
217
+ output: OutputPathType
218
+ """the output image. Each volume corresponds to the x, y & z component of
219
+ each peak direction vector in turn."""
220
+
221
+
222
+ def sh2peaks_params(
223
+ sh: InputPathType,
224
+ output: str,
225
+ num: int | None = None,
226
+ direction: list[Sh2peaksDirectionParamsDict] | None = None,
227
+ peaks: InputPathType | None = None,
228
+ threshold: float | None = None,
229
+ seeds: InputPathType | None = None,
230
+ mask: InputPathType | None = None,
231
+ fast: bool = False,
232
+ info: bool = False,
233
+ quiet: bool = False,
234
+ debug: bool = False,
235
+ force: bool = False,
236
+ nthreads: int | None = None,
237
+ config: list[Sh2peaksConfigParamsDict] | None = None,
238
+ help_: bool = False,
239
+ version: bool = False,
240
+ ) -> Sh2peaksParamsDictTagged:
241
+ """
242
+ Build parameters.
243
+
244
+ Args:
245
+ sh: the input image of SH coefficients.
246
+ output: the output image. Each volume corresponds to the x, y & z\
247
+ component of each peak direction vector in turn.
248
+ num: the number of peaks to extract (default: 3).
249
+ direction: the direction of a peak to estimate. The algorithm will\
250
+ attempt to find the same number of peaks as have been specified using\
251
+ this option.
252
+ peaks: the program will try to find the peaks that most closely match\
253
+ those in the image provided.
254
+ threshold: only peak amplitudes greater than the threshold will be\
255
+ considered.
256
+ seeds: specify a set of directions from which to start the multiple\
257
+ restarts of the optimisation (by default, the built-in 60 direction set\
258
+ is used).
259
+ mask: only perform computation within the specified binary brain mask\
260
+ image.
261
+ fast: use lookup table to compute associated Legendre polynomials\
262
+ (faster, but approximate).
263
+ info: display information messages.
264
+ quiet: do not display information messages or progress status;\
265
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
266
+ environment variable to a non-empty string.
267
+ debug: display debugging messages.
268
+ force: force overwrite of output files (caution: using the same file as\
269
+ input and output might cause unexpected behaviour).
270
+ nthreads: use this number of threads in multi-threaded applications\
271
+ (set to 0 to disable multi-threading).
272
+ config: temporarily set the value of an MRtrix config file entry.
273
+ help_: display this information page and exit.
274
+ version: display version information and exit.
275
+ Returns:
276
+ Parameter dictionary
277
+ """
278
+ params = {
279
+ "@type": "mrtrix/sh2peaks",
280
+ "fast": fast,
281
+ "info": info,
282
+ "quiet": quiet,
283
+ "debug": debug,
284
+ "force": force,
285
+ "help": help_,
286
+ "version": version,
287
+ "SH": sh,
288
+ "output": output,
289
+ }
290
+ if num is not None:
291
+ params["num"] = num
292
+ if direction is not None:
293
+ params["direction"] = direction
294
+ if peaks is not None:
295
+ params["peaks"] = peaks
296
+ if threshold is not None:
297
+ params["threshold"] = threshold
298
+ if seeds is not None:
299
+ params["seeds"] = seeds
300
+ if mask is not None:
301
+ params["mask"] = mask
302
+ if nthreads is not None:
303
+ params["nthreads"] = nthreads
304
+ if config is not None:
305
+ params["config"] = config
306
+ return params
307
+
308
+
309
+ def sh2peaks_validate(
310
+ params: typing.Any,
311
+ ) -> None:
312
+ """
313
+ Validate parameters. Throws an error if `params` is not a valid
314
+ `Sh2peaksParamsDict` object.
315
+
316
+ Args:
317
+ params: The parameters object to validate.
318
+ """
319
+ if params is None or not isinstance(params, dict):
320
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
321
+ if params.get("num", None) is not None:
322
+ if not isinstance(params["num"], int):
323
+ raise StyxValidationError(f'`num` has the wrong type: Received `{type(params.get("num", None))}` expected `int | None`')
324
+ if params.get("direction", None) is not None:
325
+ if not isinstance(params["direction"], list):
326
+ raise StyxValidationError(f'`direction` has the wrong type: Received `{type(params.get("direction", None))}` expected `list[Sh2peaksDirectionParamsDict] | None`')
327
+ for e in params["direction"]:
328
+ sh2peaks_direction_validate(e)
329
+ if params.get("peaks", None) is not None:
330
+ if not isinstance(params["peaks"], (pathlib.Path, str)):
331
+ raise StyxValidationError(f'`peaks` has the wrong type: Received `{type(params.get("peaks", None))}` expected `InputPathType | None`')
332
+ if params.get("threshold", None) is not None:
333
+ if not isinstance(params["threshold"], (float, int)):
334
+ raise StyxValidationError(f'`threshold` has the wrong type: Received `{type(params.get("threshold", None))}` expected `float | None`')
335
+ if params.get("seeds", None) is not None:
336
+ if not isinstance(params["seeds"], (pathlib.Path, str)):
337
+ raise StyxValidationError(f'`seeds` has the wrong type: Received `{type(params.get("seeds", None))}` expected `InputPathType | None`')
338
+ if params.get("mask", None) is not None:
339
+ if not isinstance(params["mask"], (pathlib.Path, str)):
340
+ raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
341
+ if params.get("fast", False) is None:
342
+ raise StyxValidationError("`fast` must not be None")
343
+ if not isinstance(params["fast"], bool):
344
+ raise StyxValidationError(f'`fast` has the wrong type: Received `{type(params.get("fast", False))}` expected `bool`')
345
+ if params.get("info", False) is None:
346
+ raise StyxValidationError("`info` must not be None")
347
+ if not isinstance(params["info"], bool):
348
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
349
+ if params.get("quiet", False) is None:
350
+ raise StyxValidationError("`quiet` must not be None")
351
+ if not isinstance(params["quiet"], bool):
352
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
353
+ if params.get("debug", False) is None:
354
+ raise StyxValidationError("`debug` must not be None")
355
+ if not isinstance(params["debug"], bool):
356
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
357
+ if params.get("force", False) is None:
358
+ raise StyxValidationError("`force` must not be None")
359
+ if not isinstance(params["force"], bool):
360
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
361
+ if params.get("nthreads", None) is not None:
362
+ if not isinstance(params["nthreads"], int):
363
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
364
+ if params.get("config", None) is not None:
365
+ if not isinstance(params["config"], list):
366
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Sh2peaksConfigParamsDict] | None`')
367
+ for e in params["config"]:
368
+ sh2peaks_config_validate(e)
369
+ if params.get("help", False) is None:
370
+ raise StyxValidationError("`help` must not be None")
371
+ if not isinstance(params["help"], bool):
372
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
373
+ if params.get("version", False) is None:
374
+ raise StyxValidationError("`version` must not be None")
375
+ if not isinstance(params["version"], bool):
376
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
377
+ if params.get("SH", None) is None:
378
+ raise StyxValidationError("`SH` must not be None")
379
+ if not isinstance(params["SH"], (pathlib.Path, str)):
380
+ raise StyxValidationError(f'`SH` has the wrong type: Received `{type(params.get("SH", None))}` expected `InputPathType`')
381
+ if params.get("output", None) is None:
382
+ raise StyxValidationError("`output` must not be None")
383
+ if not isinstance(params["output"], str):
384
+ raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
385
+
386
+
387
+ def sh2peaks_cargs(
388
+ params: Sh2peaksParamsDict,
389
+ execution: Execution,
390
+ ) -> list[str]:
391
+ """
392
+ Build command-line arguments from parameters.
393
+
394
+ Args:
395
+ params: The parameters.
396
+ execution: The execution object for resolving input paths.
397
+ Returns:
398
+ Command-line arguments.
399
+ """
400
+ cargs = []
401
+ cargs.append("sh2peaks")
402
+ if params.get("num", None) is not None:
403
+ cargs.extend([
404
+ "-num",
405
+ str(params.get("num", None))
406
+ ])
407
+ if params.get("direction", None) is not None:
408
+ cargs.extend([a for c in [sh2peaks_direction_cargs(s, execution) for s in params.get("direction", None)] for a in c])
409
+ if params.get("peaks", None) is not None:
410
+ cargs.extend([
411
+ "-peaks",
412
+ execution.input_file(params.get("peaks", None))
413
+ ])
414
+ if params.get("threshold", None) is not None:
415
+ cargs.extend([
416
+ "-threshold",
417
+ str(params.get("threshold", None))
418
+ ])
419
+ if params.get("seeds", None) is not None:
420
+ cargs.extend([
421
+ "-seeds",
422
+ execution.input_file(params.get("seeds", None))
423
+ ])
424
+ if params.get("mask", None) is not None:
425
+ cargs.extend([
426
+ "-mask",
427
+ execution.input_file(params.get("mask", None))
428
+ ])
429
+ if params.get("fast", False):
430
+ cargs.append("-fast")
431
+ if params.get("info", False):
432
+ cargs.append("-info")
433
+ if params.get("quiet", False):
434
+ cargs.append("-quiet")
435
+ if params.get("debug", False):
436
+ cargs.append("-debug")
437
+ if params.get("force", False):
438
+ cargs.append("-force")
439
+ if params.get("nthreads", None) is not None:
440
+ cargs.extend([
441
+ "-nthreads",
442
+ str(params.get("nthreads", None))
443
+ ])
444
+ if params.get("config", None) is not None:
445
+ cargs.extend([a for c in [sh2peaks_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
446
+ if params.get("help", False):
447
+ cargs.append("-help")
448
+ if params.get("version", False):
449
+ cargs.append("-version")
450
+ cargs.append(execution.input_file(params.get("SH", None)))
451
+ cargs.append(params.get("output", None))
452
+ return cargs
453
+
454
+
455
+ def sh2peaks_outputs(
456
+ params: Sh2peaksParamsDict,
457
+ execution: Execution,
458
+ ) -> Sh2peaksOutputs:
459
+ """
460
+ Build outputs object containing output file paths and possibly stdout/stderr.
461
+
462
+ Args:
463
+ params: The parameters.
464
+ execution: The execution object for resolving input paths.
465
+ Returns:
466
+ Outputs object.
467
+ """
468
+ ret = Sh2peaksOutputs(
469
+ root=execution.output_file("."),
470
+ output=execution.output_file(params.get("output", None)),
471
+ )
472
+ return ret
473
+
474
+
475
+ def sh2peaks_execute(
476
+ params: Sh2peaksParamsDict,
477
+ runner: Runner | None = None,
478
+ ) -> Sh2peaksOutputs:
479
+ """
480
+ sh2peaks
481
+
482
+ Extract the peaks of a spherical harmonic function in each voxel.
483
+
484
+ Peaks of the spherical harmonic function in each voxel are located by
485
+ commencing a Newton search along each of a set of pre-specified directions
486
+
487
+ The spherical harmonic coefficients are stored according the conventions
488
+ described the main documentation, which can be found at the following link:
489
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
490
+
491
+ References:
492
+
493
+ Jeurissen, B.; Leemans, A.; Tournier, J.-D.; Jones, D.K.; Sijbers, J.
494
+ Investigating the prevalence of complex fiber configurations in white matter
495
+ tissue with diffusion magnetic resonance imaging. Human Brain Mapping, 2013,
496
+ 34(11), 2747-2766.
497
+
498
+ Author: MRTrix3 Developers
499
+
500
+ URL: https://www.mrtrix.org/
501
+
502
+ Args:
503
+ params: The parameters.
504
+ runner: Command runner.
505
+ Returns:
506
+ NamedTuple of outputs (described in `Sh2peaksOutputs`).
507
+ """
508
+ sh2peaks_validate(params)
509
+ runner = runner or get_global_runner()
510
+ execution = runner.start_execution(SH2PEAKS_METADATA)
511
+ params = execution.params(params)
512
+ cargs = sh2peaks_cargs(params, execution)
513
+ ret = sh2peaks_outputs(params, execution)
514
+ execution.run(cargs)
515
+ return ret
516
+
517
+
518
+ def sh2peaks(
519
+ sh: InputPathType,
520
+ output: str,
521
+ num: int | None = None,
522
+ direction: list[Sh2peaksDirectionParamsDict] | None = None,
523
+ peaks: InputPathType | None = None,
524
+ threshold: float | None = None,
525
+ seeds: InputPathType | None = None,
526
+ mask: InputPathType | None = None,
527
+ fast: bool = False,
528
+ info: bool = False,
529
+ quiet: bool = False,
530
+ debug: bool = False,
531
+ force: bool = False,
532
+ nthreads: int | None = None,
533
+ config: list[Sh2peaksConfigParamsDict] | None = None,
534
+ help_: bool = False,
535
+ version: bool = False,
536
+ runner: Runner | None = None,
537
+ ) -> Sh2peaksOutputs:
538
+ """
539
+ sh2peaks
540
+
541
+ Extract the peaks of a spherical harmonic function in each voxel.
542
+
543
+ Peaks of the spherical harmonic function in each voxel are located by
544
+ commencing a Newton search along each of a set of pre-specified directions
545
+
546
+ The spherical harmonic coefficients are stored according the conventions
547
+ described the main documentation, which can be found at the following link:
548
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
549
+
550
+ References:
551
+
552
+ Jeurissen, B.; Leemans, A.; Tournier, J.-D.; Jones, D.K.; Sijbers, J.
553
+ Investigating the prevalence of complex fiber configurations in white matter
554
+ tissue with diffusion magnetic resonance imaging. Human Brain Mapping, 2013,
555
+ 34(11), 2747-2766.
556
+
557
+ Author: MRTrix3 Developers
558
+
559
+ URL: https://www.mrtrix.org/
560
+
561
+ Args:
562
+ sh: the input image of SH coefficients.
563
+ output: the output image. Each volume corresponds to the x, y & z\
564
+ component of each peak direction vector in turn.
565
+ num: the number of peaks to extract (default: 3).
566
+ direction: the direction of a peak to estimate. The algorithm will\
567
+ attempt to find the same number of peaks as have been specified using\
568
+ this option.
569
+ peaks: the program will try to find the peaks that most closely match\
570
+ those in the image provided.
571
+ threshold: only peak amplitudes greater than the threshold will be\
572
+ considered.
573
+ seeds: specify a set of directions from which to start the multiple\
574
+ restarts of the optimisation (by default, the built-in 60 direction set\
575
+ is used).
576
+ mask: only perform computation within the specified binary brain mask\
577
+ image.
578
+ fast: use lookup table to compute associated Legendre polynomials\
579
+ (faster, but approximate).
580
+ info: display information messages.
581
+ quiet: do not display information messages or progress status;\
582
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
583
+ environment variable to a non-empty string.
584
+ debug: display debugging messages.
585
+ force: force overwrite of output files (caution: using the same file as\
586
+ input and output might cause unexpected behaviour).
587
+ nthreads: use this number of threads in multi-threaded applications\
588
+ (set to 0 to disable multi-threading).
589
+ config: temporarily set the value of an MRtrix config file entry.
590
+ help_: display this information page and exit.
591
+ version: display version information and exit.
592
+ runner: Command runner.
593
+ Returns:
594
+ NamedTuple of outputs (described in `Sh2peaksOutputs`).
595
+ """
596
+ params = sh2peaks_params(
597
+ num=num,
598
+ direction=direction,
599
+ peaks=peaks,
600
+ threshold=threshold,
601
+ seeds=seeds,
602
+ mask=mask,
603
+ fast=fast,
604
+ info=info,
605
+ quiet=quiet,
606
+ debug=debug,
607
+ force=force,
608
+ nthreads=nthreads,
609
+ config=config,
610
+ help_=help_,
611
+ version=version,
612
+ sh=sh,
613
+ output=output,
614
+ )
615
+ return sh2peaks_execute(params, runner)
616
+
617
+
618
+ __all__ = [
619
+ "SH2PEAKS_METADATA",
620
+ "Sh2peaksConfigParamsDict",
621
+ "Sh2peaksConfigParamsDictTagged",
622
+ "Sh2peaksDirectionParamsDict",
623
+ "Sh2peaksDirectionParamsDictTagged",
624
+ "Sh2peaksOutputs",
625
+ "Sh2peaksParamsDict",
626
+ "Sh2peaksParamsDictTagged",
627
+ "sh2peaks",
628
+ "sh2peaks_config",
629
+ "sh2peaks_direction",
630
+ "sh2peaks_execute",
631
+ "sh2peaks_params",
632
+ ]