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,737 @@
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
+ MREDIT_METADATA = Metadata(
9
+ id="678a737a8aca3b1d9299ee0e4e4b44fe21b937dd.boutiques",
10
+ name="mredit",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _MreditPlaneParamsDictNoTag = typing.TypedDict('_MreditPlaneParamsDictNoTag', {
17
+ "axis": int,
18
+ "coord": list[int],
19
+ "value": float,
20
+ })
21
+ MreditPlaneParamsDictTagged = typing.TypedDict('MreditPlaneParamsDictTagged', {
22
+ "@type": typing.Literal["plane"],
23
+ "axis": int,
24
+ "coord": list[int],
25
+ "value": float,
26
+ })
27
+ MreditPlaneParamsDict = _MreditPlaneParamsDictNoTag | MreditPlaneParamsDictTagged
28
+
29
+
30
+ _MreditSphereParamsDictNoTag = typing.TypedDict('_MreditSphereParamsDictNoTag', {
31
+ "position": list[float],
32
+ "radius": float,
33
+ "value": float,
34
+ })
35
+ MreditSphereParamsDictTagged = typing.TypedDict('MreditSphereParamsDictTagged', {
36
+ "@type": typing.Literal["sphere"],
37
+ "position": list[float],
38
+ "radius": float,
39
+ "value": float,
40
+ })
41
+ MreditSphereParamsDict = _MreditSphereParamsDictNoTag | MreditSphereParamsDictTagged
42
+
43
+
44
+ _MreditVoxelParamsDictNoTag = typing.TypedDict('_MreditVoxelParamsDictNoTag', {
45
+ "position": list[float],
46
+ "value": float,
47
+ })
48
+ MreditVoxelParamsDictTagged = typing.TypedDict('MreditVoxelParamsDictTagged', {
49
+ "@type": typing.Literal["voxel"],
50
+ "position": list[float],
51
+ "value": float,
52
+ })
53
+ MreditVoxelParamsDict = _MreditVoxelParamsDictNoTag | MreditVoxelParamsDictTagged
54
+
55
+
56
+ _MreditConfigParamsDictNoTag = typing.TypedDict('_MreditConfigParamsDictNoTag', {
57
+ "key": str,
58
+ "value": str,
59
+ })
60
+ MreditConfigParamsDictTagged = typing.TypedDict('MreditConfigParamsDictTagged', {
61
+ "@type": typing.Literal["config"],
62
+ "key": str,
63
+ "value": str,
64
+ })
65
+ MreditConfigParamsDict = _MreditConfigParamsDictNoTag | MreditConfigParamsDictTagged
66
+
67
+
68
+ _MreditParamsDictNoTag = typing.TypedDict('_MreditParamsDictNoTag', {
69
+ "plane": typing.NotRequired[list[MreditPlaneParamsDict] | None],
70
+ "sphere": typing.NotRequired[list[MreditSphereParamsDict] | None],
71
+ "voxel": typing.NotRequired[list[MreditVoxelParamsDict] | None],
72
+ "scanner": bool,
73
+ "info": bool,
74
+ "quiet": bool,
75
+ "debug": bool,
76
+ "force": bool,
77
+ "nthreads": typing.NotRequired[int | None],
78
+ "config": typing.NotRequired[list[MreditConfigParamsDict] | None],
79
+ "help": bool,
80
+ "version": bool,
81
+ "input": InputPathType,
82
+ "output": typing.NotRequired[str | None],
83
+ })
84
+ MreditParamsDictTagged = typing.TypedDict('MreditParamsDictTagged', {
85
+ "@type": typing.Literal["mrtrix/mredit"],
86
+ "plane": typing.NotRequired[list[MreditPlaneParamsDict] | None],
87
+ "sphere": typing.NotRequired[list[MreditSphereParamsDict] | None],
88
+ "voxel": typing.NotRequired[list[MreditVoxelParamsDict] | None],
89
+ "scanner": bool,
90
+ "info": bool,
91
+ "quiet": bool,
92
+ "debug": bool,
93
+ "force": bool,
94
+ "nthreads": typing.NotRequired[int | None],
95
+ "config": typing.NotRequired[list[MreditConfigParamsDict] | None],
96
+ "help": bool,
97
+ "version": bool,
98
+ "input": InputPathType,
99
+ "output": typing.NotRequired[str | None],
100
+ })
101
+ MreditParamsDict = _MreditParamsDictNoTag | MreditParamsDictTagged
102
+
103
+
104
+ def mredit_plane(
105
+ axis: int,
106
+ coord: list[int],
107
+ value: float,
108
+ ) -> MreditPlaneParamsDictTagged:
109
+ """
110
+ Build parameters.
111
+
112
+ Args:
113
+ axis: fill one or more planes on a particular image axis.
114
+ coord: fill one or more planes on a particular image axis.
115
+ value: fill one or more planes on a particular image axis.
116
+ Returns:
117
+ Parameter dictionary
118
+ """
119
+ params = {
120
+ "@type": "plane",
121
+ "axis": axis,
122
+ "coord": coord,
123
+ "value": value,
124
+ }
125
+ return params
126
+
127
+
128
+ def mredit_plane_validate(
129
+ params: typing.Any,
130
+ ) -> None:
131
+ """
132
+ Validate parameters. Throws an error if `params` is not a valid
133
+ `MreditPlaneParamsDict` object.
134
+
135
+ Args:
136
+ params: The parameters object to validate.
137
+ """
138
+ if params is None or not isinstance(params, dict):
139
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
140
+ if params.get("axis", None) is None:
141
+ raise StyxValidationError("`axis` must not be None")
142
+ if not isinstance(params["axis"], int):
143
+ raise StyxValidationError(f'`axis` has the wrong type: Received `{type(params.get("axis", None))}` expected `int`')
144
+ if params.get("coord", None) is None:
145
+ raise StyxValidationError("`coord` must not be None")
146
+ if not isinstance(params["coord"], list):
147
+ raise StyxValidationError(f'`coord` has the wrong type: Received `{type(params.get("coord", None))}` expected `list[int]`')
148
+ for e in params["coord"]:
149
+ if not isinstance(e, int):
150
+ raise StyxValidationError(f'`coord` has the wrong type: Received `{type(params.get("coord", None))}` expected `list[int]`')
151
+ if params.get("value", None) is None:
152
+ raise StyxValidationError("`value` must not be None")
153
+ if not isinstance(params["value"], (float, int)):
154
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `float`')
155
+
156
+
157
+ def mredit_plane_cargs(
158
+ params: MreditPlaneParamsDict,
159
+ execution: Execution,
160
+ ) -> list[str]:
161
+ """
162
+ Build command-line arguments from parameters.
163
+
164
+ Args:
165
+ params: The parameters.
166
+ execution: The execution object for resolving input paths.
167
+ Returns:
168
+ Command-line arguments.
169
+ """
170
+ cargs = []
171
+ cargs.append("-plane")
172
+ cargs.append(str(params.get("axis", None)))
173
+ cargs.extend(map(str, params.get("coord", None)))
174
+ cargs.append(str(params.get("value", None)))
175
+ return cargs
176
+
177
+
178
+ def mredit_sphere(
179
+ position: list[float],
180
+ radius: float,
181
+ value: float,
182
+ ) -> MreditSphereParamsDictTagged:
183
+ """
184
+ Build parameters.
185
+
186
+ Args:
187
+ position: draw a sphere with radius in mm.
188
+ radius: draw a sphere with radius in mm.
189
+ value: draw a sphere with radius in mm.
190
+ Returns:
191
+ Parameter dictionary
192
+ """
193
+ params = {
194
+ "@type": "sphere",
195
+ "position": position,
196
+ "radius": radius,
197
+ "value": value,
198
+ }
199
+ return params
200
+
201
+
202
+ def mredit_sphere_validate(
203
+ params: typing.Any,
204
+ ) -> None:
205
+ """
206
+ Validate parameters. Throws an error if `params` is not a valid
207
+ `MreditSphereParamsDict` object.
208
+
209
+ Args:
210
+ params: The parameters object to validate.
211
+ """
212
+ if params is None or not isinstance(params, dict):
213
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
214
+ if params.get("position", None) is None:
215
+ raise StyxValidationError("`position` must not be None")
216
+ if not isinstance(params["position"], list):
217
+ raise StyxValidationError(f'`position` has the wrong type: Received `{type(params.get("position", None))}` expected `list[float]`')
218
+ for e in params["position"]:
219
+ if not isinstance(e, (float, int)):
220
+ raise StyxValidationError(f'`position` has the wrong type: Received `{type(params.get("position", None))}` expected `list[float]`')
221
+ if params.get("radius", None) is None:
222
+ raise StyxValidationError("`radius` must not be None")
223
+ if not isinstance(params["radius"], (float, int)):
224
+ raise StyxValidationError(f'`radius` has the wrong type: Received `{type(params.get("radius", None))}` expected `float`')
225
+ if params.get("value", None) is None:
226
+ raise StyxValidationError("`value` must not be None")
227
+ if not isinstance(params["value"], (float, int)):
228
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `float`')
229
+
230
+
231
+ def mredit_sphere_cargs(
232
+ params: MreditSphereParamsDict,
233
+ execution: Execution,
234
+ ) -> list[str]:
235
+ """
236
+ Build command-line arguments from parameters.
237
+
238
+ Args:
239
+ params: The parameters.
240
+ execution: The execution object for resolving input paths.
241
+ Returns:
242
+ Command-line arguments.
243
+ """
244
+ cargs = []
245
+ cargs.append("-sphere")
246
+ cargs.extend(map(str, params.get("position", None)))
247
+ cargs.append(str(params.get("radius", None)))
248
+ cargs.append(str(params.get("value", None)))
249
+ return cargs
250
+
251
+
252
+ def mredit_voxel(
253
+ position: list[float],
254
+ value: float,
255
+ ) -> MreditVoxelParamsDictTagged:
256
+ """
257
+ Build parameters.
258
+
259
+ Args:
260
+ position: change the image value within a single voxel.
261
+ value: change the image value within a single voxel.
262
+ Returns:
263
+ Parameter dictionary
264
+ """
265
+ params = {
266
+ "@type": "voxel",
267
+ "position": position,
268
+ "value": value,
269
+ }
270
+ return params
271
+
272
+
273
+ def mredit_voxel_validate(
274
+ params: typing.Any,
275
+ ) -> None:
276
+ """
277
+ Validate parameters. Throws an error if `params` is not a valid
278
+ `MreditVoxelParamsDict` object.
279
+
280
+ Args:
281
+ params: The parameters object to validate.
282
+ """
283
+ if params is None or not isinstance(params, dict):
284
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
285
+ if params.get("position", None) is None:
286
+ raise StyxValidationError("`position` must not be None")
287
+ if not isinstance(params["position"], list):
288
+ raise StyxValidationError(f'`position` has the wrong type: Received `{type(params.get("position", None))}` expected `list[float]`')
289
+ for e in params["position"]:
290
+ if not isinstance(e, (float, int)):
291
+ raise StyxValidationError(f'`position` has the wrong type: Received `{type(params.get("position", None))}` expected `list[float]`')
292
+ if params.get("value", None) is None:
293
+ raise StyxValidationError("`value` must not be None")
294
+ if not isinstance(params["value"], (float, int)):
295
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `float`')
296
+
297
+
298
+ def mredit_voxel_cargs(
299
+ params: MreditVoxelParamsDict,
300
+ execution: Execution,
301
+ ) -> list[str]:
302
+ """
303
+ Build command-line arguments from parameters.
304
+
305
+ Args:
306
+ params: The parameters.
307
+ execution: The execution object for resolving input paths.
308
+ Returns:
309
+ Command-line arguments.
310
+ """
311
+ cargs = []
312
+ cargs.append("-voxel")
313
+ cargs.extend(map(str, params.get("position", None)))
314
+ cargs.append(str(params.get("value", None)))
315
+ return cargs
316
+
317
+
318
+ def mredit_config(
319
+ key: str,
320
+ value: str,
321
+ ) -> MreditConfigParamsDictTagged:
322
+ """
323
+ Build parameters.
324
+
325
+ Args:
326
+ key: temporarily set the value of an MRtrix config file entry.
327
+ value: temporarily set the value of an MRtrix config file entry.
328
+ Returns:
329
+ Parameter dictionary
330
+ """
331
+ params = {
332
+ "@type": "config",
333
+ "key": key,
334
+ "value": value,
335
+ }
336
+ return params
337
+
338
+
339
+ def mredit_config_validate(
340
+ params: typing.Any,
341
+ ) -> None:
342
+ """
343
+ Validate parameters. Throws an error if `params` is not a valid
344
+ `MreditConfigParamsDict` object.
345
+
346
+ Args:
347
+ params: The parameters object to validate.
348
+ """
349
+ if params is None or not isinstance(params, dict):
350
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
351
+ if params.get("key", None) is None:
352
+ raise StyxValidationError("`key` must not be None")
353
+ if not isinstance(params["key"], str):
354
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
355
+ if params.get("value", None) is None:
356
+ raise StyxValidationError("`value` must not be None")
357
+ if not isinstance(params["value"], str):
358
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
359
+
360
+
361
+ def mredit_config_cargs(
362
+ params: MreditConfigParamsDict,
363
+ execution: Execution,
364
+ ) -> list[str]:
365
+ """
366
+ Build command-line arguments from parameters.
367
+
368
+ Args:
369
+ params: The parameters.
370
+ execution: The execution object for resolving input paths.
371
+ Returns:
372
+ Command-line arguments.
373
+ """
374
+ cargs = []
375
+ cargs.append("-config")
376
+ cargs.append(params.get("key", None))
377
+ cargs.append(params.get("value", None))
378
+ return cargs
379
+
380
+
381
+ class MreditOutputs(typing.NamedTuple):
382
+ """
383
+ Output object returned when calling `MreditParamsDict(...)`.
384
+ """
385
+ root: OutputPathType
386
+ """Output root folder. This is the root folder for all outputs."""
387
+ output: OutputPathType | None
388
+ """the (optional) output image"""
389
+
390
+
391
+ def mredit_params(
392
+ input_: InputPathType,
393
+ plane: list[MreditPlaneParamsDict] | None = None,
394
+ sphere: list[MreditSphereParamsDict] | None = None,
395
+ voxel: list[MreditVoxelParamsDict] | None = None,
396
+ scanner: bool = False,
397
+ info: bool = False,
398
+ quiet: bool = False,
399
+ debug: bool = False,
400
+ force: bool = False,
401
+ nthreads: int | None = None,
402
+ config: list[MreditConfigParamsDict] | None = None,
403
+ help_: bool = False,
404
+ version: bool = False,
405
+ output: str | None = None,
406
+ ) -> MreditParamsDictTagged:
407
+ """
408
+ Build parameters.
409
+
410
+ Args:
411
+ input_: the input image.
412
+ plane: fill one or more planes on a particular image axis.
413
+ sphere: draw a sphere with radius in mm.
414
+ voxel: change the image value within a single voxel.
415
+ scanner: indicate that coordinates are specified in scanner space,\
416
+ rather than as voxel coordinates.
417
+ info: display information messages.
418
+ quiet: do not display information messages or progress status;\
419
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
420
+ environment variable to a non-empty string.
421
+ debug: display debugging messages.
422
+ force: force overwrite of output files (caution: using the same file as\
423
+ input and output might cause unexpected behaviour).
424
+ nthreads: use this number of threads in multi-threaded applications\
425
+ (set to 0 to disable multi-threading).
426
+ config: temporarily set the value of an MRtrix config file entry.
427
+ help_: display this information page and exit.
428
+ version: display version information and exit.
429
+ output: the (optional) output image.
430
+ Returns:
431
+ Parameter dictionary
432
+ """
433
+ params = {
434
+ "@type": "mrtrix/mredit",
435
+ "scanner": scanner,
436
+ "info": info,
437
+ "quiet": quiet,
438
+ "debug": debug,
439
+ "force": force,
440
+ "help": help_,
441
+ "version": version,
442
+ "input": input_,
443
+ }
444
+ if plane is not None:
445
+ params["plane"] = plane
446
+ if sphere is not None:
447
+ params["sphere"] = sphere
448
+ if voxel is not None:
449
+ params["voxel"] = voxel
450
+ if nthreads is not None:
451
+ params["nthreads"] = nthreads
452
+ if config is not None:
453
+ params["config"] = config
454
+ if output is not None:
455
+ params["output"] = output
456
+ return params
457
+
458
+
459
+ def mredit_validate(
460
+ params: typing.Any,
461
+ ) -> None:
462
+ """
463
+ Validate parameters. Throws an error if `params` is not a valid
464
+ `MreditParamsDict` object.
465
+
466
+ Args:
467
+ params: The parameters object to validate.
468
+ """
469
+ if params is None or not isinstance(params, dict):
470
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
471
+ if params.get("plane", None) is not None:
472
+ if not isinstance(params["plane"], list):
473
+ raise StyxValidationError(f'`plane` has the wrong type: Received `{type(params.get("plane", None))}` expected `list[MreditPlaneParamsDict] | None`')
474
+ for e in params["plane"]:
475
+ mredit_plane_validate(e)
476
+ if params.get("sphere", None) is not None:
477
+ if not isinstance(params["sphere"], list):
478
+ raise StyxValidationError(f'`sphere` has the wrong type: Received `{type(params.get("sphere", None))}` expected `list[MreditSphereParamsDict] | None`')
479
+ for e in params["sphere"]:
480
+ mredit_sphere_validate(e)
481
+ if params.get("voxel", None) is not None:
482
+ if not isinstance(params["voxel"], list):
483
+ raise StyxValidationError(f'`voxel` has the wrong type: Received `{type(params.get("voxel", None))}` expected `list[MreditVoxelParamsDict] | None`')
484
+ for e in params["voxel"]:
485
+ mredit_voxel_validate(e)
486
+ if params.get("scanner", False) is None:
487
+ raise StyxValidationError("`scanner` must not be None")
488
+ if not isinstance(params["scanner"], bool):
489
+ raise StyxValidationError(f'`scanner` has the wrong type: Received `{type(params.get("scanner", False))}` expected `bool`')
490
+ if params.get("info", False) is None:
491
+ raise StyxValidationError("`info` must not be None")
492
+ if not isinstance(params["info"], bool):
493
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
494
+ if params.get("quiet", False) is None:
495
+ raise StyxValidationError("`quiet` must not be None")
496
+ if not isinstance(params["quiet"], bool):
497
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
498
+ if params.get("debug", False) is None:
499
+ raise StyxValidationError("`debug` must not be None")
500
+ if not isinstance(params["debug"], bool):
501
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
502
+ if params.get("force", False) is None:
503
+ raise StyxValidationError("`force` must not be None")
504
+ if not isinstance(params["force"], bool):
505
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
506
+ if params.get("nthreads", None) is not None:
507
+ if not isinstance(params["nthreads"], int):
508
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
509
+ if params.get("config", None) is not None:
510
+ if not isinstance(params["config"], list):
511
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[MreditConfigParamsDict] | None`')
512
+ for e in params["config"]:
513
+ mredit_config_validate(e)
514
+ if params.get("help", False) is None:
515
+ raise StyxValidationError("`help` must not be None")
516
+ if not isinstance(params["help"], bool):
517
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
518
+ if params.get("version", False) is None:
519
+ raise StyxValidationError("`version` must not be None")
520
+ if not isinstance(params["version"], bool):
521
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
522
+ if params.get("input", None) is None:
523
+ raise StyxValidationError("`input` must not be None")
524
+ if not isinstance(params["input"], (pathlib.Path, str)):
525
+ raise StyxValidationError(f'`input` has the wrong type: Received `{type(params.get("input", None))}` expected `InputPathType`')
526
+ if params.get("output", None) is not None:
527
+ if not isinstance(params["output"], str):
528
+ raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str | None`')
529
+
530
+
531
+ def mredit_cargs(
532
+ params: MreditParamsDict,
533
+ execution: Execution,
534
+ ) -> list[str]:
535
+ """
536
+ Build command-line arguments from parameters.
537
+
538
+ Args:
539
+ params: The parameters.
540
+ execution: The execution object for resolving input paths.
541
+ Returns:
542
+ Command-line arguments.
543
+ """
544
+ cargs = []
545
+ cargs.append("mredit")
546
+ if params.get("plane", None) is not None:
547
+ cargs.extend([a for c in [mredit_plane_cargs(s, execution) for s in params.get("plane", None)] for a in c])
548
+ if params.get("sphere", None) is not None:
549
+ cargs.extend([a for c in [mredit_sphere_cargs(s, execution) for s in params.get("sphere", None)] for a in c])
550
+ if params.get("voxel", None) is not None:
551
+ cargs.extend([a for c in [mredit_voxel_cargs(s, execution) for s in params.get("voxel", None)] for a in c])
552
+ if params.get("scanner", False):
553
+ cargs.append("-scanner")
554
+ if params.get("info", False):
555
+ cargs.append("-info")
556
+ if params.get("quiet", False):
557
+ cargs.append("-quiet")
558
+ if params.get("debug", False):
559
+ cargs.append("-debug")
560
+ if params.get("force", False):
561
+ cargs.append("-force")
562
+ if params.get("nthreads", None) is not None:
563
+ cargs.extend([
564
+ "-nthreads",
565
+ str(params.get("nthreads", None))
566
+ ])
567
+ if params.get("config", None) is not None:
568
+ cargs.extend([a for c in [mredit_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
569
+ if params.get("help", False):
570
+ cargs.append("-help")
571
+ if params.get("version", False):
572
+ cargs.append("-version")
573
+ cargs.append(execution.input_file(params.get("input", None)))
574
+ if params.get("output", None) is not None:
575
+ cargs.append(params.get("output", None))
576
+ return cargs
577
+
578
+
579
+ def mredit_outputs(
580
+ params: MreditParamsDict,
581
+ execution: Execution,
582
+ ) -> MreditOutputs:
583
+ """
584
+ Build outputs object containing output file paths and possibly stdout/stderr.
585
+
586
+ Args:
587
+ params: The parameters.
588
+ execution: The execution object for resolving input paths.
589
+ Returns:
590
+ Outputs object.
591
+ """
592
+ ret = MreditOutputs(
593
+ root=execution.output_file("."),
594
+ output=execution.output_file(params.get("output", None)) if (params.get("output") is not None) else None,
595
+ )
596
+ return ret
597
+
598
+
599
+ def mredit_execute(
600
+ params: MreditParamsDict,
601
+ runner: Runner | None = None,
602
+ ) -> MreditOutputs:
603
+ """
604
+ mredit
605
+
606
+ Directly edit the intensities within an image from the command-line.
607
+
608
+ A range of options are provided to enable direct editing of voxel
609
+ intensities based on voxel / real-space coordinates. If only one image path
610
+ is provided, the image will be edited in-place (use at own risk); if input
611
+ and output image paths are provided, the output will contain the edited
612
+ image, and the original image will not be modified in any way.
613
+
614
+ References:
615
+
616
+ .
617
+
618
+ Author: MRTrix3 Developers
619
+
620
+ URL: https://www.mrtrix.org/
621
+
622
+ Args:
623
+ params: The parameters.
624
+ runner: Command runner.
625
+ Returns:
626
+ NamedTuple of outputs (described in `MreditOutputs`).
627
+ """
628
+ mredit_validate(params)
629
+ runner = runner or get_global_runner()
630
+ execution = runner.start_execution(MREDIT_METADATA)
631
+ params = execution.params(params)
632
+ cargs = mredit_cargs(params, execution)
633
+ ret = mredit_outputs(params, execution)
634
+ execution.run(cargs)
635
+ return ret
636
+
637
+
638
+ def mredit(
639
+ input_: InputPathType,
640
+ plane: list[MreditPlaneParamsDict] | None = None,
641
+ sphere: list[MreditSphereParamsDict] | None = None,
642
+ voxel: list[MreditVoxelParamsDict] | None = None,
643
+ scanner: bool = False,
644
+ info: bool = False,
645
+ quiet: bool = False,
646
+ debug: bool = False,
647
+ force: bool = False,
648
+ nthreads: int | None = None,
649
+ config: list[MreditConfigParamsDict] | None = None,
650
+ help_: bool = False,
651
+ version: bool = False,
652
+ output: str | None = None,
653
+ runner: Runner | None = None,
654
+ ) -> MreditOutputs:
655
+ """
656
+ mredit
657
+
658
+ Directly edit the intensities within an image from the command-line.
659
+
660
+ A range of options are provided to enable direct editing of voxel
661
+ intensities based on voxel / real-space coordinates. If only one image path
662
+ is provided, the image will be edited in-place (use at own risk); if input
663
+ and output image paths are provided, the output will contain the edited
664
+ image, and the original image will not be modified in any way.
665
+
666
+ References:
667
+
668
+ .
669
+
670
+ Author: MRTrix3 Developers
671
+
672
+ URL: https://www.mrtrix.org/
673
+
674
+ Args:
675
+ input_: the input image.
676
+ plane: fill one or more planes on a particular image axis.
677
+ sphere: draw a sphere with radius in mm.
678
+ voxel: change the image value within a single voxel.
679
+ scanner: indicate that coordinates are specified in scanner space,\
680
+ rather than as voxel coordinates.
681
+ info: display information messages.
682
+ quiet: do not display information messages or progress status;\
683
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
684
+ environment variable to a non-empty string.
685
+ debug: display debugging messages.
686
+ force: force overwrite of output files (caution: using the same file as\
687
+ input and output might cause unexpected behaviour).
688
+ nthreads: use this number of threads in multi-threaded applications\
689
+ (set to 0 to disable multi-threading).
690
+ config: temporarily set the value of an MRtrix config file entry.
691
+ help_: display this information page and exit.
692
+ version: display version information and exit.
693
+ output: the (optional) output image.
694
+ runner: Command runner.
695
+ Returns:
696
+ NamedTuple of outputs (described in `MreditOutputs`).
697
+ """
698
+ params = mredit_params(
699
+ plane=plane,
700
+ sphere=sphere,
701
+ voxel=voxel,
702
+ scanner=scanner,
703
+ info=info,
704
+ quiet=quiet,
705
+ debug=debug,
706
+ force=force,
707
+ nthreads=nthreads,
708
+ config=config,
709
+ help_=help_,
710
+ version=version,
711
+ input_=input_,
712
+ output=output,
713
+ )
714
+ return mredit_execute(params, runner)
715
+
716
+
717
+ __all__ = [
718
+ "MREDIT_METADATA",
719
+ "MreditConfigParamsDict",
720
+ "MreditConfigParamsDictTagged",
721
+ "MreditOutputs",
722
+ "MreditParamsDict",
723
+ "MreditParamsDictTagged",
724
+ "MreditPlaneParamsDict",
725
+ "MreditPlaneParamsDictTagged",
726
+ "MreditSphereParamsDict",
727
+ "MreditSphereParamsDictTagged",
728
+ "MreditVoxelParamsDict",
729
+ "MreditVoxelParamsDictTagged",
730
+ "mredit",
731
+ "mredit_config",
732
+ "mredit_execute",
733
+ "mredit_params",
734
+ "mredit_plane",
735
+ "mredit_sphere",
736
+ "mredit_voxel",
737
+ ]