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,514 @@
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
+ DIRGEN_METADATA = Metadata(
9
+ id="cda69ea8a57022773ddb6022ca8ca9caa5cc0e2b.boutiques",
10
+ name="dirgen",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _DirgenConfigParamsDictNoTag = typing.TypedDict('_DirgenConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ DirgenConfigParamsDictTagged = typing.TypedDict('DirgenConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ DirgenConfigParamsDict = _DirgenConfigParamsDictNoTag | DirgenConfigParamsDictTagged
26
+
27
+
28
+ _DirgenParamsDictNoTag = typing.TypedDict('_DirgenParamsDictNoTag', {
29
+ "power": typing.NotRequired[int | None],
30
+ "niter": typing.NotRequired[int | None],
31
+ "restarts": typing.NotRequired[int | None],
32
+ "unipolar": bool,
33
+ "cartesian": bool,
34
+ "info": bool,
35
+ "quiet": bool,
36
+ "debug": bool,
37
+ "force": bool,
38
+ "nthreads": typing.NotRequired[int | None],
39
+ "config": typing.NotRequired[list[DirgenConfigParamsDict] | None],
40
+ "help": bool,
41
+ "version": bool,
42
+ "ndir": int,
43
+ "dirs": str,
44
+ })
45
+ DirgenParamsDictTagged = typing.TypedDict('DirgenParamsDictTagged', {
46
+ "@type": typing.Literal["mrtrix/dirgen"],
47
+ "power": typing.NotRequired[int | None],
48
+ "niter": typing.NotRequired[int | None],
49
+ "restarts": typing.NotRequired[int | None],
50
+ "unipolar": bool,
51
+ "cartesian": bool,
52
+ "info": bool,
53
+ "quiet": bool,
54
+ "debug": bool,
55
+ "force": bool,
56
+ "nthreads": typing.NotRequired[int | None],
57
+ "config": typing.NotRequired[list[DirgenConfigParamsDict] | None],
58
+ "help": bool,
59
+ "version": bool,
60
+ "ndir": int,
61
+ "dirs": str,
62
+ })
63
+ DirgenParamsDict = _DirgenParamsDictNoTag | DirgenParamsDictTagged
64
+
65
+
66
+ def dirgen_config(
67
+ key: str,
68
+ value: str,
69
+ ) -> DirgenConfigParamsDictTagged:
70
+ """
71
+ Build parameters.
72
+
73
+ Args:
74
+ key: temporarily set the value of an MRtrix config file entry.
75
+ value: temporarily set the value of an MRtrix config file entry.
76
+ Returns:
77
+ Parameter dictionary
78
+ """
79
+ params = {
80
+ "@type": "config",
81
+ "key": key,
82
+ "value": value,
83
+ }
84
+ return params
85
+
86
+
87
+ def dirgen_config_validate(
88
+ params: typing.Any,
89
+ ) -> None:
90
+ """
91
+ Validate parameters. Throws an error if `params` is not a valid
92
+ `DirgenConfigParamsDict` object.
93
+
94
+ Args:
95
+ params: The parameters object to validate.
96
+ """
97
+ if params is None or not isinstance(params, dict):
98
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
99
+ if params.get("key", None) is None:
100
+ raise StyxValidationError("`key` must not be None")
101
+ if not isinstance(params["key"], str):
102
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
103
+ if params.get("value", None) is None:
104
+ raise StyxValidationError("`value` must not be None")
105
+ if not isinstance(params["value"], str):
106
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
107
+
108
+
109
+ def dirgen_config_cargs(
110
+ params: DirgenConfigParamsDict,
111
+ execution: Execution,
112
+ ) -> list[str]:
113
+ """
114
+ Build command-line arguments from parameters.
115
+
116
+ Args:
117
+ params: The parameters.
118
+ execution: The execution object for resolving input paths.
119
+ Returns:
120
+ Command-line arguments.
121
+ """
122
+ cargs = []
123
+ cargs.append("-config")
124
+ cargs.append(params.get("key", None))
125
+ cargs.append(params.get("value", None))
126
+ return cargs
127
+
128
+
129
+ class DirgenOutputs(typing.NamedTuple):
130
+ """
131
+ Output object returned when calling `DirgenParamsDict(...)`.
132
+ """
133
+ root: OutputPathType
134
+ """Output root folder. This is the root folder for all outputs."""
135
+ dirs: OutputPathType
136
+ """the text file to write the directions to, as [ az el ] pairs."""
137
+
138
+
139
+ def dirgen_params(
140
+ ndir: int,
141
+ dirs: str,
142
+ power: int | None = None,
143
+ niter: int | None = None,
144
+ restarts: int | None = None,
145
+ unipolar: bool = False,
146
+ cartesian: bool = False,
147
+ info: bool = False,
148
+ quiet: bool = False,
149
+ debug: bool = False,
150
+ force: bool = False,
151
+ nthreads: int | None = None,
152
+ config: list[DirgenConfigParamsDict] | None = None,
153
+ help_: bool = False,
154
+ version: bool = False,
155
+ ) -> DirgenParamsDictTagged:
156
+ """
157
+ Build parameters.
158
+
159
+ Args:
160
+ ndir: the number of directions to generate.
161
+ dirs: the text file to write the directions to, as [ az el ] pairs.
162
+ power: specify exponent to use for repulsion power law (default: 1).\
163
+ This must be a power of 2 (i.e. 1, 2, 4, 8, 16, ...).
164
+ niter: specify the maximum number of iterations to perform (default:\
165
+ 10000).
166
+ restarts: specify the number of restarts to perform (default: 10).
167
+ unipolar: optimise assuming a unipolar electrostatic repulsion model\
168
+ rather than the bipolar model normally assumed in DWI.
169
+ cartesian: Output the directions in Cartesian coordinates [x y z]\
170
+ instead of [az el].
171
+ info: display information messages.
172
+ quiet: do not display information messages or progress status;\
173
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
174
+ environment variable to a non-empty string.
175
+ debug: display debugging messages.
176
+ force: force overwrite of output files (caution: using the same file as\
177
+ input and output might cause unexpected behaviour).
178
+ nthreads: use this number of threads in multi-threaded applications\
179
+ (set to 0 to disable multi-threading).
180
+ config: temporarily set the value of an MRtrix config file entry.
181
+ help_: display this information page and exit.
182
+ version: display version information and exit.
183
+ Returns:
184
+ Parameter dictionary
185
+ """
186
+ params = {
187
+ "@type": "mrtrix/dirgen",
188
+ "unipolar": unipolar,
189
+ "cartesian": cartesian,
190
+ "info": info,
191
+ "quiet": quiet,
192
+ "debug": debug,
193
+ "force": force,
194
+ "help": help_,
195
+ "version": version,
196
+ "ndir": ndir,
197
+ "dirs": dirs,
198
+ }
199
+ if power is not None:
200
+ params["power"] = power
201
+ if niter is not None:
202
+ params["niter"] = niter
203
+ if restarts is not None:
204
+ params["restarts"] = restarts
205
+ if nthreads is not None:
206
+ params["nthreads"] = nthreads
207
+ if config is not None:
208
+ params["config"] = config
209
+ return params
210
+
211
+
212
+ def dirgen_validate(
213
+ params: typing.Any,
214
+ ) -> None:
215
+ """
216
+ Validate parameters. Throws an error if `params` is not a valid
217
+ `DirgenParamsDict` object.
218
+
219
+ Args:
220
+ params: The parameters object to validate.
221
+ """
222
+ if params is None or not isinstance(params, dict):
223
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
224
+ if params.get("power", None) is not None:
225
+ if not isinstance(params["power"], int):
226
+ raise StyxValidationError(f'`power` has the wrong type: Received `{type(params.get("power", None))}` expected `int | None`')
227
+ if params.get("niter", None) is not None:
228
+ if not isinstance(params["niter"], int):
229
+ raise StyxValidationError(f'`niter` has the wrong type: Received `{type(params.get("niter", None))}` expected `int | None`')
230
+ if params.get("restarts", None) is not None:
231
+ if not isinstance(params["restarts"], int):
232
+ raise StyxValidationError(f'`restarts` has the wrong type: Received `{type(params.get("restarts", None))}` expected `int | None`')
233
+ if params.get("unipolar", False) is None:
234
+ raise StyxValidationError("`unipolar` must not be None")
235
+ if not isinstance(params["unipolar"], bool):
236
+ raise StyxValidationError(f'`unipolar` has the wrong type: Received `{type(params.get("unipolar", False))}` expected `bool`')
237
+ if params.get("cartesian", False) is None:
238
+ raise StyxValidationError("`cartesian` must not be None")
239
+ if not isinstance(params["cartesian"], bool):
240
+ raise StyxValidationError(f'`cartesian` has the wrong type: Received `{type(params.get("cartesian", False))}` expected `bool`')
241
+ if params.get("info", False) is None:
242
+ raise StyxValidationError("`info` must not be None")
243
+ if not isinstance(params["info"], bool):
244
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
245
+ if params.get("quiet", False) is None:
246
+ raise StyxValidationError("`quiet` must not be None")
247
+ if not isinstance(params["quiet"], bool):
248
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
249
+ if params.get("debug", False) is None:
250
+ raise StyxValidationError("`debug` must not be None")
251
+ if not isinstance(params["debug"], bool):
252
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
253
+ if params.get("force", False) is None:
254
+ raise StyxValidationError("`force` must not be None")
255
+ if not isinstance(params["force"], bool):
256
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
257
+ if params.get("nthreads", None) is not None:
258
+ if not isinstance(params["nthreads"], int):
259
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
260
+ if params.get("config", None) is not None:
261
+ if not isinstance(params["config"], list):
262
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[DirgenConfigParamsDict] | None`')
263
+ for e in params["config"]:
264
+ dirgen_config_validate(e)
265
+ if params.get("help", False) is None:
266
+ raise StyxValidationError("`help` must not be None")
267
+ if not isinstance(params["help"], bool):
268
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
269
+ if params.get("version", False) is None:
270
+ raise StyxValidationError("`version` must not be None")
271
+ if not isinstance(params["version"], bool):
272
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
273
+ if params.get("ndir", None) is None:
274
+ raise StyxValidationError("`ndir` must not be None")
275
+ if not isinstance(params["ndir"], int):
276
+ raise StyxValidationError(f'`ndir` has the wrong type: Received `{type(params.get("ndir", None))}` expected `int`')
277
+ if params.get("dirs", None) is None:
278
+ raise StyxValidationError("`dirs` must not be None")
279
+ if not isinstance(params["dirs"], str):
280
+ raise StyxValidationError(f'`dirs` has the wrong type: Received `{type(params.get("dirs", None))}` expected `str`')
281
+
282
+
283
+ def dirgen_cargs(
284
+ params: DirgenParamsDict,
285
+ execution: Execution,
286
+ ) -> list[str]:
287
+ """
288
+ Build command-line arguments from parameters.
289
+
290
+ Args:
291
+ params: The parameters.
292
+ execution: The execution object for resolving input paths.
293
+ Returns:
294
+ Command-line arguments.
295
+ """
296
+ cargs = []
297
+ cargs.append("dirgen")
298
+ if params.get("power", None) is not None:
299
+ cargs.extend([
300
+ "-power",
301
+ str(params.get("power", None))
302
+ ])
303
+ if params.get("niter", None) is not None:
304
+ cargs.extend([
305
+ "-niter",
306
+ str(params.get("niter", None))
307
+ ])
308
+ if params.get("restarts", None) is not None:
309
+ cargs.extend([
310
+ "-restarts",
311
+ str(params.get("restarts", None))
312
+ ])
313
+ if params.get("unipolar", False):
314
+ cargs.append("-unipolar")
315
+ if params.get("cartesian", False):
316
+ cargs.append("-cartesian")
317
+ if params.get("info", False):
318
+ cargs.append("-info")
319
+ if params.get("quiet", False):
320
+ cargs.append("-quiet")
321
+ if params.get("debug", False):
322
+ cargs.append("-debug")
323
+ if params.get("force", False):
324
+ cargs.append("-force")
325
+ if params.get("nthreads", None) is not None:
326
+ cargs.extend([
327
+ "-nthreads",
328
+ str(params.get("nthreads", None))
329
+ ])
330
+ if params.get("config", None) is not None:
331
+ cargs.extend([a for c in [dirgen_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
332
+ if params.get("help", False):
333
+ cargs.append("-help")
334
+ if params.get("version", False):
335
+ cargs.append("-version")
336
+ cargs.append(str(params.get("ndir", None)))
337
+ cargs.append(params.get("dirs", None))
338
+ return cargs
339
+
340
+
341
+ def dirgen_outputs(
342
+ params: DirgenParamsDict,
343
+ execution: Execution,
344
+ ) -> DirgenOutputs:
345
+ """
346
+ Build outputs object containing output file paths and possibly stdout/stderr.
347
+
348
+ Args:
349
+ params: The parameters.
350
+ execution: The execution object for resolving input paths.
351
+ Returns:
352
+ Outputs object.
353
+ """
354
+ ret = DirgenOutputs(
355
+ root=execution.output_file("."),
356
+ dirs=execution.output_file(params.get("dirs", None)),
357
+ )
358
+ return ret
359
+
360
+
361
+ def dirgen_execute(
362
+ params: DirgenParamsDict,
363
+ runner: Runner | None = None,
364
+ ) -> DirgenOutputs:
365
+ """
366
+ dirgen
367
+
368
+ Generate a set of uniformly distributed directions using a bipolar
369
+ electrostatic repulsion model.
370
+
371
+ Directions are distributed by analogy to an electrostatic repulsion system,
372
+ with each direction corresponding to a single electrostatic charge (for
373
+ -unipolar), or a pair of diametrically opposed charges (for the default
374
+ bipolar case). The energy of the system is determined based on the Coulomb
375
+ repulsion, which assumes the form 1/r^power, where r is the distance between
376
+ any pair of charges, and p is the power assumed for the repulsion law
377
+ (default: 1). The minimum energy state is obtained by gradient descent.
378
+
379
+ References:
380
+
381
+ Jones, D.; Horsfield, M. & Simmons, A. Optimal strategies for measuring
382
+ diffusion in anisotropic systems by magnetic resonance imaging. Magnetic
383
+ Resonance in Medicine, 1999, 42: 515-525
384
+
385
+ Papadakis, N. G.; Murrills, C. D.; Hall, L. D.; Huang, C. L.-H. & Adrian
386
+ Carpenter, T. Minimal gradient encoding for robust estimation of diffusion
387
+ anisotropy. Magnetic Resonance Imaging, 2000, 18: 671-679.
388
+
389
+ Author: MRTrix3 Developers
390
+
391
+ URL: https://www.mrtrix.org/
392
+
393
+ Args:
394
+ params: The parameters.
395
+ runner: Command runner.
396
+ Returns:
397
+ NamedTuple of outputs (described in `DirgenOutputs`).
398
+ """
399
+ dirgen_validate(params)
400
+ runner = runner or get_global_runner()
401
+ execution = runner.start_execution(DIRGEN_METADATA)
402
+ params = execution.params(params)
403
+ cargs = dirgen_cargs(params, execution)
404
+ ret = dirgen_outputs(params, execution)
405
+ execution.run(cargs)
406
+ return ret
407
+
408
+
409
+ def dirgen(
410
+ ndir: int,
411
+ dirs: str,
412
+ power: int | None = None,
413
+ niter: int | None = None,
414
+ restarts: int | None = None,
415
+ unipolar: bool = False,
416
+ cartesian: bool = False,
417
+ info: bool = False,
418
+ quiet: bool = False,
419
+ debug: bool = False,
420
+ force: bool = False,
421
+ nthreads: int | None = None,
422
+ config: list[DirgenConfigParamsDict] | None = None,
423
+ help_: bool = False,
424
+ version: bool = False,
425
+ runner: Runner | None = None,
426
+ ) -> DirgenOutputs:
427
+ """
428
+ dirgen
429
+
430
+ Generate a set of uniformly distributed directions using a bipolar
431
+ electrostatic repulsion model.
432
+
433
+ Directions are distributed by analogy to an electrostatic repulsion system,
434
+ with each direction corresponding to a single electrostatic charge (for
435
+ -unipolar), or a pair of diametrically opposed charges (for the default
436
+ bipolar case). The energy of the system is determined based on the Coulomb
437
+ repulsion, which assumes the form 1/r^power, where r is the distance between
438
+ any pair of charges, and p is the power assumed for the repulsion law
439
+ (default: 1). The minimum energy state is obtained by gradient descent.
440
+
441
+ References:
442
+
443
+ Jones, D.; Horsfield, M. & Simmons, A. Optimal strategies for measuring
444
+ diffusion in anisotropic systems by magnetic resonance imaging. Magnetic
445
+ Resonance in Medicine, 1999, 42: 515-525
446
+
447
+ Papadakis, N. G.; Murrills, C. D.; Hall, L. D.; Huang, C. L.-H. & Adrian
448
+ Carpenter, T. Minimal gradient encoding for robust estimation of diffusion
449
+ anisotropy. Magnetic Resonance Imaging, 2000, 18: 671-679.
450
+
451
+ Author: MRTrix3 Developers
452
+
453
+ URL: https://www.mrtrix.org/
454
+
455
+ Args:
456
+ ndir: the number of directions to generate.
457
+ dirs: the text file to write the directions to, as [ az el ] pairs.
458
+ power: specify exponent to use for repulsion power law (default: 1).\
459
+ This must be a power of 2 (i.e. 1, 2, 4, 8, 16, ...).
460
+ niter: specify the maximum number of iterations to perform (default:\
461
+ 10000).
462
+ restarts: specify the number of restarts to perform (default: 10).
463
+ unipolar: optimise assuming a unipolar electrostatic repulsion model\
464
+ rather than the bipolar model normally assumed in DWI.
465
+ cartesian: Output the directions in Cartesian coordinates [x y z]\
466
+ instead of [az el].
467
+ info: display information messages.
468
+ quiet: do not display information messages or progress status;\
469
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
470
+ environment variable to a non-empty string.
471
+ debug: display debugging messages.
472
+ force: force overwrite of output files (caution: using the same file as\
473
+ input and output might cause unexpected behaviour).
474
+ nthreads: use this number of threads in multi-threaded applications\
475
+ (set to 0 to disable multi-threading).
476
+ config: temporarily set the value of an MRtrix config file entry.
477
+ help_: display this information page and exit.
478
+ version: display version information and exit.
479
+ runner: Command runner.
480
+ Returns:
481
+ NamedTuple of outputs (described in `DirgenOutputs`).
482
+ """
483
+ params = dirgen_params(
484
+ power=power,
485
+ niter=niter,
486
+ restarts=restarts,
487
+ unipolar=unipolar,
488
+ cartesian=cartesian,
489
+ info=info,
490
+ quiet=quiet,
491
+ debug=debug,
492
+ force=force,
493
+ nthreads=nthreads,
494
+ config=config,
495
+ help_=help_,
496
+ version=version,
497
+ ndir=ndir,
498
+ dirs=dirs,
499
+ )
500
+ return dirgen_execute(params, runner)
501
+
502
+
503
+ __all__ = [
504
+ "DIRGEN_METADATA",
505
+ "DirgenConfigParamsDict",
506
+ "DirgenConfigParamsDictTagged",
507
+ "DirgenOutputs",
508
+ "DirgenParamsDict",
509
+ "DirgenParamsDictTagged",
510
+ "dirgen",
511
+ "dirgen_config",
512
+ "dirgen_execute",
513
+ "dirgen_params",
514
+ ]