niwrap-mrtrix 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of niwrap-mrtrix might be problematic. Click here for more details.

Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +130 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +453 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +362 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +423 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +347 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +530 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +351 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +344 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +336 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +382 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +351 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +546 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +413 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +427 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +316 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +353 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +394 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +373 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +498 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +772 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +580 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +404 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +592 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +441 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +356 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
  117. niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,1423 @@
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
+ MRCONVERT_METADATA = Metadata(
9
+ id="698958e49f436a4dfeb7113aafd856076c1a7be7.boutiques",
10
+ name="mrconvert",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ MrconvertCoordParameters = typing.TypedDict('MrconvertCoordParameters', {
17
+ "__STYX_TYPE__": typing.Literal["coord"],
18
+ "axis": int,
19
+ "selection": list[int],
20
+ })
21
+
22
+
23
+ MrconvertClearPropertyParameters = typing.TypedDict('MrconvertClearPropertyParameters', {
24
+ "__STYX_TYPE__": typing.Literal["clear_property"],
25
+ "key": str,
26
+ })
27
+
28
+
29
+ MrconvertSetPropertyParameters = typing.TypedDict('MrconvertSetPropertyParameters', {
30
+ "__STYX_TYPE__": typing.Literal["set_property"],
31
+ "key": str,
32
+ "value": str,
33
+ })
34
+
35
+
36
+ MrconvertAppendPropertyParameters = typing.TypedDict('MrconvertAppendPropertyParameters', {
37
+ "__STYX_TYPE__": typing.Literal["append_property"],
38
+ "key": str,
39
+ "value": str,
40
+ })
41
+
42
+
43
+ MrconvertVariousStringParameters = typing.TypedDict('MrconvertVariousStringParameters', {
44
+ "__STYX_TYPE__": typing.Literal["VariousString"],
45
+ "obj": str,
46
+ })
47
+
48
+
49
+ MrconvertVariousFileParameters = typing.TypedDict('MrconvertVariousFileParameters', {
50
+ "__STYX_TYPE__": typing.Literal["VariousFile"],
51
+ "obj": InputPathType,
52
+ })
53
+
54
+
55
+ MrconvertVariousString1Parameters = typing.TypedDict('MrconvertVariousString1Parameters', {
56
+ "__STYX_TYPE__": typing.Literal["VariousString_1"],
57
+ "obj": str,
58
+ })
59
+
60
+
61
+ MrconvertVariousFile1Parameters = typing.TypedDict('MrconvertVariousFile1Parameters', {
62
+ "__STYX_TYPE__": typing.Literal["VariousFile_1"],
63
+ "obj": InputPathType,
64
+ })
65
+
66
+
67
+ MrconvertFslgradParameters = typing.TypedDict('MrconvertFslgradParameters', {
68
+ "__STYX_TYPE__": typing.Literal["fslgrad"],
69
+ "bvecs": InputPathType,
70
+ "bvals": InputPathType,
71
+ })
72
+
73
+
74
+ MrconvertExportGradFslParameters = typing.TypedDict('MrconvertExportGradFslParameters', {
75
+ "__STYX_TYPE__": typing.Literal["export_grad_fsl"],
76
+ "bvecs_path": str,
77
+ "bvals_path": str,
78
+ })
79
+
80
+
81
+ MrconvertImportPeEddyParameters = typing.TypedDict('MrconvertImportPeEddyParameters', {
82
+ "__STYX_TYPE__": typing.Literal["import_pe_eddy"],
83
+ "config": InputPathType,
84
+ "indices": InputPathType,
85
+ })
86
+
87
+
88
+ MrconvertExportPeEddyParameters = typing.TypedDict('MrconvertExportPeEddyParameters', {
89
+ "__STYX_TYPE__": typing.Literal["export_pe_eddy"],
90
+ "config": str,
91
+ "indices": str,
92
+ })
93
+
94
+
95
+ MrconvertConfigParameters = typing.TypedDict('MrconvertConfigParameters', {
96
+ "__STYX_TYPE__": typing.Literal["config"],
97
+ "key": str,
98
+ "value": str,
99
+ })
100
+
101
+
102
+ MrconvertParameters = typing.TypedDict('MrconvertParameters', {
103
+ "__STYX_TYPE__": typing.Literal["mrconvert"],
104
+ "coord": typing.NotRequired[list[MrconvertCoordParameters] | None],
105
+ "vox": typing.NotRequired[list[float] | None],
106
+ "axes": typing.NotRequired[list[int] | None],
107
+ "scaling": typing.NotRequired[list[float] | None],
108
+ "json_import": typing.NotRequired[InputPathType | None],
109
+ "json_export": typing.NotRequired[str | None],
110
+ "clear_property": typing.NotRequired[list[MrconvertClearPropertyParameters] | None],
111
+ "set_property": typing.NotRequired[list[MrconvertSetPropertyParameters] | None],
112
+ "append_property": typing.NotRequired[list[MrconvertAppendPropertyParameters] | None],
113
+ "copy_properties": typing.NotRequired[typing.Union[MrconvertVariousStringParameters, MrconvertVariousFileParameters] | None],
114
+ "strides": typing.NotRequired[typing.Union[MrconvertVariousString1Parameters, MrconvertVariousFile1Parameters] | None],
115
+ "datatype": typing.NotRequired[str | None],
116
+ "grad": typing.NotRequired[InputPathType | None],
117
+ "fslgrad": typing.NotRequired[MrconvertFslgradParameters | None],
118
+ "bvalue_scaling": typing.NotRequired[str | None],
119
+ "export_grad_mrtrix": typing.NotRequired[str | None],
120
+ "export_grad_fsl": typing.NotRequired[MrconvertExportGradFslParameters | None],
121
+ "import_pe_table": typing.NotRequired[InputPathType | None],
122
+ "import_pe_eddy": typing.NotRequired[MrconvertImportPeEddyParameters | None],
123
+ "export_pe_table": typing.NotRequired[str | None],
124
+ "export_pe_eddy": typing.NotRequired[MrconvertExportPeEddyParameters | None],
125
+ "info": bool,
126
+ "quiet": bool,
127
+ "debug": bool,
128
+ "force": bool,
129
+ "nthreads": typing.NotRequired[int | None],
130
+ "config": typing.NotRequired[list[MrconvertConfigParameters] | None],
131
+ "help": bool,
132
+ "version": bool,
133
+ "input": InputPathType,
134
+ "output": str,
135
+ })
136
+
137
+
138
+ def dyn_cargs(
139
+ t: str,
140
+ ) -> typing.Any:
141
+ """
142
+ Get build cargs function by command type.
143
+
144
+ Args:
145
+ t: Command type.
146
+ Returns:
147
+ Build cargs function.
148
+ """
149
+ return {
150
+ "mrconvert": mrconvert_cargs,
151
+ "coord": mrconvert_coord_cargs,
152
+ "clear_property": mrconvert_clear_property_cargs,
153
+ "set_property": mrconvert_set_property_cargs,
154
+ "append_property": mrconvert_append_property_cargs,
155
+ "VariousString": mrconvert_various_string_cargs,
156
+ "VariousFile": mrconvert_various_file_cargs,
157
+ "VariousString_1": mrconvert_various_string_1_cargs,
158
+ "VariousFile_1": mrconvert_various_file_1_cargs,
159
+ "fslgrad": mrconvert_fslgrad_cargs,
160
+ "export_grad_fsl": mrconvert_export_grad_fsl_cargs,
161
+ "import_pe_eddy": mrconvert_import_pe_eddy_cargs,
162
+ "export_pe_eddy": mrconvert_export_pe_eddy_cargs,
163
+ "config": mrconvert_config_cargs,
164
+ }.get(t)
165
+
166
+
167
+ def dyn_outputs(
168
+ t: str,
169
+ ) -> typing.Any:
170
+ """
171
+ Get build outputs function by command type.
172
+
173
+ Args:
174
+ t: Command type.
175
+ Returns:
176
+ Build outputs function.
177
+ """
178
+ return {
179
+ "mrconvert": mrconvert_outputs,
180
+ "export_grad_fsl": mrconvert_export_grad_fsl_outputs,
181
+ "export_pe_eddy": mrconvert_export_pe_eddy_outputs,
182
+ }.get(t)
183
+
184
+
185
+ def mrconvert_coord_params(
186
+ axis: int,
187
+ selection: list[int],
188
+ ) -> MrconvertCoordParameters:
189
+ """
190
+ Build parameters.
191
+
192
+ Args:
193
+ axis: retain data from the input image only at the coordinates\
194
+ specified in the selection along the specified axis. The selection\
195
+ argument expects a number sequence, which can also include the 'end'\
196
+ keyword.
197
+ selection: retain data from the input image only at the coordinates\
198
+ specified in the selection along the specified axis. The selection\
199
+ argument expects a number sequence, which can also include the 'end'\
200
+ keyword.
201
+ Returns:
202
+ Parameter dictionary
203
+ """
204
+ params = {
205
+ "__STYXTYPE__": "coord",
206
+ "axis": axis,
207
+ "selection": selection,
208
+ }
209
+ return params
210
+
211
+
212
+ def mrconvert_coord_cargs(
213
+ params: MrconvertCoordParameters,
214
+ execution: Execution,
215
+ ) -> list[str]:
216
+ """
217
+ Build command-line arguments from parameters.
218
+
219
+ Args:
220
+ params: The parameters.
221
+ execution: The execution object for resolving input paths.
222
+ Returns:
223
+ Command-line arguments.
224
+ """
225
+ cargs = []
226
+ cargs.append("-coord")
227
+ cargs.append(str(params.get("axis")))
228
+ cargs.extend(map(str, params.get("selection")))
229
+ return cargs
230
+
231
+
232
+ def mrconvert_clear_property_params(
233
+ key: str,
234
+ ) -> MrconvertClearPropertyParameters:
235
+ """
236
+ Build parameters.
237
+
238
+ Args:
239
+ key: remove the specified key from the image header altogether.
240
+ Returns:
241
+ Parameter dictionary
242
+ """
243
+ params = {
244
+ "__STYXTYPE__": "clear_property",
245
+ "key": key,
246
+ }
247
+ return params
248
+
249
+
250
+ def mrconvert_clear_property_cargs(
251
+ params: MrconvertClearPropertyParameters,
252
+ execution: Execution,
253
+ ) -> list[str]:
254
+ """
255
+ Build command-line arguments from parameters.
256
+
257
+ Args:
258
+ params: The parameters.
259
+ execution: The execution object for resolving input paths.
260
+ Returns:
261
+ Command-line arguments.
262
+ """
263
+ cargs = []
264
+ cargs.append("-clear_property")
265
+ cargs.append(params.get("key"))
266
+ return cargs
267
+
268
+
269
+ def mrconvert_set_property_params(
270
+ key: str,
271
+ value: str,
272
+ ) -> MrconvertSetPropertyParameters:
273
+ """
274
+ Build parameters.
275
+
276
+ Args:
277
+ key: set the value of the specified key in the image header.
278
+ value: set the value of the specified key in the image header.
279
+ Returns:
280
+ Parameter dictionary
281
+ """
282
+ params = {
283
+ "__STYXTYPE__": "set_property",
284
+ "key": key,
285
+ "value": value,
286
+ }
287
+ return params
288
+
289
+
290
+ def mrconvert_set_property_cargs(
291
+ params: MrconvertSetPropertyParameters,
292
+ execution: Execution,
293
+ ) -> list[str]:
294
+ """
295
+ Build command-line arguments from parameters.
296
+
297
+ Args:
298
+ params: The parameters.
299
+ execution: The execution object for resolving input paths.
300
+ Returns:
301
+ Command-line arguments.
302
+ """
303
+ cargs = []
304
+ cargs.append("-set_property")
305
+ cargs.append(params.get("key"))
306
+ cargs.append(params.get("value"))
307
+ return cargs
308
+
309
+
310
+ def mrconvert_append_property_params(
311
+ key: str,
312
+ value: str,
313
+ ) -> MrconvertAppendPropertyParameters:
314
+ """
315
+ Build parameters.
316
+
317
+ Args:
318
+ key: append the given value to the specified key in the image header\
319
+ (this adds the value specified as a new line in the header value).
320
+ value: append the given value to the specified key in the image header\
321
+ (this adds the value specified as a new line in the header value).
322
+ Returns:
323
+ Parameter dictionary
324
+ """
325
+ params = {
326
+ "__STYXTYPE__": "append_property",
327
+ "key": key,
328
+ "value": value,
329
+ }
330
+ return params
331
+
332
+
333
+ def mrconvert_append_property_cargs(
334
+ params: MrconvertAppendPropertyParameters,
335
+ execution: Execution,
336
+ ) -> list[str]:
337
+ """
338
+ Build command-line arguments from parameters.
339
+
340
+ Args:
341
+ params: The parameters.
342
+ execution: The execution object for resolving input paths.
343
+ Returns:
344
+ Command-line arguments.
345
+ """
346
+ cargs = []
347
+ cargs.append("-append_property")
348
+ cargs.append(params.get("key"))
349
+ cargs.append(params.get("value"))
350
+ return cargs
351
+
352
+
353
+ def mrconvert_various_string_params(
354
+ obj: str,
355
+ ) -> MrconvertVariousStringParameters:
356
+ """
357
+ Build parameters.
358
+
359
+ Args:
360
+ obj: String object.
361
+ Returns:
362
+ Parameter dictionary
363
+ """
364
+ params = {
365
+ "__STYXTYPE__": "VariousString",
366
+ "obj": obj,
367
+ }
368
+ return params
369
+
370
+
371
+ def mrconvert_various_string_cargs(
372
+ params: MrconvertVariousStringParameters,
373
+ execution: Execution,
374
+ ) -> list[str]:
375
+ """
376
+ Build command-line arguments from parameters.
377
+
378
+ Args:
379
+ params: The parameters.
380
+ execution: The execution object for resolving input paths.
381
+ Returns:
382
+ Command-line arguments.
383
+ """
384
+ cargs = []
385
+ cargs.append(params.get("obj"))
386
+ return cargs
387
+
388
+
389
+ def mrconvert_various_file_params(
390
+ obj: InputPathType,
391
+ ) -> MrconvertVariousFileParameters:
392
+ """
393
+ Build parameters.
394
+
395
+ Args:
396
+ obj: File object.
397
+ Returns:
398
+ Parameter dictionary
399
+ """
400
+ params = {
401
+ "__STYXTYPE__": "VariousFile",
402
+ "obj": obj,
403
+ }
404
+ return params
405
+
406
+
407
+ def mrconvert_various_file_cargs(
408
+ params: MrconvertVariousFileParameters,
409
+ execution: Execution,
410
+ ) -> list[str]:
411
+ """
412
+ Build command-line arguments from parameters.
413
+
414
+ Args:
415
+ params: The parameters.
416
+ execution: The execution object for resolving input paths.
417
+ Returns:
418
+ Command-line arguments.
419
+ """
420
+ cargs = []
421
+ cargs.append(execution.input_file(params.get("obj")))
422
+ return cargs
423
+
424
+
425
+ def mrconvert_various_string_1_params(
426
+ obj: str,
427
+ ) -> MrconvertVariousString1Parameters:
428
+ """
429
+ Build parameters.
430
+
431
+ Args:
432
+ obj: String object.
433
+ Returns:
434
+ Parameter dictionary
435
+ """
436
+ params = {
437
+ "__STYXTYPE__": "VariousString_1",
438
+ "obj": obj,
439
+ }
440
+ return params
441
+
442
+
443
+ def mrconvert_various_string_1_cargs(
444
+ params: MrconvertVariousString1Parameters,
445
+ execution: Execution,
446
+ ) -> list[str]:
447
+ """
448
+ Build command-line arguments from parameters.
449
+
450
+ Args:
451
+ params: The parameters.
452
+ execution: The execution object for resolving input paths.
453
+ Returns:
454
+ Command-line arguments.
455
+ """
456
+ cargs = []
457
+ cargs.append(params.get("obj"))
458
+ return cargs
459
+
460
+
461
+ def mrconvert_various_file_1_params(
462
+ obj: InputPathType,
463
+ ) -> MrconvertVariousFile1Parameters:
464
+ """
465
+ Build parameters.
466
+
467
+ Args:
468
+ obj: File object.
469
+ Returns:
470
+ Parameter dictionary
471
+ """
472
+ params = {
473
+ "__STYXTYPE__": "VariousFile_1",
474
+ "obj": obj,
475
+ }
476
+ return params
477
+
478
+
479
+ def mrconvert_various_file_1_cargs(
480
+ params: MrconvertVariousFile1Parameters,
481
+ execution: Execution,
482
+ ) -> list[str]:
483
+ """
484
+ Build command-line arguments from parameters.
485
+
486
+ Args:
487
+ params: The parameters.
488
+ execution: The execution object for resolving input paths.
489
+ Returns:
490
+ Command-line arguments.
491
+ """
492
+ cargs = []
493
+ cargs.append(execution.input_file(params.get("obj")))
494
+ return cargs
495
+
496
+
497
+ def mrconvert_fslgrad_params(
498
+ bvecs: InputPathType,
499
+ bvals: InputPathType,
500
+ ) -> MrconvertFslgradParameters:
501
+ """
502
+ Build parameters.
503
+
504
+ Args:
505
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
506
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
507
+ scheme is present in the input image header, the data provided with\
508
+ this option will be instead used.
509
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
510
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
511
+ scheme is present in the input image header, the data provided with\
512
+ this option will be instead used.
513
+ Returns:
514
+ Parameter dictionary
515
+ """
516
+ params = {
517
+ "__STYXTYPE__": "fslgrad",
518
+ "bvecs": bvecs,
519
+ "bvals": bvals,
520
+ }
521
+ return params
522
+
523
+
524
+ def mrconvert_fslgrad_cargs(
525
+ params: MrconvertFslgradParameters,
526
+ execution: Execution,
527
+ ) -> list[str]:
528
+ """
529
+ Build command-line arguments from parameters.
530
+
531
+ Args:
532
+ params: The parameters.
533
+ execution: The execution object for resolving input paths.
534
+ Returns:
535
+ Command-line arguments.
536
+ """
537
+ cargs = []
538
+ cargs.append("-fslgrad")
539
+ cargs.append(execution.input_file(params.get("bvecs")))
540
+ cargs.append(execution.input_file(params.get("bvals")))
541
+ return cargs
542
+
543
+
544
+ class MrconvertExportGradFslOutputs(typing.NamedTuple):
545
+ """
546
+ Output object returned when calling `MrconvertExportGradFslParameters | None(...)`.
547
+ """
548
+ root: OutputPathType
549
+ """Output root folder. This is the root folder for all outputs."""
550
+ bvecs_path: OutputPathType
551
+ """export the diffusion-weighted gradient table to files in FSL (bvecs /
552
+ bvals) format"""
553
+ bvals_path: OutputPathType
554
+ """export the diffusion-weighted gradient table to files in FSL (bvecs /
555
+ bvals) format"""
556
+
557
+
558
+ def mrconvert_export_grad_fsl_params(
559
+ bvecs_path: str,
560
+ bvals_path: str,
561
+ ) -> MrconvertExportGradFslParameters:
562
+ """
563
+ Build parameters.
564
+
565
+ Args:
566
+ bvecs_path: export the diffusion-weighted gradient table to files in\
567
+ FSL (bvecs / bvals) format.
568
+ bvals_path: export the diffusion-weighted gradient table to files in\
569
+ FSL (bvecs / bvals) format.
570
+ Returns:
571
+ Parameter dictionary
572
+ """
573
+ params = {
574
+ "__STYXTYPE__": "export_grad_fsl",
575
+ "bvecs_path": bvecs_path,
576
+ "bvals_path": bvals_path,
577
+ }
578
+ return params
579
+
580
+
581
+ def mrconvert_export_grad_fsl_cargs(
582
+ params: MrconvertExportGradFslParameters,
583
+ execution: Execution,
584
+ ) -> list[str]:
585
+ """
586
+ Build command-line arguments from parameters.
587
+
588
+ Args:
589
+ params: The parameters.
590
+ execution: The execution object for resolving input paths.
591
+ Returns:
592
+ Command-line arguments.
593
+ """
594
+ cargs = []
595
+ cargs.append("-export_grad_fsl")
596
+ cargs.append(params.get("bvecs_path"))
597
+ cargs.append(params.get("bvals_path"))
598
+ return cargs
599
+
600
+
601
+ def mrconvert_export_grad_fsl_outputs(
602
+ params: MrconvertExportGradFslParameters,
603
+ execution: Execution,
604
+ ) -> MrconvertExportGradFslOutputs:
605
+ """
606
+ Build outputs object containing output file paths and possibly stdout/stderr.
607
+
608
+ Args:
609
+ params: The parameters.
610
+ execution: The execution object for resolving input paths.
611
+ Returns:
612
+ Outputs object.
613
+ """
614
+ ret = MrconvertExportGradFslOutputs(
615
+ root=execution.output_file("."),
616
+ bvecs_path=execution.output_file(params.get("bvecs_path")),
617
+ bvals_path=execution.output_file(params.get("bvals_path")),
618
+ )
619
+ return ret
620
+
621
+
622
+ def mrconvert_import_pe_eddy_params(
623
+ config: InputPathType,
624
+ indices: InputPathType,
625
+ ) -> MrconvertImportPeEddyParameters:
626
+ """
627
+ Build parameters.
628
+
629
+ Args:
630
+ config: import phase-encoding information from an EDDY-style config /\
631
+ index file pair.
632
+ indices: import phase-encoding information from an EDDY-style config /\
633
+ index file pair.
634
+ Returns:
635
+ Parameter dictionary
636
+ """
637
+ params = {
638
+ "__STYXTYPE__": "import_pe_eddy",
639
+ "config": config,
640
+ "indices": indices,
641
+ }
642
+ return params
643
+
644
+
645
+ def mrconvert_import_pe_eddy_cargs(
646
+ params: MrconvertImportPeEddyParameters,
647
+ execution: Execution,
648
+ ) -> list[str]:
649
+ """
650
+ Build command-line arguments from parameters.
651
+
652
+ Args:
653
+ params: The parameters.
654
+ execution: The execution object for resolving input paths.
655
+ Returns:
656
+ Command-line arguments.
657
+ """
658
+ cargs = []
659
+ cargs.append("-import_pe_eddy")
660
+ cargs.append(execution.input_file(params.get("config")))
661
+ cargs.append(execution.input_file(params.get("indices")))
662
+ return cargs
663
+
664
+
665
+ class MrconvertExportPeEddyOutputs(typing.NamedTuple):
666
+ """
667
+ Output object returned when calling `MrconvertExportPeEddyParameters | None(...)`.
668
+ """
669
+ root: OutputPathType
670
+ """Output root folder. This is the root folder for all outputs."""
671
+ config: OutputPathType
672
+ """export phase-encoding information to an EDDY-style config / index file
673
+ pair"""
674
+ indices: OutputPathType
675
+ """export phase-encoding information to an EDDY-style config / index file
676
+ pair"""
677
+
678
+
679
+ def mrconvert_export_pe_eddy_params(
680
+ config: str,
681
+ indices: str,
682
+ ) -> MrconvertExportPeEddyParameters:
683
+ """
684
+ Build parameters.
685
+
686
+ Args:
687
+ config: export phase-encoding information to an EDDY-style config /\
688
+ index file pair.
689
+ indices: export phase-encoding information to an EDDY-style config /\
690
+ index file pair.
691
+ Returns:
692
+ Parameter dictionary
693
+ """
694
+ params = {
695
+ "__STYXTYPE__": "export_pe_eddy",
696
+ "config": config,
697
+ "indices": indices,
698
+ }
699
+ return params
700
+
701
+
702
+ def mrconvert_export_pe_eddy_cargs(
703
+ params: MrconvertExportPeEddyParameters,
704
+ execution: Execution,
705
+ ) -> list[str]:
706
+ """
707
+ Build command-line arguments from parameters.
708
+
709
+ Args:
710
+ params: The parameters.
711
+ execution: The execution object for resolving input paths.
712
+ Returns:
713
+ Command-line arguments.
714
+ """
715
+ cargs = []
716
+ cargs.append("-export_pe_eddy")
717
+ cargs.append(params.get("config"))
718
+ cargs.append(params.get("indices"))
719
+ return cargs
720
+
721
+
722
+ def mrconvert_export_pe_eddy_outputs(
723
+ params: MrconvertExportPeEddyParameters,
724
+ execution: Execution,
725
+ ) -> MrconvertExportPeEddyOutputs:
726
+ """
727
+ Build outputs object containing output file paths and possibly stdout/stderr.
728
+
729
+ Args:
730
+ params: The parameters.
731
+ execution: The execution object for resolving input paths.
732
+ Returns:
733
+ Outputs object.
734
+ """
735
+ ret = MrconvertExportPeEddyOutputs(
736
+ root=execution.output_file("."),
737
+ config=execution.output_file(params.get("config")),
738
+ indices=execution.output_file(params.get("indices")),
739
+ )
740
+ return ret
741
+
742
+
743
+ def mrconvert_config_params(
744
+ key: str,
745
+ value: str,
746
+ ) -> MrconvertConfigParameters:
747
+ """
748
+ Build parameters.
749
+
750
+ Args:
751
+ key: temporarily set the value of an MRtrix config file entry.
752
+ value: temporarily set the value of an MRtrix config file entry.
753
+ Returns:
754
+ Parameter dictionary
755
+ """
756
+ params = {
757
+ "__STYXTYPE__": "config",
758
+ "key": key,
759
+ "value": value,
760
+ }
761
+ return params
762
+
763
+
764
+ def mrconvert_config_cargs(
765
+ params: MrconvertConfigParameters,
766
+ execution: Execution,
767
+ ) -> list[str]:
768
+ """
769
+ Build command-line arguments from parameters.
770
+
771
+ Args:
772
+ params: The parameters.
773
+ execution: The execution object for resolving input paths.
774
+ Returns:
775
+ Command-line arguments.
776
+ """
777
+ cargs = []
778
+ cargs.append("-config")
779
+ cargs.append(params.get("key"))
780
+ cargs.append(params.get("value"))
781
+ return cargs
782
+
783
+
784
+ class MrconvertOutputs(typing.NamedTuple):
785
+ """
786
+ Output object returned when calling `mrconvert(...)`.
787
+ """
788
+ root: OutputPathType
789
+ """Output root folder. This is the root folder for all outputs."""
790
+ output: OutputPathType
791
+ """the output image."""
792
+ json_export: OutputPathType | None
793
+ """export data from an image header key-value pairs into a JSON file """
794
+ export_grad_mrtrix: OutputPathType | None
795
+ """export the diffusion-weighted gradient table to file in MRtrix format """
796
+ export_pe_table: OutputPathType | None
797
+ """export phase-encoding table to file """
798
+ export_grad_fsl: MrconvertExportGradFslOutputs | None
799
+ """Outputs from `mrconvert_export_grad_fsl_outputs`."""
800
+ export_pe_eddy: MrconvertExportPeEddyOutputs | None
801
+ """Outputs from `mrconvert_export_pe_eddy_outputs`."""
802
+
803
+
804
+ def mrconvert_params(
805
+ input_: InputPathType,
806
+ output: str,
807
+ coord: list[MrconvertCoordParameters] | None = None,
808
+ vox: list[float] | None = None,
809
+ axes: list[int] | None = None,
810
+ scaling: list[float] | None = None,
811
+ json_import: InputPathType | None = None,
812
+ json_export: str | None = None,
813
+ clear_property: list[MrconvertClearPropertyParameters] | None = None,
814
+ set_property: list[MrconvertSetPropertyParameters] | None = None,
815
+ append_property: list[MrconvertAppendPropertyParameters] | None = None,
816
+ copy_properties: typing.Union[MrconvertVariousStringParameters, MrconvertVariousFileParameters] | None = None,
817
+ strides: typing.Union[MrconvertVariousString1Parameters, MrconvertVariousFile1Parameters] | None = None,
818
+ datatype: str | None = None,
819
+ grad: InputPathType | None = None,
820
+ fslgrad: MrconvertFslgradParameters | None = None,
821
+ bvalue_scaling: str | None = None,
822
+ export_grad_mrtrix: str | None = None,
823
+ export_grad_fsl: MrconvertExportGradFslParameters | None = None,
824
+ import_pe_table: InputPathType | None = None,
825
+ import_pe_eddy: MrconvertImportPeEddyParameters | None = None,
826
+ export_pe_table: str | None = None,
827
+ export_pe_eddy: MrconvertExportPeEddyParameters | None = None,
828
+ info: bool = False,
829
+ quiet: bool = False,
830
+ debug: bool = False,
831
+ force: bool = False,
832
+ nthreads: int | None = None,
833
+ config: list[MrconvertConfigParameters] | None = None,
834
+ help_: bool = False,
835
+ version: bool = False,
836
+ ) -> MrconvertParameters:
837
+ """
838
+ Build parameters.
839
+
840
+ Args:
841
+ input_: the input image.
842
+ output: the output image.
843
+ coord: retain data from the input image only at the coordinates\
844
+ specified in the selection along the specified axis. The selection\
845
+ argument expects a number sequence, which can also include the 'end'\
846
+ keyword.
847
+ vox: change the voxel dimensions reported in the output image header.
848
+ axes: specify the axes from the input image that will be used to form\
849
+ the output image.
850
+ scaling: specify the data scaling parameters used to rescale the\
851
+ intensity values.
852
+ json_import: import data from a JSON file into header key-value pairs.
853
+ json_export: export data from an image header key-value pairs into a\
854
+ JSON file.
855
+ clear_property: remove the specified key from the image header\
856
+ altogether.
857
+ set_property: set the value of the specified key in the image header.
858
+ append_property: append the given value to the specified key in the\
859
+ image header (this adds the value specified as a new line in the header\
860
+ value).
861
+ copy_properties: clear all generic properties and replace with the\
862
+ properties from the image / file specified.
863
+ strides: specify the strides of the output data in memory; either as a\
864
+ comma-separated list of (signed) integers, or as a template image from\
865
+ which the strides shall be extracted and used. The actual strides\
866
+ produced will depend on whether the output image format can support it.
867
+ datatype: specify output image data type. Valid choices are: float32,\
868
+ float32le, float32be, float64, float64le, float64be, int64, uint64,\
869
+ int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le,\
870
+ int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be,\
871
+ cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be,\
872
+ int8, uint8, bit.
873
+ grad: Provide the diffusion-weighted gradient scheme used in the\
874
+ acquisition in a text file. This should be supplied as a 4xN text file\
875
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
876
+ the direction of the applied gradient, and b gives the b-value in units\
877
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
878
+ header, the data provided with this option will be instead used.
879
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
880
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
881
+ scheme is present in the input image header, the data provided with\
882
+ this option will be instead used.
883
+ bvalue_scaling: enable or disable scaling of diffusion b-values by the\
884
+ square of the corresponding DW gradient norm (see Desciption). Valid\
885
+ choices are yes/no, true/false, 0/1 (default: automatic).
886
+ export_grad_mrtrix: export the diffusion-weighted gradient table to\
887
+ file in MRtrix format.
888
+ export_grad_fsl: export the diffusion-weighted gradient table to files\
889
+ in FSL (bvecs / bvals) format.
890
+ import_pe_table: import a phase-encoding table from file.
891
+ import_pe_eddy: import phase-encoding information from an EDDY-style\
892
+ config / index file pair.
893
+ export_pe_table: export phase-encoding table to file.
894
+ export_pe_eddy: export phase-encoding information to an EDDY-style\
895
+ config / index file pair.
896
+ info: display information messages.
897
+ quiet: do not display information messages or progress status;\
898
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
899
+ environment variable to a non-empty string.
900
+ debug: display debugging messages.
901
+ force: force overwrite of output files (caution: using the same file as\
902
+ input and output might cause unexpected behaviour).
903
+ nthreads: use this number of threads in multi-threaded applications\
904
+ (set to 0 to disable multi-threading).
905
+ config: temporarily set the value of an MRtrix config file entry.
906
+ help_: display this information page and exit.
907
+ version: display version information and exit.
908
+ Returns:
909
+ Parameter dictionary
910
+ """
911
+ params = {
912
+ "__STYXTYPE__": "mrconvert",
913
+ "info": info,
914
+ "quiet": quiet,
915
+ "debug": debug,
916
+ "force": force,
917
+ "help": help_,
918
+ "version": version,
919
+ "input": input_,
920
+ "output": output,
921
+ }
922
+ if coord is not None:
923
+ params["coord"] = coord
924
+ if vox is not None:
925
+ params["vox"] = vox
926
+ if axes is not None:
927
+ params["axes"] = axes
928
+ if scaling is not None:
929
+ params["scaling"] = scaling
930
+ if json_import is not None:
931
+ params["json_import"] = json_import
932
+ if json_export is not None:
933
+ params["json_export"] = json_export
934
+ if clear_property is not None:
935
+ params["clear_property"] = clear_property
936
+ if set_property is not None:
937
+ params["set_property"] = set_property
938
+ if append_property is not None:
939
+ params["append_property"] = append_property
940
+ if copy_properties is not None:
941
+ params["copy_properties"] = copy_properties
942
+ if strides is not None:
943
+ params["strides"] = strides
944
+ if datatype is not None:
945
+ params["datatype"] = datatype
946
+ if grad is not None:
947
+ params["grad"] = grad
948
+ if fslgrad is not None:
949
+ params["fslgrad"] = fslgrad
950
+ if bvalue_scaling is not None:
951
+ params["bvalue_scaling"] = bvalue_scaling
952
+ if export_grad_mrtrix is not None:
953
+ params["export_grad_mrtrix"] = export_grad_mrtrix
954
+ if export_grad_fsl is not None:
955
+ params["export_grad_fsl"] = export_grad_fsl
956
+ if import_pe_table is not None:
957
+ params["import_pe_table"] = import_pe_table
958
+ if import_pe_eddy is not None:
959
+ params["import_pe_eddy"] = import_pe_eddy
960
+ if export_pe_table is not None:
961
+ params["export_pe_table"] = export_pe_table
962
+ if export_pe_eddy is not None:
963
+ params["export_pe_eddy"] = export_pe_eddy
964
+ if nthreads is not None:
965
+ params["nthreads"] = nthreads
966
+ if config is not None:
967
+ params["config"] = config
968
+ return params
969
+
970
+
971
+ def mrconvert_cargs(
972
+ params: MrconvertParameters,
973
+ execution: Execution,
974
+ ) -> list[str]:
975
+ """
976
+ Build command-line arguments from parameters.
977
+
978
+ Args:
979
+ params: The parameters.
980
+ execution: The execution object for resolving input paths.
981
+ Returns:
982
+ Command-line arguments.
983
+ """
984
+ cargs = []
985
+ cargs.append("mrconvert")
986
+ if params.get("coord") is not None:
987
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("coord")] for a in c])
988
+ if params.get("vox") is not None:
989
+ cargs.extend([
990
+ "-vox",
991
+ *map(str, params.get("vox"))
992
+ ])
993
+ if params.get("axes") is not None:
994
+ cargs.extend([
995
+ "-axes",
996
+ ",".join(map(str, params.get("axes")))
997
+ ])
998
+ if params.get("scaling") is not None:
999
+ cargs.extend([
1000
+ "-scaling",
1001
+ *map(str, params.get("scaling"))
1002
+ ])
1003
+ if params.get("json_import") is not None:
1004
+ cargs.extend([
1005
+ "-json_import",
1006
+ execution.input_file(params.get("json_import"))
1007
+ ])
1008
+ if params.get("json_export") is not None:
1009
+ cargs.extend([
1010
+ "-json_export",
1011
+ params.get("json_export")
1012
+ ])
1013
+ if params.get("clear_property") is not None:
1014
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("clear_property")] for a in c])
1015
+ if params.get("set_property") is not None:
1016
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("set_property")] for a in c])
1017
+ if params.get("append_property") is not None:
1018
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("append_property")] for a in c])
1019
+ if params.get("copy_properties") is not None:
1020
+ cargs.extend([
1021
+ "-copy_properties",
1022
+ *dyn_cargs(params.get("copy_properties")["__STYXTYPE__"])(params.get("copy_properties"), execution)
1023
+ ])
1024
+ if params.get("strides") is not None:
1025
+ cargs.extend([
1026
+ "-strides",
1027
+ *dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
1028
+ ])
1029
+ if params.get("datatype") is not None:
1030
+ cargs.extend([
1031
+ "-datatype",
1032
+ params.get("datatype")
1033
+ ])
1034
+ if params.get("grad") is not None:
1035
+ cargs.extend([
1036
+ "-grad",
1037
+ execution.input_file(params.get("grad"))
1038
+ ])
1039
+ if params.get("fslgrad") is not None:
1040
+ cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
1041
+ if params.get("bvalue_scaling") is not None:
1042
+ cargs.extend([
1043
+ "-bvalue_scaling",
1044
+ params.get("bvalue_scaling")
1045
+ ])
1046
+ if params.get("export_grad_mrtrix") is not None:
1047
+ cargs.extend([
1048
+ "-export_grad_mrtrix",
1049
+ params.get("export_grad_mrtrix")
1050
+ ])
1051
+ if params.get("export_grad_fsl") is not None:
1052
+ cargs.extend(dyn_cargs(params.get("export_grad_fsl")["__STYXTYPE__"])(params.get("export_grad_fsl"), execution))
1053
+ if params.get("import_pe_table") is not None:
1054
+ cargs.extend([
1055
+ "-import_pe_table",
1056
+ execution.input_file(params.get("import_pe_table"))
1057
+ ])
1058
+ if params.get("import_pe_eddy") is not None:
1059
+ cargs.extend(dyn_cargs(params.get("import_pe_eddy")["__STYXTYPE__"])(params.get("import_pe_eddy"), execution))
1060
+ if params.get("export_pe_table") is not None:
1061
+ cargs.extend([
1062
+ "-export_pe_table",
1063
+ params.get("export_pe_table")
1064
+ ])
1065
+ if params.get("export_pe_eddy") is not None:
1066
+ cargs.extend(dyn_cargs(params.get("export_pe_eddy")["__STYXTYPE__"])(params.get("export_pe_eddy"), execution))
1067
+ if params.get("info"):
1068
+ cargs.append("-info")
1069
+ if params.get("quiet"):
1070
+ cargs.append("-quiet")
1071
+ if params.get("debug"):
1072
+ cargs.append("-debug")
1073
+ if params.get("force"):
1074
+ cargs.append("-force")
1075
+ if params.get("nthreads") is not None:
1076
+ cargs.extend([
1077
+ "-nthreads",
1078
+ str(params.get("nthreads"))
1079
+ ])
1080
+ if params.get("config") is not None:
1081
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
1082
+ if params.get("help"):
1083
+ cargs.append("-help")
1084
+ if params.get("version"):
1085
+ cargs.append("-version")
1086
+ cargs.append(execution.input_file(params.get("input")))
1087
+ cargs.append(params.get("output"))
1088
+ return cargs
1089
+
1090
+
1091
+ def mrconvert_outputs(
1092
+ params: MrconvertParameters,
1093
+ execution: Execution,
1094
+ ) -> MrconvertOutputs:
1095
+ """
1096
+ Build outputs object containing output file paths and possibly stdout/stderr.
1097
+
1098
+ Args:
1099
+ params: The parameters.
1100
+ execution: The execution object for resolving input paths.
1101
+ Returns:
1102
+ Outputs object.
1103
+ """
1104
+ ret = MrconvertOutputs(
1105
+ root=execution.output_file("."),
1106
+ output=execution.output_file(params.get("output")),
1107
+ json_export=execution.output_file(params.get("json_export")) if (params.get("json_export") is not None) else None,
1108
+ export_grad_mrtrix=execution.output_file(params.get("export_grad_mrtrix")) if (params.get("export_grad_mrtrix") is not None) else None,
1109
+ export_pe_table=execution.output_file(params.get("export_pe_table")) if (params.get("export_pe_table") is not None) else None,
1110
+ export_grad_fsl=dyn_outputs(params.get("export_grad_fsl")["__STYXTYPE__"])(params.get("export_grad_fsl"), execution) if params.get("export_grad_fsl") else None,
1111
+ export_pe_eddy=dyn_outputs(params.get("export_pe_eddy")["__STYXTYPE__"])(params.get("export_pe_eddy"), execution) if params.get("export_pe_eddy") else None,
1112
+ )
1113
+ return ret
1114
+
1115
+
1116
+ def mrconvert_execute(
1117
+ params: MrconvertParameters,
1118
+ execution: Execution,
1119
+ ) -> MrconvertOutputs:
1120
+ """
1121
+ Perform conversion between different file types and optionally extract a subset
1122
+ of the input image.
1123
+
1124
+ If used correctly, this program can be a very useful workhorse. In addition
1125
+ to converting images between different formats, it can be used to extract
1126
+ specific studies from a data set, extract a specific region of interest, or
1127
+ flip the images. Some of the possible operations are described in more
1128
+ detail below.
1129
+
1130
+ Note that for both the -coord and -axes options, indexing starts from 0
1131
+ rather than 1. E.g. -coord 3 <#> selects volumes (the fourth dimension) from
1132
+ the series; -axes 0,1,2 includes only the three spatial axes in the output
1133
+ image.
1134
+
1135
+ Additionally, for the second input to the -coord option and the -axes
1136
+ option, you can use any valid number sequence in the selection, as well as
1137
+ the 'end' keyword (see the main documentation for details); this can be
1138
+ particularly useful to select multiple coordinates.
1139
+
1140
+ The -vox option is used to change the size of the voxels in the output image
1141
+ as reported in the image header; note however that this does not re-sample
1142
+ the image based on a new voxel size (that is done using the mrgrid command).
1143
+
1144
+ By default, the intensity scaling parameters in the input image header are
1145
+ passed through to the output image header when writing to an integer image,
1146
+ and reset to 0,1 (i.e. no scaling) for floating-point and binary images.
1147
+ Note that the -scaling option will therefore have no effect for
1148
+ floating-point or binary output images.
1149
+
1150
+ The -axes option specifies which axes from the input image will be used to
1151
+ form the output image. This allows the permutation, omission, or addition of
1152
+ axes into the output image. The axes should be supplied as a comma-separated
1153
+ list of axis indices. If an axis from the input image is to be omitted from
1154
+ the output image, it must either already have a size of 1, or a single
1155
+ coordinate along that axis must be selected by the user by using the -coord
1156
+ option. Examples are provided further below.
1157
+
1158
+ The -bvalue_scaling option controls an aspect of the import of diffusion
1159
+ gradient tables. When the input diffusion-weighting direction vectors have
1160
+ norms that differ substantially from unity, the b-values will be scaled by
1161
+ the square of their corresponding vector norm (this is how multi-shell
1162
+ acquisitions are frequently achieved on scanner platforms). However in some
1163
+ rare instances, the b-values may be correct, despite the vectors not being
1164
+ of unit norm (or conversely, the b-values may need to be rescaled even
1165
+ though the vectors are close to unit norm). This option allows the user to
1166
+ control this operation and override MRrtix3's automatic detection.
1167
+
1168
+ References:
1169
+
1170
+ .
1171
+
1172
+ Author: MRTrix3 Developers
1173
+
1174
+ URL: https://www.mrtrix.org/
1175
+
1176
+ Args:
1177
+ params: The parameters.
1178
+ execution: The execution object.
1179
+ Returns:
1180
+ NamedTuple of outputs (described in `MrconvertOutputs`).
1181
+ """
1182
+ params = execution.params(params)
1183
+ cargs = mrconvert_cargs(params, execution)
1184
+ ret = mrconvert_outputs(params, execution)
1185
+ execution.run(cargs)
1186
+ return ret
1187
+
1188
+
1189
+ def mrconvert(
1190
+ input_: InputPathType,
1191
+ output: str,
1192
+ coord: list[MrconvertCoordParameters] | None = None,
1193
+ vox: list[float] | None = None,
1194
+ axes: list[int] | None = None,
1195
+ scaling: list[float] | None = None,
1196
+ json_import: InputPathType | None = None,
1197
+ json_export: str | None = None,
1198
+ clear_property: list[MrconvertClearPropertyParameters] | None = None,
1199
+ set_property: list[MrconvertSetPropertyParameters] | None = None,
1200
+ append_property: list[MrconvertAppendPropertyParameters] | None = None,
1201
+ copy_properties: typing.Union[MrconvertVariousStringParameters, MrconvertVariousFileParameters] | None = None,
1202
+ strides: typing.Union[MrconvertVariousString1Parameters, MrconvertVariousFile1Parameters] | None = None,
1203
+ datatype: str | None = None,
1204
+ grad: InputPathType | None = None,
1205
+ fslgrad: MrconvertFslgradParameters | None = None,
1206
+ bvalue_scaling: str | None = None,
1207
+ export_grad_mrtrix: str | None = None,
1208
+ export_grad_fsl: MrconvertExportGradFslParameters | None = None,
1209
+ import_pe_table: InputPathType | None = None,
1210
+ import_pe_eddy: MrconvertImportPeEddyParameters | None = None,
1211
+ export_pe_table: str | None = None,
1212
+ export_pe_eddy: MrconvertExportPeEddyParameters | None = None,
1213
+ info: bool = False,
1214
+ quiet: bool = False,
1215
+ debug: bool = False,
1216
+ force: bool = False,
1217
+ nthreads: int | None = None,
1218
+ config: list[MrconvertConfigParameters] | None = None,
1219
+ help_: bool = False,
1220
+ version: bool = False,
1221
+ runner: Runner | None = None,
1222
+ ) -> MrconvertOutputs:
1223
+ """
1224
+ Perform conversion between different file types and optionally extract a subset
1225
+ of the input image.
1226
+
1227
+ If used correctly, this program can be a very useful workhorse. In addition
1228
+ to converting images between different formats, it can be used to extract
1229
+ specific studies from a data set, extract a specific region of interest, or
1230
+ flip the images. Some of the possible operations are described in more
1231
+ detail below.
1232
+
1233
+ Note that for both the -coord and -axes options, indexing starts from 0
1234
+ rather than 1. E.g. -coord 3 <#> selects volumes (the fourth dimension) from
1235
+ the series; -axes 0,1,2 includes only the three spatial axes in the output
1236
+ image.
1237
+
1238
+ Additionally, for the second input to the -coord option and the -axes
1239
+ option, you can use any valid number sequence in the selection, as well as
1240
+ the 'end' keyword (see the main documentation for details); this can be
1241
+ particularly useful to select multiple coordinates.
1242
+
1243
+ The -vox option is used to change the size of the voxels in the output image
1244
+ as reported in the image header; note however that this does not re-sample
1245
+ the image based on a new voxel size (that is done using the mrgrid command).
1246
+
1247
+ By default, the intensity scaling parameters in the input image header are
1248
+ passed through to the output image header when writing to an integer image,
1249
+ and reset to 0,1 (i.e. no scaling) for floating-point and binary images.
1250
+ Note that the -scaling option will therefore have no effect for
1251
+ floating-point or binary output images.
1252
+
1253
+ The -axes option specifies which axes from the input image will be used to
1254
+ form the output image. This allows the permutation, omission, or addition of
1255
+ axes into the output image. The axes should be supplied as a comma-separated
1256
+ list of axis indices. If an axis from the input image is to be omitted from
1257
+ the output image, it must either already have a size of 1, or a single
1258
+ coordinate along that axis must be selected by the user by using the -coord
1259
+ option. Examples are provided further below.
1260
+
1261
+ The -bvalue_scaling option controls an aspect of the import of diffusion
1262
+ gradient tables. When the input diffusion-weighting direction vectors have
1263
+ norms that differ substantially from unity, the b-values will be scaled by
1264
+ the square of their corresponding vector norm (this is how multi-shell
1265
+ acquisitions are frequently achieved on scanner platforms). However in some
1266
+ rare instances, the b-values may be correct, despite the vectors not being
1267
+ of unit norm (or conversely, the b-values may need to be rescaled even
1268
+ though the vectors are close to unit norm). This option allows the user to
1269
+ control this operation and override MRrtix3's automatic detection.
1270
+
1271
+ References:
1272
+
1273
+ .
1274
+
1275
+ Author: MRTrix3 Developers
1276
+
1277
+ URL: https://www.mrtrix.org/
1278
+
1279
+ Args:
1280
+ input_: the input image.
1281
+ output: the output image.
1282
+ coord: retain data from the input image only at the coordinates\
1283
+ specified in the selection along the specified axis. The selection\
1284
+ argument expects a number sequence, which can also include the 'end'\
1285
+ keyword.
1286
+ vox: change the voxel dimensions reported in the output image header.
1287
+ axes: specify the axes from the input image that will be used to form\
1288
+ the output image.
1289
+ scaling: specify the data scaling parameters used to rescale the\
1290
+ intensity values.
1291
+ json_import: import data from a JSON file into header key-value pairs.
1292
+ json_export: export data from an image header key-value pairs into a\
1293
+ JSON file.
1294
+ clear_property: remove the specified key from the image header\
1295
+ altogether.
1296
+ set_property: set the value of the specified key in the image header.
1297
+ append_property: append the given value to the specified key in the\
1298
+ image header (this adds the value specified as a new line in the header\
1299
+ value).
1300
+ copy_properties: clear all generic properties and replace with the\
1301
+ properties from the image / file specified.
1302
+ strides: specify the strides of the output data in memory; either as a\
1303
+ comma-separated list of (signed) integers, or as a template image from\
1304
+ which the strides shall be extracted and used. The actual strides\
1305
+ produced will depend on whether the output image format can support it.
1306
+ datatype: specify output image data type. Valid choices are: float32,\
1307
+ float32le, float32be, float64, float64le, float64be, int64, uint64,\
1308
+ int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le,\
1309
+ int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be,\
1310
+ cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be,\
1311
+ int8, uint8, bit.
1312
+ grad: Provide the diffusion-weighted gradient scheme used in the\
1313
+ acquisition in a text file. This should be supplied as a 4xN text file\
1314
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
1315
+ the direction of the applied gradient, and b gives the b-value in units\
1316
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
1317
+ header, the data provided with this option will be instead used.
1318
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
1319
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
1320
+ scheme is present in the input image header, the data provided with\
1321
+ this option will be instead used.
1322
+ bvalue_scaling: enable or disable scaling of diffusion b-values by the\
1323
+ square of the corresponding DW gradient norm (see Desciption). Valid\
1324
+ choices are yes/no, true/false, 0/1 (default: automatic).
1325
+ export_grad_mrtrix: export the diffusion-weighted gradient table to\
1326
+ file in MRtrix format.
1327
+ export_grad_fsl: export the diffusion-weighted gradient table to files\
1328
+ in FSL (bvecs / bvals) format.
1329
+ import_pe_table: import a phase-encoding table from file.
1330
+ import_pe_eddy: import phase-encoding information from an EDDY-style\
1331
+ config / index file pair.
1332
+ export_pe_table: export phase-encoding table to file.
1333
+ export_pe_eddy: export phase-encoding information to an EDDY-style\
1334
+ config / index file pair.
1335
+ info: display information messages.
1336
+ quiet: do not display information messages or progress status;\
1337
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
1338
+ environment variable to a non-empty string.
1339
+ debug: display debugging messages.
1340
+ force: force overwrite of output files (caution: using the same file as\
1341
+ input and output might cause unexpected behaviour).
1342
+ nthreads: use this number of threads in multi-threaded applications\
1343
+ (set to 0 to disable multi-threading).
1344
+ config: temporarily set the value of an MRtrix config file entry.
1345
+ help_: display this information page and exit.
1346
+ version: display version information and exit.
1347
+ runner: Command runner.
1348
+ Returns:
1349
+ NamedTuple of outputs (described in `MrconvertOutputs`).
1350
+ """
1351
+ runner = runner or get_global_runner()
1352
+ execution = runner.start_execution(MRCONVERT_METADATA)
1353
+ params = mrconvert_params(
1354
+ coord=coord,
1355
+ vox=vox,
1356
+ axes=axes,
1357
+ scaling=scaling,
1358
+ json_import=json_import,
1359
+ json_export=json_export,
1360
+ clear_property=clear_property,
1361
+ set_property=set_property,
1362
+ append_property=append_property,
1363
+ copy_properties=copy_properties,
1364
+ strides=strides,
1365
+ datatype=datatype,
1366
+ grad=grad,
1367
+ fslgrad=fslgrad,
1368
+ bvalue_scaling=bvalue_scaling,
1369
+ export_grad_mrtrix=export_grad_mrtrix,
1370
+ export_grad_fsl=export_grad_fsl,
1371
+ import_pe_table=import_pe_table,
1372
+ import_pe_eddy=import_pe_eddy,
1373
+ export_pe_table=export_pe_table,
1374
+ export_pe_eddy=export_pe_eddy,
1375
+ info=info,
1376
+ quiet=quiet,
1377
+ debug=debug,
1378
+ force=force,
1379
+ nthreads=nthreads,
1380
+ config=config,
1381
+ help_=help_,
1382
+ version=version,
1383
+ input_=input_,
1384
+ output=output,
1385
+ )
1386
+ return mrconvert_execute(params, execution)
1387
+
1388
+
1389
+ __all__ = [
1390
+ "MRCONVERT_METADATA",
1391
+ "MrconvertAppendPropertyParameters",
1392
+ "MrconvertClearPropertyParameters",
1393
+ "MrconvertConfigParameters",
1394
+ "MrconvertCoordParameters",
1395
+ "MrconvertExportGradFslOutputs",
1396
+ "MrconvertExportGradFslParameters",
1397
+ "MrconvertExportPeEddyOutputs",
1398
+ "MrconvertExportPeEddyParameters",
1399
+ "MrconvertFslgradParameters",
1400
+ "MrconvertImportPeEddyParameters",
1401
+ "MrconvertOutputs",
1402
+ "MrconvertParameters",
1403
+ "MrconvertSetPropertyParameters",
1404
+ "MrconvertVariousFile1Parameters",
1405
+ "MrconvertVariousFileParameters",
1406
+ "MrconvertVariousString1Parameters",
1407
+ "MrconvertVariousStringParameters",
1408
+ "mrconvert",
1409
+ "mrconvert_append_property_params",
1410
+ "mrconvert_clear_property_params",
1411
+ "mrconvert_config_params",
1412
+ "mrconvert_coord_params",
1413
+ "mrconvert_export_grad_fsl_params",
1414
+ "mrconvert_export_pe_eddy_params",
1415
+ "mrconvert_fslgrad_params",
1416
+ "mrconvert_import_pe_eddy_params",
1417
+ "mrconvert_params",
1418
+ "mrconvert_set_property_params",
1419
+ "mrconvert_various_file_1_params",
1420
+ "mrconvert_various_file_params",
1421
+ "mrconvert_various_string_1_params",
1422
+ "mrconvert_various_string_params",
1423
+ ]