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,640 @@
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
+ SH2AMP_METADATA = Metadata(
9
+ id="b88a6fe01eede507fd3fd0ee64c193a8f9c85310.boutiques",
10
+ name="sh2amp",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ Sh2ampFslgradParameters = typing.TypedDict('Sh2ampFslgradParameters', {
17
+ "__STYX_TYPE__": typing.Literal["fslgrad"],
18
+ "bvecs": InputPathType,
19
+ "bvals": InputPathType,
20
+ })
21
+
22
+
23
+ Sh2ampVariousStringParameters = typing.TypedDict('Sh2ampVariousStringParameters', {
24
+ "__STYX_TYPE__": typing.Literal["VariousString"],
25
+ "obj": str,
26
+ })
27
+
28
+
29
+ Sh2ampVariousFileParameters = typing.TypedDict('Sh2ampVariousFileParameters', {
30
+ "__STYX_TYPE__": typing.Literal["VariousFile"],
31
+ "obj": InputPathType,
32
+ })
33
+
34
+
35
+ Sh2ampConfigParameters = typing.TypedDict('Sh2ampConfigParameters', {
36
+ "__STYX_TYPE__": typing.Literal["config"],
37
+ "key": str,
38
+ "value": str,
39
+ })
40
+
41
+
42
+ Sh2ampParameters = typing.TypedDict('Sh2ampParameters', {
43
+ "__STYX_TYPE__": typing.Literal["sh2amp"],
44
+ "nonnegative": bool,
45
+ "grad": typing.NotRequired[InputPathType | None],
46
+ "fslgrad": typing.NotRequired[Sh2ampFslgradParameters | None],
47
+ "strides": typing.NotRequired[typing.Union[Sh2ampVariousStringParameters, Sh2ampVariousFileParameters] | None],
48
+ "datatype": typing.NotRequired[str | None],
49
+ "info": bool,
50
+ "quiet": bool,
51
+ "debug": bool,
52
+ "force": bool,
53
+ "nthreads": typing.NotRequired[int | None],
54
+ "config": typing.NotRequired[list[Sh2ampConfigParameters] | None],
55
+ "help": bool,
56
+ "version": bool,
57
+ "input": InputPathType,
58
+ "directions": InputPathType,
59
+ "output": str,
60
+ })
61
+
62
+
63
+ def dyn_cargs(
64
+ t: str,
65
+ ) -> typing.Any:
66
+ """
67
+ Get build cargs function by command type.
68
+
69
+ Args:
70
+ t: Command type.
71
+ Returns:
72
+ Build cargs function.
73
+ """
74
+ return {
75
+ "sh2amp": sh2amp_cargs,
76
+ "fslgrad": sh2amp_fslgrad_cargs,
77
+ "VariousString": sh2amp_various_string_cargs,
78
+ "VariousFile": sh2amp_various_file_cargs,
79
+ "config": sh2amp_config_cargs,
80
+ }.get(t)
81
+
82
+
83
+ def dyn_outputs(
84
+ t: str,
85
+ ) -> typing.Any:
86
+ """
87
+ Get build outputs function by command type.
88
+
89
+ Args:
90
+ t: Command type.
91
+ Returns:
92
+ Build outputs function.
93
+ """
94
+ return {
95
+ "sh2amp": sh2amp_outputs,
96
+ }.get(t)
97
+
98
+
99
+ def sh2amp_fslgrad_params(
100
+ bvecs: InputPathType,
101
+ bvals: InputPathType,
102
+ ) -> Sh2ampFslgradParameters:
103
+ """
104
+ Build parameters.
105
+
106
+ Args:
107
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
108
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
109
+ scheme is present in the input image header, the data provided with\
110
+ this option will be instead used.
111
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
112
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
113
+ scheme is present in the input image header, the data provided with\
114
+ this option will be instead used.
115
+ Returns:
116
+ Parameter dictionary
117
+ """
118
+ params = {
119
+ "__STYXTYPE__": "fslgrad",
120
+ "bvecs": bvecs,
121
+ "bvals": bvals,
122
+ }
123
+ return params
124
+
125
+
126
+ def sh2amp_fslgrad_cargs(
127
+ params: Sh2ampFslgradParameters,
128
+ execution: Execution,
129
+ ) -> list[str]:
130
+ """
131
+ Build command-line arguments from parameters.
132
+
133
+ Args:
134
+ params: The parameters.
135
+ execution: The execution object for resolving input paths.
136
+ Returns:
137
+ Command-line arguments.
138
+ """
139
+ cargs = []
140
+ cargs.append("-fslgrad")
141
+ cargs.append(execution.input_file(params.get("bvecs")))
142
+ cargs.append(execution.input_file(params.get("bvals")))
143
+ return cargs
144
+
145
+
146
+ def sh2amp_various_string_params(
147
+ obj: str,
148
+ ) -> Sh2ampVariousStringParameters:
149
+ """
150
+ Build parameters.
151
+
152
+ Args:
153
+ obj: String object.
154
+ Returns:
155
+ Parameter dictionary
156
+ """
157
+ params = {
158
+ "__STYXTYPE__": "VariousString",
159
+ "obj": obj,
160
+ }
161
+ return params
162
+
163
+
164
+ def sh2amp_various_string_cargs(
165
+ params: Sh2ampVariousStringParameters,
166
+ execution: Execution,
167
+ ) -> list[str]:
168
+ """
169
+ Build command-line arguments from parameters.
170
+
171
+ Args:
172
+ params: The parameters.
173
+ execution: The execution object for resolving input paths.
174
+ Returns:
175
+ Command-line arguments.
176
+ """
177
+ cargs = []
178
+ cargs.append(params.get("obj"))
179
+ return cargs
180
+
181
+
182
+ def sh2amp_various_file_params(
183
+ obj: InputPathType,
184
+ ) -> Sh2ampVariousFileParameters:
185
+ """
186
+ Build parameters.
187
+
188
+ Args:
189
+ obj: File object.
190
+ Returns:
191
+ Parameter dictionary
192
+ """
193
+ params = {
194
+ "__STYXTYPE__": "VariousFile",
195
+ "obj": obj,
196
+ }
197
+ return params
198
+
199
+
200
+ def sh2amp_various_file_cargs(
201
+ params: Sh2ampVariousFileParameters,
202
+ execution: Execution,
203
+ ) -> list[str]:
204
+ """
205
+ Build command-line arguments from parameters.
206
+
207
+ Args:
208
+ params: The parameters.
209
+ execution: The execution object for resolving input paths.
210
+ Returns:
211
+ Command-line arguments.
212
+ """
213
+ cargs = []
214
+ cargs.append(execution.input_file(params.get("obj")))
215
+ return cargs
216
+
217
+
218
+ def sh2amp_config_params(
219
+ key: str,
220
+ value: str,
221
+ ) -> Sh2ampConfigParameters:
222
+ """
223
+ Build parameters.
224
+
225
+ Args:
226
+ key: temporarily set the value of an MRtrix config file entry.
227
+ value: temporarily set the value of an MRtrix config file entry.
228
+ Returns:
229
+ Parameter dictionary
230
+ """
231
+ params = {
232
+ "__STYXTYPE__": "config",
233
+ "key": key,
234
+ "value": value,
235
+ }
236
+ return params
237
+
238
+
239
+ def sh2amp_config_cargs(
240
+ params: Sh2ampConfigParameters,
241
+ execution: Execution,
242
+ ) -> list[str]:
243
+ """
244
+ Build command-line arguments from parameters.
245
+
246
+ Args:
247
+ params: The parameters.
248
+ execution: The execution object for resolving input paths.
249
+ Returns:
250
+ Command-line arguments.
251
+ """
252
+ cargs = []
253
+ cargs.append("-config")
254
+ cargs.append(params.get("key"))
255
+ cargs.append(params.get("value"))
256
+ return cargs
257
+
258
+
259
+ class Sh2ampOutputs(typing.NamedTuple):
260
+ """
261
+ Output object returned when calling `sh2amp(...)`.
262
+ """
263
+ root: OutputPathType
264
+ """Output root folder. This is the root folder for all outputs."""
265
+ output: OutputPathType
266
+ """the output image consisting of the amplitude of the SH functions along
267
+ the specified directions."""
268
+
269
+
270
+ def sh2amp_params(
271
+ input_: InputPathType,
272
+ directions: InputPathType,
273
+ output: str,
274
+ nonnegative: bool = False,
275
+ grad: InputPathType | None = None,
276
+ fslgrad: Sh2ampFslgradParameters | None = None,
277
+ strides: typing.Union[Sh2ampVariousStringParameters, Sh2ampVariousFileParameters] | None = None,
278
+ datatype: str | None = None,
279
+ info: bool = False,
280
+ quiet: bool = False,
281
+ debug: bool = False,
282
+ force: bool = False,
283
+ nthreads: int | None = None,
284
+ config: list[Sh2ampConfigParameters] | None = None,
285
+ help_: bool = False,
286
+ version: bool = False,
287
+ ) -> Sh2ampParameters:
288
+ """
289
+ Build parameters.
290
+
291
+ Args:
292
+ input_: the input image consisting of spherical harmonic (SH)\
293
+ coefficients.
294
+ directions: the list of directions along which the SH functions will be\
295
+ sampled, generated using the dirgen command.
296
+ output: the output image consisting of the amplitude of the SH\
297
+ functions along the specified directions.
298
+ nonnegative: cap all negative amplitudes to zero.
299
+ grad: Provide the diffusion-weighted gradient scheme used in the\
300
+ acquisition in a text file. This should be supplied as a 4xN text file\
301
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
302
+ the direction of the applied gradient, and b gives the b-value in units\
303
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
304
+ header, the data provided with this option will be instead used.
305
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
306
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
307
+ scheme is present in the input image header, the data provided with\
308
+ this option will be instead used.
309
+ strides: specify the strides of the output data in memory; either as a\
310
+ comma-separated list of (signed) integers, or as a template image from\
311
+ which the strides shall be extracted and used. The actual strides\
312
+ produced will depend on whether the output image format can support it.
313
+ datatype: specify output image data type. Valid choices are: float32,\
314
+ float32le, float32be, float64, float64le, float64be, int64, uint64,\
315
+ int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le,\
316
+ int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be,\
317
+ cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be,\
318
+ int8, uint8, bit.
319
+ info: display information messages.
320
+ quiet: do not display information messages or progress status;\
321
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
322
+ environment variable to a non-empty string.
323
+ debug: display debugging messages.
324
+ force: force overwrite of output files (caution: using the same file as\
325
+ input and output might cause unexpected behaviour).
326
+ nthreads: use this number of threads in multi-threaded applications\
327
+ (set to 0 to disable multi-threading).
328
+ config: temporarily set the value of an MRtrix config file entry.
329
+ help_: display this information page and exit.
330
+ version: display version information and exit.
331
+ Returns:
332
+ Parameter dictionary
333
+ """
334
+ params = {
335
+ "__STYXTYPE__": "sh2amp",
336
+ "nonnegative": nonnegative,
337
+ "info": info,
338
+ "quiet": quiet,
339
+ "debug": debug,
340
+ "force": force,
341
+ "help": help_,
342
+ "version": version,
343
+ "input": input_,
344
+ "directions": directions,
345
+ "output": output,
346
+ }
347
+ if grad is not None:
348
+ params["grad"] = grad
349
+ if fslgrad is not None:
350
+ params["fslgrad"] = fslgrad
351
+ if strides is not None:
352
+ params["strides"] = strides
353
+ if datatype is not None:
354
+ params["datatype"] = datatype
355
+ if nthreads is not None:
356
+ params["nthreads"] = nthreads
357
+ if config is not None:
358
+ params["config"] = config
359
+ return params
360
+
361
+
362
+ def sh2amp_cargs(
363
+ params: Sh2ampParameters,
364
+ execution: Execution,
365
+ ) -> list[str]:
366
+ """
367
+ Build command-line arguments from parameters.
368
+
369
+ Args:
370
+ params: The parameters.
371
+ execution: The execution object for resolving input paths.
372
+ Returns:
373
+ Command-line arguments.
374
+ """
375
+ cargs = []
376
+ cargs.append("sh2amp")
377
+ if params.get("nonnegative"):
378
+ cargs.append("-nonnegative")
379
+ if params.get("grad") is not None:
380
+ cargs.extend([
381
+ "-grad",
382
+ execution.input_file(params.get("grad"))
383
+ ])
384
+ if params.get("fslgrad") is not None:
385
+ cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
386
+ if params.get("strides") is not None:
387
+ cargs.extend([
388
+ "-strides",
389
+ *dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
390
+ ])
391
+ if params.get("datatype") is not None:
392
+ cargs.extend([
393
+ "-datatype",
394
+ params.get("datatype")
395
+ ])
396
+ if params.get("info"):
397
+ cargs.append("-info")
398
+ if params.get("quiet"):
399
+ cargs.append("-quiet")
400
+ if params.get("debug"):
401
+ cargs.append("-debug")
402
+ if params.get("force"):
403
+ cargs.append("-force")
404
+ if params.get("nthreads") is not None:
405
+ cargs.extend([
406
+ "-nthreads",
407
+ str(params.get("nthreads"))
408
+ ])
409
+ if params.get("config") is not None:
410
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
411
+ if params.get("help"):
412
+ cargs.append("-help")
413
+ if params.get("version"):
414
+ cargs.append("-version")
415
+ cargs.append(execution.input_file(params.get("input")))
416
+ cargs.append(execution.input_file(params.get("directions")))
417
+ cargs.append(params.get("output"))
418
+ return cargs
419
+
420
+
421
+ def sh2amp_outputs(
422
+ params: Sh2ampParameters,
423
+ execution: Execution,
424
+ ) -> Sh2ampOutputs:
425
+ """
426
+ Build outputs object containing output file paths and possibly stdout/stderr.
427
+
428
+ Args:
429
+ params: The parameters.
430
+ execution: The execution object for resolving input paths.
431
+ Returns:
432
+ Outputs object.
433
+ """
434
+ ret = Sh2ampOutputs(
435
+ root=execution.output_file("."),
436
+ output=execution.output_file(params.get("output")),
437
+ )
438
+ return ret
439
+
440
+
441
+ def sh2amp_execute(
442
+ params: Sh2ampParameters,
443
+ execution: Execution,
444
+ ) -> Sh2ampOutputs:
445
+ """
446
+ Evaluate the amplitude of an image of spherical harmonic functions along
447
+ specified directions.
448
+
449
+ The input image should consist of a 4D or 5D image, with SH coefficients
450
+ along the 4th dimension according to the convention below. If 4D (or size 1
451
+ along the 5th dimension), the program expects to be provided with a single
452
+ shell of directions. If 5D, each set of coefficients along the 5th dimension
453
+ is understood to correspond to a different shell.
454
+
455
+ The directions can be provided as:
456
+ - a 2-column ASCII text file contained azimuth / elevation pairs (as
457
+ produced by dirgen)
458
+ - a 3-column ASCII text file containing x, y, z Cartesian direction vectors
459
+ (as produced by dirgen -cart)
460
+ - a 4-column ASCII text file containing the x, y, z, b components of a full
461
+ DW encoding scheme (in MRtrix format, see main documentation for details).
462
+ - an image file whose header contains a valid DW encoding scheme
463
+
464
+ If a full DW encoding is provided, the number of shells needs to match those
465
+ found in the input image of coefficients (i.e. its size along the 5th
466
+ dimension). If needed, the -shell option can be used to pick out the
467
+ specific shell(s) of interest.
468
+
469
+ If the input image contains multiple shells (its size along the 5th
470
+ dimension is greater than one), the program will expect the direction set to
471
+ contain multiple shells, which can only be provided as a full DW encodings
472
+ (the last two options in the list above).
473
+
474
+ The spherical harmonic coefficients are stored according the conventions
475
+ described the main documentation, which can be found at the following link:
476
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
477
+
478
+ References:
479
+
480
+ .
481
+
482
+ Author: MRTrix3 Developers
483
+
484
+ URL: https://www.mrtrix.org/
485
+
486
+ Args:
487
+ params: The parameters.
488
+ execution: The execution object.
489
+ Returns:
490
+ NamedTuple of outputs (described in `Sh2ampOutputs`).
491
+ """
492
+ params = execution.params(params)
493
+ cargs = sh2amp_cargs(params, execution)
494
+ ret = sh2amp_outputs(params, execution)
495
+ execution.run(cargs)
496
+ return ret
497
+
498
+
499
+ def sh2amp(
500
+ input_: InputPathType,
501
+ directions: InputPathType,
502
+ output: str,
503
+ nonnegative: bool = False,
504
+ grad: InputPathType | None = None,
505
+ fslgrad: Sh2ampFslgradParameters | None = None,
506
+ strides: typing.Union[Sh2ampVariousStringParameters, Sh2ampVariousFileParameters] | None = None,
507
+ datatype: str | None = None,
508
+ info: bool = False,
509
+ quiet: bool = False,
510
+ debug: bool = False,
511
+ force: bool = False,
512
+ nthreads: int | None = None,
513
+ config: list[Sh2ampConfigParameters] | None = None,
514
+ help_: bool = False,
515
+ version: bool = False,
516
+ runner: Runner | None = None,
517
+ ) -> Sh2ampOutputs:
518
+ """
519
+ Evaluate the amplitude of an image of spherical harmonic functions along
520
+ specified directions.
521
+
522
+ The input image should consist of a 4D or 5D image, with SH coefficients
523
+ along the 4th dimension according to the convention below. If 4D (or size 1
524
+ along the 5th dimension), the program expects to be provided with a single
525
+ shell of directions. If 5D, each set of coefficients along the 5th dimension
526
+ is understood to correspond to a different shell.
527
+
528
+ The directions can be provided as:
529
+ - a 2-column ASCII text file contained azimuth / elevation pairs (as
530
+ produced by dirgen)
531
+ - a 3-column ASCII text file containing x, y, z Cartesian direction vectors
532
+ (as produced by dirgen -cart)
533
+ - a 4-column ASCII text file containing the x, y, z, b components of a full
534
+ DW encoding scheme (in MRtrix format, see main documentation for details).
535
+ - an image file whose header contains a valid DW encoding scheme
536
+
537
+ If a full DW encoding is provided, the number of shells needs to match those
538
+ found in the input image of coefficients (i.e. its size along the 5th
539
+ dimension). If needed, the -shell option can be used to pick out the
540
+ specific shell(s) of interest.
541
+
542
+ If the input image contains multiple shells (its size along the 5th
543
+ dimension is greater than one), the program will expect the direction set to
544
+ contain multiple shells, which can only be provided as a full DW encodings
545
+ (the last two options in the list above).
546
+
547
+ The spherical harmonic coefficients are stored according the conventions
548
+ described the main documentation, which can be found at the following link:
549
+ https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
550
+
551
+ References:
552
+
553
+ .
554
+
555
+ Author: MRTrix3 Developers
556
+
557
+ URL: https://www.mrtrix.org/
558
+
559
+ Args:
560
+ input_: the input image consisting of spherical harmonic (SH)\
561
+ coefficients.
562
+ directions: the list of directions along which the SH functions will be\
563
+ sampled, generated using the dirgen command.
564
+ output: the output image consisting of the amplitude of the SH\
565
+ functions along the specified directions.
566
+ nonnegative: cap all negative amplitudes to zero.
567
+ grad: Provide the diffusion-weighted gradient scheme used in the\
568
+ acquisition in a text file. This should be supplied as a 4xN text file\
569
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
570
+ the direction of the applied gradient, and b gives the b-value in units\
571
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
572
+ header, the data provided with this option will be instead used.
573
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
574
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
575
+ scheme is present in the input image header, the data provided with\
576
+ this option will be instead used.
577
+ strides: specify the strides of the output data in memory; either as a\
578
+ comma-separated list of (signed) integers, or as a template image from\
579
+ which the strides shall be extracted and used. The actual strides\
580
+ produced will depend on whether the output image format can support it.
581
+ datatype: specify output image data type. Valid choices are: float32,\
582
+ float32le, float32be, float64, float64le, float64be, int64, uint64,\
583
+ int64le, uint64le, int64be, uint64be, int32, uint32, int32le, uint32le,\
584
+ int32be, uint32be, int16, uint16, int16le, uint16le, int16be, uint16be,\
585
+ cfloat32, cfloat32le, cfloat32be, cfloat64, cfloat64le, cfloat64be,\
586
+ int8, uint8, bit.
587
+ info: display information messages.
588
+ quiet: do not display information messages or progress status;\
589
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
590
+ environment variable to a non-empty string.
591
+ debug: display debugging messages.
592
+ force: force overwrite of output files (caution: using the same file as\
593
+ input and output might cause unexpected behaviour).
594
+ nthreads: use this number of threads in multi-threaded applications\
595
+ (set to 0 to disable multi-threading).
596
+ config: temporarily set the value of an MRtrix config file entry.
597
+ help_: display this information page and exit.
598
+ version: display version information and exit.
599
+ runner: Command runner.
600
+ Returns:
601
+ NamedTuple of outputs (described in `Sh2ampOutputs`).
602
+ """
603
+ runner = runner or get_global_runner()
604
+ execution = runner.start_execution(SH2AMP_METADATA)
605
+ params = sh2amp_params(
606
+ nonnegative=nonnegative,
607
+ grad=grad,
608
+ fslgrad=fslgrad,
609
+ strides=strides,
610
+ datatype=datatype,
611
+ info=info,
612
+ quiet=quiet,
613
+ debug=debug,
614
+ force=force,
615
+ nthreads=nthreads,
616
+ config=config,
617
+ help_=help_,
618
+ version=version,
619
+ input_=input_,
620
+ directions=directions,
621
+ output=output,
622
+ )
623
+ return sh2amp_execute(params, execution)
624
+
625
+
626
+ __all__ = [
627
+ "SH2AMP_METADATA",
628
+ "Sh2ampConfigParameters",
629
+ "Sh2ampFslgradParameters",
630
+ "Sh2ampOutputs",
631
+ "Sh2ampParameters",
632
+ "Sh2ampVariousFileParameters",
633
+ "Sh2ampVariousStringParameters",
634
+ "sh2amp",
635
+ "sh2amp_config_params",
636
+ "sh2amp_fslgrad_params",
637
+ "sh2amp_params",
638
+ "sh2amp_various_file_params",
639
+ "sh2amp_various_string_params",
640
+ ]