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,583 @@
|
|
|
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
|
+
CONNECTOME2TCK_METADATA = Metadata(
|
|
9
|
+
id="ae2ef98104119bc0342c1596e2bea3d807ec75ef.boutiques",
|
|
10
|
+
name="connectome2tck",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Connectome2tckConfigParamsDictNoTag = typing.TypedDict('_Connectome2tckConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
Connectome2tckConfigParamsDictTagged = typing.TypedDict('Connectome2tckConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
Connectome2tckConfigParamsDict = _Connectome2tckConfigParamsDictNoTag | Connectome2tckConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_Connectome2tckParamsDictNoTag = typing.TypedDict('_Connectome2tckParamsDictNoTag', {
|
|
29
|
+
"nodes": typing.NotRequired[list[int] | None],
|
|
30
|
+
"exclusive": bool,
|
|
31
|
+
"files": typing.NotRequired[str | None],
|
|
32
|
+
"exemplars": typing.NotRequired[InputPathType | None],
|
|
33
|
+
"keep_unassigned": bool,
|
|
34
|
+
"keep_self": bool,
|
|
35
|
+
"tck_weights_in": typing.NotRequired[InputPathType | None],
|
|
36
|
+
"prefix_tck_weights_out": typing.NotRequired[str | None],
|
|
37
|
+
"info": bool,
|
|
38
|
+
"quiet": bool,
|
|
39
|
+
"debug": bool,
|
|
40
|
+
"force": bool,
|
|
41
|
+
"nthreads": typing.NotRequired[int | None],
|
|
42
|
+
"config": typing.NotRequired[list[Connectome2tckConfigParamsDict] | None],
|
|
43
|
+
"help": bool,
|
|
44
|
+
"version": bool,
|
|
45
|
+
"tracks_in": InputPathType,
|
|
46
|
+
"assignments_in": InputPathType,
|
|
47
|
+
"prefix_out": str,
|
|
48
|
+
})
|
|
49
|
+
Connectome2tckParamsDictTagged = typing.TypedDict('Connectome2tckParamsDictTagged', {
|
|
50
|
+
"@type": typing.Literal["mrtrix/connectome2tck"],
|
|
51
|
+
"nodes": typing.NotRequired[list[int] | None],
|
|
52
|
+
"exclusive": bool,
|
|
53
|
+
"files": typing.NotRequired[str | None],
|
|
54
|
+
"exemplars": typing.NotRequired[InputPathType | None],
|
|
55
|
+
"keep_unassigned": bool,
|
|
56
|
+
"keep_self": bool,
|
|
57
|
+
"tck_weights_in": typing.NotRequired[InputPathType | None],
|
|
58
|
+
"prefix_tck_weights_out": typing.NotRequired[str | None],
|
|
59
|
+
"info": bool,
|
|
60
|
+
"quiet": bool,
|
|
61
|
+
"debug": bool,
|
|
62
|
+
"force": bool,
|
|
63
|
+
"nthreads": typing.NotRequired[int | None],
|
|
64
|
+
"config": typing.NotRequired[list[Connectome2tckConfigParamsDict] | None],
|
|
65
|
+
"help": bool,
|
|
66
|
+
"version": bool,
|
|
67
|
+
"tracks_in": InputPathType,
|
|
68
|
+
"assignments_in": InputPathType,
|
|
69
|
+
"prefix_out": str,
|
|
70
|
+
})
|
|
71
|
+
Connectome2tckParamsDict = _Connectome2tckParamsDictNoTag | Connectome2tckParamsDictTagged
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def connectome2tck_config(
|
|
75
|
+
key: str,
|
|
76
|
+
value: str,
|
|
77
|
+
) -> Connectome2tckConfigParamsDictTagged:
|
|
78
|
+
"""
|
|
79
|
+
Build parameters.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
83
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
84
|
+
Returns:
|
|
85
|
+
Parameter dictionary
|
|
86
|
+
"""
|
|
87
|
+
params = {
|
|
88
|
+
"@type": "config",
|
|
89
|
+
"key": key,
|
|
90
|
+
"value": value,
|
|
91
|
+
}
|
|
92
|
+
return params
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def connectome2tck_config_validate(
|
|
96
|
+
params: typing.Any,
|
|
97
|
+
) -> None:
|
|
98
|
+
"""
|
|
99
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
100
|
+
`Connectome2tckConfigParamsDict` object.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
params: The parameters object to validate.
|
|
104
|
+
"""
|
|
105
|
+
if params is None or not isinstance(params, dict):
|
|
106
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
107
|
+
if params.get("key", None) is None:
|
|
108
|
+
raise StyxValidationError("`key` must not be None")
|
|
109
|
+
if not isinstance(params["key"], str):
|
|
110
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
111
|
+
if params.get("value", None) is None:
|
|
112
|
+
raise StyxValidationError("`value` must not be None")
|
|
113
|
+
if not isinstance(params["value"], str):
|
|
114
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def connectome2tck_config_cargs(
|
|
118
|
+
params: Connectome2tckConfigParamsDict,
|
|
119
|
+
execution: Execution,
|
|
120
|
+
) -> list[str]:
|
|
121
|
+
"""
|
|
122
|
+
Build command-line arguments from parameters.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
params: The parameters.
|
|
126
|
+
execution: The execution object for resolving input paths.
|
|
127
|
+
Returns:
|
|
128
|
+
Command-line arguments.
|
|
129
|
+
"""
|
|
130
|
+
cargs = []
|
|
131
|
+
cargs.append("-config")
|
|
132
|
+
cargs.append(params.get("key", None))
|
|
133
|
+
cargs.append(params.get("value", None))
|
|
134
|
+
return cargs
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class Connectome2tckOutputs(typing.NamedTuple):
|
|
138
|
+
"""
|
|
139
|
+
Output object returned when calling `Connectome2tckParamsDict(...)`.
|
|
140
|
+
"""
|
|
141
|
+
root: OutputPathType
|
|
142
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def connectome2tck_params(
|
|
146
|
+
tracks_in: InputPathType,
|
|
147
|
+
assignments_in: InputPathType,
|
|
148
|
+
prefix_out: str,
|
|
149
|
+
nodes: list[int] | None = None,
|
|
150
|
+
exclusive: bool = False,
|
|
151
|
+
files: str | None = None,
|
|
152
|
+
exemplars: InputPathType | None = None,
|
|
153
|
+
keep_unassigned: bool = False,
|
|
154
|
+
keep_self: bool = False,
|
|
155
|
+
tck_weights_in: InputPathType | None = None,
|
|
156
|
+
prefix_tck_weights_out: str | None = None,
|
|
157
|
+
info: bool = False,
|
|
158
|
+
quiet: bool = False,
|
|
159
|
+
debug: bool = False,
|
|
160
|
+
force: bool = False,
|
|
161
|
+
nthreads: int | None = None,
|
|
162
|
+
config: list[Connectome2tckConfigParamsDict] | None = None,
|
|
163
|
+
help_: bool = False,
|
|
164
|
+
version: bool = False,
|
|
165
|
+
) -> Connectome2tckParamsDictTagged:
|
|
166
|
+
"""
|
|
167
|
+
Build parameters.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
tracks_in: the input track file.
|
|
171
|
+
assignments_in: input text file containing the node assignments for\
|
|
172
|
+
each streamline.
|
|
173
|
+
prefix_out: the output file / prefix.
|
|
174
|
+
nodes: only select tracks that involve a set of nodes of interest\
|
|
175
|
+
(provide as a comma-separated list of integers).
|
|
176
|
+
exclusive: only select tracks that exclusively connect nodes from\
|
|
177
|
+
within the list of nodes of interest.
|
|
178
|
+
files: select how the resulting streamlines will be grouped in output\
|
|
179
|
+
files. Options are: per_edge, per_node, single (default: per_edge).
|
|
180
|
+
exemplars: generate a mean connection exemplar per edge, rather than\
|
|
181
|
+
keeping all streamlines (the parcellation node image must be provided\
|
|
182
|
+
in order to constrain the exemplar endpoints).
|
|
183
|
+
keep_unassigned: by default, the program discards those streamlines\
|
|
184
|
+
that are not successfully assigned to a node. Set this option to\
|
|
185
|
+
generate corresponding outputs containing these streamlines (labelled\
|
|
186
|
+
as node index 0).
|
|
187
|
+
keep_self: by default, the program will not output streamlines that\
|
|
188
|
+
connect to the same node at both ends. Set this option to instead keep\
|
|
189
|
+
these self-connections.
|
|
190
|
+
tck_weights_in: specify a text scalar file containing the streamline\
|
|
191
|
+
weights.
|
|
192
|
+
prefix_tck_weights_out: provide a prefix for outputting a text file\
|
|
193
|
+
corresponding to each output file, each containing only the streamline\
|
|
194
|
+
weights relevant for that track file.
|
|
195
|
+
info: display information messages.
|
|
196
|
+
quiet: do not display information messages or progress status;\
|
|
197
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
198
|
+
environment variable to a non-empty string.
|
|
199
|
+
debug: display debugging messages.
|
|
200
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
201
|
+
input and output might cause unexpected behaviour).
|
|
202
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
203
|
+
(set to 0 to disable multi-threading).
|
|
204
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
205
|
+
help_: display this information page and exit.
|
|
206
|
+
version: display version information and exit.
|
|
207
|
+
Returns:
|
|
208
|
+
Parameter dictionary
|
|
209
|
+
"""
|
|
210
|
+
params = {
|
|
211
|
+
"@type": "mrtrix/connectome2tck",
|
|
212
|
+
"exclusive": exclusive,
|
|
213
|
+
"keep_unassigned": keep_unassigned,
|
|
214
|
+
"keep_self": keep_self,
|
|
215
|
+
"info": info,
|
|
216
|
+
"quiet": quiet,
|
|
217
|
+
"debug": debug,
|
|
218
|
+
"force": force,
|
|
219
|
+
"help": help_,
|
|
220
|
+
"version": version,
|
|
221
|
+
"tracks_in": tracks_in,
|
|
222
|
+
"assignments_in": assignments_in,
|
|
223
|
+
"prefix_out": prefix_out,
|
|
224
|
+
}
|
|
225
|
+
if nodes is not None:
|
|
226
|
+
params["nodes"] = nodes
|
|
227
|
+
if files is not None:
|
|
228
|
+
params["files"] = files
|
|
229
|
+
if exemplars is not None:
|
|
230
|
+
params["exemplars"] = exemplars
|
|
231
|
+
if tck_weights_in is not None:
|
|
232
|
+
params["tck_weights_in"] = tck_weights_in
|
|
233
|
+
if prefix_tck_weights_out is not None:
|
|
234
|
+
params["prefix_tck_weights_out"] = prefix_tck_weights_out
|
|
235
|
+
if nthreads is not None:
|
|
236
|
+
params["nthreads"] = nthreads
|
|
237
|
+
if config is not None:
|
|
238
|
+
params["config"] = config
|
|
239
|
+
return params
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def connectome2tck_validate(
|
|
243
|
+
params: typing.Any,
|
|
244
|
+
) -> None:
|
|
245
|
+
"""
|
|
246
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
247
|
+
`Connectome2tckParamsDict` object.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
params: The parameters object to validate.
|
|
251
|
+
"""
|
|
252
|
+
if params is None or not isinstance(params, dict):
|
|
253
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
254
|
+
if params.get("nodes", None) is not None:
|
|
255
|
+
if not isinstance(params["nodes"], list):
|
|
256
|
+
raise StyxValidationError(f'`nodes` has the wrong type: Received `{type(params.get("nodes", None))}` expected `list[int] | None`')
|
|
257
|
+
for e in params["nodes"]:
|
|
258
|
+
if not isinstance(e, int):
|
|
259
|
+
raise StyxValidationError(f'`nodes` has the wrong type: Received `{type(params.get("nodes", None))}` expected `list[int] | None`')
|
|
260
|
+
if params.get("exclusive", False) is None:
|
|
261
|
+
raise StyxValidationError("`exclusive` must not be None")
|
|
262
|
+
if not isinstance(params["exclusive"], bool):
|
|
263
|
+
raise StyxValidationError(f'`exclusive` has the wrong type: Received `{type(params.get("exclusive", False))}` expected `bool`')
|
|
264
|
+
if params.get("files", None) is not None:
|
|
265
|
+
if not isinstance(params["files"], str):
|
|
266
|
+
raise StyxValidationError(f'`files` has the wrong type: Received `{type(params.get("files", None))}` expected `str | None`')
|
|
267
|
+
if params.get("exemplars", None) is not None:
|
|
268
|
+
if not isinstance(params["exemplars"], (pathlib.Path, str)):
|
|
269
|
+
raise StyxValidationError(f'`exemplars` has the wrong type: Received `{type(params.get("exemplars", None))}` expected `InputPathType | None`')
|
|
270
|
+
if params.get("keep_unassigned", False) is None:
|
|
271
|
+
raise StyxValidationError("`keep_unassigned` must not be None")
|
|
272
|
+
if not isinstance(params["keep_unassigned"], bool):
|
|
273
|
+
raise StyxValidationError(f'`keep_unassigned` has the wrong type: Received `{type(params.get("keep_unassigned", False))}` expected `bool`')
|
|
274
|
+
if params.get("keep_self", False) is None:
|
|
275
|
+
raise StyxValidationError("`keep_self` must not be None")
|
|
276
|
+
if not isinstance(params["keep_self"], bool):
|
|
277
|
+
raise StyxValidationError(f'`keep_self` has the wrong type: Received `{type(params.get("keep_self", False))}` expected `bool`')
|
|
278
|
+
if params.get("tck_weights_in", None) is not None:
|
|
279
|
+
if not isinstance(params["tck_weights_in"], (pathlib.Path, str)):
|
|
280
|
+
raise StyxValidationError(f'`tck_weights_in` has the wrong type: Received `{type(params.get("tck_weights_in", None))}` expected `InputPathType | None`')
|
|
281
|
+
if params.get("prefix_tck_weights_out", None) is not None:
|
|
282
|
+
if not isinstance(params["prefix_tck_weights_out"], str):
|
|
283
|
+
raise StyxValidationError(f'`prefix_tck_weights_out` has the wrong type: Received `{type(params.get("prefix_tck_weights_out", None))}` expected `str | None`')
|
|
284
|
+
if params.get("info", False) is None:
|
|
285
|
+
raise StyxValidationError("`info` must not be None")
|
|
286
|
+
if not isinstance(params["info"], bool):
|
|
287
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
288
|
+
if params.get("quiet", False) is None:
|
|
289
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
290
|
+
if not isinstance(params["quiet"], bool):
|
|
291
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
292
|
+
if params.get("debug", False) is None:
|
|
293
|
+
raise StyxValidationError("`debug` must not be None")
|
|
294
|
+
if not isinstance(params["debug"], bool):
|
|
295
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
296
|
+
if params.get("force", False) is None:
|
|
297
|
+
raise StyxValidationError("`force` must not be None")
|
|
298
|
+
if not isinstance(params["force"], bool):
|
|
299
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
300
|
+
if params.get("nthreads", None) is not None:
|
|
301
|
+
if not isinstance(params["nthreads"], int):
|
|
302
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
303
|
+
if params.get("config", None) is not None:
|
|
304
|
+
if not isinstance(params["config"], list):
|
|
305
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Connectome2tckConfigParamsDict] | None`')
|
|
306
|
+
for e in params["config"]:
|
|
307
|
+
connectome2tck_config_validate(e)
|
|
308
|
+
if params.get("help", False) is None:
|
|
309
|
+
raise StyxValidationError("`help` must not be None")
|
|
310
|
+
if not isinstance(params["help"], bool):
|
|
311
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
312
|
+
if params.get("version", False) is None:
|
|
313
|
+
raise StyxValidationError("`version` must not be None")
|
|
314
|
+
if not isinstance(params["version"], bool):
|
|
315
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
316
|
+
if params.get("tracks_in", None) is None:
|
|
317
|
+
raise StyxValidationError("`tracks_in` must not be None")
|
|
318
|
+
if not isinstance(params["tracks_in"], (pathlib.Path, str)):
|
|
319
|
+
raise StyxValidationError(f'`tracks_in` has the wrong type: Received `{type(params.get("tracks_in", None))}` expected `InputPathType`')
|
|
320
|
+
if params.get("assignments_in", None) is None:
|
|
321
|
+
raise StyxValidationError("`assignments_in` must not be None")
|
|
322
|
+
if not isinstance(params["assignments_in"], (pathlib.Path, str)):
|
|
323
|
+
raise StyxValidationError(f'`assignments_in` has the wrong type: Received `{type(params.get("assignments_in", None))}` expected `InputPathType`')
|
|
324
|
+
if params.get("prefix_out", None) is None:
|
|
325
|
+
raise StyxValidationError("`prefix_out` must not be None")
|
|
326
|
+
if not isinstance(params["prefix_out"], str):
|
|
327
|
+
raise StyxValidationError(f'`prefix_out` has the wrong type: Received `{type(params.get("prefix_out", None))}` expected `str`')
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def connectome2tck_cargs(
|
|
331
|
+
params: Connectome2tckParamsDict,
|
|
332
|
+
execution: Execution,
|
|
333
|
+
) -> list[str]:
|
|
334
|
+
"""
|
|
335
|
+
Build command-line arguments from parameters.
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
params: The parameters.
|
|
339
|
+
execution: The execution object for resolving input paths.
|
|
340
|
+
Returns:
|
|
341
|
+
Command-line arguments.
|
|
342
|
+
"""
|
|
343
|
+
cargs = []
|
|
344
|
+
cargs.append("connectome2tck")
|
|
345
|
+
if params.get("nodes", None) is not None:
|
|
346
|
+
cargs.extend([
|
|
347
|
+
"-nodes",
|
|
348
|
+
",".join(map(str, params.get("nodes", None)))
|
|
349
|
+
])
|
|
350
|
+
if params.get("exclusive", False):
|
|
351
|
+
cargs.append("-exclusive")
|
|
352
|
+
if params.get("files", None) is not None:
|
|
353
|
+
cargs.extend([
|
|
354
|
+
"-files",
|
|
355
|
+
params.get("files", None)
|
|
356
|
+
])
|
|
357
|
+
if params.get("exemplars", None) is not None:
|
|
358
|
+
cargs.extend([
|
|
359
|
+
"-exemplars",
|
|
360
|
+
execution.input_file(params.get("exemplars", None))
|
|
361
|
+
])
|
|
362
|
+
if params.get("keep_unassigned", False):
|
|
363
|
+
cargs.append("-keep_unassigned")
|
|
364
|
+
if params.get("keep_self", False):
|
|
365
|
+
cargs.append("-keep_self")
|
|
366
|
+
if params.get("tck_weights_in", None) is not None:
|
|
367
|
+
cargs.extend([
|
|
368
|
+
"-tck_weights_in",
|
|
369
|
+
execution.input_file(params.get("tck_weights_in", None))
|
|
370
|
+
])
|
|
371
|
+
if params.get("prefix_tck_weights_out", None) is not None:
|
|
372
|
+
cargs.extend([
|
|
373
|
+
"-prefix_tck_weights_out",
|
|
374
|
+
params.get("prefix_tck_weights_out", None)
|
|
375
|
+
])
|
|
376
|
+
if params.get("info", False):
|
|
377
|
+
cargs.append("-info")
|
|
378
|
+
if params.get("quiet", False):
|
|
379
|
+
cargs.append("-quiet")
|
|
380
|
+
if params.get("debug", False):
|
|
381
|
+
cargs.append("-debug")
|
|
382
|
+
if params.get("force", False):
|
|
383
|
+
cargs.append("-force")
|
|
384
|
+
if params.get("nthreads", None) is not None:
|
|
385
|
+
cargs.extend([
|
|
386
|
+
"-nthreads",
|
|
387
|
+
str(params.get("nthreads", None))
|
|
388
|
+
])
|
|
389
|
+
if params.get("config", None) is not None:
|
|
390
|
+
cargs.extend([a for c in [connectome2tck_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
391
|
+
if params.get("help", False):
|
|
392
|
+
cargs.append("-help")
|
|
393
|
+
if params.get("version", False):
|
|
394
|
+
cargs.append("-version")
|
|
395
|
+
cargs.append(execution.input_file(params.get("tracks_in", None)))
|
|
396
|
+
cargs.append(execution.input_file(params.get("assignments_in", None)))
|
|
397
|
+
cargs.append(params.get("prefix_out", None))
|
|
398
|
+
return cargs
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def connectome2tck_outputs(
|
|
402
|
+
params: Connectome2tckParamsDict,
|
|
403
|
+
execution: Execution,
|
|
404
|
+
) -> Connectome2tckOutputs:
|
|
405
|
+
"""
|
|
406
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
params: The parameters.
|
|
410
|
+
execution: The execution object for resolving input paths.
|
|
411
|
+
Returns:
|
|
412
|
+
Outputs object.
|
|
413
|
+
"""
|
|
414
|
+
ret = Connectome2tckOutputs(
|
|
415
|
+
root=execution.output_file("."),
|
|
416
|
+
)
|
|
417
|
+
return ret
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def connectome2tck_execute(
|
|
421
|
+
params: Connectome2tckParamsDict,
|
|
422
|
+
runner: Runner | None = None,
|
|
423
|
+
) -> Connectome2tckOutputs:
|
|
424
|
+
"""
|
|
425
|
+
connectome2tck
|
|
426
|
+
|
|
427
|
+
Extract streamlines from a tractogram based on their assignment to
|
|
428
|
+
parcellated nodes.
|
|
429
|
+
|
|
430
|
+
The compulsory input file "assignments_in" should contain a text file where
|
|
431
|
+
there is one row for each streamline, and each row contains a list of
|
|
432
|
+
numbers corresponding to the parcels to which that streamline was assigned
|
|
433
|
+
(most typically there will be two entries per streamline, one for each
|
|
434
|
+
endpoint; but this is not strictly a requirement). This file will most
|
|
435
|
+
typically be generated using the tck2connectome command with the
|
|
436
|
+
-out_assignments option.
|
|
437
|
+
|
|
438
|
+
References:
|
|
439
|
+
|
|
440
|
+
.
|
|
441
|
+
|
|
442
|
+
Author: MRTrix3 Developers
|
|
443
|
+
|
|
444
|
+
URL: https://www.mrtrix.org/
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
params: The parameters.
|
|
448
|
+
runner: Command runner.
|
|
449
|
+
Returns:
|
|
450
|
+
NamedTuple of outputs (described in `Connectome2tckOutputs`).
|
|
451
|
+
"""
|
|
452
|
+
connectome2tck_validate(params)
|
|
453
|
+
runner = runner or get_global_runner()
|
|
454
|
+
execution = runner.start_execution(CONNECTOME2TCK_METADATA)
|
|
455
|
+
params = execution.params(params)
|
|
456
|
+
cargs = connectome2tck_cargs(params, execution)
|
|
457
|
+
ret = connectome2tck_outputs(params, execution)
|
|
458
|
+
execution.run(cargs)
|
|
459
|
+
return ret
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def connectome2tck(
|
|
463
|
+
tracks_in: InputPathType,
|
|
464
|
+
assignments_in: InputPathType,
|
|
465
|
+
prefix_out: str,
|
|
466
|
+
nodes: list[int] | None = None,
|
|
467
|
+
exclusive: bool = False,
|
|
468
|
+
files: str | None = None,
|
|
469
|
+
exemplars: InputPathType | None = None,
|
|
470
|
+
keep_unassigned: bool = False,
|
|
471
|
+
keep_self: bool = False,
|
|
472
|
+
tck_weights_in: InputPathType | None = None,
|
|
473
|
+
prefix_tck_weights_out: str | None = None,
|
|
474
|
+
info: bool = False,
|
|
475
|
+
quiet: bool = False,
|
|
476
|
+
debug: bool = False,
|
|
477
|
+
force: bool = False,
|
|
478
|
+
nthreads: int | None = None,
|
|
479
|
+
config: list[Connectome2tckConfigParamsDict] | None = None,
|
|
480
|
+
help_: bool = False,
|
|
481
|
+
version: bool = False,
|
|
482
|
+
runner: Runner | None = None,
|
|
483
|
+
) -> Connectome2tckOutputs:
|
|
484
|
+
"""
|
|
485
|
+
connectome2tck
|
|
486
|
+
|
|
487
|
+
Extract streamlines from a tractogram based on their assignment to
|
|
488
|
+
parcellated nodes.
|
|
489
|
+
|
|
490
|
+
The compulsory input file "assignments_in" should contain a text file where
|
|
491
|
+
there is one row for each streamline, and each row contains a list of
|
|
492
|
+
numbers corresponding to the parcels to which that streamline was assigned
|
|
493
|
+
(most typically there will be two entries per streamline, one for each
|
|
494
|
+
endpoint; but this is not strictly a requirement). This file will most
|
|
495
|
+
typically be generated using the tck2connectome command with the
|
|
496
|
+
-out_assignments option.
|
|
497
|
+
|
|
498
|
+
References:
|
|
499
|
+
|
|
500
|
+
.
|
|
501
|
+
|
|
502
|
+
Author: MRTrix3 Developers
|
|
503
|
+
|
|
504
|
+
URL: https://www.mrtrix.org/
|
|
505
|
+
|
|
506
|
+
Args:
|
|
507
|
+
tracks_in: the input track file.
|
|
508
|
+
assignments_in: input text file containing the node assignments for\
|
|
509
|
+
each streamline.
|
|
510
|
+
prefix_out: the output file / prefix.
|
|
511
|
+
nodes: only select tracks that involve a set of nodes of interest\
|
|
512
|
+
(provide as a comma-separated list of integers).
|
|
513
|
+
exclusive: only select tracks that exclusively connect nodes from\
|
|
514
|
+
within the list of nodes of interest.
|
|
515
|
+
files: select how the resulting streamlines will be grouped in output\
|
|
516
|
+
files. Options are: per_edge, per_node, single (default: per_edge).
|
|
517
|
+
exemplars: generate a mean connection exemplar per edge, rather than\
|
|
518
|
+
keeping all streamlines (the parcellation node image must be provided\
|
|
519
|
+
in order to constrain the exemplar endpoints).
|
|
520
|
+
keep_unassigned: by default, the program discards those streamlines\
|
|
521
|
+
that are not successfully assigned to a node. Set this option to\
|
|
522
|
+
generate corresponding outputs containing these streamlines (labelled\
|
|
523
|
+
as node index 0).
|
|
524
|
+
keep_self: by default, the program will not output streamlines that\
|
|
525
|
+
connect to the same node at both ends. Set this option to instead keep\
|
|
526
|
+
these self-connections.
|
|
527
|
+
tck_weights_in: specify a text scalar file containing the streamline\
|
|
528
|
+
weights.
|
|
529
|
+
prefix_tck_weights_out: provide a prefix for outputting a text file\
|
|
530
|
+
corresponding to each output file, each containing only the streamline\
|
|
531
|
+
weights relevant for that track file.
|
|
532
|
+
info: display information messages.
|
|
533
|
+
quiet: do not display information messages or progress status;\
|
|
534
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
535
|
+
environment variable to a non-empty string.
|
|
536
|
+
debug: display debugging messages.
|
|
537
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
538
|
+
input and output might cause unexpected behaviour).
|
|
539
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
540
|
+
(set to 0 to disable multi-threading).
|
|
541
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
542
|
+
help_: display this information page and exit.
|
|
543
|
+
version: display version information and exit.
|
|
544
|
+
runner: Command runner.
|
|
545
|
+
Returns:
|
|
546
|
+
NamedTuple of outputs (described in `Connectome2tckOutputs`).
|
|
547
|
+
"""
|
|
548
|
+
params = connectome2tck_params(
|
|
549
|
+
nodes=nodes,
|
|
550
|
+
exclusive=exclusive,
|
|
551
|
+
files=files,
|
|
552
|
+
exemplars=exemplars,
|
|
553
|
+
keep_unassigned=keep_unassigned,
|
|
554
|
+
keep_self=keep_self,
|
|
555
|
+
tck_weights_in=tck_weights_in,
|
|
556
|
+
prefix_tck_weights_out=prefix_tck_weights_out,
|
|
557
|
+
info=info,
|
|
558
|
+
quiet=quiet,
|
|
559
|
+
debug=debug,
|
|
560
|
+
force=force,
|
|
561
|
+
nthreads=nthreads,
|
|
562
|
+
config=config,
|
|
563
|
+
help_=help_,
|
|
564
|
+
version=version,
|
|
565
|
+
tracks_in=tracks_in,
|
|
566
|
+
assignments_in=assignments_in,
|
|
567
|
+
prefix_out=prefix_out,
|
|
568
|
+
)
|
|
569
|
+
return connectome2tck_execute(params, runner)
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
__all__ = [
|
|
573
|
+
"CONNECTOME2TCK_METADATA",
|
|
574
|
+
"Connectome2tckConfigParamsDict",
|
|
575
|
+
"Connectome2tckConfigParamsDictTagged",
|
|
576
|
+
"Connectome2tckOutputs",
|
|
577
|
+
"Connectome2tckParamsDict",
|
|
578
|
+
"Connectome2tckParamsDictTagged",
|
|
579
|
+
"connectome2tck",
|
|
580
|
+
"connectome2tck_config",
|
|
581
|
+
"connectome2tck_execute",
|
|
582
|
+
"connectome2tck_params",
|
|
583
|
+
]
|