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,659 @@
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
+ TENSOR2METRIC_METADATA = Metadata(
9
+ id="27f4e9c1379c830bcec96cfb3c8b321a7c99c245.boutiques",
10
+ name="tensor2metric",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _Tensor2metricConfigParamsDictNoTag = typing.TypedDict('_Tensor2metricConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ Tensor2metricConfigParamsDictTagged = typing.TypedDict('Tensor2metricConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ Tensor2metricConfigParamsDict = _Tensor2metricConfigParamsDictNoTag | Tensor2metricConfigParamsDictTagged
26
+
27
+
28
+ _Tensor2metricParamsDictNoTag = typing.TypedDict('_Tensor2metricParamsDictNoTag', {
29
+ "adc": typing.NotRequired[str | None],
30
+ "fa": typing.NotRequired[str | None],
31
+ "ad": typing.NotRequired[str | None],
32
+ "rd": typing.NotRequired[str | None],
33
+ "cl": typing.NotRequired[str | None],
34
+ "cp": typing.NotRequired[str | None],
35
+ "cs": typing.NotRequired[str | None],
36
+ "value": typing.NotRequired[str | None],
37
+ "vector": typing.NotRequired[str | None],
38
+ "num": typing.NotRequired[list[int] | None],
39
+ "modulate": typing.NotRequired[str | None],
40
+ "mask": typing.NotRequired[InputPathType | None],
41
+ "info": bool,
42
+ "quiet": bool,
43
+ "debug": bool,
44
+ "force": bool,
45
+ "nthreads": typing.NotRequired[int | None],
46
+ "config": typing.NotRequired[list[Tensor2metricConfigParamsDict] | None],
47
+ "help": bool,
48
+ "version": bool,
49
+ "tensor": InputPathType,
50
+ })
51
+ Tensor2metricParamsDictTagged = typing.TypedDict('Tensor2metricParamsDictTagged', {
52
+ "@type": typing.Literal["mrtrix/tensor2metric"],
53
+ "adc": typing.NotRequired[str | None],
54
+ "fa": typing.NotRequired[str | None],
55
+ "ad": typing.NotRequired[str | None],
56
+ "rd": typing.NotRequired[str | None],
57
+ "cl": typing.NotRequired[str | None],
58
+ "cp": typing.NotRequired[str | None],
59
+ "cs": typing.NotRequired[str | None],
60
+ "value": typing.NotRequired[str | None],
61
+ "vector": typing.NotRequired[str | None],
62
+ "num": typing.NotRequired[list[int] | None],
63
+ "modulate": typing.NotRequired[str | None],
64
+ "mask": typing.NotRequired[InputPathType | None],
65
+ "info": bool,
66
+ "quiet": bool,
67
+ "debug": bool,
68
+ "force": bool,
69
+ "nthreads": typing.NotRequired[int | None],
70
+ "config": typing.NotRequired[list[Tensor2metricConfigParamsDict] | None],
71
+ "help": bool,
72
+ "version": bool,
73
+ "tensor": InputPathType,
74
+ })
75
+ Tensor2metricParamsDict = _Tensor2metricParamsDictNoTag | Tensor2metricParamsDictTagged
76
+
77
+
78
+ def tensor2metric_config(
79
+ key: str,
80
+ value: str,
81
+ ) -> Tensor2metricConfigParamsDictTagged:
82
+ """
83
+ Build parameters.
84
+
85
+ Args:
86
+ key: temporarily set the value of an MRtrix config file entry.
87
+ value: temporarily set the value of an MRtrix config file entry.
88
+ Returns:
89
+ Parameter dictionary
90
+ """
91
+ params = {
92
+ "@type": "config",
93
+ "key": key,
94
+ "value": value,
95
+ }
96
+ return params
97
+
98
+
99
+ def tensor2metric_config_validate(
100
+ params: typing.Any,
101
+ ) -> None:
102
+ """
103
+ Validate parameters. Throws an error if `params` is not a valid
104
+ `Tensor2metricConfigParamsDict` object.
105
+
106
+ Args:
107
+ params: The parameters object to validate.
108
+ """
109
+ if params is None or not isinstance(params, dict):
110
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
111
+ if params.get("key", None) is None:
112
+ raise StyxValidationError("`key` must not be None")
113
+ if not isinstance(params["key"], str):
114
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
115
+ if params.get("value", None) is None:
116
+ raise StyxValidationError("`value` must not be None")
117
+ if not isinstance(params["value"], str):
118
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
119
+
120
+
121
+ def tensor2metric_config_cargs(
122
+ params: Tensor2metricConfigParamsDict,
123
+ execution: Execution,
124
+ ) -> list[str]:
125
+ """
126
+ Build command-line arguments from parameters.
127
+
128
+ Args:
129
+ params: The parameters.
130
+ execution: The execution object for resolving input paths.
131
+ Returns:
132
+ Command-line arguments.
133
+ """
134
+ cargs = []
135
+ cargs.append("-config")
136
+ cargs.append(params.get("key", None))
137
+ cargs.append(params.get("value", None))
138
+ return cargs
139
+
140
+
141
+ class Tensor2metricOutputs(typing.NamedTuple):
142
+ """
143
+ Output object returned when calling `Tensor2metricParamsDict(...)`.
144
+ """
145
+ root: OutputPathType
146
+ """Output root folder. This is the root folder for all outputs."""
147
+ adc: OutputPathType | None
148
+ """compute the mean apparent diffusion coefficient (ADC) of the diffusion
149
+ tensor. (sometimes also referred to as the mean diffusivity (MD)) """
150
+ fa: OutputPathType | None
151
+ """compute the fractional anisotropy (FA) of the diffusion tensor. """
152
+ ad: OutputPathType | None
153
+ """compute the axial diffusivity (AD) of the diffusion tensor. (equivalent
154
+ to the principal eigenvalue) """
155
+ rd: OutputPathType | None
156
+ """compute the radial diffusivity (RD) of the diffusion tensor. (equivalent
157
+ to the mean of the two non-principal eigenvalues) """
158
+ cl: OutputPathType | None
159
+ """compute the linearity metric of the diffusion tensor. (one of the three
160
+ Westin shape metrics) """
161
+ cp: OutputPathType | None
162
+ """compute the planarity metric of the diffusion tensor. (one of the three
163
+ Westin shape metrics) """
164
+ cs: OutputPathType | None
165
+ """compute the sphericity metric of the diffusion tensor. (one of the three
166
+ Westin shape metrics) """
167
+ value: OutputPathType | None
168
+ """compute the selected eigenvalue(s) of the diffusion tensor. """
169
+ vector: OutputPathType | None
170
+ """compute the selected eigenvector(s) of the diffusion tensor. """
171
+
172
+
173
+ def tensor2metric_params(
174
+ tensor: InputPathType,
175
+ adc: str | None = None,
176
+ fa: str | None = None,
177
+ ad: str | None = None,
178
+ rd: str | None = None,
179
+ cl: str | None = None,
180
+ cp: str | None = None,
181
+ cs: str | None = None,
182
+ value: str | None = None,
183
+ vector: str | None = None,
184
+ num: list[int] | None = None,
185
+ modulate: str | None = None,
186
+ mask: InputPathType | None = None,
187
+ info: bool = False,
188
+ quiet: bool = False,
189
+ debug: bool = False,
190
+ force: bool = False,
191
+ nthreads: int | None = None,
192
+ config: list[Tensor2metricConfigParamsDict] | None = None,
193
+ help_: bool = False,
194
+ version: bool = False,
195
+ ) -> Tensor2metricParamsDictTagged:
196
+ """
197
+ Build parameters.
198
+
199
+ Args:
200
+ tensor: the input tensor image.
201
+ adc: compute the mean apparent diffusion coefficient (ADC) of the\
202
+ diffusion tensor. (sometimes also referred to as the mean diffusivity\
203
+ (MD)).
204
+ fa: compute the fractional anisotropy (FA) of the diffusion tensor.
205
+ ad: compute the axial diffusivity (AD) of the diffusion tensor.\
206
+ (equivalent to the principal eigenvalue).
207
+ rd: compute the radial diffusivity (RD) of the diffusion tensor.\
208
+ (equivalent to the mean of the two non-principal eigenvalues).
209
+ cl: compute the linearity metric of the diffusion tensor. (one of the\
210
+ three Westin shape metrics).
211
+ cp: compute the planarity metric of the diffusion tensor. (one of the\
212
+ three Westin shape metrics).
213
+ cs: compute the sphericity metric of the diffusion tensor. (one of the\
214
+ three Westin shape metrics).
215
+ value: compute the selected eigenvalue(s) of the diffusion tensor.
216
+ vector: compute the selected eigenvector(s) of the diffusion tensor.
217
+ num: specify the desired eigenvalue/eigenvector(s). Note that several\
218
+ eigenvalues can be specified as a number sequence. For example, '1,3'\
219
+ specifies the principal (1) and minor (3) eigenvalues/eigenvectors\
220
+ (default = 1).
221
+ modulate: specify how to modulate the magnitude of the eigenvectors.\
222
+ Valid choices are: none, FA, eigval (default = FA).
223
+ mask: only perform computation within the specified binary brain mask\
224
+ image.
225
+ info: display information messages.
226
+ quiet: do not display information messages or progress status;\
227
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
228
+ environment variable to a non-empty string.
229
+ debug: display debugging messages.
230
+ force: force overwrite of output files (caution: using the same file as\
231
+ input and output might cause unexpected behaviour).
232
+ nthreads: use this number of threads in multi-threaded applications\
233
+ (set to 0 to disable multi-threading).
234
+ config: temporarily set the value of an MRtrix config file entry.
235
+ help_: display this information page and exit.
236
+ version: display version information and exit.
237
+ Returns:
238
+ Parameter dictionary
239
+ """
240
+ params = {
241
+ "@type": "mrtrix/tensor2metric",
242
+ "info": info,
243
+ "quiet": quiet,
244
+ "debug": debug,
245
+ "force": force,
246
+ "help": help_,
247
+ "version": version,
248
+ "tensor": tensor,
249
+ }
250
+ if adc is not None:
251
+ params["adc"] = adc
252
+ if fa is not None:
253
+ params["fa"] = fa
254
+ if ad is not None:
255
+ params["ad"] = ad
256
+ if rd is not None:
257
+ params["rd"] = rd
258
+ if cl is not None:
259
+ params["cl"] = cl
260
+ if cp is not None:
261
+ params["cp"] = cp
262
+ if cs is not None:
263
+ params["cs"] = cs
264
+ if value is not None:
265
+ params["value"] = value
266
+ if vector is not None:
267
+ params["vector"] = vector
268
+ if num is not None:
269
+ params["num"] = num
270
+ if modulate is not None:
271
+ params["modulate"] = modulate
272
+ if mask is not None:
273
+ params["mask"] = mask
274
+ if nthreads is not None:
275
+ params["nthreads"] = nthreads
276
+ if config is not None:
277
+ params["config"] = config
278
+ return params
279
+
280
+
281
+ def tensor2metric_validate(
282
+ params: typing.Any,
283
+ ) -> None:
284
+ """
285
+ Validate parameters. Throws an error if `params` is not a valid
286
+ `Tensor2metricParamsDict` object.
287
+
288
+ Args:
289
+ params: The parameters object to validate.
290
+ """
291
+ if params is None or not isinstance(params, dict):
292
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
293
+ if params.get("adc", None) is not None:
294
+ if not isinstance(params["adc"], str):
295
+ raise StyxValidationError(f'`adc` has the wrong type: Received `{type(params.get("adc", None))}` expected `str | None`')
296
+ if params.get("fa", None) is not None:
297
+ if not isinstance(params["fa"], str):
298
+ raise StyxValidationError(f'`fa` has the wrong type: Received `{type(params.get("fa", None))}` expected `str | None`')
299
+ if params.get("ad", None) is not None:
300
+ if not isinstance(params["ad"], str):
301
+ raise StyxValidationError(f'`ad` has the wrong type: Received `{type(params.get("ad", None))}` expected `str | None`')
302
+ if params.get("rd", None) is not None:
303
+ if not isinstance(params["rd"], str):
304
+ raise StyxValidationError(f'`rd` has the wrong type: Received `{type(params.get("rd", None))}` expected `str | None`')
305
+ if params.get("cl", None) is not None:
306
+ if not isinstance(params["cl"], str):
307
+ raise StyxValidationError(f'`cl` has the wrong type: Received `{type(params.get("cl", None))}` expected `str | None`')
308
+ if params.get("cp", None) is not None:
309
+ if not isinstance(params["cp"], str):
310
+ raise StyxValidationError(f'`cp` has the wrong type: Received `{type(params.get("cp", None))}` expected `str | None`')
311
+ if params.get("cs", None) is not None:
312
+ if not isinstance(params["cs"], str):
313
+ raise StyxValidationError(f'`cs` has the wrong type: Received `{type(params.get("cs", None))}` expected `str | None`')
314
+ if params.get("value", None) is not None:
315
+ if not isinstance(params["value"], str):
316
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str | None`')
317
+ if params.get("vector", None) is not None:
318
+ if not isinstance(params["vector"], str):
319
+ raise StyxValidationError(f'`vector` has the wrong type: Received `{type(params.get("vector", None))}` expected `str | None`')
320
+ if params.get("num", None) is not None:
321
+ if not isinstance(params["num"], list):
322
+ raise StyxValidationError(f'`num` has the wrong type: Received `{type(params.get("num", None))}` expected `list[int] | None`')
323
+ for e in params["num"]:
324
+ if not isinstance(e, int):
325
+ raise StyxValidationError(f'`num` has the wrong type: Received `{type(params.get("num", None))}` expected `list[int] | None`')
326
+ if params.get("modulate", None) is not None:
327
+ if not isinstance(params["modulate"], str):
328
+ raise StyxValidationError(f'`modulate` has the wrong type: Received `{type(params.get("modulate", None))}` expected `str | None`')
329
+ if params.get("mask", None) is not None:
330
+ if not isinstance(params["mask"], (pathlib.Path, str)):
331
+ raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
332
+ if params.get("info", False) is None:
333
+ raise StyxValidationError("`info` must not be None")
334
+ if not isinstance(params["info"], bool):
335
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
336
+ if params.get("quiet", False) is None:
337
+ raise StyxValidationError("`quiet` must not be None")
338
+ if not isinstance(params["quiet"], bool):
339
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
340
+ if params.get("debug", False) is None:
341
+ raise StyxValidationError("`debug` must not be None")
342
+ if not isinstance(params["debug"], bool):
343
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
344
+ if params.get("force", False) is None:
345
+ raise StyxValidationError("`force` must not be None")
346
+ if not isinstance(params["force"], bool):
347
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
348
+ if params.get("nthreads", None) is not None:
349
+ if not isinstance(params["nthreads"], int):
350
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
351
+ if params.get("config", None) is not None:
352
+ if not isinstance(params["config"], list):
353
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Tensor2metricConfigParamsDict] | None`')
354
+ for e in params["config"]:
355
+ tensor2metric_config_validate(e)
356
+ if params.get("help", False) is None:
357
+ raise StyxValidationError("`help` must not be None")
358
+ if not isinstance(params["help"], bool):
359
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
360
+ if params.get("version", False) is None:
361
+ raise StyxValidationError("`version` must not be None")
362
+ if not isinstance(params["version"], bool):
363
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
364
+ if params.get("tensor", None) is None:
365
+ raise StyxValidationError("`tensor` must not be None")
366
+ if not isinstance(params["tensor"], (pathlib.Path, str)):
367
+ raise StyxValidationError(f'`tensor` has the wrong type: Received `{type(params.get("tensor", None))}` expected `InputPathType`')
368
+
369
+
370
+ def tensor2metric_cargs(
371
+ params: Tensor2metricParamsDict,
372
+ execution: Execution,
373
+ ) -> list[str]:
374
+ """
375
+ Build command-line arguments from parameters.
376
+
377
+ Args:
378
+ params: The parameters.
379
+ execution: The execution object for resolving input paths.
380
+ Returns:
381
+ Command-line arguments.
382
+ """
383
+ cargs = []
384
+ cargs.append("tensor2metric")
385
+ if params.get("adc", None) is not None:
386
+ cargs.extend([
387
+ "-adc",
388
+ params.get("adc", None)
389
+ ])
390
+ if params.get("fa", None) is not None:
391
+ cargs.extend([
392
+ "-fa",
393
+ params.get("fa", None)
394
+ ])
395
+ if params.get("ad", None) is not None:
396
+ cargs.extend([
397
+ "-ad",
398
+ params.get("ad", None)
399
+ ])
400
+ if params.get("rd", None) is not None:
401
+ cargs.extend([
402
+ "-rd",
403
+ params.get("rd", None)
404
+ ])
405
+ if params.get("cl", None) is not None:
406
+ cargs.extend([
407
+ "-cl",
408
+ params.get("cl", None)
409
+ ])
410
+ if params.get("cp", None) is not None:
411
+ cargs.extend([
412
+ "-cp",
413
+ params.get("cp", None)
414
+ ])
415
+ if params.get("cs", None) is not None:
416
+ cargs.extend([
417
+ "-cs",
418
+ params.get("cs", None)
419
+ ])
420
+ if params.get("value", None) is not None:
421
+ cargs.extend([
422
+ "-value",
423
+ params.get("value", None)
424
+ ])
425
+ if params.get("vector", None) is not None:
426
+ cargs.extend([
427
+ "-vector",
428
+ params.get("vector", None)
429
+ ])
430
+ if params.get("num", None) is not None:
431
+ cargs.extend([
432
+ "-num",
433
+ *map(str, params.get("num", None))
434
+ ])
435
+ if params.get("modulate", None) is not None:
436
+ cargs.extend([
437
+ "-modulate",
438
+ params.get("modulate", None)
439
+ ])
440
+ if params.get("mask", None) is not None:
441
+ cargs.extend([
442
+ "-mask",
443
+ execution.input_file(params.get("mask", None))
444
+ ])
445
+ if params.get("info", False):
446
+ cargs.append("-info")
447
+ if params.get("quiet", False):
448
+ cargs.append("-quiet")
449
+ if params.get("debug", False):
450
+ cargs.append("-debug")
451
+ if params.get("force", False):
452
+ cargs.append("-force")
453
+ if params.get("nthreads", None) is not None:
454
+ cargs.extend([
455
+ "-nthreads",
456
+ str(params.get("nthreads", None))
457
+ ])
458
+ if params.get("config", None) is not None:
459
+ cargs.extend([a for c in [tensor2metric_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
460
+ if params.get("help", False):
461
+ cargs.append("-help")
462
+ if params.get("version", False):
463
+ cargs.append("-version")
464
+ cargs.append(execution.input_file(params.get("tensor", None)))
465
+ return cargs
466
+
467
+
468
+ def tensor2metric_outputs(
469
+ params: Tensor2metricParamsDict,
470
+ execution: Execution,
471
+ ) -> Tensor2metricOutputs:
472
+ """
473
+ Build outputs object containing output file paths and possibly stdout/stderr.
474
+
475
+ Args:
476
+ params: The parameters.
477
+ execution: The execution object for resolving input paths.
478
+ Returns:
479
+ Outputs object.
480
+ """
481
+ ret = Tensor2metricOutputs(
482
+ root=execution.output_file("."),
483
+ adc=execution.output_file(params.get("adc", None)) if (params.get("adc") is not None) else None,
484
+ fa=execution.output_file(params.get("fa", None)) if (params.get("fa") is not None) else None,
485
+ ad=execution.output_file(params.get("ad", None)) if (params.get("ad") is not None) else None,
486
+ rd=execution.output_file(params.get("rd", None)) if (params.get("rd") is not None) else None,
487
+ cl=execution.output_file(params.get("cl", None)) if (params.get("cl") is not None) else None,
488
+ cp=execution.output_file(params.get("cp", None)) if (params.get("cp") is not None) else None,
489
+ cs=execution.output_file(params.get("cs", None)) if (params.get("cs") is not None) else None,
490
+ value=execution.output_file(params.get("value", None)) if (params.get("value") is not None) else None,
491
+ vector=execution.output_file(params.get("vector", None)) if (params.get("vector") is not None) else None,
492
+ )
493
+ return ret
494
+
495
+
496
+ def tensor2metric_execute(
497
+ params: Tensor2metricParamsDict,
498
+ runner: Runner | None = None,
499
+ ) -> Tensor2metricOutputs:
500
+ """
501
+ tensor2metric
502
+
503
+ Generate maps of tensor-derived parameters.
504
+
505
+
506
+
507
+ References:
508
+
509
+ Basser, P. J.; Mattiello, J. & Lebihan, D. MR diffusion tensor spectroscopy
510
+ and imaging. Biophysical Journal, 1994, 66, 259-267
511
+
512
+ Westin, C. F.; Peled, S.; Gudbjartsson, H.; Kikinis, R. & Jolesz, F. A.
513
+ Geometrical diffusion measures for MRI from tensor basis analysis. Proc Intl
514
+ Soc Mag Reson Med, 1997, 5, 1742.
515
+
516
+ Author: MRTrix3 Developers
517
+
518
+ URL: https://www.mrtrix.org/
519
+
520
+ Args:
521
+ params: The parameters.
522
+ runner: Command runner.
523
+ Returns:
524
+ NamedTuple of outputs (described in `Tensor2metricOutputs`).
525
+ """
526
+ tensor2metric_validate(params)
527
+ runner = runner or get_global_runner()
528
+ execution = runner.start_execution(TENSOR2METRIC_METADATA)
529
+ params = execution.params(params)
530
+ cargs = tensor2metric_cargs(params, execution)
531
+ ret = tensor2metric_outputs(params, execution)
532
+ execution.run(cargs)
533
+ return ret
534
+
535
+
536
+ def tensor2metric(
537
+ tensor: InputPathType,
538
+ adc: str | None = None,
539
+ fa: str | None = None,
540
+ ad: str | None = None,
541
+ rd: str | None = None,
542
+ cl: str | None = None,
543
+ cp: str | None = None,
544
+ cs: str | None = None,
545
+ value: str | None = None,
546
+ vector: str | None = None,
547
+ num: list[int] | None = None,
548
+ modulate: str | None = None,
549
+ mask: InputPathType | None = None,
550
+ info: bool = False,
551
+ quiet: bool = False,
552
+ debug: bool = False,
553
+ force: bool = False,
554
+ nthreads: int | None = None,
555
+ config: list[Tensor2metricConfigParamsDict] | None = None,
556
+ help_: bool = False,
557
+ version: bool = False,
558
+ runner: Runner | None = None,
559
+ ) -> Tensor2metricOutputs:
560
+ """
561
+ tensor2metric
562
+
563
+ Generate maps of tensor-derived parameters.
564
+
565
+
566
+
567
+ References:
568
+
569
+ Basser, P. J.; Mattiello, J. & Lebihan, D. MR diffusion tensor spectroscopy
570
+ and imaging. Biophysical Journal, 1994, 66, 259-267
571
+
572
+ Westin, C. F.; Peled, S.; Gudbjartsson, H.; Kikinis, R. & Jolesz, F. A.
573
+ Geometrical diffusion measures for MRI from tensor basis analysis. Proc Intl
574
+ Soc Mag Reson Med, 1997, 5, 1742.
575
+
576
+ Author: MRTrix3 Developers
577
+
578
+ URL: https://www.mrtrix.org/
579
+
580
+ Args:
581
+ tensor: the input tensor image.
582
+ adc: compute the mean apparent diffusion coefficient (ADC) of the\
583
+ diffusion tensor. (sometimes also referred to as the mean diffusivity\
584
+ (MD)).
585
+ fa: compute the fractional anisotropy (FA) of the diffusion tensor.
586
+ ad: compute the axial diffusivity (AD) of the diffusion tensor.\
587
+ (equivalent to the principal eigenvalue).
588
+ rd: compute the radial diffusivity (RD) of the diffusion tensor.\
589
+ (equivalent to the mean of the two non-principal eigenvalues).
590
+ cl: compute the linearity metric of the diffusion tensor. (one of the\
591
+ three Westin shape metrics).
592
+ cp: compute the planarity metric of the diffusion tensor. (one of the\
593
+ three Westin shape metrics).
594
+ cs: compute the sphericity metric of the diffusion tensor. (one of the\
595
+ three Westin shape metrics).
596
+ value: compute the selected eigenvalue(s) of the diffusion tensor.
597
+ vector: compute the selected eigenvector(s) of the diffusion tensor.
598
+ num: specify the desired eigenvalue/eigenvector(s). Note that several\
599
+ eigenvalues can be specified as a number sequence. For example, '1,3'\
600
+ specifies the principal (1) and minor (3) eigenvalues/eigenvectors\
601
+ (default = 1).
602
+ modulate: specify how to modulate the magnitude of the eigenvectors.\
603
+ Valid choices are: none, FA, eigval (default = FA).
604
+ mask: only perform computation within the specified binary brain mask\
605
+ image.
606
+ info: display information messages.
607
+ quiet: do not display information messages or progress status;\
608
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
609
+ environment variable to a non-empty string.
610
+ debug: display debugging messages.
611
+ force: force overwrite of output files (caution: using the same file as\
612
+ input and output might cause unexpected behaviour).
613
+ nthreads: use this number of threads in multi-threaded applications\
614
+ (set to 0 to disable multi-threading).
615
+ config: temporarily set the value of an MRtrix config file entry.
616
+ help_: display this information page and exit.
617
+ version: display version information and exit.
618
+ runner: Command runner.
619
+ Returns:
620
+ NamedTuple of outputs (described in `Tensor2metricOutputs`).
621
+ """
622
+ params = tensor2metric_params(
623
+ adc=adc,
624
+ fa=fa,
625
+ ad=ad,
626
+ rd=rd,
627
+ cl=cl,
628
+ cp=cp,
629
+ cs=cs,
630
+ value=value,
631
+ vector=vector,
632
+ num=num,
633
+ modulate=modulate,
634
+ mask=mask,
635
+ info=info,
636
+ quiet=quiet,
637
+ debug=debug,
638
+ force=force,
639
+ nthreads=nthreads,
640
+ config=config,
641
+ help_=help_,
642
+ version=version,
643
+ tensor=tensor,
644
+ )
645
+ return tensor2metric_execute(params, runner)
646
+
647
+
648
+ __all__ = [
649
+ "TENSOR2METRIC_METADATA",
650
+ "Tensor2metricConfigParamsDict",
651
+ "Tensor2metricConfigParamsDictTagged",
652
+ "Tensor2metricOutputs",
653
+ "Tensor2metricParamsDict",
654
+ "Tensor2metricParamsDictTagged",
655
+ "tensor2metric",
656
+ "tensor2metric_config",
657
+ "tensor2metric_execute",
658
+ "tensor2metric_params",
659
+ ]