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