niwrap-mrtrix 0.6.2__py3-none-any.whl → 0.7.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 (122) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +133 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +59 -68
  3. niwrap_mrtrix/mrtrix/amp2response.py +72 -77
  4. niwrap_mrtrix/mrtrix/amp2sh.py +109 -74
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +77 -79
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +52 -62
  7. niwrap_mrtrix/mrtrix/connectomestats.py +117 -104
  8. niwrap_mrtrix/mrtrix/dcmedit.py +68 -73
  9. niwrap_mrtrix/mrtrix/dcminfo.py +67 -72
  10. niwrap_mrtrix/mrtrix/dirflip.py +56 -66
  11. niwrap_mrtrix/mrtrix/dirgen.py +68 -75
  12. niwrap_mrtrix/mrtrix/dirmerge.py +56 -66
  13. niwrap_mrtrix/mrtrix/dirorder.py +53 -64
  14. niwrap_mrtrix/mrtrix/dirsplit.py +56 -66
  15. niwrap_mrtrix/mrtrix/dirstat.py +70 -75
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +67 -74
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +141 -96
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +70 -76
  19. niwrap_mrtrix/mrtrix/dwi2response.py +238 -157
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +87 -88
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +97 -95
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +67 -74
  23. niwrap_mrtrix/mrtrix/dwiextract.py +143 -99
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +89 -91
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +77 -51
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +54 -65
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +56 -66
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +62 -70
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +145 -93
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +62 -70
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +136 -69
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +61 -69
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +53 -64
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +139 -71
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +53 -64
  36. niwrap_mrtrix/mrtrix/fod2dec.py +70 -75
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +84 -85
  38. niwrap_mrtrix/mrtrix/label2colour.py +58 -67
  39. niwrap_mrtrix/mrtrix/label2mesh.py +53 -64
  40. niwrap_mrtrix/mrtrix/labelconvert.py +58 -67
  41. niwrap_mrtrix/mrtrix/labelstats.py +53 -63
  42. niwrap_mrtrix/mrtrix/maskdump.py +52 -64
  43. niwrap_mrtrix/mrtrix/maskfilter.py +93 -61
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +53 -64
  45. niwrap_mrtrix/mrtrix/meshconvert.py +66 -73
  46. niwrap_mrtrix/mrtrix/meshfilter.py +59 -68
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +62 -70
  48. niwrap_mrtrix/mrtrix/mrcalc.py +522 -397
  49. niwrap_mrtrix/mrtrix/mrcat.py +59 -68
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +53 -63
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +58 -67
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +119 -105
  53. niwrap_mrtrix/mrtrix/mrcolour.py +62 -70
  54. niwrap_mrtrix/mrtrix/mrconvert.py +275 -173
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +66 -73
  56. niwrap_mrtrix/mrtrix/mrdump.py +55 -66
  57. niwrap_mrtrix/mrtrix/mredit.py +97 -94
  58. niwrap_mrtrix/mrtrix/mrfilter.py +124 -81
  59. niwrap_mrtrix/mrtrix/mrgrid.py +131 -88
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +64 -71
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +64 -71
  62. niwrap_mrtrix/mrtrix/mrinfo.py +160 -137
  63. niwrap_mrtrix/mrtrix/mrmath.py +65 -73
  64. niwrap_mrtrix/mrtrix/mrmetric.py +69 -73
  65. niwrap_mrtrix/mrtrix/mrregister.py +263 -212
  66. niwrap_mrtrix/mrtrix/mrstats.py +66 -72
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +80 -81
  68. niwrap_mrtrix/mrtrix/mrtransform.py +162 -109
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +85 -88
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +51 -63
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +54 -65
  72. niwrap_mrtrix/mrtrix/responsemean.py +51 -62
  73. niwrap_mrtrix/mrtrix/sh2amp.py +98 -65
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +81 -83
  75. niwrap_mrtrix/mrtrix/sh2power.py +53 -64
  76. niwrap_mrtrix/mrtrix/sh2response.py +62 -70
  77. niwrap_mrtrix/mrtrix/shbasis.py +51 -62
  78. niwrap_mrtrix/mrtrix/shconv.py +78 -52
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +93 -88
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +57 -65
  81. niwrap_mrtrix/mrtrix/tckconvert.py +99 -65
  82. niwrap_mrtrix/mrtrix/tckdfc.py +82 -83
  83. niwrap_mrtrix/mrtrix/tckedit.py +240 -122
  84. niwrap_mrtrix/mrtrix/tckgen.py +364 -207
  85. niwrap_mrtrix/mrtrix/tckglobal.py +127 -115
  86. niwrap_mrtrix/mrtrix/tckinfo.py +50 -61
  87. niwrap_mrtrix/mrtrix/tckmap.py +121 -79
  88. niwrap_mrtrix/mrtrix/tckresample.py +97 -93
  89. niwrap_mrtrix/mrtrix/tcksample.py +62 -69
  90. niwrap_mrtrix/mrtrix/tcksift.py +102 -97
  91. niwrap_mrtrix/mrtrix/tcksift2.py +119 -107
  92. niwrap_mrtrix/mrtrix/tckstats.py +72 -78
  93. niwrap_mrtrix/mrtrix/tcktransform.py +53 -64
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +93 -94
  95. niwrap_mrtrix/mrtrix/transformcalc.py +53 -64
  96. niwrap_mrtrix/mrtrix/transformcompose.py +74 -48
  97. niwrap_mrtrix/mrtrix/transformconvert.py +53 -64
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +53 -64
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +53 -63
  100. niwrap_mrtrix/mrtrix/tsfmult.py +51 -63
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +54 -65
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +55 -65
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +50 -61
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +54 -65
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +69 -75
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +51 -62
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +73 -79
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +132 -86
  109. niwrap_mrtrix/mrtrix/vectorstats.py +92 -88
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +54 -63
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +56 -66
  112. niwrap_mrtrix/mrtrix/warp2metric.py +71 -77
  113. niwrap_mrtrix/mrtrix/warpconvert.py +61 -69
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +61 -71
  115. niwrap_mrtrix/mrtrix/warpinit.py +51 -63
  116. niwrap_mrtrix/mrtrix/warpinvert.py +56 -66
  117. niwrap_mrtrix-0.7.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.7.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.7.0.dist-info/WHEEL +4 -0
  120. niwrap_mrtrix-0.6.2.dist-info/METADATA +0 -8
  121. niwrap_mrtrix-0.6.2.dist-info/RECORD +0 -119
  122. niwrap_mrtrix-0.6.2.dist-info/WHEEL +0 -4
