niwrap-mrtrix 0.6.3__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.3.dist-info/METADATA +0 -8
  121. niwrap_mrtrix-0.6.3.dist-info/RECORD +0 -119
  122. niwrap_mrtrix-0.6.3.dist-info/WHEEL +0 -4
@@ -6,7 +6,7 @@ import pathlib
6
6
  from styxdefs import *
7
7
 
8
8
  SH2PEAKS_METADATA = Metadata(
9
- id="fa5c5976ef9cd75e8ab67b278ed530d08b43702c.boutiques",
9
+ id="1cf460ab2a2a452d9f75103cade5ef23706312a1.boutiques",
10
10
  name="sh2peaks",
11
11
  package="mrtrix",
12
12
  container_image_tag="mrtrix3/mrtrix3:3.0.4",
@@ -14,21 +14,51 @@ SH2PEAKS_METADATA = Metadata(
14
14
 
15
15
 
16
16
  Sh2peaksDirectionParameters = typing.TypedDict('Sh2peaksDirectionParameters', {
17
- "__STYXTYPE__": typing.Literal["direction"],
17
+ "@type": typing.NotRequired[typing.Literal["direction"]],
18
+ "phi": float,
19
+ "theta": float,
20
+ })
21
+ Sh2peaksDirectionParametersTagged = typing.TypedDict('Sh2peaksDirectionParametersTagged', {
22
+ "@type": typing.Literal["direction"],
18
23
  "phi": float,
19
24
  "theta": float,
20
25
  })
21
26
 
22
27
 
23
28
  Sh2peaksConfigParameters = typing.TypedDict('Sh2peaksConfigParameters', {
24
- "__STYXTYPE__": typing.Literal["config"],
29
+ "@type": typing.NotRequired[typing.Literal["config"]],
30
+ "key": str,
31
+ "value": str,
32
+ })
33
+ Sh2peaksConfigParametersTagged = typing.TypedDict('Sh2peaksConfigParametersTagged', {
34
+ "@type": typing.Literal["config"],
25
35
  "key": str,
26
36
  "value": str,
27
37
  })
28
38
 
29
39
 
30
40
  Sh2peaksParameters = typing.TypedDict('Sh2peaksParameters', {
31
- "__STYXTYPE__": typing.Literal["sh2peaks"],
41
+ "@type": typing.NotRequired[typing.Literal["mrtrix/sh2peaks"]],
42
+ "num": typing.NotRequired[int | None],
43
+ "direction": typing.NotRequired[list[Sh2peaksDirectionParameters] | None],
44
+ "peaks": typing.NotRequired[InputPathType | None],
45
+ "threshold": typing.NotRequired[float | None],
46
+ "seeds": typing.NotRequired[InputPathType | None],
47
+ "mask": typing.NotRequired[InputPathType | None],
48
+ "fast": bool,
49
+ "info": bool,
50
+ "quiet": bool,
51
+ "debug": bool,
52
+ "force": bool,
53
+ "nthreads": typing.NotRequired[int | None],
54
+ "config": typing.NotRequired[list[Sh2peaksConfigParameters] | None],
55
+ "help": bool,
56
+ "version": bool,
57
+ "SH": InputPathType,
58
+ "output": str,
59
+ })
60
+ Sh2peaksParametersTagged = typing.TypedDict('Sh2peaksParametersTagged', {
61
+ "@type": typing.Literal["mrtrix/sh2peaks"],
32
62
  "num": typing.NotRequired[int | None],
33
63
  "direction": typing.NotRequired[list[Sh2peaksDirectionParameters] | None],
34
64
  "peaks": typing.NotRequired[InputPathType | None],
@@ -47,46 +77,12 @@ Sh2peaksParameters = typing.TypedDict('Sh2peaksParameters', {
47
77
  "SH": InputPathType,
48
78
  "output": str,
49
79
  })
50
-
51
-
52
- def dyn_cargs(
53
- t: str,
54
- ) -> typing.Any:
55
- """
56
- Get build cargs function by command type.
57
-
58
- Args:
59
- t: Command type.
60
- Returns:
61
- Build cargs function.
62
- """
63
- return {
64
- "sh2peaks": sh2peaks_cargs,
65
- "direction": sh2peaks_direction_cargs,
66
- "config": sh2peaks_config_cargs,
67
- }.get(t)
68
-
69
-
70
- def dyn_outputs(
71
- t: str,
72
- ) -> typing.Any:
73
- """
74
- Get build outputs function by command type.
75
-
76
- Args:
77
- t: Command type.
78
- Returns:
79
- Build outputs function.
80
- """
81
- return {
82
- "sh2peaks": sh2peaks_outputs,
83
- }.get(t)
84
80
 
85
81
 
86
82
  def sh2peaks_direction_params(
87
83
  phi: float,
88
84
  theta: float,
89
- ) -> Sh2peaksDirectionParameters:
85
+ ) -> Sh2peaksDirectionParametersTagged:
90
86
  """
91
87
  Build parameters.
92
88
 
@@ -100,7 +96,7 @@ def sh2peaks_direction_params(
100
96
  Parameter dictionary
101
97
  """
102
98
  params = {
103
- "__STYXTYPE__": "direction",
99
+ "@type": "direction",
104
100
  "phi": phi,
105
101
  "theta": theta,
106
102
  }
@@ -122,15 +118,15 @@ def sh2peaks_direction_cargs(
122
118
  """
123
119
  cargs = []
124
120
  cargs.append("-direction")
125
- cargs.append(str(params.get("phi")))
126
- cargs.append(str(params.get("theta")))
121
+ cargs.append(str(params.get("phi", None)))
122
+ cargs.append(str(params.get("theta", None)))
127
123
  return cargs
128
124
 
129
125
 
130
126
  def sh2peaks_config_params(
131
127
  key: str,
132
128
  value: str,
133
- ) -> Sh2peaksConfigParameters:
129
+ ) -> Sh2peaksConfigParametersTagged:
134
130
  """
135
131
  Build parameters.
136
132
 
@@ -141,7 +137,7 @@ def sh2peaks_config_params(
141
137
  Parameter dictionary
142
138
  """
143
139
  params = {
144
- "__STYXTYPE__": "config",
140
+ "@type": "config",
145
141
  "key": key,
146
142
  "value": value,
147
143
  }
@@ -163,14 +159,14 @@ def sh2peaks_config_cargs(
163
159
  """
164
160
  cargs = []
165
161
  cargs.append("-config")
166
- cargs.append(params.get("key"))
167
- cargs.append(params.get("value"))
162
+ cargs.append(params.get("key", None))
163
+ cargs.append(params.get("value", None))
168
164
  return cargs
169
165
 
170
166
 
171
167
  class Sh2peaksOutputs(typing.NamedTuple):
172
168
  """
173
- Output object returned when calling `sh2peaks(...)`.
169
+ Output object returned when calling `Sh2peaksParameters(...)`.
174
170
  """
175
171
  root: OutputPathType
176
172
  """Output root folder. This is the root folder for all outputs."""
@@ -197,7 +193,7 @@ def sh2peaks_params(
197
193
  config: list[Sh2peaksConfigParameters] | None = None,
198
194
  help_: bool = False,
199
195
  version: bool = False,
200
- ) -> Sh2peaksParameters:
196
+ ) -> Sh2peaksParametersTagged:
201
197
  """
202
198
  Build parameters.
203
199
 
@@ -236,7 +232,7 @@ def sh2peaks_params(
236
232
  Parameter dictionary
237
233
  """
238
234
  params = {
239
- "__STYXTYPE__": "sh2peaks",
235
+ "@type": "mrtrix/sh2peaks",
240
236
  "fast": fast,
241
237
  "info": info,
242
238
  "quiet": quiet,
@@ -281,56 +277,56 @@ def sh2peaks_cargs(
281
277
  """
282
278
  cargs = []
283
279
  cargs.append("sh2peaks")
284
- if params.get("num") is not None:
280
+ if params.get("num", None) is not None:
285
281
  cargs.extend([
286
282
  "-num",
287
- str(params.get("num"))
283
+ str(params.get("num", None))
288
284
  ])
289
- if params.get("direction") is not None:
290
- cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("direction")] for a in c])
291
- if params.get("peaks") is not None:
285
+ if params.get("direction", None) is not None:
286
+ cargs.extend([a for c in [sh2peaks_direction_cargs(s, execution) for s in params.get("direction", None)] for a in c])
287
+ if params.get("peaks", None) is not None:
292
288
  cargs.extend([
293
289
  "-peaks",
294
- execution.input_file(params.get("peaks"))
290
+ execution.input_file(params.get("peaks", None))
295
291
  ])
296
- if params.get("threshold") is not None:
292
+ if params.get("threshold", None) is not None:
297
293
  cargs.extend([
298
294
  "-threshold",
299
- str(params.get("threshold"))
295
+ str(params.get("threshold", None))
300
296
  ])
301
- if params.get("seeds") is not None:
297
+ if params.get("seeds", None) is not None:
302
298
  cargs.extend([
303
299
  "-seeds",
304
- execution.input_file(params.get("seeds"))
300
+ execution.input_file(params.get("seeds", None))
305
301
  ])
306
- if params.get("mask") is not None:
302
+ if params.get("mask", None) is not None:
307
303
  cargs.extend([
308
304
  "-mask",
309
- execution.input_file(params.get("mask"))
305
+ execution.input_file(params.get("mask", None))
310
306
  ])
311
- if params.get("fast"):
307
+ if params.get("fast", False):
312
308
  cargs.append("-fast")
313
- if params.get("info"):
309
+ if params.get("info", False):
314
310
  cargs.append("-info")
315
- if params.get("quiet"):
311
+ if params.get("quiet", False):
316
312
  cargs.append("-quiet")
317
- if params.get("debug"):
313
+ if params.get("debug", False):
318
314
  cargs.append("-debug")
319
- if params.get("force"):
315
+ if params.get("force", False):
320
316
  cargs.append("-force")
321
- if params.get("nthreads") is not None:
317
+ if params.get("nthreads", None) is not None:
322
318
  cargs.extend([
323
319
  "-nthreads",
324
- str(params.get("nthreads"))
320
+ str(params.get("nthreads", None))
325
321
  ])
326
- if params.get("config") is not None:
327
- cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
328
- if params.get("help"):
322
+ if params.get("config", None) is not None:
323
+ cargs.extend([a for c in [sh2peaks_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
324
+ if params.get("help", False):
329
325
  cargs.append("-help")
330
- if params.get("version"):
326
+ if params.get("version", False):
331
327
  cargs.append("-version")
332
- cargs.append(execution.input_file(params.get("SH")))
333
- cargs.append(params.get("output"))
328
+ cargs.append(execution.input_file(params.get("SH", None)))
329
+ cargs.append(params.get("output", None))
334
330
  return cargs
335
331
 
336
332
 
@@ -349,16 +345,18 @@ def sh2peaks_outputs(
349
345
  """
350
346
  ret = Sh2peaksOutputs(
351
347
  root=execution.output_file("."),
352
- output=execution.output_file(params.get("output")),
348
+ output=execution.output_file(params.get("output", None)),
353
349
  )
354
350
  return ret
355
351
 
356
352
 
357
353
  def sh2peaks_execute(
358
354
  params: Sh2peaksParameters,
359
- execution: Execution,
355
+ runner: Runner | None = None,
360
356
  ) -> Sh2peaksOutputs:
361
357
  """
358
+ sh2peaks
359
+
362
360
  Extract the peaks of a spherical harmonic function in each voxel.
363
361
 
364
362
  Peaks of the spherical harmonic function in each voxel are located by
@@ -381,10 +379,12 @@ def sh2peaks_execute(
381
379
 
382
380
  Args:
383
381
  params: The parameters.
384
- execution: The execution object.
382
+ runner: Command runner.
385
383
  Returns:
386
384
  NamedTuple of outputs (described in `Sh2peaksOutputs`).
387
385
  """
386
+ runner = runner or get_global_runner()
387
+ execution = runner.start_execution(SH2PEAKS_METADATA)
388
388
  params = execution.params(params)
389
389
  cargs = sh2peaks_cargs(params, execution)
390
390
  ret = sh2peaks_outputs(params, execution)
@@ -413,6 +413,8 @@ def sh2peaks(
413
413
  runner: Runner | None = None,
414
414
  ) -> Sh2peaksOutputs:
415
415
  """
416
+ sh2peaks
417
+
416
418
  Extract the peaks of a spherical harmonic function in each voxel.
417
419
 
418
420
  Peaks of the spherical harmonic function in each voxel are located by
@@ -468,8 +470,6 @@ def sh2peaks(
468
470
  Returns:
469
471
  NamedTuple of outputs (described in `Sh2peaksOutputs`).
470
472
  """
471
- runner = runner or get_global_runner()
472
- execution = runner.start_execution(SH2PEAKS_METADATA)
473
473
  params = sh2peaks_params(
474
474
  num=num,
475
475
  direction=direction,
@@ -489,17 +489,15 @@ def sh2peaks(
489
489
  sh=sh,
490
490
  output=output,
491
491
  )
492
- return sh2peaks_execute(params, execution)
492
+ return sh2peaks_execute(params, runner)
493
493
 
494
494
 
495
495
  __all__ = [
496
496
  "SH2PEAKS_METADATA",
497
- "Sh2peaksConfigParameters",
498
- "Sh2peaksDirectionParameters",
499
497
  "Sh2peaksOutputs",
500
- "Sh2peaksParameters",
501
498
  "sh2peaks",
502
499
  "sh2peaks_config_params",
503
500
  "sh2peaks_direction_params",
501
+ "sh2peaks_execute",
504
502
  "sh2peaks_params",
505
503
  ]
@@ -6,7 +6,7 @@ import pathlib
6
6
  from styxdefs import *
7
7
 
8
8
  SH2POWER_METADATA = Metadata(
9
- id="51541fdc4332f8deff6104a920269e275945d304.boutiques",
9
+ id="a770bfd27441085e1e72ab3538cb5be866f4dd4f.boutiques",
10
10
  name="sh2power",
11
11
  package="mrtrix",
12
12
  container_image_tag="mrtrix3/mrtrix3:3.0.4",
@@ -14,14 +14,33 @@ SH2POWER_METADATA = Metadata(
14
14
 
15
15
 
16
16
  Sh2powerConfigParameters = typing.TypedDict('Sh2powerConfigParameters', {
17
- "__STYXTYPE__": typing.Literal["config"],
17
+ "@type": typing.NotRequired[typing.Literal["config"]],
18
+ "key": str,
19
+ "value": str,
20
+ })
21
+ Sh2powerConfigParametersTagged = typing.TypedDict('Sh2powerConfigParametersTagged', {
22
+ "@type": typing.Literal["config"],
18
23
  "key": str,
19
24
  "value": str,
20
25
  })
21
26
 
22
27
 
23
28
  Sh2powerParameters = typing.TypedDict('Sh2powerParameters', {
24
- "__STYXTYPE__": typing.Literal["sh2power"],
29
+ "@type": typing.NotRequired[typing.Literal["mrtrix/sh2power"]],
30
+ "spectrum": bool,
31
+ "info": bool,
32
+ "quiet": bool,
33
+ "debug": bool,
34
+ "force": bool,
35
+ "nthreads": typing.NotRequired[int | None],
36
+ "config": typing.NotRequired[list[Sh2powerConfigParameters] | None],
37
+ "help": bool,
38
+ "version": bool,
39
+ "SH": InputPathType,
40
+ "power": str,
41
+ })
42
+ Sh2powerParametersTagged = typing.TypedDict('Sh2powerParametersTagged', {
43
+ "@type": typing.Literal["mrtrix/sh2power"],
25
44
  "spectrum": bool,
26
45
  "info": bool,
27
46
  "quiet": bool,
@@ -34,45 +53,12 @@ Sh2powerParameters = typing.TypedDict('Sh2powerParameters', {
34
53
  "SH": InputPathType,
35
54
  "power": str,
36
55
  })
37
-
38
-
39
- def dyn_cargs(
40
- t: str,
41
- ) -> typing.Any:
42
- """
43
- Get build cargs function by command type.
44
-
45
- Args:
46
- t: Command type.
47
- Returns:
48
- Build cargs function.
49
- """
50
- return {
51
- "sh2power": sh2power_cargs,
52
- "config": sh2power_config_cargs,
53
- }.get(t)
54
-
55
-
56
- def dyn_outputs(
57
- t: str,
58
- ) -> typing.Any:
59
- """
60
- Get build outputs function by command type.
61
-
62
- Args:
63
- t: Command type.
64
- Returns:
65
- Build outputs function.
66
- """
67
- return {
68
- "sh2power": sh2power_outputs,
69
- }.get(t)
70
56
 
71
57
 
72
58
  def sh2power_config_params(
73
59
  key: str,
74
60
  value: str,
75
- ) -> Sh2powerConfigParameters:
61
+ ) -> Sh2powerConfigParametersTagged:
76
62
  """
77
63
  Build parameters.
78
64
 
@@ -83,7 +69,7 @@ def sh2power_config_params(
83
69
  Parameter dictionary
84
70
  """
85
71
  params = {
86
- "__STYXTYPE__": "config",
72
+ "@type": "config",
87
73
  "key": key,
88
74
  "value": value,
89
75
  }
@@ -105,14 +91,14 @@ def sh2power_config_cargs(
105
91
  """
106
92
  cargs = []
107
93
  cargs.append("-config")
108
- cargs.append(params.get("key"))
109
- cargs.append(params.get("value"))
94
+ cargs.append(params.get("key", None))
95
+ cargs.append(params.get("value", None))
110
96
  return cargs
111
97
 
112
98
 
113
99
  class Sh2powerOutputs(typing.NamedTuple):
114
100
  """
115
- Output object returned when calling `sh2power(...)`.
101
+ Output object returned when calling `Sh2powerParameters(...)`.
116
102
  """
117
103
  root: OutputPathType
118
104
  """Output root folder. This is the root folder for all outputs."""
@@ -132,7 +118,7 @@ def sh2power_params(
132
118
  config: list[Sh2powerConfigParameters] | None = None,
133
119
  help_: bool = False,
134
120
  version: bool = False,
135
- ) -> Sh2powerParameters:
121
+ ) -> Sh2powerParametersTagged:
136
122
  """
137
123
  Build parameters.
138
124
 
@@ -157,7 +143,7 @@ def sh2power_params(
157
143
  Parameter dictionary
158
144
  """
159
145
  params = {
160
- "__STYXTYPE__": "sh2power",
146
+ "@type": "mrtrix/sh2power",
161
147
  "spectrum": spectrum,
162
148
  "info": info,
163
149
  "quiet": quiet,
@@ -190,29 +176,29 @@ def sh2power_cargs(
190
176
  """
191
177
  cargs = []
192
178
  cargs.append("sh2power")
193
- if params.get("spectrum"):
179
+ if params.get("spectrum", False):
194
180
  cargs.append("-spectrum")
195
- if params.get("info"):
181
+ if params.get("info", False):
196
182
  cargs.append("-info")
197
- if params.get("quiet"):
183
+ if params.get("quiet", False):
198
184
  cargs.append("-quiet")
199
- if params.get("debug"):
185
+ if params.get("debug", False):
200
186
  cargs.append("-debug")
201
- if params.get("force"):
187
+ if params.get("force", False):
202
188
  cargs.append("-force")
203
- if params.get("nthreads") is not None:
189
+ if params.get("nthreads", None) is not None:
204
190
  cargs.extend([
205
191
  "-nthreads",
206
- str(params.get("nthreads"))
192
+ str(params.get("nthreads", None))
207
193
  ])
208
- if params.get("config") is not None:
209
- cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
210
- if params.get("help"):
194
+ if params.get("config", None) is not None:
195
+ cargs.extend([a for c in [sh2power_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
196
+ if params.get("help", False):
211
197
  cargs.append("-help")
212
- if params.get("version"):
198
+ if params.get("version", False):
213
199
  cargs.append("-version")
214
- cargs.append(execution.input_file(params.get("SH")))
215
- cargs.append(params.get("power"))
200
+ cargs.append(execution.input_file(params.get("SH", None)))
201
+ cargs.append(params.get("power", None))
216
202
  return cargs
217
203
 
218
204
 
@@ -231,16 +217,18 @@ def sh2power_outputs(
231
217
  """
232
218
  ret = Sh2powerOutputs(
233
219
  root=execution.output_file("."),
234
- power=execution.output_file(params.get("power")),
220
+ power=execution.output_file(params.get("power", None)),
235
221
  )
236
222
  return ret
237
223
 
238
224
 
239
225
  def sh2power_execute(
240
226
  params: Sh2powerParameters,
241
- execution: Execution,
227
+ runner: Runner | None = None,
242
228
  ) -> Sh2powerOutputs:
243
229
  """
230
+ sh2power
231
+
244
232
  Compute the total power of a spherical harmonics image.
245
233
 
246
234
  This command computes the sum of squared SH coefficients, which equals the
@@ -260,10 +248,12 @@ def sh2power_execute(
260
248
 
261
249
  Args:
262
250
  params: The parameters.
263
- execution: The execution object.
251
+ runner: Command runner.
264
252
  Returns:
265
253
  NamedTuple of outputs (described in `Sh2powerOutputs`).
266
254
  """
255
+ runner = runner or get_global_runner()
256
+ execution = runner.start_execution(SH2POWER_METADATA)
267
257
  params = execution.params(params)
268
258
  cargs = sh2power_cargs(params, execution)
269
259
  ret = sh2power_outputs(params, execution)
@@ -286,6 +276,8 @@ def sh2power(
286
276
  runner: Runner | None = None,
287
277
  ) -> Sh2powerOutputs:
288
278
  """
279
+ sh2power
280
+
289
281
  Compute the total power of a spherical harmonics image.
290
282
 
291
283
  This command computes the sum of squared SH coefficients, which equals the
@@ -324,8 +316,6 @@ def sh2power(
324
316
  Returns:
325
317
  NamedTuple of outputs (described in `Sh2powerOutputs`).
326
318
  """
327
- runner = runner or get_global_runner()
328
- execution = runner.start_execution(SH2POWER_METADATA)
329
319
  params = sh2power_params(
330
320
  spectrum=spectrum,
331
321
  info=info,
@@ -339,15 +329,14 @@ def sh2power(
339
329
  sh=sh,
340
330
  power=power,
341
331
  )
342
- return sh2power_execute(params, execution)
332
+ return sh2power_execute(params, runner)
343
333
 
344
334
 
345
335
  __all__ = [
346
336
  "SH2POWER_METADATA",
347
- "Sh2powerConfigParameters",
348
337
  "Sh2powerOutputs",
349
- "Sh2powerParameters",
350
338
  "sh2power",
351
339
  "sh2power_config_params",
340
+ "sh2power_execute",
352
341
  "sh2power_params",
353
342
  ]