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,560 @@
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
+ AMP2RESPONSE_METADATA = Metadata(
9
+ id="f0088602c41a6ff20ec7c430ad21aee73ff1f3e4.boutiques",
10
+ name="amp2response",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _Amp2responseConfigParamsDictNoTag = typing.TypedDict('_Amp2responseConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ Amp2responseConfigParamsDictTagged = typing.TypedDict('Amp2responseConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ Amp2responseConfigParamsDict = _Amp2responseConfigParamsDictNoTag | Amp2responseConfigParamsDictTagged
26
+
27
+
28
+ _Amp2responseParamsDictNoTag = typing.TypedDict('_Amp2responseParamsDictNoTag', {
29
+ "isotropic": bool,
30
+ "noconstraint": bool,
31
+ "directions": typing.NotRequired[InputPathType | None],
32
+ "shells": typing.NotRequired[list[float] | None],
33
+ "lmax": typing.NotRequired[list[int] | None],
34
+ "info": bool,
35
+ "quiet": bool,
36
+ "debug": bool,
37
+ "force": bool,
38
+ "nthreads": typing.NotRequired[int | None],
39
+ "config": typing.NotRequired[list[Amp2responseConfigParamsDict] | None],
40
+ "help": bool,
41
+ "version": bool,
42
+ "amps": InputPathType,
43
+ "mask": InputPathType,
44
+ "directions_1": InputPathType,
45
+ "response": str,
46
+ })
47
+ Amp2responseParamsDictTagged = typing.TypedDict('Amp2responseParamsDictTagged', {
48
+ "@type": typing.Literal["mrtrix/amp2response"],
49
+ "isotropic": bool,
50
+ "noconstraint": bool,
51
+ "directions": typing.NotRequired[InputPathType | None],
52
+ "shells": typing.NotRequired[list[float] | None],
53
+ "lmax": typing.NotRequired[list[int] | None],
54
+ "info": bool,
55
+ "quiet": bool,
56
+ "debug": bool,
57
+ "force": bool,
58
+ "nthreads": typing.NotRequired[int | None],
59
+ "config": typing.NotRequired[list[Amp2responseConfigParamsDict] | None],
60
+ "help": bool,
61
+ "version": bool,
62
+ "amps": InputPathType,
63
+ "mask": InputPathType,
64
+ "directions_1": InputPathType,
65
+ "response": str,
66
+ })
67
+ Amp2responseParamsDict = _Amp2responseParamsDictNoTag | Amp2responseParamsDictTagged
68
+
69
+
70
+ def amp2response_config(
71
+ key: str,
72
+ value: str,
73
+ ) -> Amp2responseConfigParamsDictTagged:
74
+ """
75
+ Build parameters.
76
+
77
+ Args:
78
+ key: temporarily set the value of an MRtrix config file entry.
79
+ value: temporarily set the value of an MRtrix config file entry.
80
+ Returns:
81
+ Parameter dictionary
82
+ """
83
+ params = {
84
+ "@type": "config",
85
+ "key": key,
86
+ "value": value,
87
+ }
88
+ return params
89
+
90
+
91
+ def amp2response_config_validate(
92
+ params: typing.Any,
93
+ ) -> None:
94
+ """
95
+ Validate parameters. Throws an error if `params` is not a valid
96
+ `Amp2responseConfigParamsDict` object.
97
+
98
+ Args:
99
+ params: The parameters object to validate.
100
+ """
101
+ if params is None or not isinstance(params, dict):
102
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
103
+ if params.get("key", None) is None:
104
+ raise StyxValidationError("`key` must not be None")
105
+ if not isinstance(params["key"], str):
106
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
107
+ if params.get("value", None) is None:
108
+ raise StyxValidationError("`value` must not be None")
109
+ if not isinstance(params["value"], str):
110
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
111
+
112
+
113
+ def amp2response_config_cargs(
114
+ params: Amp2responseConfigParamsDict,
115
+ execution: Execution,
116
+ ) -> list[str]:
117
+ """
118
+ Build command-line arguments from parameters.
119
+
120
+ Args:
121
+ params: The parameters.
122
+ execution: The execution object for resolving input paths.
123
+ Returns:
124
+ Command-line arguments.
125
+ """
126
+ cargs = []
127
+ cargs.append("-config")
128
+ cargs.append(params.get("key", None))
129
+ cargs.append(params.get("value", None))
130
+ return cargs
131
+
132
+
133
+ class Amp2responseOutputs(typing.NamedTuple):
134
+ """
135
+ Output object returned when calling `Amp2responseParamsDict(...)`.
136
+ """
137
+ root: OutputPathType
138
+ """Output root folder. This is the root folder for all outputs."""
139
+ response: OutputPathType
140
+ """the output zonal spherical harmonic coefficients"""
141
+
142
+
143
+ def amp2response_params(
144
+ amps: InputPathType,
145
+ mask: InputPathType,
146
+ directions_1: InputPathType,
147
+ response: str,
148
+ isotropic: bool = False,
149
+ noconstraint: bool = False,
150
+ directions: InputPathType | None = None,
151
+ shells: list[float] | None = None,
152
+ lmax: list[int] | None = None,
153
+ info: bool = False,
154
+ quiet: bool = False,
155
+ debug: bool = False,
156
+ force: bool = False,
157
+ nthreads: int | None = None,
158
+ config: list[Amp2responseConfigParamsDict] | None = None,
159
+ help_: bool = False,
160
+ version: bool = False,
161
+ ) -> Amp2responseParamsDictTagged:
162
+ """
163
+ Build parameters.
164
+
165
+ Args:
166
+ amps: the amplitudes image.
167
+ mask: the mask containing the voxels from which to estimate the\
168
+ response function.
169
+ directions_1: a 4D image containing the estimated fibre directions.
170
+ response: the output zonal spherical harmonic coefficients.
171
+ isotropic: estimate an isotropic response function (lmax=0 for all\
172
+ shells).
173
+ noconstraint: disable the non-negativity and monotonicity constraints.
174
+ directions: provide an external text file containing the directions\
175
+ along which the amplitudes are sampled.
176
+ shells: specify one or more b-values to use during processing, as a\
177
+ comma-separated list of the desired approximate b-values (b-values are\
178
+ clustered to allow for small deviations). Note that some commands are\
179
+ incompatible with multiple b-values, and will report an error if more\
180
+ than one b-value is provided.\
181
+ WARNING: note that, even though the b=0 volumes are never referred\
182
+ to as shells in the literature, they still have to be explicitly\
183
+ included in the list of b-values as provided to the -shell option!\
184
+ Several algorithms which include the b=0 volumes in their\
185
+ computations may otherwise return an undesired result.
186
+ lmax: specify the maximum harmonic degree of the response function to\
187
+ estimate (can be a comma-separated list for multi-shell data).
188
+ info: display information messages.
189
+ quiet: do not display information messages or progress status;\
190
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
191
+ environment variable to a non-empty string.
192
+ debug: display debugging messages.
193
+ force: force overwrite of output files (caution: using the same file as\
194
+ input and output might cause unexpected behaviour).
195
+ nthreads: use this number of threads in multi-threaded applications\
196
+ (set to 0 to disable multi-threading).
197
+ config: temporarily set the value of an MRtrix config file entry.
198
+ help_: display this information page and exit.
199
+ version: display version information and exit.
200
+ Returns:
201
+ Parameter dictionary
202
+ """
203
+ params = {
204
+ "@type": "mrtrix/amp2response",
205
+ "isotropic": isotropic,
206
+ "noconstraint": noconstraint,
207
+ "info": info,
208
+ "quiet": quiet,
209
+ "debug": debug,
210
+ "force": force,
211
+ "help": help_,
212
+ "version": version,
213
+ "amps": amps,
214
+ "mask": mask,
215
+ "directions_1": directions_1,
216
+ "response": response,
217
+ }
218
+ if directions is not None:
219
+ params["directions"] = directions
220
+ if shells is not None:
221
+ params["shells"] = shells
222
+ if lmax is not None:
223
+ params["lmax"] = lmax
224
+ if nthreads is not None:
225
+ params["nthreads"] = nthreads
226
+ if config is not None:
227
+ params["config"] = config
228
+ return params
229
+
230
+
231
+ def amp2response_validate(
232
+ params: typing.Any,
233
+ ) -> None:
234
+ """
235
+ Validate parameters. Throws an error if `params` is not a valid
236
+ `Amp2responseParamsDict` object.
237
+
238
+ Args:
239
+ params: The parameters object to validate.
240
+ """
241
+ if params is None or not isinstance(params, dict):
242
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
243
+ if params.get("isotropic", False) is None:
244
+ raise StyxValidationError("`isotropic` must not be None")
245
+ if not isinstance(params["isotropic"], bool):
246
+ raise StyxValidationError(f'`isotropic` has the wrong type: Received `{type(params.get("isotropic", False))}` expected `bool`')
247
+ if params.get("noconstraint", False) is None:
248
+ raise StyxValidationError("`noconstraint` must not be None")
249
+ if not isinstance(params["noconstraint"], bool):
250
+ raise StyxValidationError(f'`noconstraint` has the wrong type: Received `{type(params.get("noconstraint", False))}` expected `bool`')
251
+ if params.get("directions", None) is not None:
252
+ if not isinstance(params["directions"], (pathlib.Path, str)):
253
+ raise StyxValidationError(f'`directions` has the wrong type: Received `{type(params.get("directions", None))}` expected `InputPathType | None`')
254
+ if params.get("shells", None) is not None:
255
+ if not isinstance(params["shells"], list):
256
+ raise StyxValidationError(f'`shells` has the wrong type: Received `{type(params.get("shells", None))}` expected `list[float] | None`')
257
+ for e in params["shells"]:
258
+ if not isinstance(e, (float, int)):
259
+ raise StyxValidationError(f'`shells` has the wrong type: Received `{type(params.get("shells", None))}` expected `list[float] | None`')
260
+ if params.get("lmax", None) is not None:
261
+ if not isinstance(params["lmax"], list):
262
+ raise StyxValidationError(f'`lmax` has the wrong type: Received `{type(params.get("lmax", None))}` expected `list[int] | None`')
263
+ for e in params["lmax"]:
264
+ if not isinstance(e, int):
265
+ raise StyxValidationError(f'`lmax` has the wrong type: Received `{type(params.get("lmax", None))}` expected `list[int] | None`')
266
+ if params.get("info", False) is None:
267
+ raise StyxValidationError("`info` must not be None")
268
+ if not isinstance(params["info"], bool):
269
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
270
+ if params.get("quiet", False) is None:
271
+ raise StyxValidationError("`quiet` must not be None")
272
+ if not isinstance(params["quiet"], bool):
273
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
274
+ if params.get("debug", False) is None:
275
+ raise StyxValidationError("`debug` must not be None")
276
+ if not isinstance(params["debug"], bool):
277
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
278
+ if params.get("force", False) is None:
279
+ raise StyxValidationError("`force` must not be None")
280
+ if not isinstance(params["force"], bool):
281
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
282
+ if params.get("nthreads", None) is not None:
283
+ if not isinstance(params["nthreads"], int):
284
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
285
+ if params.get("config", None) is not None:
286
+ if not isinstance(params["config"], list):
287
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Amp2responseConfigParamsDict] | None`')
288
+ for e in params["config"]:
289
+ amp2response_config_validate(e)
290
+ if params.get("help", False) is None:
291
+ raise StyxValidationError("`help` must not be None")
292
+ if not isinstance(params["help"], bool):
293
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
294
+ if params.get("version", False) is None:
295
+ raise StyxValidationError("`version` must not be None")
296
+ if not isinstance(params["version"], bool):
297
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
298
+ if params.get("amps", None) is None:
299
+ raise StyxValidationError("`amps` must not be None")
300
+ if not isinstance(params["amps"], (pathlib.Path, str)):
301
+ raise StyxValidationError(f'`amps` has the wrong type: Received `{type(params.get("amps", None))}` expected `InputPathType`')
302
+ if params.get("mask", None) is None:
303
+ raise StyxValidationError("`mask` must not be None")
304
+ if not isinstance(params["mask"], (pathlib.Path, str)):
305
+ raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType`')
306
+ if params.get("directions_1", None) is None:
307
+ raise StyxValidationError("`directions_1` must not be None")
308
+ if not isinstance(params["directions_1"], (pathlib.Path, str)):
309
+ raise StyxValidationError(f'`directions_1` has the wrong type: Received `{type(params.get("directions_1", None))}` expected `InputPathType`')
310
+ if params.get("response", None) is None:
311
+ raise StyxValidationError("`response` must not be None")
312
+ if not isinstance(params["response"], str):
313
+ raise StyxValidationError(f'`response` has the wrong type: Received `{type(params.get("response", None))}` expected `str`')
314
+
315
+
316
+ def amp2response_cargs(
317
+ params: Amp2responseParamsDict,
318
+ execution: Execution,
319
+ ) -> list[str]:
320
+ """
321
+ Build command-line arguments from parameters.
322
+
323
+ Args:
324
+ params: The parameters.
325
+ execution: The execution object for resolving input paths.
326
+ Returns:
327
+ Command-line arguments.
328
+ """
329
+ cargs = []
330
+ cargs.append("amp2response")
331
+ if params.get("isotropic", False):
332
+ cargs.append("-isotropic")
333
+ if params.get("noconstraint", False):
334
+ cargs.append("-noconstraint")
335
+ if params.get("directions", None) is not None:
336
+ cargs.extend([
337
+ "-directions",
338
+ execution.input_file(params.get("directions", None))
339
+ ])
340
+ if params.get("shells", None) is not None:
341
+ cargs.extend([
342
+ "-shells",
343
+ ",".join(map(str, params.get("shells", None)))
344
+ ])
345
+ if params.get("lmax", None) is not None:
346
+ cargs.extend([
347
+ "-lmax",
348
+ ",".join(map(str, params.get("lmax", None)))
349
+ ])
350
+ if params.get("info", False):
351
+ cargs.append("-info")
352
+ if params.get("quiet", False):
353
+ cargs.append("-quiet")
354
+ if params.get("debug", False):
355
+ cargs.append("-debug")
356
+ if params.get("force", False):
357
+ cargs.append("-force")
358
+ if params.get("nthreads", None) is not None:
359
+ cargs.extend([
360
+ "-nthreads",
361
+ str(params.get("nthreads", None))
362
+ ])
363
+ if params.get("config", None) is not None:
364
+ cargs.extend([a for c in [amp2response_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
365
+ if params.get("help", False):
366
+ cargs.append("-help")
367
+ if params.get("version", False):
368
+ cargs.append("-version")
369
+ cargs.append(execution.input_file(params.get("amps", None)))
370
+ cargs.append(execution.input_file(params.get("mask", None)))
371
+ cargs.append(execution.input_file(params.get("directions_1", None)))
372
+ cargs.append(params.get("response", None))
373
+ return cargs
374
+
375
+
376
+ def amp2response_outputs(
377
+ params: Amp2responseParamsDict,
378
+ execution: Execution,
379
+ ) -> Amp2responseOutputs:
380
+ """
381
+ Build outputs object containing output file paths and possibly stdout/stderr.
382
+
383
+ Args:
384
+ params: The parameters.
385
+ execution: The execution object for resolving input paths.
386
+ Returns:
387
+ Outputs object.
388
+ """
389
+ ret = Amp2responseOutputs(
390
+ root=execution.output_file("."),
391
+ response=execution.output_file(params.get("response", None)),
392
+ )
393
+ return ret
394
+
395
+
396
+ def amp2response_execute(
397
+ params: Amp2responseParamsDict,
398
+ runner: Runner | None = None,
399
+ ) -> Amp2responseOutputs:
400
+ """
401
+ amp2response
402
+
403
+ Estimate response function coefficients based on the DWI signal in
404
+ single-fibre voxels.
405
+
406
+ This command uses the image data from all selected single-fibre voxels
407
+ concurrently, rather than simply averaging their individual spherical
408
+ harmonic coefficients. It also ensures that the response function is
409
+ non-negative, and monotonic (i.e. its amplitude must increase from the fibre
410
+ direction out to the orthogonal plane).
411
+
412
+ If multi-shell data are provided, and one or more b-value shells are not
413
+ explicitly requested, the command will generate a response function for
414
+ every b-value shell (including b=0 if present).
415
+
416
+ References:
417
+
418
+ Smith, R. E.; Dhollander, T. & Connelly, A. Constrained linear least squares
419
+ estimation of anisotropic response function for spherical deconvolution.
420
+ ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 23.
421
+
422
+ Author: MRTrix3 Developers
423
+
424
+ URL: https://www.mrtrix.org/
425
+
426
+ Args:
427
+ params: The parameters.
428
+ runner: Command runner.
429
+ Returns:
430
+ NamedTuple of outputs (described in `Amp2responseOutputs`).
431
+ """
432
+ amp2response_validate(params)
433
+ runner = runner or get_global_runner()
434
+ execution = runner.start_execution(AMP2RESPONSE_METADATA)
435
+ params = execution.params(params)
436
+ cargs = amp2response_cargs(params, execution)
437
+ ret = amp2response_outputs(params, execution)
438
+ execution.run(cargs)
439
+ return ret
440
+
441
+
442
+ def amp2response(
443
+ amps: InputPathType,
444
+ mask: InputPathType,
445
+ directions_1: InputPathType,
446
+ response: str,
447
+ isotropic: bool = False,
448
+ noconstraint: bool = False,
449
+ directions: InputPathType | None = None,
450
+ shells: list[float] | None = None,
451
+ lmax: list[int] | None = None,
452
+ info: bool = False,
453
+ quiet: bool = False,
454
+ debug: bool = False,
455
+ force: bool = False,
456
+ nthreads: int | None = None,
457
+ config: list[Amp2responseConfigParamsDict] | None = None,
458
+ help_: bool = False,
459
+ version: bool = False,
460
+ runner: Runner | None = None,
461
+ ) -> Amp2responseOutputs:
462
+ """
463
+ amp2response
464
+
465
+ Estimate response function coefficients based on the DWI signal in
466
+ single-fibre voxels.
467
+
468
+ This command uses the image data from all selected single-fibre voxels
469
+ concurrently, rather than simply averaging their individual spherical
470
+ harmonic coefficients. It also ensures that the response function is
471
+ non-negative, and monotonic (i.e. its amplitude must increase from the fibre
472
+ direction out to the orthogonal plane).
473
+
474
+ If multi-shell data are provided, and one or more b-value shells are not
475
+ explicitly requested, the command will generate a response function for
476
+ every b-value shell (including b=0 if present).
477
+
478
+ References:
479
+
480
+ Smith, R. E.; Dhollander, T. & Connelly, A. Constrained linear least squares
481
+ estimation of anisotropic response function for spherical deconvolution.
482
+ ISMRM Workshop on Breaking the Barriers of Diffusion MRI, 23.
483
+
484
+ Author: MRTrix3 Developers
485
+
486
+ URL: https://www.mrtrix.org/
487
+
488
+ Args:
489
+ amps: the amplitudes image.
490
+ mask: the mask containing the voxels from which to estimate the\
491
+ response function.
492
+ directions_1: a 4D image containing the estimated fibre directions.
493
+ response: the output zonal spherical harmonic coefficients.
494
+ isotropic: estimate an isotropic response function (lmax=0 for all\
495
+ shells).
496
+ noconstraint: disable the non-negativity and monotonicity constraints.
497
+ directions: provide an external text file containing the directions\
498
+ along which the amplitudes are sampled.
499
+ shells: specify one or more b-values to use during processing, as a\
500
+ comma-separated list of the desired approximate b-values (b-values are\
501
+ clustered to allow for small deviations). Note that some commands are\
502
+ incompatible with multiple b-values, and will report an error if more\
503
+ than one b-value is provided.\
504
+ WARNING: note that, even though the b=0 volumes are never referred\
505
+ to as shells in the literature, they still have to be explicitly\
506
+ included in the list of b-values as provided to the -shell option!\
507
+ Several algorithms which include the b=0 volumes in their\
508
+ computations may otherwise return an undesired result.
509
+ lmax: specify the maximum harmonic degree of the response function to\
510
+ estimate (can be a comma-separated list for multi-shell data).
511
+ info: display information messages.
512
+ quiet: do not display information messages or progress status;\
513
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
514
+ environment variable to a non-empty string.
515
+ debug: display debugging messages.
516
+ force: force overwrite of output files (caution: using the same file as\
517
+ input and output might cause unexpected behaviour).
518
+ nthreads: use this number of threads in multi-threaded applications\
519
+ (set to 0 to disable multi-threading).
520
+ config: temporarily set the value of an MRtrix config file entry.
521
+ help_: display this information page and exit.
522
+ version: display version information and exit.
523
+ runner: Command runner.
524
+ Returns:
525
+ NamedTuple of outputs (described in `Amp2responseOutputs`).
526
+ """
527
+ params = amp2response_params(
528
+ isotropic=isotropic,
529
+ noconstraint=noconstraint,
530
+ directions=directions,
531
+ shells=shells,
532
+ lmax=lmax,
533
+ info=info,
534
+ quiet=quiet,
535
+ debug=debug,
536
+ force=force,
537
+ nthreads=nthreads,
538
+ config=config,
539
+ help_=help_,
540
+ version=version,
541
+ amps=amps,
542
+ mask=mask,
543
+ directions_1=directions_1,
544
+ response=response,
545
+ )
546
+ return amp2response_execute(params, runner)
547
+
548
+
549
+ __all__ = [
550
+ "AMP2RESPONSE_METADATA",
551
+ "Amp2responseConfigParamsDict",
552
+ "Amp2responseConfigParamsDictTagged",
553
+ "Amp2responseOutputs",
554
+ "Amp2responseParamsDict",
555
+ "Amp2responseParamsDictTagged",
556
+ "amp2response",
557
+ "amp2response_config",
558
+ "amp2response_execute",
559
+ "amp2response_params",
560
+ ]