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.
- niwrap_mrtrix/mrtrix/__init__.py +133 -0
- niwrap_mrtrix/mrtrix/afdconnectivity.py +59 -68
- niwrap_mrtrix/mrtrix/amp2response.py +72 -77
- niwrap_mrtrix/mrtrix/amp2sh.py +109 -74
- niwrap_mrtrix/mrtrix/connectome2tck.py +77 -79
- niwrap_mrtrix/mrtrix/connectomeedit.py +52 -62
- niwrap_mrtrix/mrtrix/connectomestats.py +117 -104
- niwrap_mrtrix/mrtrix/dcmedit.py +68 -73
- niwrap_mrtrix/mrtrix/dcminfo.py +67 -72
- niwrap_mrtrix/mrtrix/dirflip.py +56 -66
- niwrap_mrtrix/mrtrix/dirgen.py +68 -75
- niwrap_mrtrix/mrtrix/dirmerge.py +56 -66
- niwrap_mrtrix/mrtrix/dirorder.py +53 -64
- niwrap_mrtrix/mrtrix/dirsplit.py +56 -66
- niwrap_mrtrix/mrtrix/dirstat.py +70 -75
- niwrap_mrtrix/mrtrix/dwi2adc.py +67 -74
- niwrap_mrtrix/mrtrix/dwi2fod.py +141 -96
- niwrap_mrtrix/mrtrix/dwi2mask.py +70 -76
- niwrap_mrtrix/mrtrix/dwi2response.py +238 -157
- niwrap_mrtrix/mrtrix/dwi2tensor.py +87 -88
- niwrap_mrtrix/mrtrix/dwibiascorrect.py +97 -95
- niwrap_mrtrix/mrtrix/dwidenoise.py +67 -74
- niwrap_mrtrix/mrtrix/dwiextract.py +143 -99
- niwrap_mrtrix/mrtrix/dwigradcheck.py +89 -91
- niwrap_mrtrix/mrtrix/fixel2peaks.py +77 -51
- niwrap_mrtrix/mrtrix/fixel2sh.py +54 -65
- niwrap_mrtrix/mrtrix/fixel2tsf.py +56 -66
- niwrap_mrtrix/mrtrix/fixel2voxel.py +62 -70
- niwrap_mrtrix/mrtrix/fixelcfestats.py +145 -93
- niwrap_mrtrix/mrtrix/fixelconnectivity.py +62 -70
- niwrap_mrtrix/mrtrix/fixelconvert.py +136 -69
- niwrap_mrtrix/mrtrix/fixelcorrespondence.py +61 -69
- niwrap_mrtrix/mrtrix/fixelcrop.py +53 -64
- niwrap_mrtrix/mrtrix/fixelfilter.py +139 -71
- niwrap_mrtrix/mrtrix/fixelreorient.py +53 -64
- niwrap_mrtrix/mrtrix/fod2dec.py +70 -75
- niwrap_mrtrix/mrtrix/fod2fixel.py +84 -85
- niwrap_mrtrix/mrtrix/label2colour.py +58 -67
- niwrap_mrtrix/mrtrix/label2mesh.py +53 -64
- niwrap_mrtrix/mrtrix/labelconvert.py +58 -67
- niwrap_mrtrix/mrtrix/labelstats.py +53 -63
- niwrap_mrtrix/mrtrix/maskdump.py +52 -64
- niwrap_mrtrix/mrtrix/maskfilter.py +93 -61
- niwrap_mrtrix/mrtrix/mesh2voxel.py +53 -64
- niwrap_mrtrix/mrtrix/meshconvert.py +66 -73
- niwrap_mrtrix/mrtrix/meshfilter.py +59 -68
- niwrap_mrtrix/mrtrix/mraverageheader.py +62 -70
- niwrap_mrtrix/mrtrix/mrcalc.py +522 -397
- niwrap_mrtrix/mrtrix/mrcat.py +59 -68
- niwrap_mrtrix/mrtrix/mrcentroid.py +53 -63
- niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +58 -67
- niwrap_mrtrix/mrtrix/mrclusterstats.py +119 -105
- niwrap_mrtrix/mrtrix/mrcolour.py +62 -70
- niwrap_mrtrix/mrtrix/mrconvert.py +275 -173
- niwrap_mrtrix/mrtrix/mrdegibbs.py +66 -73
- niwrap_mrtrix/mrtrix/mrdump.py +55 -66
- niwrap_mrtrix/mrtrix/mredit.py +97 -94
- niwrap_mrtrix/mrtrix/mrfilter.py +124 -81
- niwrap_mrtrix/mrtrix/mrgrid.py +131 -88
- niwrap_mrtrix/mrtrix/mrhistmatch.py +64 -71
- niwrap_mrtrix/mrtrix/mrhistogram.py +64 -71
- niwrap_mrtrix/mrtrix/mrinfo.py +160 -137
- niwrap_mrtrix/mrtrix/mrmath.py +65 -73
- niwrap_mrtrix/mrtrix/mrmetric.py +69 -73
- niwrap_mrtrix/mrtrix/mrregister.py +263 -212
- niwrap_mrtrix/mrtrix/mrstats.py +66 -72
- niwrap_mrtrix/mrtrix/mrthreshold.py +80 -81
- niwrap_mrtrix/mrtrix/mrtransform.py +162 -109
- niwrap_mrtrix/mrtrix/mtnormalise.py +85 -88
- niwrap_mrtrix/mrtrix/peaks2amp.py +51 -63
- niwrap_mrtrix/mrtrix/peaks2fixel.py +54 -65
- niwrap_mrtrix/mrtrix/responsemean.py +51 -62
- niwrap_mrtrix/mrtrix/sh2amp.py +98 -65
- niwrap_mrtrix/mrtrix/sh2peaks.py +81 -83
- niwrap_mrtrix/mrtrix/sh2power.py +53 -64
- niwrap_mrtrix/mrtrix/sh2response.py +62 -70
- niwrap_mrtrix/mrtrix/shbasis.py +51 -62
- niwrap_mrtrix/mrtrix/shconv.py +78 -52
- niwrap_mrtrix/mrtrix/tck2connectome.py +93 -88
- niwrap_mrtrix/mrtrix/tck2fixel.py +57 -65
- niwrap_mrtrix/mrtrix/tckconvert.py +99 -65
- niwrap_mrtrix/mrtrix/tckdfc.py +82 -83
- niwrap_mrtrix/mrtrix/tckedit.py +240 -122
- niwrap_mrtrix/mrtrix/tckgen.py +364 -207
- niwrap_mrtrix/mrtrix/tckglobal.py +127 -115
- niwrap_mrtrix/mrtrix/tckinfo.py +50 -61
- niwrap_mrtrix/mrtrix/tckmap.py +121 -79
- niwrap_mrtrix/mrtrix/tckresample.py +97 -93
- niwrap_mrtrix/mrtrix/tcksample.py +62 -69
- niwrap_mrtrix/mrtrix/tcksift.py +102 -97
- niwrap_mrtrix/mrtrix/tcksift2.py +119 -107
- niwrap_mrtrix/mrtrix/tckstats.py +72 -78
- niwrap_mrtrix/mrtrix/tcktransform.py +53 -64
- niwrap_mrtrix/mrtrix/tensor2metric.py +93 -94
- niwrap_mrtrix/mrtrix/transformcalc.py +53 -64
- niwrap_mrtrix/mrtrix/transformcompose.py +74 -48
- niwrap_mrtrix/mrtrix/transformconvert.py +53 -64
- niwrap_mrtrix/mrtrix/tsfdivide.py +53 -64
- niwrap_mrtrix/mrtrix/tsfinfo.py +53 -63
- niwrap_mrtrix/mrtrix/tsfmult.py +51 -63
- niwrap_mrtrix/mrtrix/tsfsmooth.py +54 -65
- niwrap_mrtrix/mrtrix/tsfthreshold.py +55 -65
- niwrap_mrtrix/mrtrix/tsfvalidate.py +50 -61
- niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +54 -65
- niwrap_mrtrix/mrtrix/v_5tt2vis.py +69 -75
- niwrap_mrtrix/mrtrix/v_5ttcheck.py +51 -62
- niwrap_mrtrix/mrtrix/v_5ttedit.py +73 -79
- niwrap_mrtrix/mrtrix/v_5ttgen.py +132 -86
- niwrap_mrtrix/mrtrix/vectorstats.py +92 -88
- niwrap_mrtrix/mrtrix/voxel2fixel.py +54 -63
- niwrap_mrtrix/mrtrix/voxel2mesh.py +56 -66
- niwrap_mrtrix/mrtrix/warp2metric.py +71 -77
- niwrap_mrtrix/mrtrix/warpconvert.py +61 -69
- niwrap_mrtrix/mrtrix/warpcorrect.py +61 -71
- niwrap_mrtrix/mrtrix/warpinit.py +51 -63
- niwrap_mrtrix/mrtrix/warpinvert.py +56 -66
- niwrap_mrtrix-0.7.0.dist-info/METADATA +8 -0
- niwrap_mrtrix-0.7.0.dist-info/RECORD +119 -0
- niwrap_mrtrix-0.7.0.dist-info/WHEEL +4 -0
- niwrap_mrtrix-0.6.3.dist-info/METADATA +0 -8
- niwrap_mrtrix-0.6.3.dist-info/RECORD +0 -119
- niwrap_mrtrix-0.6.3.dist-info/WHEEL +0 -4
niwrap_mrtrix/mrtrix/mrmath.py
CHANGED
|
@@ -6,7 +6,7 @@ import pathlib
|
|
|
6
6
|
from styxdefs import *
|
|
7
7
|
|
|
8
8
|
MRMATH_METADATA = Metadata(
|
|
9
|
-
id="
|
|
9
|
+
id="53ebb217f19a2e0a5175c77890d64115b390d7bd.boutiques",
|
|
10
10
|
name="mrmath",
|
|
11
11
|
package="mrtrix",
|
|
12
12
|
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
@@ -14,14 +14,36 @@ MRMATH_METADATA = Metadata(
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
MrmathConfigParameters = typing.TypedDict('MrmathConfigParameters', {
|
|
17
|
-
"
|
|
17
|
+
"@type": typing.NotRequired[typing.Literal["config"]],
|
|
18
|
+
"key": str,
|
|
19
|
+
"value": str,
|
|
20
|
+
})
|
|
21
|
+
MrmathConfigParametersTagged = typing.TypedDict('MrmathConfigParametersTagged', {
|
|
22
|
+
"@type": typing.Literal["config"],
|
|
18
23
|
"key": str,
|
|
19
24
|
"value": str,
|
|
20
25
|
})
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
MrmathParameters = typing.TypedDict('MrmathParameters', {
|
|
24
|
-
"
|
|
29
|
+
"@type": typing.NotRequired[typing.Literal["mrtrix/mrmath"]],
|
|
30
|
+
"axis": typing.NotRequired[int | None],
|
|
31
|
+
"keep_unary_axes": bool,
|
|
32
|
+
"datatype": typing.NotRequired[str | None],
|
|
33
|
+
"info": bool,
|
|
34
|
+
"quiet": bool,
|
|
35
|
+
"debug": bool,
|
|
36
|
+
"force": bool,
|
|
37
|
+
"nthreads": typing.NotRequired[int | None],
|
|
38
|
+
"config": typing.NotRequired[list[MrmathConfigParameters] | None],
|
|
39
|
+
"help": bool,
|
|
40
|
+
"version": bool,
|
|
41
|
+
"input": list[InputPathType],
|
|
42
|
+
"operation": str,
|
|
43
|
+
"output": str,
|
|
44
|
+
})
|
|
45
|
+
MrmathParametersTagged = typing.TypedDict('MrmathParametersTagged', {
|
|
46
|
+
"@type": typing.Literal["mrtrix/mrmath"],
|
|
25
47
|
"axis": typing.NotRequired[int | None],
|
|
26
48
|
"keep_unary_axes": bool,
|
|
27
49
|
"datatype": typing.NotRequired[str | None],
|
|
@@ -37,45 +59,12 @@ MrmathParameters = typing.TypedDict('MrmathParameters', {
|
|
|
37
59
|
"operation": str,
|
|
38
60
|
"output": str,
|
|
39
61
|
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def dyn_cargs(
|
|
43
|
-
t: str,
|
|
44
|
-
) -> typing.Any:
|
|
45
|
-
"""
|
|
46
|
-
Get build cargs function by command type.
|
|
47
|
-
|
|
48
|
-
Args:
|
|
49
|
-
t: Command type.
|
|
50
|
-
Returns:
|
|
51
|
-
Build cargs function.
|
|
52
|
-
"""
|
|
53
|
-
return {
|
|
54
|
-
"mrmath": mrmath_cargs,
|
|
55
|
-
"config": mrmath_config_cargs,
|
|
56
|
-
}.get(t)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def dyn_outputs(
|
|
60
|
-
t: str,
|
|
61
|
-
) -> typing.Any:
|
|
62
|
-
"""
|
|
63
|
-
Get build outputs function by command type.
|
|
64
|
-
|
|
65
|
-
Args:
|
|
66
|
-
t: Command type.
|
|
67
|
-
Returns:
|
|
68
|
-
Build outputs function.
|
|
69
|
-
"""
|
|
70
|
-
return {
|
|
71
|
-
"mrmath": mrmath_outputs,
|
|
72
|
-
}.get(t)
|
|
73
62
|
|
|
74
63
|
|
|
75
64
|
def mrmath_config_params(
|
|
76
65
|
key: str,
|
|
77
66
|
value: str,
|
|
78
|
-
) ->
|
|
67
|
+
) -> MrmathConfigParametersTagged:
|
|
79
68
|
"""
|
|
80
69
|
Build parameters.
|
|
81
70
|
|
|
@@ -86,7 +75,7 @@ def mrmath_config_params(
|
|
|
86
75
|
Parameter dictionary
|
|
87
76
|
"""
|
|
88
77
|
params = {
|
|
89
|
-
"
|
|
78
|
+
"@type": "config",
|
|
90
79
|
"key": key,
|
|
91
80
|
"value": value,
|
|
92
81
|
}
|
|
@@ -108,14 +97,14 @@ def mrmath_config_cargs(
|
|
|
108
97
|
"""
|
|
109
98
|
cargs = []
|
|
110
99
|
cargs.append("-config")
|
|
111
|
-
cargs.append(params.get("key"))
|
|
112
|
-
cargs.append(params.get("value"))
|
|
100
|
+
cargs.append(params.get("key", None))
|
|
101
|
+
cargs.append(params.get("value", None))
|
|
113
102
|
return cargs
|
|
114
103
|
|
|
115
104
|
|
|
116
105
|
class MrmathOutputs(typing.NamedTuple):
|
|
117
106
|
"""
|
|
118
|
-
Output object returned when calling `
|
|
107
|
+
Output object returned when calling `MrmathParameters(...)`.
|
|
119
108
|
"""
|
|
120
109
|
root: OutputPathType
|
|
121
110
|
"""Output root folder. This is the root folder for all outputs."""
|
|
@@ -138,7 +127,7 @@ def mrmath_params(
|
|
|
138
127
|
config: list[MrmathConfigParameters] | None = None,
|
|
139
128
|
help_: bool = False,
|
|
140
129
|
version: bool = False,
|
|
141
|
-
) ->
|
|
130
|
+
) -> MrmathParametersTagged:
|
|
142
131
|
"""
|
|
143
132
|
Build parameters.
|
|
144
133
|
|
|
@@ -172,7 +161,7 @@ def mrmath_params(
|
|
|
172
161
|
Parameter dictionary
|
|
173
162
|
"""
|
|
174
163
|
params = {
|
|
175
|
-
"
|
|
164
|
+
"@type": "mrtrix/mrmath",
|
|
176
165
|
"keep_unary_axes": keep_unary_axes,
|
|
177
166
|
"info": info,
|
|
178
167
|
"quiet": quiet,
|
|
@@ -210,40 +199,40 @@ def mrmath_cargs(
|
|
|
210
199
|
"""
|
|
211
200
|
cargs = []
|
|
212
201
|
cargs.append("mrmath")
|
|
213
|
-
if params.get("axis") is not None:
|
|
202
|
+
if params.get("axis", None) is not None:
|
|
214
203
|
cargs.extend([
|
|
215
204
|
"-axis",
|
|
216
|
-
str(params.get("axis"))
|
|
205
|
+
str(params.get("axis", None))
|
|
217
206
|
])
|
|
218
|
-
if params.get("keep_unary_axes"):
|
|
207
|
+
if params.get("keep_unary_axes", False):
|
|
219
208
|
cargs.append("-keep_unary_axes")
|
|
220
|
-
if params.get("datatype") is not None:
|
|
209
|
+
if params.get("datatype", None) is not None:
|
|
221
210
|
cargs.extend([
|
|
222
211
|
"-datatype",
|
|
223
|
-
params.get("datatype")
|
|
212
|
+
params.get("datatype", None)
|
|
224
213
|
])
|
|
225
|
-
if params.get("info"):
|
|
214
|
+
if params.get("info", False):
|
|
226
215
|
cargs.append("-info")
|
|
227
|
-
if params.get("quiet"):
|
|
216
|
+
if params.get("quiet", False):
|
|
228
217
|
cargs.append("-quiet")
|
|
229
|
-
if params.get("debug"):
|
|
218
|
+
if params.get("debug", False):
|
|
230
219
|
cargs.append("-debug")
|
|
231
|
-
if params.get("force"):
|
|
220
|
+
if params.get("force", False):
|
|
232
221
|
cargs.append("-force")
|
|
233
|
-
if params.get("nthreads") is not None:
|
|
222
|
+
if params.get("nthreads", None) is not None:
|
|
234
223
|
cargs.extend([
|
|
235
224
|
"-nthreads",
|
|
236
|
-
str(params.get("nthreads"))
|
|
225
|
+
str(params.get("nthreads", None))
|
|
237
226
|
])
|
|
238
|
-
if params.get("config") is not None:
|
|
239
|
-
cargs.extend([a for c in [
|
|
240
|
-
if params.get("help"):
|
|
227
|
+
if params.get("config", None) is not None:
|
|
228
|
+
cargs.extend([a for c in [mrmath_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
229
|
+
if params.get("help", False):
|
|
241
230
|
cargs.append("-help")
|
|
242
|
-
if params.get("version"):
|
|
231
|
+
if params.get("version", False):
|
|
243
232
|
cargs.append("-version")
|
|
244
|
-
cargs.extend([execution.input_file(f) for f in params.get("input")])
|
|
245
|
-
cargs.append(params.get("operation"))
|
|
246
|
-
cargs.append(params.get("output"))
|
|
233
|
+
cargs.extend([execution.input_file(f) for f in params.get("input", None)])
|
|
234
|
+
cargs.append(params.get("operation", None))
|
|
235
|
+
cargs.append(params.get("output", None))
|
|
247
236
|
return cargs
|
|
248
237
|
|
|
249
238
|
|
|
@@ -262,18 +251,20 @@ def mrmath_outputs(
|
|
|
262
251
|
"""
|
|
263
252
|
ret = MrmathOutputs(
|
|
264
253
|
root=execution.output_file("."),
|
|
265
|
-
output=execution.output_file(params.get("output")),
|
|
254
|
+
output=execution.output_file(params.get("output", None)),
|
|
266
255
|
)
|
|
267
256
|
return ret
|
|
268
257
|
|
|
269
258
|
|
|
270
259
|
def mrmath_execute(
|
|
271
260
|
params: MrmathParameters,
|
|
272
|
-
|
|
261
|
+
runner: Runner | None = None,
|
|
273
262
|
) -> MrmathOutputs:
|
|
274
263
|
"""
|
|
275
|
-
|
|
276
|
-
|
|
264
|
+
mrmath
|
|
265
|
+
|
|
266
|
+
Compute summary statistic on image intensities either across images, or
|
|
267
|
+
along a specified axis of a single image.
|
|
277
268
|
|
|
278
269
|
Supported operations are:
|
|
279
270
|
|
|
@@ -298,10 +289,12 @@ def mrmath_execute(
|
|
|
298
289
|
|
|
299
290
|
Args:
|
|
300
291
|
params: The parameters.
|
|
301
|
-
|
|
292
|
+
runner: Command runner.
|
|
302
293
|
Returns:
|
|
303
294
|
NamedTuple of outputs (described in `MrmathOutputs`).
|
|
304
295
|
"""
|
|
296
|
+
runner = runner or get_global_runner()
|
|
297
|
+
execution = runner.start_execution(MRMATH_METADATA)
|
|
305
298
|
params = execution.params(params)
|
|
306
299
|
cargs = mrmath_cargs(params, execution)
|
|
307
300
|
ret = mrmath_outputs(params, execution)
|
|
@@ -327,8 +320,10 @@ def mrmath(
|
|
|
327
320
|
runner: Runner | None = None,
|
|
328
321
|
) -> MrmathOutputs:
|
|
329
322
|
"""
|
|
330
|
-
|
|
331
|
-
|
|
323
|
+
mrmath
|
|
324
|
+
|
|
325
|
+
Compute summary statistic on image intensities either across images, or
|
|
326
|
+
along a specified axis of a single image.
|
|
332
327
|
|
|
333
328
|
Supported operations are:
|
|
334
329
|
|
|
@@ -381,8 +376,6 @@ def mrmath(
|
|
|
381
376
|
Returns:
|
|
382
377
|
NamedTuple of outputs (described in `MrmathOutputs`).
|
|
383
378
|
"""
|
|
384
|
-
runner = runner or get_global_runner()
|
|
385
|
-
execution = runner.start_execution(MRMATH_METADATA)
|
|
386
379
|
params = mrmath_params(
|
|
387
380
|
axis=axis,
|
|
388
381
|
keep_unary_axes=keep_unary_axes,
|
|
@@ -399,15 +392,14 @@ def mrmath(
|
|
|
399
392
|
operation=operation,
|
|
400
393
|
output=output,
|
|
401
394
|
)
|
|
402
|
-
return mrmath_execute(params,
|
|
395
|
+
return mrmath_execute(params, runner)
|
|
403
396
|
|
|
404
397
|
|
|
405
398
|
__all__ = [
|
|
406
399
|
"MRMATH_METADATA",
|
|
407
|
-
"MrmathConfigParameters",
|
|
408
400
|
"MrmathOutputs",
|
|
409
|
-
"MrmathParameters",
|
|
410
401
|
"mrmath",
|
|
411
402
|
"mrmath_config_params",
|
|
403
|
+
"mrmath_execute",
|
|
412
404
|
"mrmath_params",
|
|
413
405
|
]
|
niwrap_mrtrix/mrtrix/mrmetric.py
CHANGED
|
@@ -6,7 +6,7 @@ import pathlib
|
|
|
6
6
|
from styxdefs import *
|
|
7
7
|
|
|
8
8
|
MRMETRIC_METADATA = Metadata(
|
|
9
|
-
id="
|
|
9
|
+
id="900f502c877db64aba337cc23f205ccc871706a3.boutiques",
|
|
10
10
|
name="mrmetric",
|
|
11
11
|
package="mrtrix",
|
|
12
12
|
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
@@ -14,14 +14,39 @@ MRMETRIC_METADATA = Metadata(
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
MrmetricConfigParameters = typing.TypedDict('MrmetricConfigParameters', {
|
|
17
|
-
"
|
|
17
|
+
"@type": typing.NotRequired[typing.Literal["config"]],
|
|
18
|
+
"key": str,
|
|
19
|
+
"value": str,
|
|
20
|
+
})
|
|
21
|
+
MrmetricConfigParametersTagged = typing.TypedDict('MrmetricConfigParametersTagged', {
|
|
22
|
+
"@type": typing.Literal["config"],
|
|
18
23
|
"key": str,
|
|
19
24
|
"value": str,
|
|
20
25
|
})
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
MrmetricParameters = typing.TypedDict('MrmetricParameters', {
|
|
24
|
-
"
|
|
29
|
+
"@type": typing.NotRequired[typing.Literal["mrtrix/mrmetric"]],
|
|
30
|
+
"space": typing.NotRequired[str | None],
|
|
31
|
+
"interp": typing.NotRequired[str | None],
|
|
32
|
+
"metric": typing.NotRequired[str | None],
|
|
33
|
+
"mask1": typing.NotRequired[InputPathType | None],
|
|
34
|
+
"mask2": typing.NotRequired[InputPathType | None],
|
|
35
|
+
"nonormalisation": bool,
|
|
36
|
+
"overlap": bool,
|
|
37
|
+
"info": bool,
|
|
38
|
+
"quiet": bool,
|
|
39
|
+
"debug": bool,
|
|
40
|
+
"force": bool,
|
|
41
|
+
"nthreads": typing.NotRequired[int | None],
|
|
42
|
+
"config": typing.NotRequired[list[MrmetricConfigParameters] | None],
|
|
43
|
+
"help": bool,
|
|
44
|
+
"version": bool,
|
|
45
|
+
"image1": InputPathType,
|
|
46
|
+
"image2": InputPathType,
|
|
47
|
+
})
|
|
48
|
+
MrmetricParametersTagged = typing.TypedDict('MrmetricParametersTagged', {
|
|
49
|
+
"@type": typing.Literal["mrtrix/mrmetric"],
|
|
25
50
|
"space": typing.NotRequired[str | None],
|
|
26
51
|
"interp": typing.NotRequired[str | None],
|
|
27
52
|
"metric": typing.NotRequired[str | None],
|
|
@@ -40,44 +65,12 @@ MrmetricParameters = typing.TypedDict('MrmetricParameters', {
|
|
|
40
65
|
"image1": InputPathType,
|
|
41
66
|
"image2": InputPathType,
|
|
42
67
|
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def dyn_cargs(
|
|
46
|
-
t: str,
|
|
47
|
-
) -> typing.Any:
|
|
48
|
-
"""
|
|
49
|
-
Get build cargs function by command type.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
t: Command type.
|
|
53
|
-
Returns:
|
|
54
|
-
Build cargs function.
|
|
55
|
-
"""
|
|
56
|
-
return {
|
|
57
|
-
"mrmetric": mrmetric_cargs,
|
|
58
|
-
"config": mrmetric_config_cargs,
|
|
59
|
-
}.get(t)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def dyn_outputs(
|
|
63
|
-
t: str,
|
|
64
|
-
) -> typing.Any:
|
|
65
|
-
"""
|
|
66
|
-
Get build outputs function by command type.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
t: Command type.
|
|
70
|
-
Returns:
|
|
71
|
-
Build outputs function.
|
|
72
|
-
"""
|
|
73
|
-
return {
|
|
74
|
-
}.get(t)
|
|
75
68
|
|
|
76
69
|
|
|
77
70
|
def mrmetric_config_params(
|
|
78
71
|
key: str,
|
|
79
72
|
value: str,
|
|
80
|
-
) ->
|
|
73
|
+
) -> MrmetricConfigParametersTagged:
|
|
81
74
|
"""
|
|
82
75
|
Build parameters.
|
|
83
76
|
|
|
@@ -88,7 +81,7 @@ def mrmetric_config_params(
|
|
|
88
81
|
Parameter dictionary
|
|
89
82
|
"""
|
|
90
83
|
params = {
|
|
91
|
-
"
|
|
84
|
+
"@type": "config",
|
|
92
85
|
"key": key,
|
|
93
86
|
"value": value,
|
|
94
87
|
}
|
|
@@ -110,14 +103,14 @@ def mrmetric_config_cargs(
|
|
|
110
103
|
"""
|
|
111
104
|
cargs = []
|
|
112
105
|
cargs.append("-config")
|
|
113
|
-
cargs.append(params.get("key"))
|
|
114
|
-
cargs.append(params.get("value"))
|
|
106
|
+
cargs.append(params.get("key", None))
|
|
107
|
+
cargs.append(params.get("value", None))
|
|
115
108
|
return cargs
|
|
116
109
|
|
|
117
110
|
|
|
118
111
|
class MrmetricOutputs(typing.NamedTuple):
|
|
119
112
|
"""
|
|
120
|
-
Output object returned when calling `
|
|
113
|
+
Output object returned when calling `MrmetricParameters(...)`.
|
|
121
114
|
"""
|
|
122
115
|
root: OutputPathType
|
|
123
116
|
"""Output root folder. This is the root folder for all outputs."""
|
|
@@ -141,7 +134,7 @@ def mrmetric_params(
|
|
|
141
134
|
config: list[MrmetricConfigParameters] | None = None,
|
|
142
135
|
help_: bool = False,
|
|
143
136
|
version: bool = False,
|
|
144
|
-
) ->
|
|
137
|
+
) -> MrmetricParametersTagged:
|
|
145
138
|
"""
|
|
146
139
|
Build parameters.
|
|
147
140
|
|
|
@@ -178,7 +171,7 @@ def mrmetric_params(
|
|
|
178
171
|
Parameter dictionary
|
|
179
172
|
"""
|
|
180
173
|
params = {
|
|
181
|
-
"
|
|
174
|
+
"@type": "mrtrix/mrmetric",
|
|
182
175
|
"nonormalisation": nonormalisation,
|
|
183
176
|
"overlap": overlap,
|
|
184
177
|
"info": info,
|
|
@@ -222,56 +215,56 @@ def mrmetric_cargs(
|
|
|
222
215
|
"""
|
|
223
216
|
cargs = []
|
|
224
217
|
cargs.append("mrmetric")
|
|
225
|
-
if params.get("space") is not None:
|
|
218
|
+
if params.get("space", None) is not None:
|
|
226
219
|
cargs.extend([
|
|
227
220
|
"-space",
|
|
228
|
-
params.get("space")
|
|
221
|
+
params.get("space", None)
|
|
229
222
|
])
|
|
230
|
-
if params.get("interp") is not None:
|
|
223
|
+
if params.get("interp", None) is not None:
|
|
231
224
|
cargs.extend([
|
|
232
225
|
"-interp",
|
|
233
|
-
params.get("interp")
|
|
226
|
+
params.get("interp", None)
|
|
234
227
|
])
|
|
235
|
-
if params.get("metric") is not None:
|
|
228
|
+
if params.get("metric", None) is not None:
|
|
236
229
|
cargs.extend([
|
|
237
230
|
"-metric",
|
|
238
|
-
params.get("metric")
|
|
231
|
+
params.get("metric", None)
|
|
239
232
|
])
|
|
240
|
-
if params.get("mask1") is not None:
|
|
233
|
+
if params.get("mask1", None) is not None:
|
|
241
234
|
cargs.extend([
|
|
242
235
|
"-mask1",
|
|
243
|
-
execution.input_file(params.get("mask1"))
|
|
236
|
+
execution.input_file(params.get("mask1", None))
|
|
244
237
|
])
|
|
245
|
-
if params.get("mask2") is not None:
|
|
238
|
+
if params.get("mask2", None) is not None:
|
|
246
239
|
cargs.extend([
|
|
247
240
|
"-mask2",
|
|
248
|
-
execution.input_file(params.get("mask2"))
|
|
241
|
+
execution.input_file(params.get("mask2", None))
|
|
249
242
|
])
|
|
250
|
-
if params.get("nonormalisation"):
|
|
243
|
+
if params.get("nonormalisation", False):
|
|
251
244
|
cargs.append("-nonormalisation")
|
|
252
|
-
if params.get("overlap"):
|
|
245
|
+
if params.get("overlap", False):
|
|
253
246
|
cargs.append("-overlap")
|
|
254
|
-
if params.get("info"):
|
|
247
|
+
if params.get("info", False):
|
|
255
248
|
cargs.append("-info")
|
|
256
|
-
if params.get("quiet"):
|
|
249
|
+
if params.get("quiet", False):
|
|
257
250
|
cargs.append("-quiet")
|
|
258
|
-
if params.get("debug"):
|
|
251
|
+
if params.get("debug", False):
|
|
259
252
|
cargs.append("-debug")
|
|
260
|
-
if params.get("force"):
|
|
253
|
+
if params.get("force", False):
|
|
261
254
|
cargs.append("-force")
|
|
262
|
-
if params.get("nthreads") is not None:
|
|
255
|
+
if params.get("nthreads", None) is not None:
|
|
263
256
|
cargs.extend([
|
|
264
257
|
"-nthreads",
|
|
265
|
-
str(params.get("nthreads"))
|
|
258
|
+
str(params.get("nthreads", None))
|
|
266
259
|
])
|
|
267
|
-
if params.get("config") is not None:
|
|
268
|
-
cargs.extend([a for c in [
|
|
269
|
-
if params.get("help"):
|
|
260
|
+
if params.get("config", None) is not None:
|
|
261
|
+
cargs.extend([a for c in [mrmetric_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
262
|
+
if params.get("help", False):
|
|
270
263
|
cargs.append("-help")
|
|
271
|
-
if params.get("version"):
|
|
264
|
+
if params.get("version", False):
|
|
272
265
|
cargs.append("-version")
|
|
273
|
-
cargs.append(execution.input_file(params.get("image1")))
|
|
274
|
-
cargs.append(execution.input_file(params.get("image2")))
|
|
266
|
+
cargs.append(execution.input_file(params.get("image1", None)))
|
|
267
|
+
cargs.append(execution.input_file(params.get("image2", None)))
|
|
275
268
|
return cargs
|
|
276
269
|
|
|
277
270
|
|
|
@@ -296,9 +289,11 @@ def mrmetric_outputs(
|
|
|
296
289
|
|
|
297
290
|
def mrmetric_execute(
|
|
298
291
|
params: MrmetricParameters,
|
|
299
|
-
|
|
292
|
+
runner: Runner | None = None,
|
|
300
293
|
) -> MrmetricOutputs:
|
|
301
294
|
"""
|
|
295
|
+
mrmetric
|
|
296
|
+
|
|
302
297
|
Computes a dissimilarity metric between two images.
|
|
303
298
|
|
|
304
299
|
Currently only the mean squared difference is fully implemented.
|
|
@@ -313,10 +308,12 @@ def mrmetric_execute(
|
|
|
313
308
|
|
|
314
309
|
Args:
|
|
315
310
|
params: The parameters.
|
|
316
|
-
|
|
311
|
+
runner: Command runner.
|
|
317
312
|
Returns:
|
|
318
313
|
NamedTuple of outputs (described in `MrmetricOutputs`).
|
|
319
314
|
"""
|
|
315
|
+
runner = runner or get_global_runner()
|
|
316
|
+
execution = runner.start_execution(MRMETRIC_METADATA)
|
|
320
317
|
params = execution.params(params)
|
|
321
318
|
cargs = mrmetric_cargs(params, execution)
|
|
322
319
|
ret = mrmetric_outputs(params, execution)
|
|
@@ -345,6 +342,8 @@ def mrmetric(
|
|
|
345
342
|
runner: Runner | None = None,
|
|
346
343
|
) -> MrmetricOutputs:
|
|
347
344
|
"""
|
|
345
|
+
mrmetric
|
|
346
|
+
|
|
348
347
|
Computes a dissimilarity metric between two images.
|
|
349
348
|
|
|
350
349
|
Currently only the mean squared difference is fully implemented.
|
|
@@ -390,8 +389,6 @@ def mrmetric(
|
|
|
390
389
|
Returns:
|
|
391
390
|
NamedTuple of outputs (described in `MrmetricOutputs`).
|
|
392
391
|
"""
|
|
393
|
-
runner = runner or get_global_runner()
|
|
394
|
-
execution = runner.start_execution(MRMETRIC_METADATA)
|
|
395
392
|
params = mrmetric_params(
|
|
396
393
|
space=space,
|
|
397
394
|
interp=interp,
|
|
@@ -411,15 +408,14 @@ def mrmetric(
|
|
|
411
408
|
image1=image1,
|
|
412
409
|
image2=image2,
|
|
413
410
|
)
|
|
414
|
-
return mrmetric_execute(params,
|
|
411
|
+
return mrmetric_execute(params, runner)
|
|
415
412
|
|
|
416
413
|
|
|
417
414
|
__all__ = [
|
|
418
415
|
"MRMETRIC_METADATA",
|
|
419
|
-
"MrmetricConfigParameters",
|
|
420
416
|
"MrmetricOutputs",
|
|
421
|
-
"MrmetricParameters",
|
|
422
417
|
"mrmetric",
|
|
423
418
|
"mrmetric_config_params",
|
|
419
|
+
"mrmetric_execute",
|
|
424
420
|
"mrmetric_params",
|
|
425
421
|
]
|