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.
- 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.2.dist-info/METADATA +0 -8
- niwrap_mrtrix-0.6.2.dist-info/RECORD +0 -119
- 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
|
LABEL2MESH_METADATA = Metadata(
|
|
9
|
-
id="
|
|
9
|
+
id="6c52afdd4cc628f3b852b8dbd81f4fe3c2968fb8.boutiques",
|
|
10
10
|
name="label2mesh",
|
|
11
11
|
package="mrtrix",
|
|
12
12
|
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
@@ -14,14 +14,33 @@ LABEL2MESH_METADATA = Metadata(
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
Label2meshConfigParameters = typing.TypedDict('Label2meshConfigParameters', {
|
|
17
|
-
"
|
|
17
|
+
"@type": typing.NotRequired[typing.Literal["config"]],
|
|
18
|
+
"key": str,
|
|
19
|
+
"value": str,
|
|
20
|
+
})
|
|
21
|
+
Label2meshConfigParametersTagged = typing.TypedDict('Label2meshConfigParametersTagged', {
|
|
22
|
+
"@type": typing.Literal["config"],
|
|
18
23
|
"key": str,
|
|
19
24
|
"value": str,
|
|
20
25
|
})
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
Label2meshParameters = typing.TypedDict('Label2meshParameters', {
|
|
24
|
-
"
|
|
29
|
+
"@type": typing.NotRequired[typing.Literal["mrtrix/label2mesh"]],
|
|
30
|
+
"blocky": bool,
|
|
31
|
+
"info": bool,
|
|
32
|
+
"quiet": bool,
|
|
33
|
+
"debug": bool,
|
|
34
|
+
"force": bool,
|
|
35
|
+
"nthreads": typing.NotRequired[int | None],
|
|
36
|
+
"config": typing.NotRequired[list[Label2meshConfigParameters] | None],
|
|
37
|
+
"help": bool,
|
|
38
|
+
"version": bool,
|
|
39
|
+
"nodes_in": InputPathType,
|
|
40
|
+
"mesh_out": str,
|
|
41
|
+
})
|
|
42
|
+
Label2meshParametersTagged = typing.TypedDict('Label2meshParametersTagged', {
|
|
43
|
+
"@type": typing.Literal["mrtrix/label2mesh"],
|
|
25
44
|
"blocky": bool,
|
|
26
45
|
"info": bool,
|
|
27
46
|
"quiet": bool,
|
|
@@ -34,45 +53,12 @@ Label2meshParameters = typing.TypedDict('Label2meshParameters', {
|
|
|
34
53
|
"nodes_in": InputPathType,
|
|
35
54
|
"mesh_out": 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
|
-
"label2mesh": label2mesh_cargs,
|
|
52
|
-
"config": label2mesh_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
|
-
"label2mesh": label2mesh_outputs,
|
|
69
|
-
}.get(t)
|
|
70
56
|
|
|
71
57
|
|
|
72
58
|
def label2mesh_config_params(
|
|
73
59
|
key: str,
|
|
74
60
|
value: str,
|
|
75
|
-
) ->
|
|
61
|
+
) -> Label2meshConfigParametersTagged:
|
|
76
62
|
"""
|
|
77
63
|
Build parameters.
|
|
78
64
|
|
|
@@ -83,7 +69,7 @@ def label2mesh_config_params(
|
|
|
83
69
|
Parameter dictionary
|
|
84
70
|
"""
|
|
85
71
|
params = {
|
|
86
|
-
"
|
|
72
|
+
"@type": "config",
|
|
87
73
|
"key": key,
|
|
88
74
|
"value": value,
|
|
89
75
|
}
|
|
@@ -105,14 +91,14 @@ def label2mesh_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 Label2meshOutputs(typing.NamedTuple):
|
|
114
100
|
"""
|
|
115
|
-
Output object returned when calling `
|
|
101
|
+
Output object returned when calling `Label2meshParameters(...)`.
|
|
116
102
|
"""
|
|
117
103
|
root: OutputPathType
|
|
118
104
|
"""Output root folder. This is the root folder for all outputs."""
|
|
@@ -132,7 +118,7 @@ def label2mesh_params(
|
|
|
132
118
|
config: list[Label2meshConfigParameters] | None = None,
|
|
133
119
|
help_: bool = False,
|
|
134
120
|
version: bool = False,
|
|
135
|
-
) ->
|
|
121
|
+
) -> Label2meshParametersTagged:
|
|
136
122
|
"""
|
|
137
123
|
Build parameters.
|
|
138
124
|
|
|
@@ -157,7 +143,7 @@ def label2mesh_params(
|
|
|
157
143
|
Parameter dictionary
|
|
158
144
|
"""
|
|
159
145
|
params = {
|
|
160
|
-
"
|
|
146
|
+
"@type": "mrtrix/label2mesh",
|
|
161
147
|
"blocky": blocky,
|
|
162
148
|
"info": info,
|
|
163
149
|
"quiet": quiet,
|
|
@@ -190,29 +176,29 @@ def label2mesh_cargs(
|
|
|
190
176
|
"""
|
|
191
177
|
cargs = []
|
|
192
178
|
cargs.append("label2mesh")
|
|
193
|
-
if params.get("blocky"):
|
|
179
|
+
if params.get("blocky", False):
|
|
194
180
|
cargs.append("-blocky")
|
|
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 [
|
|
210
|
-
if params.get("help"):
|
|
194
|
+
if params.get("config", None) is not None:
|
|
195
|
+
cargs.extend([a for c in [label2mesh_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("nodes_in")))
|
|
215
|
-
cargs.append(params.get("mesh_out"))
|
|
200
|
+
cargs.append(execution.input_file(params.get("nodes_in", None)))
|
|
201
|
+
cargs.append(params.get("mesh_out", None))
|
|
216
202
|
return cargs
|
|
217
203
|
|
|
218
204
|
|
|
@@ -231,16 +217,18 @@ def label2mesh_outputs(
|
|
|
231
217
|
"""
|
|
232
218
|
ret = Label2meshOutputs(
|
|
233
219
|
root=execution.output_file("."),
|
|
234
|
-
mesh_out=execution.output_file(params.get("mesh_out")),
|
|
220
|
+
mesh_out=execution.output_file(params.get("mesh_out", None)),
|
|
235
221
|
)
|
|
236
222
|
return ret
|
|
237
223
|
|
|
238
224
|
|
|
239
225
|
def label2mesh_execute(
|
|
240
226
|
params: Label2meshParameters,
|
|
241
|
-
|
|
227
|
+
runner: Runner | None = None,
|
|
242
228
|
) -> Label2meshOutputs:
|
|
243
229
|
"""
|
|
230
|
+
label2mesh
|
|
231
|
+
|
|
244
232
|
Generate meshes from a label image.
|
|
245
233
|
|
|
246
234
|
|
|
@@ -255,10 +243,12 @@ def label2mesh_execute(
|
|
|
255
243
|
|
|
256
244
|
Args:
|
|
257
245
|
params: The parameters.
|
|
258
|
-
|
|
246
|
+
runner: Command runner.
|
|
259
247
|
Returns:
|
|
260
248
|
NamedTuple of outputs (described in `Label2meshOutputs`).
|
|
261
249
|
"""
|
|
250
|
+
runner = runner or get_global_runner()
|
|
251
|
+
execution = runner.start_execution(LABEL2MESH_METADATA)
|
|
262
252
|
params = execution.params(params)
|
|
263
253
|
cargs = label2mesh_cargs(params, execution)
|
|
264
254
|
ret = label2mesh_outputs(params, execution)
|
|
@@ -281,6 +271,8 @@ def label2mesh(
|
|
|
281
271
|
runner: Runner | None = None,
|
|
282
272
|
) -> Label2meshOutputs:
|
|
283
273
|
"""
|
|
274
|
+
label2mesh
|
|
275
|
+
|
|
284
276
|
Generate meshes from a label image.
|
|
285
277
|
|
|
286
278
|
|
|
@@ -314,8 +306,6 @@ def label2mesh(
|
|
|
314
306
|
Returns:
|
|
315
307
|
NamedTuple of outputs (described in `Label2meshOutputs`).
|
|
316
308
|
"""
|
|
317
|
-
runner = runner or get_global_runner()
|
|
318
|
-
execution = runner.start_execution(LABEL2MESH_METADATA)
|
|
319
309
|
params = label2mesh_params(
|
|
320
310
|
blocky=blocky,
|
|
321
311
|
info=info,
|
|
@@ -329,15 +319,14 @@ def label2mesh(
|
|
|
329
319
|
nodes_in=nodes_in,
|
|
330
320
|
mesh_out=mesh_out,
|
|
331
321
|
)
|
|
332
|
-
return label2mesh_execute(params,
|
|
322
|
+
return label2mesh_execute(params, runner)
|
|
333
323
|
|
|
334
324
|
|
|
335
325
|
__all__ = [
|
|
336
326
|
"LABEL2MESH_METADATA",
|
|
337
|
-
"Label2meshConfigParameters",
|
|
338
327
|
"Label2meshOutputs",
|
|
339
|
-
"Label2meshParameters",
|
|
340
328
|
"label2mesh",
|
|
341
329
|
"label2mesh_config_params",
|
|
330
|
+
"label2mesh_execute",
|
|
342
331
|
"label2mesh_params",
|
|
343
332
|
]
|
|
@@ -6,7 +6,7 @@ import pathlib
|
|
|
6
6
|
from styxdefs import *
|
|
7
7
|
|
|
8
8
|
LABELCONVERT_METADATA = Metadata(
|
|
9
|
-
id="
|
|
9
|
+
id="5aa09ff9ec4b21693b7d07b8329c2bc641669b7c.boutiques",
|
|
10
10
|
name="labelconvert",
|
|
11
11
|
package="mrtrix",
|
|
12
12
|
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
@@ -14,14 +14,35 @@ LABELCONVERT_METADATA = Metadata(
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
LabelconvertConfigParameters = typing.TypedDict('LabelconvertConfigParameters', {
|
|
17
|
-
"
|
|
17
|
+
"@type": typing.NotRequired[typing.Literal["config"]],
|
|
18
|
+
"key": str,
|
|
19
|
+
"value": str,
|
|
20
|
+
})
|
|
21
|
+
LabelconvertConfigParametersTagged = typing.TypedDict('LabelconvertConfigParametersTagged', {
|
|
22
|
+
"@type": typing.Literal["config"],
|
|
18
23
|
"key": str,
|
|
19
24
|
"value": str,
|
|
20
25
|
})
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
LabelconvertParameters = typing.TypedDict('LabelconvertParameters', {
|
|
24
|
-
"
|
|
29
|
+
"@type": typing.NotRequired[typing.Literal["mrtrix/labelconvert"]],
|
|
30
|
+
"spine": typing.NotRequired[InputPathType | None],
|
|
31
|
+
"info": bool,
|
|
32
|
+
"quiet": bool,
|
|
33
|
+
"debug": bool,
|
|
34
|
+
"force": bool,
|
|
35
|
+
"nthreads": typing.NotRequired[int | None],
|
|
36
|
+
"config": typing.NotRequired[list[LabelconvertConfigParameters] | None],
|
|
37
|
+
"help": bool,
|
|
38
|
+
"version": bool,
|
|
39
|
+
"path_in": InputPathType,
|
|
40
|
+
"lut_in": InputPathType,
|
|
41
|
+
"lut_out": InputPathType,
|
|
42
|
+
"image_out": str,
|
|
43
|
+
})
|
|
44
|
+
LabelconvertParametersTagged = typing.TypedDict('LabelconvertParametersTagged', {
|
|
45
|
+
"@type": typing.Literal["mrtrix/labelconvert"],
|
|
25
46
|
"spine": typing.NotRequired[InputPathType | None],
|
|
26
47
|
"info": bool,
|
|
27
48
|
"quiet": bool,
|
|
@@ -36,45 +57,12 @@ LabelconvertParameters = typing.TypedDict('LabelconvertParameters', {
|
|
|
36
57
|
"lut_out": InputPathType,
|
|
37
58
|
"image_out": str,
|
|
38
59
|
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def dyn_cargs(
|
|
42
|
-
t: str,
|
|
43
|
-
) -> typing.Any:
|
|
44
|
-
"""
|
|
45
|
-
Get build cargs function by command type.
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
t: Command type.
|
|
49
|
-
Returns:
|
|
50
|
-
Build cargs function.
|
|
51
|
-
"""
|
|
52
|
-
return {
|
|
53
|
-
"labelconvert": labelconvert_cargs,
|
|
54
|
-
"config": labelconvert_config_cargs,
|
|
55
|
-
}.get(t)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def dyn_outputs(
|
|
59
|
-
t: str,
|
|
60
|
-
) -> typing.Any:
|
|
61
|
-
"""
|
|
62
|
-
Get build outputs function by command type.
|
|
63
|
-
|
|
64
|
-
Args:
|
|
65
|
-
t: Command type.
|
|
66
|
-
Returns:
|
|
67
|
-
Build outputs function.
|
|
68
|
-
"""
|
|
69
|
-
return {
|
|
70
|
-
"labelconvert": labelconvert_outputs,
|
|
71
|
-
}.get(t)
|
|
72
60
|
|
|
73
61
|
|
|
74
62
|
def labelconvert_config_params(
|
|
75
63
|
key: str,
|
|
76
64
|
value: str,
|
|
77
|
-
) ->
|
|
65
|
+
) -> LabelconvertConfigParametersTagged:
|
|
78
66
|
"""
|
|
79
67
|
Build parameters.
|
|
80
68
|
|
|
@@ -85,7 +73,7 @@ def labelconvert_config_params(
|
|
|
85
73
|
Parameter dictionary
|
|
86
74
|
"""
|
|
87
75
|
params = {
|
|
88
|
-
"
|
|
76
|
+
"@type": "config",
|
|
89
77
|
"key": key,
|
|
90
78
|
"value": value,
|
|
91
79
|
}
|
|
@@ -107,14 +95,14 @@ def labelconvert_config_cargs(
|
|
|
107
95
|
"""
|
|
108
96
|
cargs = []
|
|
109
97
|
cargs.append("-config")
|
|
110
|
-
cargs.append(params.get("key"))
|
|
111
|
-
cargs.append(params.get("value"))
|
|
98
|
+
cargs.append(params.get("key", None))
|
|
99
|
+
cargs.append(params.get("value", None))
|
|
112
100
|
return cargs
|
|
113
101
|
|
|
114
102
|
|
|
115
103
|
class LabelconvertOutputs(typing.NamedTuple):
|
|
116
104
|
"""
|
|
117
|
-
Output object returned when calling `
|
|
105
|
+
Output object returned when calling `LabelconvertParameters(...)`.
|
|
118
106
|
"""
|
|
119
107
|
root: OutputPathType
|
|
120
108
|
"""Output root folder. This is the root folder for all outputs."""
|
|
@@ -136,7 +124,7 @@ def labelconvert_params(
|
|
|
136
124
|
config: list[LabelconvertConfigParameters] | None = None,
|
|
137
125
|
help_: bool = False,
|
|
138
126
|
version: bool = False,
|
|
139
|
-
) ->
|
|
127
|
+
) -> LabelconvertParametersTagged:
|
|
140
128
|
"""
|
|
141
129
|
Build parameters.
|
|
142
130
|
|
|
@@ -164,7 +152,7 @@ def labelconvert_params(
|
|
|
164
152
|
Parameter dictionary
|
|
165
153
|
"""
|
|
166
154
|
params = {
|
|
167
|
-
"
|
|
155
|
+
"@type": "mrtrix/labelconvert",
|
|
168
156
|
"info": info,
|
|
169
157
|
"quiet": quiet,
|
|
170
158
|
"debug": debug,
|
|
@@ -200,34 +188,34 @@ def labelconvert_cargs(
|
|
|
200
188
|
"""
|
|
201
189
|
cargs = []
|
|
202
190
|
cargs.append("labelconvert")
|
|
203
|
-
if params.get("spine") is not None:
|
|
191
|
+
if params.get("spine", None) is not None:
|
|
204
192
|
cargs.extend([
|
|
205
193
|
"-spine",
|
|
206
|
-
execution.input_file(params.get("spine"))
|
|
194
|
+
execution.input_file(params.get("spine", None))
|
|
207
195
|
])
|
|
208
|
-
if params.get("info"):
|
|
196
|
+
if params.get("info", False):
|
|
209
197
|
cargs.append("-info")
|
|
210
|
-
if params.get("quiet"):
|
|
198
|
+
if params.get("quiet", False):
|
|
211
199
|
cargs.append("-quiet")
|
|
212
|
-
if params.get("debug"):
|
|
200
|
+
if params.get("debug", False):
|
|
213
201
|
cargs.append("-debug")
|
|
214
|
-
if params.get("force"):
|
|
202
|
+
if params.get("force", False):
|
|
215
203
|
cargs.append("-force")
|
|
216
|
-
if params.get("nthreads") is not None:
|
|
204
|
+
if params.get("nthreads", None) is not None:
|
|
217
205
|
cargs.extend([
|
|
218
206
|
"-nthreads",
|
|
219
|
-
str(params.get("nthreads"))
|
|
207
|
+
str(params.get("nthreads", None))
|
|
220
208
|
])
|
|
221
|
-
if params.get("config") is not None:
|
|
222
|
-
cargs.extend([a for c in [
|
|
223
|
-
if params.get("help"):
|
|
209
|
+
if params.get("config", None) is not None:
|
|
210
|
+
cargs.extend([a for c in [labelconvert_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
211
|
+
if params.get("help", False):
|
|
224
212
|
cargs.append("-help")
|
|
225
|
-
if params.get("version"):
|
|
213
|
+
if params.get("version", False):
|
|
226
214
|
cargs.append("-version")
|
|
227
|
-
cargs.append(execution.input_file(params.get("path_in")))
|
|
228
|
-
cargs.append(execution.input_file(params.get("lut_in")))
|
|
229
|
-
cargs.append(execution.input_file(params.get("lut_out")))
|
|
230
|
-
cargs.append(params.get("image_out"))
|
|
215
|
+
cargs.append(execution.input_file(params.get("path_in", None)))
|
|
216
|
+
cargs.append(execution.input_file(params.get("lut_in", None)))
|
|
217
|
+
cargs.append(execution.input_file(params.get("lut_out", None)))
|
|
218
|
+
cargs.append(params.get("image_out", None))
|
|
231
219
|
return cargs
|
|
232
220
|
|
|
233
221
|
|
|
@@ -246,16 +234,18 @@ def labelconvert_outputs(
|
|
|
246
234
|
"""
|
|
247
235
|
ret = LabelconvertOutputs(
|
|
248
236
|
root=execution.output_file("."),
|
|
249
|
-
image_out=execution.output_file(params.get("image_out")),
|
|
237
|
+
image_out=execution.output_file(params.get("image_out", None)),
|
|
250
238
|
)
|
|
251
239
|
return ret
|
|
252
240
|
|
|
253
241
|
|
|
254
242
|
def labelconvert_execute(
|
|
255
243
|
params: LabelconvertParameters,
|
|
256
|
-
|
|
244
|
+
runner: Runner | None = None,
|
|
257
245
|
) -> LabelconvertOutputs:
|
|
258
246
|
"""
|
|
247
|
+
labelconvert
|
|
248
|
+
|
|
259
249
|
Convert a connectome node image from one lookup table to another.
|
|
260
250
|
|
|
261
251
|
Typical usage is to convert a parcellation image provided by some other
|
|
@@ -276,10 +266,12 @@ def labelconvert_execute(
|
|
|
276
266
|
|
|
277
267
|
Args:
|
|
278
268
|
params: The parameters.
|
|
279
|
-
|
|
269
|
+
runner: Command runner.
|
|
280
270
|
Returns:
|
|
281
271
|
NamedTuple of outputs (described in `LabelconvertOutputs`).
|
|
282
272
|
"""
|
|
273
|
+
runner = runner or get_global_runner()
|
|
274
|
+
execution = runner.start_execution(LABELCONVERT_METADATA)
|
|
283
275
|
params = execution.params(params)
|
|
284
276
|
cargs = labelconvert_cargs(params, execution)
|
|
285
277
|
ret = labelconvert_outputs(params, execution)
|
|
@@ -304,6 +296,8 @@ def labelconvert(
|
|
|
304
296
|
runner: Runner | None = None,
|
|
305
297
|
) -> LabelconvertOutputs:
|
|
306
298
|
"""
|
|
299
|
+
labelconvert
|
|
300
|
+
|
|
307
301
|
Convert a connectome node image from one lookup table to another.
|
|
308
302
|
|
|
309
303
|
Typical usage is to convert a parcellation image provided by some other
|
|
@@ -346,8 +340,6 @@ def labelconvert(
|
|
|
346
340
|
Returns:
|
|
347
341
|
NamedTuple of outputs (described in `LabelconvertOutputs`).
|
|
348
342
|
"""
|
|
349
|
-
runner = runner or get_global_runner()
|
|
350
|
-
execution = runner.start_execution(LABELCONVERT_METADATA)
|
|
351
343
|
params = labelconvert_params(
|
|
352
344
|
spine=spine,
|
|
353
345
|
info=info,
|
|
@@ -363,15 +355,14 @@ def labelconvert(
|
|
|
363
355
|
lut_out=lut_out,
|
|
364
356
|
image_out=image_out,
|
|
365
357
|
)
|
|
366
|
-
return labelconvert_execute(params,
|
|
358
|
+
return labelconvert_execute(params, runner)
|
|
367
359
|
|
|
368
360
|
|
|
369
361
|
__all__ = [
|
|
370
362
|
"LABELCONVERT_METADATA",
|
|
371
|
-
"LabelconvertConfigParameters",
|
|
372
363
|
"LabelconvertOutputs",
|
|
373
|
-
"LabelconvertParameters",
|
|
374
364
|
"labelconvert",
|
|
375
365
|
"labelconvert_config_params",
|
|
366
|
+
"labelconvert_execute",
|
|
376
367
|
"labelconvert_params",
|
|
377
368
|
]
|