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,775 @@
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
+ TCKCONVERT_METADATA = Metadata(
9
+ id="55a4f5691d675bdf7129499cb50a199b880d7c7a.boutiques",
10
+ name="tckconvert",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _TckconvertConfigParamsDictNoTag = typing.TypedDict('_TckconvertConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ TckconvertConfigParamsDictTagged = typing.TypedDict('TckconvertConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ TckconvertConfigParamsDict = _TckconvertConfigParamsDictNoTag | TckconvertConfigParamsDictTagged
26
+
27
+
28
+ _TckconvertVariousStringParamsDictNoTag = typing.TypedDict('_TckconvertVariousStringParamsDictNoTag', {
29
+ "obj": str,
30
+ })
31
+ TckconvertVariousStringParamsDictTagged = typing.TypedDict('TckconvertVariousStringParamsDictTagged', {
32
+ "@type": typing.Literal["VariousString"],
33
+ "obj": str,
34
+ })
35
+ TckconvertVariousStringParamsDict = _TckconvertVariousStringParamsDictNoTag | TckconvertVariousStringParamsDictTagged
36
+
37
+
38
+ _TckconvertVariousFileParamsDictNoTag = typing.TypedDict('_TckconvertVariousFileParamsDictNoTag', {
39
+ "obj": InputPathType,
40
+ })
41
+ TckconvertVariousFileParamsDictTagged = typing.TypedDict('TckconvertVariousFileParamsDictTagged', {
42
+ "@type": typing.Literal["VariousFile"],
43
+ "obj": InputPathType,
44
+ })
45
+ TckconvertVariousFileParamsDict = _TckconvertVariousFileParamsDictNoTag | TckconvertVariousFileParamsDictTagged
46
+
47
+
48
+ _TckconvertParamsDictNoTag = typing.TypedDict('_TckconvertParamsDictNoTag', {
49
+ "scanner2voxel": typing.NotRequired[InputPathType | None],
50
+ "scanner2image": typing.NotRequired[InputPathType | None],
51
+ "voxel2scanner": typing.NotRequired[InputPathType | None],
52
+ "image2scanner": typing.NotRequired[InputPathType | None],
53
+ "sides": typing.NotRequired[int | None],
54
+ "increment": typing.NotRequired[int | None],
55
+ "dec": bool,
56
+ "radius": typing.NotRequired[float | None],
57
+ "ascii": bool,
58
+ "binary": bool,
59
+ "info": bool,
60
+ "quiet": bool,
61
+ "debug": bool,
62
+ "force": bool,
63
+ "nthreads": typing.NotRequired[int | None],
64
+ "config": typing.NotRequired[list[TckconvertConfigParamsDict] | None],
65
+ "help": bool,
66
+ "version": bool,
67
+ "input": typing.Union[TckconvertVariousStringParamsDictTagged, TckconvertVariousFileParamsDictTagged],
68
+ "output": str,
69
+ })
70
+ TckconvertParamsDictTagged = typing.TypedDict('TckconvertParamsDictTagged', {
71
+ "@type": typing.Literal["mrtrix/tckconvert"],
72
+ "scanner2voxel": typing.NotRequired[InputPathType | None],
73
+ "scanner2image": typing.NotRequired[InputPathType | None],
74
+ "voxel2scanner": typing.NotRequired[InputPathType | None],
75
+ "image2scanner": typing.NotRequired[InputPathType | None],
76
+ "sides": typing.NotRequired[int | None],
77
+ "increment": typing.NotRequired[int | None],
78
+ "dec": bool,
79
+ "radius": typing.NotRequired[float | None],
80
+ "ascii": bool,
81
+ "binary": bool,
82
+ "info": bool,
83
+ "quiet": bool,
84
+ "debug": bool,
85
+ "force": bool,
86
+ "nthreads": typing.NotRequired[int | None],
87
+ "config": typing.NotRequired[list[TckconvertConfigParamsDict] | None],
88
+ "help": bool,
89
+ "version": bool,
90
+ "input": typing.Union[TckconvertVariousStringParamsDictTagged, TckconvertVariousFileParamsDictTagged],
91
+ "output": str,
92
+ })
93
+ TckconvertParamsDict = _TckconvertParamsDictNoTag | TckconvertParamsDictTagged
94
+
95
+
96
+ def tckconvert_input_cargs_dyn_fn(
97
+ t: str,
98
+ ) -> typing.Any:
99
+ """
100
+ Get build cargs function by command type.
101
+
102
+ Args:
103
+ t: Command type.
104
+ Returns:
105
+ Build cargs function.
106
+ """
107
+ return {
108
+ "VariousString": tckconvert_various_string_cargs,
109
+ "VariousFile": tckconvert_various_file_cargs,
110
+ }.get(t)
111
+
112
+
113
+ def tckconvert_input_validate_dyn_fn(
114
+ t: str,
115
+ ) -> typing.Any:
116
+ """
117
+ Get validate params function by command type.
118
+
119
+ Args:
120
+ t: Command type.
121
+ Returns:
122
+ Validate params function.
123
+ """
124
+ return {
125
+ "VariousString": tckconvert_various_string_validate,
126
+ "VariousFile": tckconvert_various_file_validate,
127
+ }.get(t)
128
+
129
+
130
+ def tckconvert_config(
131
+ key: str,
132
+ value: str,
133
+ ) -> TckconvertConfigParamsDictTagged:
134
+ """
135
+ Build parameters.
136
+
137
+ Args:
138
+ key: temporarily set the value of an MRtrix config file entry.
139
+ value: temporarily set the value of an MRtrix config file entry.
140
+ Returns:
141
+ Parameter dictionary
142
+ """
143
+ params = {
144
+ "@type": "config",
145
+ "key": key,
146
+ "value": value,
147
+ }
148
+ return params
149
+
150
+
151
+ def tckconvert_config_validate(
152
+ params: typing.Any,
153
+ ) -> None:
154
+ """
155
+ Validate parameters. Throws an error if `params` is not a valid
156
+ `TckconvertConfigParamsDict` object.
157
+
158
+ Args:
159
+ params: The parameters object to validate.
160
+ """
161
+ if params is None or not isinstance(params, dict):
162
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
163
+ if params.get("key", None) is None:
164
+ raise StyxValidationError("`key` must not be None")
165
+ if not isinstance(params["key"], str):
166
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
167
+ if params.get("value", None) is None:
168
+ raise StyxValidationError("`value` must not be None")
169
+ if not isinstance(params["value"], str):
170
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
171
+
172
+
173
+ def tckconvert_config_cargs(
174
+ params: TckconvertConfigParamsDict,
175
+ execution: Execution,
176
+ ) -> list[str]:
177
+ """
178
+ Build command-line arguments from parameters.
179
+
180
+ Args:
181
+ params: The parameters.
182
+ execution: The execution object for resolving input paths.
183
+ Returns:
184
+ Command-line arguments.
185
+ """
186
+ cargs = []
187
+ cargs.append("-config")
188
+ cargs.append(params.get("key", None))
189
+ cargs.append(params.get("value", None))
190
+ return cargs
191
+
192
+
193
+ def tckconvert_various_string(
194
+ obj: str,
195
+ ) -> TckconvertVariousStringParamsDictTagged:
196
+ """
197
+ Build parameters.
198
+
199
+ Args:
200
+ obj: String object.
201
+ Returns:
202
+ Parameter dictionary
203
+ """
204
+ params = {
205
+ "@type": "VariousString",
206
+ "obj": obj,
207
+ }
208
+ return params
209
+
210
+
211
+ def tckconvert_various_string_validate(
212
+ params: typing.Any,
213
+ ) -> None:
214
+ """
215
+ Validate parameters. Throws an error if `params` is not a valid
216
+ `TckconvertVariousStringParamsDict` object.
217
+
218
+ Args:
219
+ params: The parameters object to validate.
220
+ """
221
+ if params is None or not isinstance(params, dict):
222
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
223
+ if params.get("obj", None) is None:
224
+ raise StyxValidationError("`obj` must not be None")
225
+ if not isinstance(params["obj"], str):
226
+ raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `str`')
227
+
228
+
229
+ def tckconvert_various_string_cargs(
230
+ params: TckconvertVariousStringParamsDict,
231
+ execution: Execution,
232
+ ) -> list[str]:
233
+ """
234
+ Build command-line arguments from parameters.
235
+
236
+ Args:
237
+ params: The parameters.
238
+ execution: The execution object for resolving input paths.
239
+ Returns:
240
+ Command-line arguments.
241
+ """
242
+ cargs = []
243
+ cargs.append(params.get("obj", None))
244
+ return cargs
245
+
246
+
247
+ def tckconvert_various_file(
248
+ obj: InputPathType,
249
+ ) -> TckconvertVariousFileParamsDictTagged:
250
+ """
251
+ Build parameters.
252
+
253
+ Args:
254
+ obj: File object.
255
+ Returns:
256
+ Parameter dictionary
257
+ """
258
+ params = {
259
+ "@type": "VariousFile",
260
+ "obj": obj,
261
+ }
262
+ return params
263
+
264
+
265
+ def tckconvert_various_file_validate(
266
+ params: typing.Any,
267
+ ) -> None:
268
+ """
269
+ Validate parameters. Throws an error if `params` is not a valid
270
+ `TckconvertVariousFileParamsDict` object.
271
+
272
+ Args:
273
+ params: The parameters object to validate.
274
+ """
275
+ if params is None or not isinstance(params, dict):
276
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
277
+ if params.get("obj", None) is None:
278
+ raise StyxValidationError("`obj` must not be None")
279
+ if not isinstance(params["obj"], (pathlib.Path, str)):
280
+ raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `InputPathType`')
281
+
282
+
283
+ def tckconvert_various_file_cargs(
284
+ params: TckconvertVariousFileParamsDict,
285
+ execution: Execution,
286
+ ) -> list[str]:
287
+ """
288
+ Build command-line arguments from parameters.
289
+
290
+ Args:
291
+ params: The parameters.
292
+ execution: The execution object for resolving input paths.
293
+ Returns:
294
+ Command-line arguments.
295
+ """
296
+ cargs = []
297
+ cargs.append(execution.input_file(params.get("obj", None)))
298
+ return cargs
299
+
300
+
301
+ class TckconvertOutputs(typing.NamedTuple):
302
+ """
303
+ Output object returned when calling `TckconvertParamsDict(...)`.
304
+ """
305
+ root: OutputPathType
306
+ """Output root folder. This is the root folder for all outputs."""
307
+ output: OutputPathType
308
+ """the output track file."""
309
+
310
+
311
+ def tckconvert_params(
312
+ input_: typing.Union[TckconvertVariousStringParamsDictTagged, TckconvertVariousFileParamsDictTagged],
313
+ output: str,
314
+ scanner2voxel: InputPathType | None = None,
315
+ scanner2image: InputPathType | None = None,
316
+ voxel2scanner: InputPathType | None = None,
317
+ image2scanner: InputPathType | None = None,
318
+ sides: int | None = None,
319
+ increment: int | None = None,
320
+ dec: bool = False,
321
+ radius: float | None = None,
322
+ ascii_: bool = False,
323
+ binary: bool = False,
324
+ info: bool = False,
325
+ quiet: bool = False,
326
+ debug: bool = False,
327
+ force: bool = False,
328
+ nthreads: int | None = None,
329
+ config: list[TckconvertConfigParamsDict] | None = None,
330
+ help_: bool = False,
331
+ version: bool = False,
332
+ ) -> TckconvertParamsDictTagged:
333
+ """
334
+ Build parameters.
335
+
336
+ Args:
337
+ input_: the input track file.
338
+ output: the output track file.
339
+ scanner2voxel: if specified, the properties of this image will be used\
340
+ to convert track point positions from real (scanner) coordinates into\
341
+ voxel coordinates.
342
+ scanner2image: if specified, the properties of this image will be used\
343
+ to convert track point positions from real (scanner) coordinates into\
344
+ image coordinates (in mm).
345
+ voxel2scanner: if specified, the properties of this image will be used\
346
+ to convert track point positions from voxel coordinates into real\
347
+ (scanner) coordinates.
348
+ image2scanner: if specified, the properties of this image will be used\
349
+ to convert track point positions from image coordinates (in mm) into\
350
+ real (scanner) coordinates.
351
+ sides: number of sides for streamlines.
352
+ increment: generate streamline points at every (increment) points.
353
+ dec: add DEC as a primvar.
354
+ radius: radius of the streamlines.
355
+ ascii_: write an ASCII VTK file (this is the default).
356
+ binary: write a binary VTK file.
357
+ info: display information messages.
358
+ quiet: do not display information messages or progress status;\
359
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
360
+ environment variable to a non-empty string.
361
+ debug: display debugging messages.
362
+ force: force overwrite of output files (caution: using the same file as\
363
+ input and output might cause unexpected behaviour).
364
+ nthreads: use this number of threads in multi-threaded applications\
365
+ (set to 0 to disable multi-threading).
366
+ config: temporarily set the value of an MRtrix config file entry.
367
+ help_: display this information page and exit.
368
+ version: display version information and exit.
369
+ Returns:
370
+ Parameter dictionary
371
+ """
372
+ params = {
373
+ "@type": "mrtrix/tckconvert",
374
+ "dec": dec,
375
+ "ascii": ascii_,
376
+ "binary": binary,
377
+ "info": info,
378
+ "quiet": quiet,
379
+ "debug": debug,
380
+ "force": force,
381
+ "help": help_,
382
+ "version": version,
383
+ "input": input_,
384
+ "output": output,
385
+ }
386
+ if scanner2voxel is not None:
387
+ params["scanner2voxel"] = scanner2voxel
388
+ if scanner2image is not None:
389
+ params["scanner2image"] = scanner2image
390
+ if voxel2scanner is not None:
391
+ params["voxel2scanner"] = voxel2scanner
392
+ if image2scanner is not None:
393
+ params["image2scanner"] = image2scanner
394
+ if sides is not None:
395
+ params["sides"] = sides
396
+ if increment is not None:
397
+ params["increment"] = increment
398
+ if radius is not None:
399
+ params["radius"] = radius
400
+ if nthreads is not None:
401
+ params["nthreads"] = nthreads
402
+ if config is not None:
403
+ params["config"] = config
404
+ return params
405
+
406
+
407
+ def tckconvert_validate(
408
+ params: typing.Any,
409
+ ) -> None:
410
+ """
411
+ Validate parameters. Throws an error if `params` is not a valid
412
+ `TckconvertParamsDict` object.
413
+
414
+ Args:
415
+ params: The parameters object to validate.
416
+ """
417
+ if params is None or not isinstance(params, dict):
418
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
419
+ if params.get("scanner2voxel", None) is not None:
420
+ if not isinstance(params["scanner2voxel"], (pathlib.Path, str)):
421
+ raise StyxValidationError(f'`scanner2voxel` has the wrong type: Received `{type(params.get("scanner2voxel", None))}` expected `InputPathType | None`')
422
+ if params.get("scanner2image", None) is not None:
423
+ if not isinstance(params["scanner2image"], (pathlib.Path, str)):
424
+ raise StyxValidationError(f'`scanner2image` has the wrong type: Received `{type(params.get("scanner2image", None))}` expected `InputPathType | None`')
425
+ if params.get("voxel2scanner", None) is not None:
426
+ if not isinstance(params["voxel2scanner"], (pathlib.Path, str)):
427
+ raise StyxValidationError(f'`voxel2scanner` has the wrong type: Received `{type(params.get("voxel2scanner", None))}` expected `InputPathType | None`')
428
+ if params.get("image2scanner", None) is not None:
429
+ if not isinstance(params["image2scanner"], (pathlib.Path, str)):
430
+ raise StyxValidationError(f'`image2scanner` has the wrong type: Received `{type(params.get("image2scanner", None))}` expected `InputPathType | None`')
431
+ if params.get("sides", None) is not None:
432
+ if not isinstance(params["sides"], int):
433
+ raise StyxValidationError(f'`sides` has the wrong type: Received `{type(params.get("sides", None))}` expected `int | None`')
434
+ if params.get("increment", None) is not None:
435
+ if not isinstance(params["increment"], int):
436
+ raise StyxValidationError(f'`increment` has the wrong type: Received `{type(params.get("increment", None))}` expected `int | None`')
437
+ if params.get("dec", False) is None:
438
+ raise StyxValidationError("`dec` must not be None")
439
+ if not isinstance(params["dec"], bool):
440
+ raise StyxValidationError(f'`dec` has the wrong type: Received `{type(params.get("dec", False))}` expected `bool`')
441
+ if params.get("radius", None) is not None:
442
+ if not isinstance(params["radius"], (float, int)):
443
+ raise StyxValidationError(f'`radius` has the wrong type: Received `{type(params.get("radius", None))}` expected `float | None`')
444
+ if params.get("ascii", False) is None:
445
+ raise StyxValidationError("`ascii` must not be None")
446
+ if not isinstance(params["ascii"], bool):
447
+ raise StyxValidationError(f'`ascii` has the wrong type: Received `{type(params.get("ascii", False))}` expected `bool`')
448
+ if params.get("binary", False) is None:
449
+ raise StyxValidationError("`binary` must not be None")
450
+ if not isinstance(params["binary"], bool):
451
+ raise StyxValidationError(f'`binary` has the wrong type: Received `{type(params.get("binary", False))}` expected `bool`')
452
+ if params.get("info", False) is None:
453
+ raise StyxValidationError("`info` must not be None")
454
+ if not isinstance(params["info"], bool):
455
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
456
+ if params.get("quiet", False) is None:
457
+ raise StyxValidationError("`quiet` must not be None")
458
+ if not isinstance(params["quiet"], bool):
459
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
460
+ if params.get("debug", False) is None:
461
+ raise StyxValidationError("`debug` must not be None")
462
+ if not isinstance(params["debug"], bool):
463
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
464
+ if params.get("force", False) is None:
465
+ raise StyxValidationError("`force` must not be None")
466
+ if not isinstance(params["force"], bool):
467
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
468
+ if params.get("nthreads", None) is not None:
469
+ if not isinstance(params["nthreads"], int):
470
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
471
+ if params.get("config", None) is not None:
472
+ if not isinstance(params["config"], list):
473
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[TckconvertConfigParamsDict] | None`')
474
+ for e in params["config"]:
475
+ tckconvert_config_validate(e)
476
+ if params.get("help", False) is None:
477
+ raise StyxValidationError("`help` must not be None")
478
+ if not isinstance(params["help"], bool):
479
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
480
+ if params.get("version", False) is None:
481
+ raise StyxValidationError("`version` must not be None")
482
+ if not isinstance(params["version"], bool):
483
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
484
+ if params.get("input", None) is None:
485
+ raise StyxValidationError("`input` must not be None")
486
+ if not isinstance(params["input"], dict):
487
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params["input"])}\'')
488
+ if "@type" not in params["input"]:
489
+ raise StyxValidationError("Params object is missing `@type`")
490
+ if params["input"]["@type"] not in ["VariousString", "VariousFile"]:
491
+ raise StyxValidationError("Parameter `input`s `@type` must be one of [\"VariousString\", \"VariousFile\"]")
492
+ tckconvert_input_validate_dyn_fn(params["input"]["@type"])(params["input"])
493
+ if params.get("output", None) is None:
494
+ raise StyxValidationError("`output` must not be None")
495
+ if not isinstance(params["output"], str):
496
+ raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
497
+
498
+
499
+ def tckconvert_cargs(
500
+ params: TckconvertParamsDict,
501
+ execution: Execution,
502
+ ) -> list[str]:
503
+ """
504
+ Build command-line arguments from parameters.
505
+
506
+ Args:
507
+ params: The parameters.
508
+ execution: The execution object for resolving input paths.
509
+ Returns:
510
+ Command-line arguments.
511
+ """
512
+ cargs = []
513
+ cargs.append("tckconvert")
514
+ if params.get("scanner2voxel", None) is not None:
515
+ cargs.extend([
516
+ "-scanner2voxel",
517
+ execution.input_file(params.get("scanner2voxel", None))
518
+ ])
519
+ if params.get("scanner2image", None) is not None:
520
+ cargs.extend([
521
+ "-scanner2image",
522
+ execution.input_file(params.get("scanner2image", None))
523
+ ])
524
+ if params.get("voxel2scanner", None) is not None:
525
+ cargs.extend([
526
+ "-voxel2scanner",
527
+ execution.input_file(params.get("voxel2scanner", None))
528
+ ])
529
+ if params.get("image2scanner", None) is not None:
530
+ cargs.extend([
531
+ "-image2scanner",
532
+ execution.input_file(params.get("image2scanner", None))
533
+ ])
534
+ if params.get("sides", None) is not None:
535
+ cargs.extend([
536
+ "-sides",
537
+ str(params.get("sides", None))
538
+ ])
539
+ if params.get("increment", None) is not None:
540
+ cargs.extend([
541
+ "-increment",
542
+ str(params.get("increment", None))
543
+ ])
544
+ if params.get("dec", False):
545
+ cargs.append("-dec")
546
+ if params.get("radius", None) is not None:
547
+ cargs.extend([
548
+ "-radius",
549
+ str(params.get("radius", None))
550
+ ])
551
+ if params.get("ascii", False):
552
+ cargs.append("-ascii")
553
+ if params.get("binary", False):
554
+ cargs.append("-binary")
555
+ if params.get("info", False):
556
+ cargs.append("-info")
557
+ if params.get("quiet", False):
558
+ cargs.append("-quiet")
559
+ if params.get("debug", False):
560
+ cargs.append("-debug")
561
+ if params.get("force", False):
562
+ cargs.append("-force")
563
+ if params.get("nthreads", None) is not None:
564
+ cargs.extend([
565
+ "-nthreads",
566
+ str(params.get("nthreads", None))
567
+ ])
568
+ if params.get("config", None) is not None:
569
+ cargs.extend([a for c in [tckconvert_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
570
+ if params.get("help", False):
571
+ cargs.append("-help")
572
+ if params.get("version", False):
573
+ cargs.append("-version")
574
+ cargs.extend(tckconvert_input_cargs_dyn_fn(params.get("input", None)["@type"])(params.get("input", None), execution))
575
+ cargs.append(params.get("output", None))
576
+ return cargs
577
+
578
+
579
+ def tckconvert_outputs(
580
+ params: TckconvertParamsDict,
581
+ execution: Execution,
582
+ ) -> TckconvertOutputs:
583
+ """
584
+ Build outputs object containing output file paths and possibly stdout/stderr.
585
+
586
+ Args:
587
+ params: The parameters.
588
+ execution: The execution object for resolving input paths.
589
+ Returns:
590
+ Outputs object.
591
+ """
592
+ ret = TckconvertOutputs(
593
+ root=execution.output_file("."),
594
+ output=execution.output_file(params.get("output", None)),
595
+ )
596
+ return ret
597
+
598
+
599
+ def tckconvert_execute(
600
+ params: TckconvertParamsDict,
601
+ runner: Runner | None = None,
602
+ ) -> TckconvertOutputs:
603
+ """
604
+ tckconvert
605
+
606
+ Convert between different track file formats.
607
+
608
+ The program currently supports MRtrix .tck files (input/output), ascii text
609
+ files (input/output), VTK polydata files (input/output), and RenderMan RIB
610
+ (export only).
611
+
612
+ Note that ascii files will be stored with one streamline per numbered file.
613
+ To support this, the command will use the multi-file numbering syntax, where
614
+ square brackets denote the position of the numbering for the files, for
615
+ example:
616
+
617
+ $ tckconvert input.tck output-'[]'.txt
618
+
619
+ will produce files named output-0000.txt, output-0001.txt, output-0002.txt,
620
+ ...
621
+
622
+ References:
623
+
624
+ .
625
+
626
+ Author: MRTrix3 Developers
627
+
628
+ URL: https://www.mrtrix.org/
629
+
630
+ Args:
631
+ params: The parameters.
632
+ runner: Command runner.
633
+ Returns:
634
+ NamedTuple of outputs (described in `TckconvertOutputs`).
635
+ """
636
+ tckconvert_validate(params)
637
+ runner = runner or get_global_runner()
638
+ execution = runner.start_execution(TCKCONVERT_METADATA)
639
+ params = execution.params(params)
640
+ cargs = tckconvert_cargs(params, execution)
641
+ ret = tckconvert_outputs(params, execution)
642
+ execution.run(cargs)
643
+ return ret
644
+
645
+
646
+ def tckconvert(
647
+ input_: typing.Union[TckconvertVariousStringParamsDictTagged, TckconvertVariousFileParamsDictTagged],
648
+ output: str,
649
+ scanner2voxel: InputPathType | None = None,
650
+ scanner2image: InputPathType | None = None,
651
+ voxel2scanner: InputPathType | None = None,
652
+ image2scanner: InputPathType | None = None,
653
+ sides: int | None = None,
654
+ increment: int | None = None,
655
+ dec: bool = False,
656
+ radius: float | None = None,
657
+ ascii_: bool = False,
658
+ binary: bool = False,
659
+ info: bool = False,
660
+ quiet: bool = False,
661
+ debug: bool = False,
662
+ force: bool = False,
663
+ nthreads: int | None = None,
664
+ config: list[TckconvertConfigParamsDict] | None = None,
665
+ help_: bool = False,
666
+ version: bool = False,
667
+ runner: Runner | None = None,
668
+ ) -> TckconvertOutputs:
669
+ """
670
+ tckconvert
671
+
672
+ Convert between different track file formats.
673
+
674
+ The program currently supports MRtrix .tck files (input/output), ascii text
675
+ files (input/output), VTK polydata files (input/output), and RenderMan RIB
676
+ (export only).
677
+
678
+ Note that ascii files will be stored with one streamline per numbered file.
679
+ To support this, the command will use the multi-file numbering syntax, where
680
+ square brackets denote the position of the numbering for the files, for
681
+ example:
682
+
683
+ $ tckconvert input.tck output-'[]'.txt
684
+
685
+ will produce files named output-0000.txt, output-0001.txt, output-0002.txt,
686
+ ...
687
+
688
+ References:
689
+
690
+ .
691
+
692
+ Author: MRTrix3 Developers
693
+
694
+ URL: https://www.mrtrix.org/
695
+
696
+ Args:
697
+ input_: the input track file.
698
+ output: the output track file.
699
+ scanner2voxel: if specified, the properties of this image will be used\
700
+ to convert track point positions from real (scanner) coordinates into\
701
+ voxel coordinates.
702
+ scanner2image: if specified, the properties of this image will be used\
703
+ to convert track point positions from real (scanner) coordinates into\
704
+ image coordinates (in mm).
705
+ voxel2scanner: if specified, the properties of this image will be used\
706
+ to convert track point positions from voxel coordinates into real\
707
+ (scanner) coordinates.
708
+ image2scanner: if specified, the properties of this image will be used\
709
+ to convert track point positions from image coordinates (in mm) into\
710
+ real (scanner) coordinates.
711
+ sides: number of sides for streamlines.
712
+ increment: generate streamline points at every (increment) points.
713
+ dec: add DEC as a primvar.
714
+ radius: radius of the streamlines.
715
+ ascii_: write an ASCII VTK file (this is the default).
716
+ binary: write a binary VTK file.
717
+ info: display information messages.
718
+ quiet: do not display information messages or progress status;\
719
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
720
+ environment variable to a non-empty string.
721
+ debug: display debugging messages.
722
+ force: force overwrite of output files (caution: using the same file as\
723
+ input and output might cause unexpected behaviour).
724
+ nthreads: use this number of threads in multi-threaded applications\
725
+ (set to 0 to disable multi-threading).
726
+ config: temporarily set the value of an MRtrix config file entry.
727
+ help_: display this information page and exit.
728
+ version: display version information and exit.
729
+ runner: Command runner.
730
+ Returns:
731
+ NamedTuple of outputs (described in `TckconvertOutputs`).
732
+ """
733
+ params = tckconvert_params(
734
+ scanner2voxel=scanner2voxel,
735
+ scanner2image=scanner2image,
736
+ voxel2scanner=voxel2scanner,
737
+ image2scanner=image2scanner,
738
+ sides=sides,
739
+ increment=increment,
740
+ dec=dec,
741
+ radius=radius,
742
+ ascii_=ascii_,
743
+ binary=binary,
744
+ info=info,
745
+ quiet=quiet,
746
+ debug=debug,
747
+ force=force,
748
+ nthreads=nthreads,
749
+ config=config,
750
+ help_=help_,
751
+ version=version,
752
+ input_=input_,
753
+ output=output,
754
+ )
755
+ return tckconvert_execute(params, runner)
756
+
757
+
758
+ __all__ = [
759
+ "TCKCONVERT_METADATA",
760
+ "TckconvertConfigParamsDict",
761
+ "TckconvertConfigParamsDictTagged",
762
+ "TckconvertOutputs",
763
+ "TckconvertParamsDict",
764
+ "TckconvertParamsDictTagged",
765
+ "TckconvertVariousFileParamsDict",
766
+ "TckconvertVariousFileParamsDictTagged",
767
+ "TckconvertVariousStringParamsDict",
768
+ "TckconvertVariousStringParamsDictTagged",
769
+ "tckconvert",
770
+ "tckconvert_config",
771
+ "tckconvert_execute",
772
+ "tckconvert_params",
773
+ "tckconvert_various_file",
774
+ "tckconvert_various_string",
775
+ ]