@@ -6,7 +6,7 @@ import pathlib
6
6
  from styxdefs import *
7
7
 
8
8
  DWIBIASCORRECT_METADATA = Metadata(
9
- id="dac5427c31c92afc7a68b01d1ea1d2a9c9d5a76c.boutiques",
9
+ id="b6c72322d3d00ba26448970257e9f0b213c34953.boutiques",
10
10
  name="dwibiascorrect",
11
11
  package="mrtrix",
12
12
  container_image_tag="mrtrix3/mrtrix3:3.0.4",
@@ -14,21 +14,55 @@ DWIBIASCORRECT_METADATA = Metadata(
14
14
 
15
15
 
16
16
  DwibiascorrectFslgradParameters = typing.TypedDict('DwibiascorrectFslgradParameters', {
17
- "__STYXTYPE__": typing.Literal["fslgrad"],
17
+ "@type": typing.NotRequired[typing.Literal["fslgrad"]],
18
+ "bvecs": InputPathType,
19
+ "bvals": InputPathType,
20
+ })
21
+ DwibiascorrectFslgradParametersTagged = typing.TypedDict('DwibiascorrectFslgradParametersTagged', {
22
+ "@type": typing.Literal["fslgrad"],
18
23
  "bvecs": InputPathType,
19
24
  "bvals": InputPathType,
20
25
  })
21
26
 
22
27
 
23
28
  DwibiascorrectConfigParameters = typing.TypedDict('DwibiascorrectConfigParameters', {
24
- "__STYXTYPE__": typing.Literal["config"],
29
+ "@type": typing.NotRequired[typing.Literal["config"]],
30
+ "key": str,
31
+ "value": str,
32
+ })
33
+ DwibiascorrectConfigParametersTagged = typing.TypedDict('DwibiascorrectConfigParametersTagged', {
34
+ "@type": typing.Literal["config"],
25
35
  "key": str,
26
36
  "value": str,
27
37
  })
28
38
 
29
39
 
30
40
  DwibiascorrectParameters = typing.TypedDict('DwibiascorrectParameters', {
31
- "__STYXTYPE__": typing.Literal["dwibiascorrect"],
41
+ "@type": typing.NotRequired[typing.Literal["mrtrix/dwibiascorrect"]],
42
+ "algorithm": str,
43
+ "input_image": InputPathType,
44
+ "output_image": str,
45
+ "grad": typing.NotRequired[InputPathType | None],
46
+ "fslgrad": typing.NotRequired[DwibiascorrectFslgradParameters | None],
47
+ "mask_image": typing.NotRequired[InputPathType | None],
48
+ "bias_image": typing.NotRequired[InputPathType | None],
49
+ "nocleanup": bool,
50
+ "scratch_dir": typing.NotRequired[InputPathType | None],
51
+ "continue_scratch_dir": typing.NotRequired[list[InputPathType] | None],
52
+ "info": bool,
53
+ "quiet": bool,
54
+ "debug": bool,
55
+ "force": bool,
56
+ "nthreads": typing.NotRequired[float | None],
57
+ "config": typing.NotRequired[list[DwibiascorrectConfigParameters] | None],
58
+ "help": bool,
59
+ "version": bool,
60
+ "ants_b": typing.NotRequired[str | None],
61
+ "ants_c": typing.NotRequired[str | None],
62
+ "ants_s": typing.NotRequired[str | None],
63
+ })
64
+ DwibiascorrectParametersTagged = typing.TypedDict('DwibiascorrectParametersTagged', {
65
+ "@type": typing.Literal["mrtrix/dwibiascorrect"],
32
66
  "algorithm": str,
33
67
  "input_image": InputPathType,
34
68
  "output_image": str,
@@ -51,46 +85,12 @@ DwibiascorrectParameters = typing.TypedDict('DwibiascorrectParameters', {
51
85
  "ants_c": typing.NotRequired[str | None],
52
86
  "ants_s": typing.NotRequired[str | None],
53
87
  })
54
-
55
-
56
- def dyn_cargs(
57
- t: str,
58
- ) -> typing.Any:
59
- """
60
- Get build cargs function by command type.
61
-
62
- Args:
63
- t: Command type.
64
- Returns:
65
- Build cargs function.
66
- """
67
- return {
68
- "dwibiascorrect": dwibiascorrect_cargs,
69
- "fslgrad": dwibiascorrect_fslgrad_cargs,
70
- "config": dwibiascorrect_config_cargs,
71
- }.get(t)
72
-
73
-
74
- def dyn_outputs(
75
- t: str,
76
- ) -> typing.Any:
77
- """
78
- Get build outputs function by command type.
79
-
80
- Args:
81
- t: Command type.
82
- Returns:
83
- Build outputs function.
84
- """
85
- return {
86
- "dwibiascorrect": dwibiascorrect_outputs,
87
- }.get(t)
88
88
 
89
89
 
90
90
  def dwibiascorrect_fslgrad_params(
91
91
  bvecs: InputPathType,
92
92
  bvals: InputPathType,
93
- ) -> DwibiascorrectFslgradParameters:
93
+ ) -> DwibiascorrectFslgradParametersTagged:
94
94
  """
95
95
  Build parameters.
96
96
 
@@ -107,7 +107,7 @@ def dwibiascorrect_fslgrad_params(
107
107
  Parameter dictionary
108
108
  """
109
109
  params = {
110
- "__STYXTYPE__": "fslgrad",
110
+ "@type": "fslgrad",
111
111
  "bvecs": bvecs,
112
112
  "bvals": bvals,
113
113
  }
@@ -129,15 +129,15 @@ def dwibiascorrect_fslgrad_cargs(
129
129
  """
130
130
  cargs = []
131
131
  cargs.append("-fslgrad")
132
- cargs.append(execution.input_file(params.get("bvecs")))
133
- cargs.append(execution.input_file(params.get("bvals")))
132
+ cargs.append(execution.input_file(params.get("bvecs", None)))
133
+ cargs.append(execution.input_file(params.get("bvals", None)))
134
134
  return cargs
135
135
 
136
136
 
137
137
  def dwibiascorrect_config_params(
138
138
  key: str,
139
139
  value: str,
140
- ) -> DwibiascorrectConfigParameters:
140
+ ) -> DwibiascorrectConfigParametersTagged:
141
141
  """
142
142
  Build parameters.
143
143
 
@@ -148,7 +148,7 @@ def dwibiascorrect_config_params(
148
148
  Parameter dictionary
149
149
  """
150
150
  params = {
151
- "__STYXTYPE__": "config",
151
+ "@type": "config",
152
152
  "key": key,
153
153
  "value": value,
154
154
  }
@@ -170,14 +170,14 @@ def dwibiascorrect_config_cargs(
170
170
  """
171
171
  cargs = []
172
172
  cargs.append("-config")
173
- cargs.append(params.get("key"))
174
- cargs.append(params.get("value"))
173
+ cargs.append(params.get("key", None))
174
+ cargs.append(params.get("value", None))
175
175
  return cargs
176
176
 
177
177
 
178
178
  class DwibiascorrectOutputs(typing.NamedTuple):
179
179
  """
180
- Output object returned when calling `dwibiascorrect(...)`.
180
+ Output object returned when calling `DwibiascorrectParameters(...)`.
181
181
  """
182
182
  root: OutputPathType
183
183
  """Output root folder. This is the root folder for all outputs."""
@@ -209,7 +209,7 @@ def dwibiascorrect_params(
209
209
  ants_b: str | None = None,
210
210
  ants_c: str | None = None,
211
211
  ants_s: str | None = None,
212
- ) -> DwibiascorrectParameters:
212
+ ) -> DwibiascorrectParametersTagged:
213
213
  """
214
214
  Build parameters.
215
215
 
@@ -250,7 +250,7 @@ def dwibiascorrect_params(
250
250
  Parameter dictionary
251
251
  """
252
252
  params = {
253
- "__STYXTYPE__": "dwibiascorrect",
253
+ "@type": "mrtrix/dwibiascorrect",
254
254
  "algorithm": algorithm,
255
255
  "input_image": input_image,
256
256
  "output_image": output_image,
@@ -302,71 +302,71 @@ def dwibiascorrect_cargs(
302
302
  """
303
303
  cargs = []
304
304
  cargs.append("dwibiascorrect")
305
- cargs.append(params.get("algorithm"))
306
- cargs.append(execution.input_file(params.get("input_image")))
307
- cargs.append(params.get("output_image"))
308
- if params.get("grad") is not None:
305
+ cargs.append(params.get("algorithm", None))
306
+ cargs.append(execution.input_file(params.get("input_image", None)))
307
+ cargs.append(params.get("output_image", None))
308
+ if params.get("grad", None) is not None:
309
309
  cargs.extend([
310
310
  "-grad",
311
- execution.input_file(params.get("grad"))
311
+ execution.input_file(params.get("grad", None))
312
312
  ])
313
- if params.get("fslgrad") is not None:
314
- cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
315
- if params.get("mask_image") is not None:
313
+ if params.get("fslgrad", None) is not None:
314
+ cargs.extend(dwibiascorrect_fslgrad_cargs(params.get("fslgrad", None), execution))
315
+ if params.get("mask_image", None) is not None:
316
316
  cargs.extend([
317
317
  "-mask",
318
- execution.input_file(params.get("mask_image"))
318
+ execution.input_file(params.get("mask_image", None))
319
319
  ])
320
- if params.get("bias_image") is not None:
320
+ if params.get("bias_image", None) is not None:
321
321
  cargs.extend([
322
322
  "-bias",
323
- execution.input_file(params.get("bias_image"))
323
+ execution.input_file(params.get("bias_image", None))
324
324
  ])
325
- if params.get("nocleanup"):
325
+ if params.get("nocleanup", False):
326
326
  cargs.append("-nocleanup")
327
- if params.get("scratch_dir") is not None:
327
+ if params.get("scratch_dir", None) is not None:
328
328
  cargs.extend([
329
329
  "-scratch",
330
- execution.input_file(params.get("scratch_dir"))
330
+ execution.input_file(params.get("scratch_dir", None))
331
331
  ])
332
- if params.get("continue_scratch_dir") is not None:
332
+ if params.get("continue_scratch_dir", None) is not None:
333
333
  cargs.extend([
334
334
  "-continue",
335
- *[execution.input_file(f) for f in params.get("continue_scratch_dir")]
335
+ *[execution.input_file(f) for f in params.get("continue_scratch_dir", None)]
336
336
  ])
337
- if params.get("info"):
337
+ if params.get("info", False):
338
338
  cargs.append("-info")
339
- if params.get("quiet"):
339
+ if params.get("quiet", False):
340
340
  cargs.append("-quiet")
341
- if params.get("debug"):
341
+ if params.get("debug", False):
342
342
  cargs.append("-debug")
343
- if params.get("force"):
343
+ if params.get("force", False):
344
344
  cargs.append("-force")
345
- if params.get("nthreads") is not None:
345
+ if params.get("nthreads", None) is not None:
346
346
  cargs.extend([
347
347
  "-nthreads",
348
- str(params.get("nthreads"))
348
+ str(params.get("nthreads", None))
349
349
  ])
350
- if params.get("config") is not None:
351
- cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
352
- if params.get("help"):
350
+ if params.get("config", None) is not None:
351
+ cargs.extend([a for c in [dwibiascorrect_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
352
+ if params.get("help", False):
353
353
  cargs.append("-help")
354
- if params.get("version"):
354
+ if params.get("version", False):
355
355
  cargs.append("-version")
356
- if params.get("ants_b") is not None:
356
+ if params.get("ants_b", None) is not None:
357
357
  cargs.extend([
358
358
  "-ants.b",
359
- params.get("ants_b")
359
+ params.get("ants_b", None)
360
360
  ])
361
- if params.get("ants_c") is not None:
361
+ if params.get("ants_c", None) is not None:
362
362
  cargs.extend([
363
363
  "-ants.c",
364
- params.get("ants_c")
364
+ params.get("ants_c", None)
365
365
  ])
366
- if params.get("ants_s") is not None:
366
+ if params.get("ants_s", None) is not None:
367
367
  cargs.extend([
368
368
  "-ants.s",
369
- params.get("ants_s")
369
+ params.get("ants_s", None)
370
370
  ])
371
371
  return cargs
372
372
 
@@ -386,19 +386,21 @@ def dwibiascorrect_outputs(
386
386
  """
387
387
  ret = DwibiascorrectOutputs(
388
388
  root=execution.output_file("."),
389
- output_image_file=execution.output_file(params.get("output_image")),
390
- bias_image_file=execution.output_file(pathlib.Path(params.get("bias_image")).name) if (params.get("bias_image") is not None) else None,
389
+ output_image_file=execution.output_file(params.get("output_image", None)),
390
+ bias_image_file=execution.output_file(pathlib.Path(params.get("bias_image", None)).name) if (params.get("bias_image") is not None) else None,
391
391
  )
392
392
  return ret
393
393
 
394
394
 
395
395
  def dwibiascorrect_execute(
396
396
  params: DwibiascorrectParameters,
397
- execution: Execution,
397
+ runner: Runner | None = None,
398
398
  ) -> DwibiascorrectOutputs:
399
399
  """
400
- Perform B1 field inhomogeneity correction for a DWI volume series using either
401
- ANTs or FSL.
400
+ dwibiascorrect
401
+
402
+ Perform B1 field inhomogeneity correction for a DWI volume series using
403
+ either ANTs or FSL.
402
404
 
403
405
  Author: MRTrix3 Developers
404
406
 
@@ -406,10 +408,12 @@ def dwibiascorrect_execute(
406
408
 
407
409
  Args:
408
410
  params: The parameters.
409
- execution: The execution object.
411
+ runner: Command runner.
410
412
  Returns:
411
413
  NamedTuple of outputs (described in `DwibiascorrectOutputs`).
412
414
  """
415
+ runner = runner or get_global_runner()
416
+ execution = runner.start_execution(DWIBIASCORRECT_METADATA)
413
417
  params = execution.params(params)
414
418
  cargs = dwibiascorrect_cargs(params, execution)
415
419
  ret = dwibiascorrect_outputs(params, execution)
@@ -442,8 +446,10 @@ def dwibiascorrect(
442
446
  runner: Runner | None = None,
443
447
  ) -> DwibiascorrectOutputs:
444
448
  """
445
- Perform B1 field inhomogeneity correction for a DWI volume series using either
446
- ANTs or FSL.
449
+ dwibiascorrect
450
+
451
+ Perform B1 field inhomogeneity correction for a DWI volume series using
452
+ either ANTs or FSL.
447
453
 
448
454
  Author: MRTrix3 Developers
449
455
 
@@ -486,8 +492,6 @@ def dwibiascorrect(
486
492
  Returns:
487
493
  NamedTuple of outputs (described in `DwibiascorrectOutputs`).
488
494
  """
489
- runner = runner or get_global_runner()
490
- execution = runner.start_execution(DWIBIASCORRECT_METADATA)
491
495
  params = dwibiascorrect_params(
492
496
  algorithm=algorithm,
493
497
  input_image=input_image,
@@ -511,17 +515,15 @@ def dwibiascorrect(
511
515
  ants_c=ants_c,
512
516
  ants_s=ants_s,
513
517
  )
514
- return dwibiascorrect_execute(params, execution)
518
+ return dwibiascorrect_execute(params, runner)
515
519
 
516
520
 
517
521
  __all__ = [
518
522
  "DWIBIASCORRECT_METADATA",
519
- "DwibiascorrectConfigParameters",
520
- "DwibiascorrectFslgradParameters",
521
523
  "DwibiascorrectOutputs",
522
- "DwibiascorrectParameters",
523
524
  "dwibiascorrect",
524
525
  "dwibiascorrect_config_params",
526
+ "dwibiascorrect_execute",
525
527
  "dwibiascorrect_fslgrad_params",
526
528
  "dwibiascorrect_params",
527
529
  ]
@@ -6,7 +6,7 @@ import pathlib
6
6
  from styxdefs import *
7
7
 
8
8
  DWIDENOISE_METADATA = Metadata(
9
- id="66375761a5c4ae75db2849ddf80e513a6eeb4c88.boutiques",
9
+ id="82c3888900162dbe688e89a630bf3f397f859b0b.boutiques",
10
10
  name="dwidenoise",
11
11
  package="mrtrix",
12
12
  container_image_tag="mrtrix3/mrtrix3:3.0.4",
@@ -14,14 +14,37 @@ DWIDENOISE_METADATA = Metadata(
14
14
 
15
15
 
16
16
  DwidenoiseConfigParameters = typing.TypedDict('DwidenoiseConfigParameters', {
17
- "__STYXTYPE__": typing.Literal["config"],
17
+ "@type": typing.NotRequired[typing.Literal["config"]],
18
+ "key": str,
19
+ "value": str,
20
+ })
21
+ DwidenoiseConfigParametersTagged = typing.TypedDict('DwidenoiseConfigParametersTagged', {
22
+ "@type": typing.Literal["config"],
18
23
  "key": str,
19
24
  "value": str,
20
25
  })
21
26
 
22
27
 
23
28
  DwidenoiseParameters = typing.TypedDict('DwidenoiseParameters', {
24
- "__STYXTYPE__": typing.Literal["dwidenoise"],
29
+ "@type": typing.NotRequired[typing.Literal["mrtrix/dwidenoise"]],
30
+ "mask": typing.NotRequired[InputPathType | None],
31
+ "extent": typing.NotRequired[list[int] | None],
32
+ "noise": typing.NotRequired[str | None],
33
+ "datatype": typing.NotRequired[str | None],
34
+ "estimator": typing.NotRequired[str | None],
35
+ "info": bool,
36
+ "quiet": bool,
37
+ "debug": bool,
38
+ "force": bool,
39
+ "nthreads": typing.NotRequired[int | None],
40
+ "config": typing.NotRequired[list[DwidenoiseConfigParameters] | None],
41
+ "help": bool,
42
+ "version": bool,
43
+ "dwi": InputPathType,
44
+ "out": str,
45
+ })
46
+ DwidenoiseParametersTagged = typing.TypedDict('DwidenoiseParametersTagged', {
47
+ "@type": typing.Literal["mrtrix/dwidenoise"],
25
48
  "mask": typing.NotRequired[InputPathType | None],
26
49
  "extent": typing.NotRequired[list[int] | None],
27
50
  "noise": typing.NotRequired[str | None],
@@ -38,45 +61,12 @@ DwidenoiseParameters = typing.TypedDict('DwidenoiseParameters', {
38
61
  "dwi": InputPathType,
39
62
  "out": str,
40
63
  })
41
-
42
-
43
- def dyn_cargs(
44
- t: str,
45
- ) -> typing.Any:
46
- """
47
- Get build cargs function by command type.
48
-
49
- Args:
50
- t: Command type.
51
- Returns:
52
- Build cargs function.
53
- """
54
- return {
55
- "dwidenoise": dwidenoise_cargs,
56
- "config": dwidenoise_config_cargs,
57
- }.get(t)
58
-
59
-
60
- def dyn_outputs(
61
- t: str,
62
- ) -> typing.Any:
63
- """
64
- Get build outputs function by command type.
65
-
66
- Args:
67
- t: Command type.
68
- Returns:
69
- Build outputs function.
70
- """
71
- return {
72
- "dwidenoise": dwidenoise_outputs,
73
- }.get(t)
74
64
 
75
65
 
76
66
  def dwidenoise_config_params(
77
67
  key: str,
78
68
  value: str,
79
- ) -> DwidenoiseConfigParameters:
69
+ ) -> DwidenoiseConfigParametersTagged:
80
70
  """
81
71
  Build parameters.
82
72
 
@@ -87,7 +77,7 @@ def dwidenoise_config_params(
87
77
  Parameter dictionary
88
78
  """
89
79
  params = {
90
- "__STYXTYPE__": "config",
80
+ "@type": "config",
91
81
  "key": key,
92
82
  "value": value,
93
83
  }
@@ -109,14 +99,14 @@ def dwidenoise_config_cargs(
109
99
  """
110
100
  cargs = []
111
101
  cargs.append("-config")
112
- cargs.append(params.get("key"))
113
- cargs.append(params.get("value"))
102
+ cargs.append(params.get("key", None))
103
+ cargs.append(params.get("value", None))
114
104
  return cargs
115
105
 
116
106
 
117
107
  class DwidenoiseOutputs(typing.NamedTuple):
118
108
  """
119
- Output object returned when calling `dwidenoise(...)`.
109
+ Output object returned when calling `DwidenoiseParameters(...)`.
120
110
  """
121
111
  root: OutputPathType
122
112
  """Output root folder. This is the root folder for all outputs."""
@@ -144,7 +134,7 @@ def dwidenoise_params(
144
134
  config: list[DwidenoiseConfigParameters] | None = None,
145
135
  help_: bool = False,
146
136
  version: bool = False,
147
- ) -> DwidenoiseParameters:
137
+ ) -> DwidenoiseParametersTagged:
148
138
  """
149
139
  Build parameters.
150
140
 
@@ -183,7 +173,7 @@ def dwidenoise_params(
183
173
  Parameter dictionary
184
174
  """
185
175
  params = {
186
- "__STYXTYPE__": "dwidenoise",
176
+ "@type": "mrtrix/dwidenoise",
187
177
  "info": info,
188
178
  "quiet": quiet,
189
179
  "debug": debug,
@@ -225,52 +215,52 @@ def dwidenoise_cargs(
225
215
  """
226
216
  cargs = []
227
217
  cargs.append("dwidenoise")
228
- if params.get("mask") is not None:
218
+ if params.get("mask", None) is not None:
229
219
  cargs.extend([
230
220
  "-mask",
231
- execution.input_file(params.get("mask"))
221
+ execution.input_file(params.get("mask", None))
232
222
  ])
233
- if params.get("extent") is not None:
223
+ if params.get("extent", None) is not None:
234
224
  cargs.extend([
235
225
  "-extent",
236
- *map(str, params.get("extent"))
226
+ *map(str, params.get("extent", None))
237
227
  ])
238
- if params.get("noise") is not None:
228
+ if params.get("noise", None) is not None:
239
229
  cargs.extend([
240
230
  "-noise",
241
- params.get("noise")
231
+ params.get("noise", None)
242
232
  ])
243
- if params.get("datatype") is not None:
233
+ if params.get("datatype", None) is not None:
244
234
  cargs.extend([
245
235
  "-datatype",
246
- params.get("datatype")
236
+ params.get("datatype", None)
247
237
  ])
248
- if params.get("estimator") is not None:
238
+ if params.get("estimator", None) is not None:
249
239
  cargs.extend([
250
240
  "-estimator",
251
- params.get("estimator")
241
+ params.get("estimator", None)
252
242
  ])
253
- if params.get("info"):
243
+ if params.get("info", False):
254
244
  cargs.append("-info")
255
- if params.get("quiet"):
245
+ if params.get("quiet", False):
256
246
  cargs.append("-quiet")
257
- if params.get("debug"):
247
+ if params.get("debug", False):
258
248
  cargs.append("-debug")
259
- if params.get("force"):
249
+ if params.get("force", False):
260
250
  cargs.append("-force")
261
- if params.get("nthreads") is not None:
251
+ if params.get("nthreads", None) is not None:
262
252
  cargs.extend([
263
253
  "-nthreads",
264
- str(params.get("nthreads"))
254
+ str(params.get("nthreads", None))
265
255
  ])
266
- if params.get("config") is not None:
267
- cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
268
- if params.get("help"):
256
+ if params.get("config", None) is not None:
257
+ cargs.extend([a for c in [dwidenoise_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
258
+ if params.get("help", False):
269
259
  cargs.append("-help")
270
- if params.get("version"):
260
+ if params.get("version", False):
271
261
  cargs.append("-version")
272
- cargs.append(execution.input_file(params.get("dwi")))
273
- cargs.append(params.get("out"))
262
+ cargs.append(execution.input_file(params.get("dwi", None)))
263
+ cargs.append(params.get("out", None))
274
264
  return cargs
275
265
 
276
266
 
@@ -289,17 +279,19 @@ def dwidenoise_outputs(
289
279
  """
290
280
  ret = DwidenoiseOutputs(
291
281
  root=execution.output_file("."),
292
- out=execution.output_file(params.get("out")),
293
- noise=execution.output_file(params.get("noise")) if (params.get("noise") is not None) else None,
282
+ out=execution.output_file(params.get("out", None)),
283
+ noise=execution.output_file(params.get("noise", None)) if (params.get("noise") is not None) else None,
294
284
  )
295
285
  return ret
296
286
 
297
287
 
298
288
  def dwidenoise_execute(
299
289
  params: DwidenoiseParameters,
300
- execution: Execution,
290
+ runner: Runner | None = None,
301
291
  ) -> DwidenoiseOutputs:
302
292
  """
293
+ dwidenoise
294
+
303
295
  dMRI noise level estimation and denoising using Marchenko-Pastur PCA.
304
296
 
305
297
  DWI data denoising and noise map estimation by exploiting data redundancy in
@@ -341,10 +333,12 @@ def dwidenoise_execute(
341
333
 
342
334
  Args:
343
335
  params: The parameters.
344
- execution: The execution object.
336
+ runner: Command runner.
345
337
  Returns:
346
338
  NamedTuple of outputs (described in `DwidenoiseOutputs`).
347
339
  """
340
+ runner = runner or get_global_runner()
341
+ execution = runner.start_execution(DWIDENOISE_METADATA)
348
342
  params = execution.params(params)
349
343
  cargs = dwidenoise_cargs(params, execution)
350
344
  ret = dwidenoise_outputs(params, execution)
@@ -371,6 +365,8 @@ def dwidenoise(
371
365
  runner: Runner | None = None,
372
366
  ) -> DwidenoiseOutputs:
373
367
  """
368
+ dwidenoise
369
+
374
370
  dMRI noise level estimation and denoising using Marchenko-Pastur PCA.
375
371
 
376
372
  DWI data denoising and noise map estimation by exploiting data redundancy in
@@ -445,8 +441,6 @@ def dwidenoise(
445
441
  Returns:
446
442
  NamedTuple of outputs (described in `DwidenoiseOutputs`).
447
443
  """
448
- runner = runner or get_global_runner()
449
- execution = runner.start_execution(DWIDENOISE_METADATA)
450
444
  params = dwidenoise_params(
451
445
  mask=mask,
452
446
  extent=extent,
@@ -464,15 +458,14 @@ def dwidenoise(
464
458
  dwi=dwi,
465
459
  out=out,
466
460
  )
467
- return dwidenoise_execute(params, execution)
461
+ return dwidenoise_execute(params, runner)
468
462
 
469
463
 
470
464
  __all__ = [
471
465
  "DWIDENOISE_METADATA",
472
- "DwidenoiseConfigParameters",
473
466
  "DwidenoiseOutputs",
474
- "DwidenoiseParameters",
475
467
  "dwidenoise",
476
468
  "dwidenoise_config_params",
469
+ "dwidenoise_execute",
477
470
  "dwidenoise_params",
478
471
  ]