niwrap-mrtrix 0.5.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.

Potentially problematic release.


This version of niwrap-mrtrix might be problematic. Click here for more details.

Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +130 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +453 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +362 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +423 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +347 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +530 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +351 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +344 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +336 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +382 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +351 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +546 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +413 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +427 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +316 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +353 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +394 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +373 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +498 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +772 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +580 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +404 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +592 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +441 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +356 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
  117. niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,716 @@
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
+ MRFILTER_METADATA = Metadata(
9
+ id="3bb2ab8375a99185acaeac0f9e608829bff091ac.boutiques",
10
+ name="mrfilter",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ MrfilterVariousStringParameters = typing.TypedDict('MrfilterVariousStringParameters', {
17
+ "__STYX_TYPE__": typing.Literal["VariousString"],
18
+ "obj": str,
19
+ })
20
+
21
+
22
+ MrfilterVariousFileParameters = typing.TypedDict('MrfilterVariousFileParameters', {
23
+ "__STYX_TYPE__": typing.Literal["VariousFile"],
24
+ "obj": InputPathType,
25
+ })
26
+
27
+
28
+ MrfilterConfigParameters = typing.TypedDict('MrfilterConfigParameters', {
29
+ "__STYX_TYPE__": typing.Literal["config"],
30
+ "key": str,
31
+ "value": str,
32
+ })
33
+
34
+
35
+ MrfilterParameters = typing.TypedDict('MrfilterParameters', {
36
+ "__STYX_TYPE__": typing.Literal["mrfilter"],
37
+ "axes": typing.NotRequired[list[int] | None],
38
+ "inverse": bool,
39
+ "magnitude": bool,
40
+ "centre_zero": bool,
41
+ "stdev": typing.NotRequired[list[float] | None],
42
+ "magnitude_1": bool,
43
+ "scanner": bool,
44
+ "extent": typing.NotRequired[list[int] | None],
45
+ "extent_1": typing.NotRequired[list[int] | None],
46
+ "stdev_1": typing.NotRequired[list[float] | None],
47
+ "fwhm": typing.NotRequired[list[float] | None],
48
+ "extent_2": typing.NotRequired[list[int] | None],
49
+ "zupper": typing.NotRequired[float | None],
50
+ "zlower": typing.NotRequired[float | None],
51
+ "bridge": typing.NotRequired[int | None],
52
+ "maskin": typing.NotRequired[InputPathType | None],
53
+ "maskout": typing.NotRequired[str | None],
54
+ "strides": typing.NotRequired[typing.Union[MrfilterVariousStringParameters, MrfilterVariousFileParameters] | None],
55
+ "info": bool,
56
+ "quiet": bool,
57
+ "debug": bool,
58
+ "force": bool,
59
+ "nthreads": typing.NotRequired[int | None],
60
+ "config": typing.NotRequired[list[MrfilterConfigParameters] | None],
61
+ "help": bool,
62
+ "version": bool,
63
+ "input": InputPathType,
64
+ "filter": str,
65
+ "output": str,
66
+ })
67
+
68
+
69
+ def dyn_cargs(
70
+ t: str,
71
+ ) -> typing.Any:
72
+ """
73
+ Get build cargs function by command type.
74
+
75
+ Args:
76
+ t: Command type.
77
+ Returns:
78
+ Build cargs function.
79
+ """
80
+ return {
81
+ "mrfilter": mrfilter_cargs,
82
+ "VariousString": mrfilter_various_string_cargs,
83
+ "VariousFile": mrfilter_various_file_cargs,
84
+ "config": mrfilter_config_cargs,
85
+ }.get(t)
86
+
87
+
88
+ def dyn_outputs(
89
+ t: str,
90
+ ) -> typing.Any:
91
+ """
92
+ Get build outputs function by command type.
93
+
94
+ Args:
95
+ t: Command type.
96
+ Returns:
97
+ Build outputs function.
98
+ """
99
+ return {
100
+ "mrfilter": mrfilter_outputs,
101
+ }.get(t)
102
+
103
+
104
+ def mrfilter_various_string_params(
105
+ obj: str,
106
+ ) -> MrfilterVariousStringParameters:
107
+ """
108
+ Build parameters.
109
+
110
+ Args:
111
+ obj: String object.
112
+ Returns:
113
+ Parameter dictionary
114
+ """
115
+ params = {
116
+ "__STYXTYPE__": "VariousString",
117
+ "obj": obj,
118
+ }
119
+ return params
120
+
121
+
122
+ def mrfilter_various_string_cargs(
123
+ params: MrfilterVariousStringParameters,
124
+ execution: Execution,
125
+ ) -> list[str]:
126
+ """
127
+ Build command-line arguments from parameters.
128
+
129
+ Args:
130
+ params: The parameters.
131
+ execution: The execution object for resolving input paths.
132
+ Returns:
133
+ Command-line arguments.
134
+ """
135
+ cargs = []
136
+ cargs.append(params.get("obj"))
137
+ return cargs
138
+
139
+
140
+ def mrfilter_various_file_params(
141
+ obj: InputPathType,
142
+ ) -> MrfilterVariousFileParameters:
143
+ """
144
+ Build parameters.
145
+
146
+ Args:
147
+ obj: File object.
148
+ Returns:
149
+ Parameter dictionary
150
+ """
151
+ params = {
152
+ "__STYXTYPE__": "VariousFile",
153
+ "obj": obj,
154
+ }
155
+ return params
156
+
157
+
158
+ def mrfilter_various_file_cargs(
159
+ params: MrfilterVariousFileParameters,
160
+ execution: Execution,
161
+ ) -> list[str]:
162
+ """
163
+ Build command-line arguments from parameters.
164
+
165
+ Args:
166
+ params: The parameters.
167
+ execution: The execution object for resolving input paths.
168
+ Returns:
169
+ Command-line arguments.
170
+ """
171
+ cargs = []
172
+ cargs.append(execution.input_file(params.get("obj")))
173
+ return cargs
174
+
175
+
176
+ def mrfilter_config_params(
177
+ key: str,
178
+ value: str,
179
+ ) -> MrfilterConfigParameters:
180
+ """
181
+ Build parameters.
182
+
183
+ Args:
184
+ key: temporarily set the value of an MRtrix config file entry.
185
+ value: temporarily set the value of an MRtrix config file entry.
186
+ Returns:
187
+ Parameter dictionary
188
+ """
189
+ params = {
190
+ "__STYXTYPE__": "config",
191
+ "key": key,
192
+ "value": value,
193
+ }
194
+ return params
195
+
196
+
197
+ def mrfilter_config_cargs(
198
+ params: MrfilterConfigParameters,
199
+ execution: Execution,
200
+ ) -> list[str]:
201
+ """
202
+ Build command-line arguments from parameters.
203
+
204
+ Args:
205
+ params: The parameters.
206
+ execution: The execution object for resolving input paths.
207
+ Returns:
208
+ Command-line arguments.
209
+ """
210
+ cargs = []
211
+ cargs.append("-config")
212
+ cargs.append(params.get("key"))
213
+ cargs.append(params.get("value"))
214
+ return cargs
215
+
216
+
217
+ class MrfilterOutputs(typing.NamedTuple):
218
+ """
219
+ Output object returned when calling `mrfilter(...)`.
220
+ """
221
+ root: OutputPathType
222
+ """Output root folder. This is the root folder for all outputs."""
223
+ output: OutputPathType
224
+ """the output image."""
225
+ maskout: OutputPathType | None
226
+ """Output a refined mask based on a spatially coherent region with normal
227
+ intensity range. """
228
+
229
+
230
+ def mrfilter_params(
231
+ input_: InputPathType,
232
+ filter_: str,
233
+ output: str,
234
+ axes: list[int] | None = None,
235
+ inverse: bool = False,
236
+ magnitude: bool = False,
237
+ centre_zero: bool = False,
238
+ stdev: list[float] | None = None,
239
+ magnitude_1: bool = False,
240
+ scanner: bool = False,
241
+ extent: list[int] | None = None,
242
+ extent_1: list[int] | None = None,
243
+ stdev_1: list[float] | None = None,
244
+ fwhm: list[float] | None = None,
245
+ extent_2: list[int] | None = None,
246
+ zupper: float | None = None,
247
+ zlower: float | None = None,
248
+ bridge: int | None = None,
249
+ maskin: InputPathType | None = None,
250
+ maskout: str | None = None,
251
+ strides: typing.Union[MrfilterVariousStringParameters, MrfilterVariousFileParameters] | None = None,
252
+ info: bool = False,
253
+ quiet: bool = False,
254
+ debug: bool = False,
255
+ force: bool = False,
256
+ nthreads: int | None = None,
257
+ config: list[MrfilterConfigParameters] | None = None,
258
+ help_: bool = False,
259
+ version: bool = False,
260
+ ) -> MrfilterParameters:
261
+ """
262
+ Build parameters.
263
+
264
+ Args:
265
+ input_: the input image.
266
+ filter_: the type of filter to be applied.
267
+ output: the output image.
268
+ axes: the axes along which to apply the Fourier Transform. By default,\
269
+ the transform is applied along the three spatial axes. Provide as a\
270
+ comma-separate list of axis indices.
271
+ inverse: apply the inverse FFT.
272
+ magnitude: output a magnitude image rather than a complex-valued image.
273
+ centre_zero: re-arrange the FFT results so that the zero-frequency\
274
+ component appears in the centre of the image, rather than at the edges.
275
+ stdev: the standard deviation of the Gaussian kernel used to smooth the\
276
+ input image (in mm). The image is smoothed to reduced large spurious\
277
+ gradients caused by noise. Use this option to override the default\
278
+ stdev of 1 voxel. This can be specified either as a single value to be\
279
+ used for all 3 axes, or as a comma-separated list of 3 values, one for\
280
+ each axis.
281
+ magnitude_1: output the gradient magnitude, rather than the default\
282
+ x,y,z components.
283
+ scanner: define the gradient with respect to the scanner coordinate\
284
+ frame of reference.
285
+ extent: specify extent of median filtering neighbourhood in voxels.\
286
+ This can be specified either as a single value to be used for all 3\
287
+ axes, or as a comma-separated list of 3 values, one for each axis\
288
+ (default: 3x3x3).
289
+ extent_1: specify extent of normalisation filtering neighbourhood in\
290
+ voxels. This can be specified either as a single value to be used for\
291
+ all 3 axes, or as a comma-separated list of 3 values, one for each axis\
292
+ (default: 3x3x3).
293
+ stdev_1: apply Gaussian smoothing with the specified standard\
294
+ deviation. The standard deviation is defined in mm (Default 1 voxel).\
295
+ This can be specified either as a single value to be used for all axes,\
296
+ or as a comma-separated list of the stdev for each axis.
297
+ fwhm: apply Gaussian smoothing with the specified full-width half\
298
+ maximum. The FWHM is defined in mm (Default 1 voxel * 2.3548). This can\
299
+ be specified either as a single value to be used for all axes, or as a\
300
+ comma-separated list of the FWHM for each axis.
301
+ extent_2: specify the extent (width) of kernel size in voxels. This can\
302
+ be specified either as a single value to be used for all axes, or as a\
303
+ comma-separated list of the extent for each axis. The default extent is\
304
+ 2 * ceil(2.5 * stdev / voxel_size) - 1.
305
+ zupper: define high intensity outliers: default: 2.5.
306
+ zlower: define low intensity outliers: default: 2.5.
307
+ bridge: number of voxels to gap to fill holes in mask: default: 4.
308
+ maskin: initial mask that defines the maximum spatial extent and the\
309
+ region from which to smaple the intensity range.
310
+ maskout: Output a refined mask based on a spatially coherent region\
311
+ with normal intensity range.
312
+ strides: specify the strides of the output data in memory; either as a\
313
+ comma-separated list of (signed) integers, or as a template image from\
314
+ which the strides shall be extracted and used. The actual strides\
315
+ produced will depend on whether the output image format can support it.
316
+ info: display information messages.
317
+ quiet: do not display information messages or progress status;\
318
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
319
+ environment variable to a non-empty string.
320
+ debug: display debugging messages.
321
+ force: force overwrite of output files (caution: using the same file as\
322
+ input and output might cause unexpected behaviour).
323
+ nthreads: use this number of threads in multi-threaded applications\
324
+ (set to 0 to disable multi-threading).
325
+ config: temporarily set the value of an MRtrix config file entry.
326
+ help_: display this information page and exit.
327
+ version: display version information and exit.
328
+ Returns:
329
+ Parameter dictionary
330
+ """
331
+ params = {
332
+ "__STYXTYPE__": "mrfilter",
333
+ "inverse": inverse,
334
+ "magnitude": magnitude,
335
+ "centre_zero": centre_zero,
336
+ "magnitude_1": magnitude_1,
337
+ "scanner": scanner,
338
+ "info": info,
339
+ "quiet": quiet,
340
+ "debug": debug,
341
+ "force": force,
342
+ "help": help_,
343
+ "version": version,
344
+ "input": input_,
345
+ "filter": filter_,
346
+ "output": output,
347
+ }
348
+ if axes is not None:
349
+ params["axes"] = axes
350
+ if stdev is not None:
351
+ params["stdev"] = stdev
352
+ if extent is not None:
353
+ params["extent"] = extent
354
+ if extent_1 is not None:
355
+ params["extent_1"] = extent_1
356
+ if stdev_1 is not None:
357
+ params["stdev_1"] = stdev_1
358
+ if fwhm is not None:
359
+ params["fwhm"] = fwhm
360
+ if extent_2 is not None:
361
+ params["extent_2"] = extent_2
362
+ if zupper is not None:
363
+ params["zupper"] = zupper
364
+ if zlower is not None:
365
+ params["zlower"] = zlower
366
+ if bridge is not None:
367
+ params["bridge"] = bridge
368
+ if maskin is not None:
369
+ params["maskin"] = maskin
370
+ if maskout is not None:
371
+ params["maskout"] = maskout
372
+ if strides is not None:
373
+ params["strides"] = strides
374
+ if nthreads is not None:
375
+ params["nthreads"] = nthreads
376
+ if config is not None:
377
+ params["config"] = config
378
+ return params
379
+
380
+
381
+ def mrfilter_cargs(
382
+ params: MrfilterParameters,
383
+ execution: Execution,
384
+ ) -> list[str]:
385
+ """
386
+ Build command-line arguments from parameters.
387
+
388
+ Args:
389
+ params: The parameters.
390
+ execution: The execution object for resolving input paths.
391
+ Returns:
392
+ Command-line arguments.
393
+ """
394
+ cargs = []
395
+ cargs.append("mrfilter")
396
+ if params.get("axes") is not None:
397
+ cargs.extend([
398
+ "-axes",
399
+ *map(str, params.get("axes"))
400
+ ])
401
+ if params.get("inverse"):
402
+ cargs.append("-inverse")
403
+ if params.get("magnitude"):
404
+ cargs.append("-magnitude")
405
+ if params.get("centre_zero"):
406
+ cargs.append("-centre_zero")
407
+ if params.get("stdev") is not None:
408
+ cargs.extend([
409
+ "-stdev",
410
+ ",".join(map(str, params.get("stdev")))
411
+ ])
412
+ if params.get("magnitude_1"):
413
+ cargs.append("-magnitude")
414
+ if params.get("scanner"):
415
+ cargs.append("-scanner")
416
+ if params.get("extent") is not None:
417
+ cargs.extend([
418
+ "-extent",
419
+ ",".join(map(str, params.get("extent")))
420
+ ])
421
+ if params.get("extent_1") is not None:
422
+ cargs.extend([
423
+ "-extent",
424
+ ",".join(map(str, params.get("extent_1")))
425
+ ])
426
+ if params.get("stdev_1") is not None:
427
+ cargs.extend([
428
+ "-stdev",
429
+ ",".join(map(str, params.get("stdev_1")))
430
+ ])
431
+ if params.get("fwhm") is not None:
432
+ cargs.extend([
433
+ "-fwhm",
434
+ ",".join(map(str, params.get("fwhm")))
435
+ ])
436
+ if params.get("extent_2") is not None:
437
+ cargs.extend([
438
+ "-extent",
439
+ ",".join(map(str, params.get("extent_2")))
440
+ ])
441
+ if params.get("zupper") is not None:
442
+ cargs.extend([
443
+ "-zupper",
444
+ str(params.get("zupper"))
445
+ ])
446
+ if params.get("zlower") is not None:
447
+ cargs.extend([
448
+ "-zlower",
449
+ str(params.get("zlower"))
450
+ ])
451
+ if params.get("bridge") is not None:
452
+ cargs.extend([
453
+ "-bridge",
454
+ str(params.get("bridge"))
455
+ ])
456
+ if params.get("maskin") is not None:
457
+ cargs.extend([
458
+ "-maskin",
459
+ execution.input_file(params.get("maskin"))
460
+ ])
461
+ if params.get("maskout") is not None:
462
+ cargs.extend([
463
+ "-maskout",
464
+ params.get("maskout")
465
+ ])
466
+ if params.get("strides") is not None:
467
+ cargs.extend([
468
+ "-strides",
469
+ *dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
470
+ ])
471
+ if params.get("info"):
472
+ cargs.append("-info")
473
+ if params.get("quiet"):
474
+ cargs.append("-quiet")
475
+ if params.get("debug"):
476
+ cargs.append("-debug")
477
+ if params.get("force"):
478
+ cargs.append("-force")
479
+ if params.get("nthreads") is not None:
480
+ cargs.extend([
481
+ "-nthreads",
482
+ str(params.get("nthreads"))
483
+ ])
484
+ if params.get("config") is not None:
485
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
486
+ if params.get("help"):
487
+ cargs.append("-help")
488
+ if params.get("version"):
489
+ cargs.append("-version")
490
+ cargs.append(execution.input_file(params.get("input")))
491
+ cargs.append(params.get("filter"))
492
+ cargs.append(params.get("output"))
493
+ return cargs
494
+
495
+
496
+ def mrfilter_outputs(
497
+ params: MrfilterParameters,
498
+ execution: Execution,
499
+ ) -> MrfilterOutputs:
500
+ """
501
+ Build outputs object containing output file paths and possibly stdout/stderr.
502
+
503
+ Args:
504
+ params: The parameters.
505
+ execution: The execution object for resolving input paths.
506
+ Returns:
507
+ Outputs object.
508
+ """
509
+ ret = MrfilterOutputs(
510
+ root=execution.output_file("."),
511
+ output=execution.output_file(params.get("output")),
512
+ maskout=execution.output_file(params.get("maskout")) if (params.get("maskout") is not None) else None,
513
+ )
514
+ return ret
515
+
516
+
517
+ def mrfilter_execute(
518
+ params: MrfilterParameters,
519
+ execution: Execution,
520
+ ) -> MrfilterOutputs:
521
+ """
522
+ Perform filtering operations on 3D / 4D MR images.
523
+
524
+ The available filters are: fft, gradient, median, smooth, normalise, zclean.
525
+
526
+ Each filter has its own unique set of optional parameters.
527
+
528
+ For 4D images, each 3D volume is processed independently.
529
+
530
+ References:
531
+
532
+ .
533
+
534
+ Author: MRTrix3 Developers
535
+
536
+ URL: https://www.mrtrix.org/
537
+
538
+ Args:
539
+ params: The parameters.
540
+ execution: The execution object.
541
+ Returns:
542
+ NamedTuple of outputs (described in `MrfilterOutputs`).
543
+ """
544
+ params = execution.params(params)
545
+ cargs = mrfilter_cargs(params, execution)
546
+ ret = mrfilter_outputs(params, execution)
547
+ execution.run(cargs)
548
+ return ret
549
+
550
+
551
+ def mrfilter(
552
+ input_: InputPathType,
553
+ filter_: str,
554
+ output: str,
555
+ axes: list[int] | None = None,
556
+ inverse: bool = False,
557
+ magnitude: bool = False,
558
+ centre_zero: bool = False,
559
+ stdev: list[float] | None = None,
560
+ magnitude_1: bool = False,
561
+ scanner: bool = False,
562
+ extent: list[int] | None = None,
563
+ extent_1: list[int] | None = None,
564
+ stdev_1: list[float] | None = None,
565
+ fwhm: list[float] | None = None,
566
+ extent_2: list[int] | None = None,
567
+ zupper: float | None = None,
568
+ zlower: float | None = None,
569
+ bridge: int | None = None,
570
+ maskin: InputPathType | None = None,
571
+ maskout: str | None = None,
572
+ strides: typing.Union[MrfilterVariousStringParameters, MrfilterVariousFileParameters] | None = None,
573
+ info: bool = False,
574
+ quiet: bool = False,
575
+ debug: bool = False,
576
+ force: bool = False,
577
+ nthreads: int | None = None,
578
+ config: list[MrfilterConfigParameters] | None = None,
579
+ help_: bool = False,
580
+ version: bool = False,
581
+ runner: Runner | None = None,
582
+ ) -> MrfilterOutputs:
583
+ """
584
+ Perform filtering operations on 3D / 4D MR images.
585
+
586
+ The available filters are: fft, gradient, median, smooth, normalise, zclean.
587
+
588
+ Each filter has its own unique set of optional parameters.
589
+
590
+ For 4D images, each 3D volume is processed independently.
591
+
592
+ References:
593
+
594
+ .
595
+
596
+ Author: MRTrix3 Developers
597
+
598
+ URL: https://www.mrtrix.org/
599
+
600
+ Args:
601
+ input_: the input image.
602
+ filter_: the type of filter to be applied.
603
+ output: the output image.
604
+ axes: the axes along which to apply the Fourier Transform. By default,\
605
+ the transform is applied along the three spatial axes. Provide as a\
606
+ comma-separate list of axis indices.
607
+ inverse: apply the inverse FFT.
608
+ magnitude: output a magnitude image rather than a complex-valued image.
609
+ centre_zero: re-arrange the FFT results so that the zero-frequency\
610
+ component appears in the centre of the image, rather than at the edges.
611
+ stdev: the standard deviation of the Gaussian kernel used to smooth the\
612
+ input image (in mm). The image is smoothed to reduced large spurious\
613
+ gradients caused by noise. Use this option to override the default\
614
+ stdev of 1 voxel. This can be specified either as a single value to be\
615
+ used for all 3 axes, or as a comma-separated list of 3 values, one for\
616
+ each axis.
617
+ magnitude_1: output the gradient magnitude, rather than the default\
618
+ x,y,z components.
619
+ scanner: define the gradient with respect to the scanner coordinate\
620
+ frame of reference.
621
+ extent: specify extent of median filtering neighbourhood in voxels.\
622
+ This can be specified either as a single value to be used for all 3\
623
+ axes, or as a comma-separated list of 3 values, one for each axis\
624
+ (default: 3x3x3).
625
+ extent_1: specify extent of normalisation filtering neighbourhood in\
626
+ voxels. This can be specified either as a single value to be used for\
627
+ all 3 axes, or as a comma-separated list of 3 values, one for each axis\
628
+ (default: 3x3x3).
629
+ stdev_1: apply Gaussian smoothing with the specified standard\
630
+ deviation. The standard deviation is defined in mm (Default 1 voxel).\
631
+ This can be specified either as a single value to be used for all axes,\
632
+ or as a comma-separated list of the stdev for each axis.
633
+ fwhm: apply Gaussian smoothing with the specified full-width half\
634
+ maximum. The FWHM is defined in mm (Default 1 voxel * 2.3548). This can\
635
+ be specified either as a single value to be used for all axes, or as a\
636
+ comma-separated list of the FWHM for each axis.
637
+ extent_2: specify the extent (width) of kernel size in voxels. This can\
638
+ be specified either as a single value to be used for all axes, or as a\
639
+ comma-separated list of the extent for each axis. The default extent is\
640
+ 2 * ceil(2.5 * stdev / voxel_size) - 1.
641
+ zupper: define high intensity outliers: default: 2.5.
642
+ zlower: define low intensity outliers: default: 2.5.
643
+ bridge: number of voxels to gap to fill holes in mask: default: 4.
644
+ maskin: initial mask that defines the maximum spatial extent and the\
645
+ region from which to smaple the intensity range.
646
+ maskout: Output a refined mask based on a spatially coherent region\
647
+ with normal intensity range.
648
+ strides: specify the strides of the output data in memory; either as a\
649
+ comma-separated list of (signed) integers, or as a template image from\
650
+ which the strides shall be extracted and used. The actual strides\
651
+ produced will depend on whether the output image format can support it.
652
+ info: display information messages.
653
+ quiet: do not display information messages or progress status;\
654
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
655
+ environment variable to a non-empty string.
656
+ debug: display debugging messages.
657
+ force: force overwrite of output files (caution: using the same file as\
658
+ input and output might cause unexpected behaviour).
659
+ nthreads: use this number of threads in multi-threaded applications\
660
+ (set to 0 to disable multi-threading).
661
+ config: temporarily set the value of an MRtrix config file entry.
662
+ help_: display this information page and exit.
663
+ version: display version information and exit.
664
+ runner: Command runner.
665
+ Returns:
666
+ NamedTuple of outputs (described in `MrfilterOutputs`).
667
+ """
668
+ runner = runner or get_global_runner()
669
+ execution = runner.start_execution(MRFILTER_METADATA)
670
+ params = mrfilter_params(
671
+ axes=axes,
672
+ inverse=inverse,
673
+ magnitude=magnitude,
674
+ centre_zero=centre_zero,
675
+ stdev=stdev,
676
+ magnitude_1=magnitude_1,
677
+ scanner=scanner,
678
+ extent=extent,
679
+ extent_1=extent_1,
680
+ stdev_1=stdev_1,
681
+ fwhm=fwhm,
682
+ extent_2=extent_2,
683
+ zupper=zupper,
684
+ zlower=zlower,
685
+ bridge=bridge,
686
+ maskin=maskin,
687
+ maskout=maskout,
688
+ strides=strides,
689
+ info=info,
690
+ quiet=quiet,
691
+ debug=debug,
692
+ force=force,
693
+ nthreads=nthreads,
694
+ config=config,
695
+ help_=help_,
696
+ version=version,
697
+ input_=input_,
698
+ filter_=filter_,
699
+ output=output,
700
+ )
701
+ return mrfilter_execute(params, execution)
702
+
703
+
704
+ __all__ = [
705
+ "MRFILTER_METADATA",
706
+ "MrfilterConfigParameters",
707
+ "MrfilterOutputs",
708
+ "MrfilterParameters",
709
+ "MrfilterVariousFileParameters",
710
+ "MrfilterVariousStringParameters",
711
+ "mrfilter",
712
+ "mrfilter_config_params",
713
+ "mrfilter_params",
714
+ "mrfilter_various_file_params",
715
+ "mrfilter_various_string_params",
716
+ ]