niwrap-mrtrix 0.8.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.
- niwrap_mrtrix/mrtrix/__init__.py +263 -0
- niwrap_mrtrix/mrtrix/afdconnectivity.py +527 -0
- niwrap_mrtrix/mrtrix/amp2response.py +560 -0
- niwrap_mrtrix/mrtrix/amp2sh.py +870 -0
- niwrap_mrtrix/mrtrix/connectome2tck.py +583 -0
- niwrap_mrtrix/mrtrix/connectomeedit.py +413 -0
- niwrap_mrtrix/mrtrix/connectomestats.py +956 -0
- niwrap_mrtrix/mrtrix/dcmedit.py +552 -0
- niwrap_mrtrix/mrtrix/dcminfo.py +529 -0
- niwrap_mrtrix/mrtrix/dirflip.py +440 -0
- niwrap_mrtrix/mrtrix/dirgen.py +514 -0
- niwrap_mrtrix/mrtrix/dirmerge.py +446 -0
- niwrap_mrtrix/mrtrix/dirorder.py +421 -0
- niwrap_mrtrix/mrtrix/dirsplit.py +436 -0
- niwrap_mrtrix/mrtrix/dirstat.py +640 -0
- niwrap_mrtrix/mrtrix/dwi2adc.py +531 -0
- niwrap_mrtrix/mrtrix/dwi2fod.py +1156 -0
- niwrap_mrtrix/mrtrix/dwi2mask.py +570 -0
- niwrap_mrtrix/mrtrix/dwi2response.py +1774 -0
- niwrap_mrtrix/mrtrix/dwi2tensor.py +715 -0
- niwrap_mrtrix/mrtrix/dwibiascorrect.py +673 -0
- niwrap_mrtrix/mrtrix/dwidenoise.py +570 -0
- niwrap_mrtrix/mrtrix/dwiextract.py +1111 -0
- niwrap_mrtrix/mrtrix/dwigradcheck.py +665 -0
- niwrap_mrtrix/mrtrix/fixel2peaks.py +613 -0
- niwrap_mrtrix/mrtrix/fixel2sh.py +430 -0
- niwrap_mrtrix/mrtrix/fixel2tsf.py +435 -0
- niwrap_mrtrix/mrtrix/fixel2voxel.py +523 -0
- niwrap_mrtrix/mrtrix/fixelcfestats.py +1179 -0
- niwrap_mrtrix/mrtrix/fixelconnectivity.py +477 -0
- niwrap_mrtrix/mrtrix/fixelconvert.py +850 -0
- niwrap_mrtrix/mrtrix/fixelcorrespondence.py +455 -0
- niwrap_mrtrix/mrtrix/fixelcrop.py +422 -0
- niwrap_mrtrix/mrtrix/fixelfilter.py +882 -0
- niwrap_mrtrix/mrtrix/fixelreorient.py +435 -0
- niwrap_mrtrix/mrtrix/fod2dec.py +571 -0
- niwrap_mrtrix/mrtrix/fod2fixel.py +646 -0
- niwrap_mrtrix/mrtrix/label2colour.py +426 -0
- niwrap_mrtrix/mrtrix/label2mesh.py +417 -0
- niwrap_mrtrix/mrtrix/labelconvert.py +460 -0
- niwrap_mrtrix/mrtrix/labelstats.py +418 -0
- niwrap_mrtrix/mrtrix/maskdump.py +404 -0
- niwrap_mrtrix/mrtrix/maskfilter.py +730 -0
- niwrap_mrtrix/mrtrix/mesh2voxel.py +422 -0
- niwrap_mrtrix/mrtrix/meshconvert.py +514 -0
- niwrap_mrtrix/mrtrix/meshfilter.py +452 -0
- niwrap_mrtrix/mrtrix/mraverageheader.py +485 -0
- niwrap_mrtrix/mrtrix/mrcalc.py +4302 -0
- niwrap_mrtrix/mrtrix/mrcat.py +467 -0
- niwrap_mrtrix/mrtrix/mrcentroid.py +418 -0
- niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +446 -0
- niwrap_mrtrix/mrtrix/mrclusterstats.py +930 -0
- niwrap_mrtrix/mrtrix/mrcolour.py +490 -0
- niwrap_mrtrix/mrtrix/mrconvert.py +1967 -0
- niwrap_mrtrix/mrtrix/mrdegibbs.py +535 -0
- niwrap_mrtrix/mrtrix/mrdump.py +423 -0
- niwrap_mrtrix/mrtrix/mredit.py +737 -0
- niwrap_mrtrix/mrtrix/mrfilter.py +971 -0
- niwrap_mrtrix/mrtrix/mrgrid.py +1079 -0
- niwrap_mrtrix/mrtrix/mrhistmatch.py +494 -0
- niwrap_mrtrix/mrtrix/mrhistogram.py +484 -0
- niwrap_mrtrix/mrtrix/mrinfo.py +1282 -0
- niwrap_mrtrix/mrtrix/mrmath.py +503 -0
- niwrap_mrtrix/mrtrix/mrmetric.py +525 -0
- niwrap_mrtrix/mrtrix/mrregister.py +2098 -0
- niwrap_mrtrix/mrtrix/mrstats.py +534 -0
- niwrap_mrtrix/mrtrix/mrthreshold.py +666 -0
- niwrap_mrtrix/mrtrix/mrtransform.py +1372 -0
- niwrap_mrtrix/mrtrix/mtnormalise.py +725 -0
- niwrap_mrtrix/mrtrix/peaks2amp.py +403 -0
- niwrap_mrtrix/mrtrix/peaks2fixel.py +422 -0
- niwrap_mrtrix/mrtrix/responsemean.py +385 -0
- niwrap_mrtrix/mrtrix/sh2amp.py +844 -0
- niwrap_mrtrix/mrtrix/sh2peaks.py +632 -0
- niwrap_mrtrix/mrtrix/sh2power.py +427 -0
- niwrap_mrtrix/mrtrix/sh2response.py +481 -0
- niwrap_mrtrix/mrtrix/shbasis.py +445 -0
- niwrap_mrtrix/mrtrix/shconv.py +661 -0
- niwrap_mrtrix/mrtrix/tck2connectome.py +727 -0
- niwrap_mrtrix/mrtrix/tck2fixel.py +447 -0
- niwrap_mrtrix/mrtrix/tckconvert.py +775 -0
- niwrap_mrtrix/mrtrix/tckdfc.py +684 -0
- niwrap_mrtrix/mrtrix/tckedit.py +1478 -0
- niwrap_mrtrix/mrtrix/tckgen.py +2733 -0
- niwrap_mrtrix/mrtrix/tckglobal.py +944 -0
- niwrap_mrtrix/mrtrix/tckinfo.py +402 -0
- niwrap_mrtrix/mrtrix/tckmap.py +1004 -0
- niwrap_mrtrix/mrtrix/tckresample.py +760 -0
- niwrap_mrtrix/mrtrix/tcksample.py +497 -0
- niwrap_mrtrix/mrtrix/tcksift.py +739 -0
- niwrap_mrtrix/mrtrix/tcksift2.py +902 -0
- niwrap_mrtrix/mrtrix/tckstats.py +550 -0
- niwrap_mrtrix/mrtrix/tcktransform.py +414 -0
- niwrap_mrtrix/mrtrix/tensor2metric.py +659 -0
- niwrap_mrtrix/mrtrix/transformcalc.py +421 -0
- niwrap_mrtrix/mrtrix/transformcompose.py +625 -0
- niwrap_mrtrix/mrtrix/transformconvert.py +423 -0
- niwrap_mrtrix/mrtrix/tsfdivide.py +414 -0
- niwrap_mrtrix/mrtrix/tsfinfo.py +421 -0
- niwrap_mrtrix/mrtrix/tsfmult.py +401 -0
- niwrap_mrtrix/mrtrix/tsfsmooth.py +420 -0
- niwrap_mrtrix/mrtrix/tsfthreshold.py +428 -0
- niwrap_mrtrix/mrtrix/tsfvalidate.py +398 -0
- niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +432 -0
- niwrap_mrtrix/mrtrix/v_5tt2vis.py +505 -0
- niwrap_mrtrix/mrtrix/v_5ttcheck.py +409 -0
- niwrap_mrtrix/mrtrix/v_5ttedit.py +513 -0
- niwrap_mrtrix/mrtrix/v_5ttgen.py +1107 -0
- niwrap_mrtrix/mrtrix/vectorstats.py +736 -0
- niwrap_mrtrix/mrtrix/voxel2fixel.py +430 -0
- niwrap_mrtrix/mrtrix/voxel2mesh.py +454 -0
- niwrap_mrtrix/mrtrix/warp2metric.py +556 -0
- niwrap_mrtrix/mrtrix/warpconvert.py +498 -0
- niwrap_mrtrix/mrtrix/warpcorrect.py +448 -0
- niwrap_mrtrix/mrtrix/warpinit.py +425 -0
- niwrap_mrtrix/mrtrix/warpinvert.py +448 -0
- niwrap_mrtrix-0.8.0.dist-info/METADATA +8 -0
- niwrap_mrtrix-0.8.0.dist-info/RECORD +119 -0
- niwrap_mrtrix-0.8.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
# This file was auto generated by Styx.
|
|
2
|
+
# Do not edit this file directly.
|
|
3
|
+
|
|
4
|
+
import typing
|
|
5
|
+
import pathlib
|
|
6
|
+
from styxdefs import *
|
|
7
|
+
|
|
8
|
+
LABELCONVERT_METADATA = Metadata(
|
|
9
|
+
id="5aa09ff9ec4b21693b7d07b8329c2bc641669b7c.boutiques",
|
|
10
|
+
name="labelconvert",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_LabelconvertConfigParamsDictNoTag = typing.TypedDict('_LabelconvertConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
LabelconvertConfigParamsDictTagged = typing.TypedDict('LabelconvertConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
LabelconvertConfigParamsDict = _LabelconvertConfigParamsDictNoTag | LabelconvertConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_LabelconvertParamsDictNoTag = typing.TypedDict('_LabelconvertParamsDictNoTag', {
|
|
29
|
+
"spine": typing.NotRequired[InputPathType | None],
|
|
30
|
+
"info": bool,
|
|
31
|
+
"quiet": bool,
|
|
32
|
+
"debug": bool,
|
|
33
|
+
"force": bool,
|
|
34
|
+
"nthreads": typing.NotRequired[int | None],
|
|
35
|
+
"config": typing.NotRequired[list[LabelconvertConfigParamsDict] | None],
|
|
36
|
+
"help": bool,
|
|
37
|
+
"version": bool,
|
|
38
|
+
"path_in": InputPathType,
|
|
39
|
+
"lut_in": InputPathType,
|
|
40
|
+
"lut_out": InputPathType,
|
|
41
|
+
"image_out": str,
|
|
42
|
+
})
|
|
43
|
+
LabelconvertParamsDictTagged = typing.TypedDict('LabelconvertParamsDictTagged', {
|
|
44
|
+
"@type": typing.Literal["mrtrix/labelconvert"],
|
|
45
|
+
"spine": typing.NotRequired[InputPathType | None],
|
|
46
|
+
"info": bool,
|
|
47
|
+
"quiet": bool,
|
|
48
|
+
"debug": bool,
|
|
49
|
+
"force": bool,
|
|
50
|
+
"nthreads": typing.NotRequired[int | None],
|
|
51
|
+
"config": typing.NotRequired[list[LabelconvertConfigParamsDict] | None],
|
|
52
|
+
"help": bool,
|
|
53
|
+
"version": bool,
|
|
54
|
+
"path_in": InputPathType,
|
|
55
|
+
"lut_in": InputPathType,
|
|
56
|
+
"lut_out": InputPathType,
|
|
57
|
+
"image_out": str,
|
|
58
|
+
})
|
|
59
|
+
LabelconvertParamsDict = _LabelconvertParamsDictNoTag | LabelconvertParamsDictTagged
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def labelconvert_config(
|
|
63
|
+
key: str,
|
|
64
|
+
value: str,
|
|
65
|
+
) -> LabelconvertConfigParamsDictTagged:
|
|
66
|
+
"""
|
|
67
|
+
Build parameters.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
71
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
72
|
+
Returns:
|
|
73
|
+
Parameter dictionary
|
|
74
|
+
"""
|
|
75
|
+
params = {
|
|
76
|
+
"@type": "config",
|
|
77
|
+
"key": key,
|
|
78
|
+
"value": value,
|
|
79
|
+
}
|
|
80
|
+
return params
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def labelconvert_config_validate(
|
|
84
|
+
params: typing.Any,
|
|
85
|
+
) -> None:
|
|
86
|
+
"""
|
|
87
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
88
|
+
`LabelconvertConfigParamsDict` object.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
params: The parameters object to validate.
|
|
92
|
+
"""
|
|
93
|
+
if params is None or not isinstance(params, dict):
|
|
94
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
95
|
+
if params.get("key", None) is None:
|
|
96
|
+
raise StyxValidationError("`key` must not be None")
|
|
97
|
+
if not isinstance(params["key"], str):
|
|
98
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
99
|
+
if params.get("value", None) is None:
|
|
100
|
+
raise StyxValidationError("`value` must not be None")
|
|
101
|
+
if not isinstance(params["value"], str):
|
|
102
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def labelconvert_config_cargs(
|
|
106
|
+
params: LabelconvertConfigParamsDict,
|
|
107
|
+
execution: Execution,
|
|
108
|
+
) -> list[str]:
|
|
109
|
+
"""
|
|
110
|
+
Build command-line arguments from parameters.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
params: The parameters.
|
|
114
|
+
execution: The execution object for resolving input paths.
|
|
115
|
+
Returns:
|
|
116
|
+
Command-line arguments.
|
|
117
|
+
"""
|
|
118
|
+
cargs = []
|
|
119
|
+
cargs.append("-config")
|
|
120
|
+
cargs.append(params.get("key", None))
|
|
121
|
+
cargs.append(params.get("value", None))
|
|
122
|
+
return cargs
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class LabelconvertOutputs(typing.NamedTuple):
|
|
126
|
+
"""
|
|
127
|
+
Output object returned when calling `LabelconvertParamsDict(...)`.
|
|
128
|
+
"""
|
|
129
|
+
root: OutputPathType
|
|
130
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
131
|
+
image_out: OutputPathType
|
|
132
|
+
"""the output image"""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def labelconvert_params(
|
|
136
|
+
path_in: InputPathType,
|
|
137
|
+
lut_in: InputPathType,
|
|
138
|
+
lut_out: InputPathType,
|
|
139
|
+
image_out: str,
|
|
140
|
+
spine: InputPathType | None = None,
|
|
141
|
+
info: bool = False,
|
|
142
|
+
quiet: bool = False,
|
|
143
|
+
debug: bool = False,
|
|
144
|
+
force: bool = False,
|
|
145
|
+
nthreads: int | None = None,
|
|
146
|
+
config: list[LabelconvertConfigParamsDict] | None = None,
|
|
147
|
+
help_: bool = False,
|
|
148
|
+
version: bool = False,
|
|
149
|
+
) -> LabelconvertParamsDictTagged:
|
|
150
|
+
"""
|
|
151
|
+
Build parameters.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
path_in: the input image.
|
|
155
|
+
lut_in: the connectome lookup table corresponding to the input image.
|
|
156
|
+
lut_out: the target connectome lookup table for the output image.
|
|
157
|
+
image_out: the output image.
|
|
158
|
+
spine: provide a manually-defined segmentation of the base of the spine\
|
|
159
|
+
where the streamlines terminate, so that this can become a node in the\
|
|
160
|
+
connection matrix.
|
|
161
|
+
info: display information messages.
|
|
162
|
+
quiet: do not display information messages or progress status;\
|
|
163
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
164
|
+
environment variable to a non-empty string.
|
|
165
|
+
debug: display debugging messages.
|
|
166
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
167
|
+
input and output might cause unexpected behaviour).
|
|
168
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
169
|
+
(set to 0 to disable multi-threading).
|
|
170
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
171
|
+
help_: display this information page and exit.
|
|
172
|
+
version: display version information and exit.
|
|
173
|
+
Returns:
|
|
174
|
+
Parameter dictionary
|
|
175
|
+
"""
|
|
176
|
+
params = {
|
|
177
|
+
"@type": "mrtrix/labelconvert",
|
|
178
|
+
"info": info,
|
|
179
|
+
"quiet": quiet,
|
|
180
|
+
"debug": debug,
|
|
181
|
+
"force": force,
|
|
182
|
+
"help": help_,
|
|
183
|
+
"version": version,
|
|
184
|
+
"path_in": path_in,
|
|
185
|
+
"lut_in": lut_in,
|
|
186
|
+
"lut_out": lut_out,
|
|
187
|
+
"image_out": image_out,
|
|
188
|
+
}
|
|
189
|
+
if spine is not None:
|
|
190
|
+
params["spine"] = spine
|
|
191
|
+
if nthreads is not None:
|
|
192
|
+
params["nthreads"] = nthreads
|
|
193
|
+
if config is not None:
|
|
194
|
+
params["config"] = config
|
|
195
|
+
return params
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def labelconvert_validate(
|
|
199
|
+
params: typing.Any,
|
|
200
|
+
) -> None:
|
|
201
|
+
"""
|
|
202
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
203
|
+
`LabelconvertParamsDict` object.
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
params: The parameters object to validate.
|
|
207
|
+
"""
|
|
208
|
+
if params is None or not isinstance(params, dict):
|
|
209
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
210
|
+
if params.get("spine", None) is not None:
|
|
211
|
+
if not isinstance(params["spine"], (pathlib.Path, str)):
|
|
212
|
+
raise StyxValidationError(f'`spine` has the wrong type: Received `{type(params.get("spine", None))}` expected `InputPathType | None`')
|
|
213
|
+
if params.get("info", False) is None:
|
|
214
|
+
raise StyxValidationError("`info` must not be None")
|
|
215
|
+
if not isinstance(params["info"], bool):
|
|
216
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
217
|
+
if params.get("quiet", False) is None:
|
|
218
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
219
|
+
if not isinstance(params["quiet"], bool):
|
|
220
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
221
|
+
if params.get("debug", False) is None:
|
|
222
|
+
raise StyxValidationError("`debug` must not be None")
|
|
223
|
+
if not isinstance(params["debug"], bool):
|
|
224
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
225
|
+
if params.get("force", False) is None:
|
|
226
|
+
raise StyxValidationError("`force` must not be None")
|
|
227
|
+
if not isinstance(params["force"], bool):
|
|
228
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
229
|
+
if params.get("nthreads", None) is not None:
|
|
230
|
+
if not isinstance(params["nthreads"], int):
|
|
231
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
232
|
+
if params.get("config", None) is not None:
|
|
233
|
+
if not isinstance(params["config"], list):
|
|
234
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[LabelconvertConfigParamsDict] | None`')
|
|
235
|
+
for e in params["config"]:
|
|
236
|
+
labelconvert_config_validate(e)
|
|
237
|
+
if params.get("help", False) is None:
|
|
238
|
+
raise StyxValidationError("`help` must not be None")
|
|
239
|
+
if not isinstance(params["help"], bool):
|
|
240
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
241
|
+
if params.get("version", False) is None:
|
|
242
|
+
raise StyxValidationError("`version` must not be None")
|
|
243
|
+
if not isinstance(params["version"], bool):
|
|
244
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
245
|
+
if params.get("path_in", None) is None:
|
|
246
|
+
raise StyxValidationError("`path_in` must not be None")
|
|
247
|
+
if not isinstance(params["path_in"], (pathlib.Path, str)):
|
|
248
|
+
raise StyxValidationError(f'`path_in` has the wrong type: Received `{type(params.get("path_in", None))}` expected `InputPathType`')
|
|
249
|
+
if params.get("lut_in", None) is None:
|
|
250
|
+
raise StyxValidationError("`lut_in` must not be None")
|
|
251
|
+
if not isinstance(params["lut_in"], (pathlib.Path, str)):
|
|
252
|
+
raise StyxValidationError(f'`lut_in` has the wrong type: Received `{type(params.get("lut_in", None))}` expected `InputPathType`')
|
|
253
|
+
if params.get("lut_out", None) is None:
|
|
254
|
+
raise StyxValidationError("`lut_out` must not be None")
|
|
255
|
+
if not isinstance(params["lut_out"], (pathlib.Path, str)):
|
|
256
|
+
raise StyxValidationError(f'`lut_out` has the wrong type: Received `{type(params.get("lut_out", None))}` expected `InputPathType`')
|
|
257
|
+
if params.get("image_out", None) is None:
|
|
258
|
+
raise StyxValidationError("`image_out` must not be None")
|
|
259
|
+
if not isinstance(params["image_out"], str):
|
|
260
|
+
raise StyxValidationError(f'`image_out` has the wrong type: Received `{type(params.get("image_out", None))}` expected `str`')
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def labelconvert_cargs(
|
|
264
|
+
params: LabelconvertParamsDict,
|
|
265
|
+
execution: Execution,
|
|
266
|
+
) -> list[str]:
|
|
267
|
+
"""
|
|
268
|
+
Build command-line arguments from parameters.
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
params: The parameters.
|
|
272
|
+
execution: The execution object for resolving input paths.
|
|
273
|
+
Returns:
|
|
274
|
+
Command-line arguments.
|
|
275
|
+
"""
|
|
276
|
+
cargs = []
|
|
277
|
+
cargs.append("labelconvert")
|
|
278
|
+
if params.get("spine", None) is not None:
|
|
279
|
+
cargs.extend([
|
|
280
|
+
"-spine",
|
|
281
|
+
execution.input_file(params.get("spine", None))
|
|
282
|
+
])
|
|
283
|
+
if params.get("info", False):
|
|
284
|
+
cargs.append("-info")
|
|
285
|
+
if params.get("quiet", False):
|
|
286
|
+
cargs.append("-quiet")
|
|
287
|
+
if params.get("debug", False):
|
|
288
|
+
cargs.append("-debug")
|
|
289
|
+
if params.get("force", False):
|
|
290
|
+
cargs.append("-force")
|
|
291
|
+
if params.get("nthreads", None) is not None:
|
|
292
|
+
cargs.extend([
|
|
293
|
+
"-nthreads",
|
|
294
|
+
str(params.get("nthreads", None))
|
|
295
|
+
])
|
|
296
|
+
if params.get("config", None) is not None:
|
|
297
|
+
cargs.extend([a for c in [labelconvert_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
298
|
+
if params.get("help", False):
|
|
299
|
+
cargs.append("-help")
|
|
300
|
+
if params.get("version", False):
|
|
301
|
+
cargs.append("-version")
|
|
302
|
+
cargs.append(execution.input_file(params.get("path_in", None)))
|
|
303
|
+
cargs.append(execution.input_file(params.get("lut_in", None)))
|
|
304
|
+
cargs.append(execution.input_file(params.get("lut_out", None)))
|
|
305
|
+
cargs.append(params.get("image_out", None))
|
|
306
|
+
return cargs
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def labelconvert_outputs(
|
|
310
|
+
params: LabelconvertParamsDict,
|
|
311
|
+
execution: Execution,
|
|
312
|
+
) -> LabelconvertOutputs:
|
|
313
|
+
"""
|
|
314
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
315
|
+
|
|
316
|
+
Args:
|
|
317
|
+
params: The parameters.
|
|
318
|
+
execution: The execution object for resolving input paths.
|
|
319
|
+
Returns:
|
|
320
|
+
Outputs object.
|
|
321
|
+
"""
|
|
322
|
+
ret = LabelconvertOutputs(
|
|
323
|
+
root=execution.output_file("."),
|
|
324
|
+
image_out=execution.output_file(params.get("image_out", None)),
|
|
325
|
+
)
|
|
326
|
+
return ret
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def labelconvert_execute(
|
|
330
|
+
params: LabelconvertParamsDict,
|
|
331
|
+
runner: Runner | None = None,
|
|
332
|
+
) -> LabelconvertOutputs:
|
|
333
|
+
"""
|
|
334
|
+
labelconvert
|
|
335
|
+
|
|
336
|
+
Convert a connectome node image from one lookup table to another.
|
|
337
|
+
|
|
338
|
+
Typical usage is to convert a parcellation image provided by some other
|
|
339
|
+
software, based on the lookup table provided by that software, to conform to
|
|
340
|
+
a new lookup table, particularly one where the node indices increment from
|
|
341
|
+
1, in preparation for connectome construction; examples of such target
|
|
342
|
+
lookup table files are provided in share//mrtrix3//labelconvert//, but can
|
|
343
|
+
be created by the user to provide the desired node set // ordering //
|
|
344
|
+
colours.
|
|
345
|
+
|
|
346
|
+
References:
|
|
347
|
+
|
|
348
|
+
.
|
|
349
|
+
|
|
350
|
+
Author: MRTrix3 Developers
|
|
351
|
+
|
|
352
|
+
URL: https://www.mrtrix.org/
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
params: The parameters.
|
|
356
|
+
runner: Command runner.
|
|
357
|
+
Returns:
|
|
358
|
+
NamedTuple of outputs (described in `LabelconvertOutputs`).
|
|
359
|
+
"""
|
|
360
|
+
labelconvert_validate(params)
|
|
361
|
+
runner = runner or get_global_runner()
|
|
362
|
+
execution = runner.start_execution(LABELCONVERT_METADATA)
|
|
363
|
+
params = execution.params(params)
|
|
364
|
+
cargs = labelconvert_cargs(params, execution)
|
|
365
|
+
ret = labelconvert_outputs(params, execution)
|
|
366
|
+
execution.run(cargs)
|
|
367
|
+
return ret
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def labelconvert(
|
|
371
|
+
path_in: InputPathType,
|
|
372
|
+
lut_in: InputPathType,
|
|
373
|
+
lut_out: InputPathType,
|
|
374
|
+
image_out: str,
|
|
375
|
+
spine: InputPathType | None = None,
|
|
376
|
+
info: bool = False,
|
|
377
|
+
quiet: bool = False,
|
|
378
|
+
debug: bool = False,
|
|
379
|
+
force: bool = False,
|
|
380
|
+
nthreads: int | None = None,
|
|
381
|
+
config: list[LabelconvertConfigParamsDict] | None = None,
|
|
382
|
+
help_: bool = False,
|
|
383
|
+
version: bool = False,
|
|
384
|
+
runner: Runner | None = None,
|
|
385
|
+
) -> LabelconvertOutputs:
|
|
386
|
+
"""
|
|
387
|
+
labelconvert
|
|
388
|
+
|
|
389
|
+
Convert a connectome node image from one lookup table to another.
|
|
390
|
+
|
|
391
|
+
Typical usage is to convert a parcellation image provided by some other
|
|
392
|
+
software, based on the lookup table provided by that software, to conform to
|
|
393
|
+
a new lookup table, particularly one where the node indices increment from
|
|
394
|
+
1, in preparation for connectome construction; examples of such target
|
|
395
|
+
lookup table files are provided in share//mrtrix3//labelconvert//, but can
|
|
396
|
+
be created by the user to provide the desired node set // ordering //
|
|
397
|
+
colours.
|
|
398
|
+
|
|
399
|
+
References:
|
|
400
|
+
|
|
401
|
+
.
|
|
402
|
+
|
|
403
|
+
Author: MRTrix3 Developers
|
|
404
|
+
|
|
405
|
+
URL: https://www.mrtrix.org/
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
path_in: the input image.
|
|
409
|
+
lut_in: the connectome lookup table corresponding to the input image.
|
|
410
|
+
lut_out: the target connectome lookup table for the output image.
|
|
411
|
+
image_out: the output image.
|
|
412
|
+
spine: provide a manually-defined segmentation of the base of the spine\
|
|
413
|
+
where the streamlines terminate, so that this can become a node in the\
|
|
414
|
+
connection matrix.
|
|
415
|
+
info: display information messages.
|
|
416
|
+
quiet: do not display information messages or progress status;\
|
|
417
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
418
|
+
environment variable to a non-empty string.
|
|
419
|
+
debug: display debugging messages.
|
|
420
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
421
|
+
input and output might cause unexpected behaviour).
|
|
422
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
423
|
+
(set to 0 to disable multi-threading).
|
|
424
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
425
|
+
help_: display this information page and exit.
|
|
426
|
+
version: display version information and exit.
|
|
427
|
+
runner: Command runner.
|
|
428
|
+
Returns:
|
|
429
|
+
NamedTuple of outputs (described in `LabelconvertOutputs`).
|
|
430
|
+
"""
|
|
431
|
+
params = labelconvert_params(
|
|
432
|
+
spine=spine,
|
|
433
|
+
info=info,
|
|
434
|
+
quiet=quiet,
|
|
435
|
+
debug=debug,
|
|
436
|
+
force=force,
|
|
437
|
+
nthreads=nthreads,
|
|
438
|
+
config=config,
|
|
439
|
+
help_=help_,
|
|
440
|
+
version=version,
|
|
441
|
+
path_in=path_in,
|
|
442
|
+
lut_in=lut_in,
|
|
443
|
+
lut_out=lut_out,
|
|
444
|
+
image_out=image_out,
|
|
445
|
+
)
|
|
446
|
+
return labelconvert_execute(params, runner)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
__all__ = [
|
|
450
|
+
"LABELCONVERT_METADATA",
|
|
451
|
+
"LabelconvertConfigParamsDict",
|
|
452
|
+
"LabelconvertConfigParamsDictTagged",
|
|
453
|
+
"LabelconvertOutputs",
|
|
454
|
+
"LabelconvertParamsDict",
|
|
455
|
+
"LabelconvertParamsDictTagged",
|
|
456
|
+
"labelconvert",
|
|
457
|
+
"labelconvert_config",
|
|
458
|
+
"labelconvert_execute",
|
|
459
|
+
"labelconvert_params",
|
|
460
|
+
]
|