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,1478 @@
|
|
|
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
|
+
TCKEDIT_METADATA = Metadata(
|
|
9
|
+
id="8969d0b343f6f6903fb3ca1d150899aafd2fdca5.boutiques",
|
|
10
|
+
name="tckedit",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_TckeditVariousStringParamsDictNoTag = typing.TypedDict('_TckeditVariousStringParamsDictNoTag', {
|
|
17
|
+
"obj": str,
|
|
18
|
+
})
|
|
19
|
+
TckeditVariousStringParamsDictTagged = typing.TypedDict('TckeditVariousStringParamsDictTagged', {
|
|
20
|
+
"@type": typing.Literal["VariousString"],
|
|
21
|
+
"obj": str,
|
|
22
|
+
})
|
|
23
|
+
TckeditVariousStringParamsDict = _TckeditVariousStringParamsDictNoTag | TckeditVariousStringParamsDictTagged
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
_TckeditVariousFileParamsDictNoTag = typing.TypedDict('_TckeditVariousFileParamsDictNoTag', {
|
|
27
|
+
"obj": InputPathType,
|
|
28
|
+
})
|
|
29
|
+
TckeditVariousFileParamsDictTagged = typing.TypedDict('TckeditVariousFileParamsDictTagged', {
|
|
30
|
+
"@type": typing.Literal["VariousFile"],
|
|
31
|
+
"obj": InputPathType,
|
|
32
|
+
})
|
|
33
|
+
TckeditVariousFileParamsDict = _TckeditVariousFileParamsDictNoTag | TckeditVariousFileParamsDictTagged
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
_TckeditIncludeParamsDictNoTag = typing.TypedDict('_TckeditIncludeParamsDictNoTag', {
|
|
37
|
+
"spec": typing.Union[TckeditVariousStringParamsDictTagged, TckeditVariousFileParamsDictTagged],
|
|
38
|
+
})
|
|
39
|
+
TckeditIncludeParamsDictTagged = typing.TypedDict('TckeditIncludeParamsDictTagged', {
|
|
40
|
+
"@type": typing.Literal["include"],
|
|
41
|
+
"spec": typing.Union[TckeditVariousStringParamsDictTagged, TckeditVariousFileParamsDictTagged],
|
|
42
|
+
})
|
|
43
|
+
TckeditIncludeParamsDict = _TckeditIncludeParamsDictNoTag | TckeditIncludeParamsDictTagged
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
_TckeditIncludeOrderedParamsDictNoTag = typing.TypedDict('_TckeditIncludeOrderedParamsDictNoTag', {
|
|
47
|
+
"image": str,
|
|
48
|
+
})
|
|
49
|
+
TckeditIncludeOrderedParamsDictTagged = typing.TypedDict('TckeditIncludeOrderedParamsDictTagged', {
|
|
50
|
+
"@type": typing.Literal["include_ordered"],
|
|
51
|
+
"image": str,
|
|
52
|
+
})
|
|
53
|
+
TckeditIncludeOrderedParamsDict = _TckeditIncludeOrderedParamsDictNoTag | TckeditIncludeOrderedParamsDictTagged
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
_TckeditVariousString1ParamsDictNoTag = typing.TypedDict('_TckeditVariousString1ParamsDictNoTag', {
|
|
57
|
+
"obj": str,
|
|
58
|
+
})
|
|
59
|
+
TckeditVariousString1ParamsDictTagged = typing.TypedDict('TckeditVariousString1ParamsDictTagged', {
|
|
60
|
+
"@type": typing.Literal["VariousString_1"],
|
|
61
|
+
"obj": str,
|
|
62
|
+
})
|
|
63
|
+
TckeditVariousString1ParamsDict = _TckeditVariousString1ParamsDictNoTag | TckeditVariousString1ParamsDictTagged
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
_TckeditVariousFile1ParamsDictNoTag = typing.TypedDict('_TckeditVariousFile1ParamsDictNoTag', {
|
|
67
|
+
"obj": InputPathType,
|
|
68
|
+
})
|
|
69
|
+
TckeditVariousFile1ParamsDictTagged = typing.TypedDict('TckeditVariousFile1ParamsDictTagged', {
|
|
70
|
+
"@type": typing.Literal["VariousFile_1"],
|
|
71
|
+
"obj": InputPathType,
|
|
72
|
+
})
|
|
73
|
+
TckeditVariousFile1ParamsDict = _TckeditVariousFile1ParamsDictNoTag | TckeditVariousFile1ParamsDictTagged
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
_TckeditExcludeParamsDictNoTag = typing.TypedDict('_TckeditExcludeParamsDictNoTag', {
|
|
77
|
+
"spec": typing.Union[TckeditVariousString1ParamsDictTagged, TckeditVariousFile1ParamsDictTagged],
|
|
78
|
+
})
|
|
79
|
+
TckeditExcludeParamsDictTagged = typing.TypedDict('TckeditExcludeParamsDictTagged', {
|
|
80
|
+
"@type": typing.Literal["exclude"],
|
|
81
|
+
"spec": typing.Union[TckeditVariousString1ParamsDictTagged, TckeditVariousFile1ParamsDictTagged],
|
|
82
|
+
})
|
|
83
|
+
TckeditExcludeParamsDict = _TckeditExcludeParamsDictNoTag | TckeditExcludeParamsDictTagged
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
_TckeditVariousString2ParamsDictNoTag = typing.TypedDict('_TckeditVariousString2ParamsDictNoTag', {
|
|
87
|
+
"obj": str,
|
|
88
|
+
})
|
|
89
|
+
TckeditVariousString2ParamsDictTagged = typing.TypedDict('TckeditVariousString2ParamsDictTagged', {
|
|
90
|
+
"@type": typing.Literal["VariousString_2"],
|
|
91
|
+
"obj": str,
|
|
92
|
+
})
|
|
93
|
+
TckeditVariousString2ParamsDict = _TckeditVariousString2ParamsDictNoTag | TckeditVariousString2ParamsDictTagged
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
_TckeditVariousFile2ParamsDictNoTag = typing.TypedDict('_TckeditVariousFile2ParamsDictNoTag', {
|
|
97
|
+
"obj": InputPathType,
|
|
98
|
+
})
|
|
99
|
+
TckeditVariousFile2ParamsDictTagged = typing.TypedDict('TckeditVariousFile2ParamsDictTagged', {
|
|
100
|
+
"@type": typing.Literal["VariousFile_2"],
|
|
101
|
+
"obj": InputPathType,
|
|
102
|
+
})
|
|
103
|
+
TckeditVariousFile2ParamsDict = _TckeditVariousFile2ParamsDictNoTag | TckeditVariousFile2ParamsDictTagged
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
_TckeditMaskParamsDictNoTag = typing.TypedDict('_TckeditMaskParamsDictNoTag', {
|
|
107
|
+
"spec": typing.Union[TckeditVariousString2ParamsDictTagged, TckeditVariousFile2ParamsDictTagged],
|
|
108
|
+
})
|
|
109
|
+
TckeditMaskParamsDictTagged = typing.TypedDict('TckeditMaskParamsDictTagged', {
|
|
110
|
+
"@type": typing.Literal["mask"],
|
|
111
|
+
"spec": typing.Union[TckeditVariousString2ParamsDictTagged, TckeditVariousFile2ParamsDictTagged],
|
|
112
|
+
})
|
|
113
|
+
TckeditMaskParamsDict = _TckeditMaskParamsDictNoTag | TckeditMaskParamsDictTagged
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
_TckeditConfigParamsDictNoTag = typing.TypedDict('_TckeditConfigParamsDictNoTag', {
|
|
117
|
+
"key": str,
|
|
118
|
+
"value": str,
|
|
119
|
+
})
|
|
120
|
+
TckeditConfigParamsDictTagged = typing.TypedDict('TckeditConfigParamsDictTagged', {
|
|
121
|
+
"@type": typing.Literal["config"],
|
|
122
|
+
"key": str,
|
|
123
|
+
"value": str,
|
|
124
|
+
})
|
|
125
|
+
TckeditConfigParamsDict = _TckeditConfigParamsDictNoTag | TckeditConfigParamsDictTagged
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
_TckeditParamsDictNoTag = typing.TypedDict('_TckeditParamsDictNoTag', {
|
|
129
|
+
"include": typing.NotRequired[list[TckeditIncludeParamsDict] | None],
|
|
130
|
+
"include_ordered": typing.NotRequired[list[TckeditIncludeOrderedParamsDict] | None],
|
|
131
|
+
"exclude": typing.NotRequired[list[TckeditExcludeParamsDict] | None],
|
|
132
|
+
"mask": typing.NotRequired[list[TckeditMaskParamsDict] | None],
|
|
133
|
+
"maxlength": typing.NotRequired[float | None],
|
|
134
|
+
"minlength": typing.NotRequired[float | None],
|
|
135
|
+
"number": typing.NotRequired[int | None],
|
|
136
|
+
"skip": typing.NotRequired[int | None],
|
|
137
|
+
"maxweight": typing.NotRequired[float | None],
|
|
138
|
+
"minweight": typing.NotRequired[float | None],
|
|
139
|
+
"inverse": bool,
|
|
140
|
+
"ends_only": bool,
|
|
141
|
+
"tck_weights_in": typing.NotRequired[InputPathType | None],
|
|
142
|
+
"tck_weights_out": typing.NotRequired[str | None],
|
|
143
|
+
"info": bool,
|
|
144
|
+
"quiet": bool,
|
|
145
|
+
"debug": bool,
|
|
146
|
+
"force": bool,
|
|
147
|
+
"nthreads": typing.NotRequired[int | None],
|
|
148
|
+
"config": typing.NotRequired[list[TckeditConfigParamsDict] | None],
|
|
149
|
+
"help": bool,
|
|
150
|
+
"version": bool,
|
|
151
|
+
"tracks_in": list[InputPathType],
|
|
152
|
+
"tracks_out": str,
|
|
153
|
+
})
|
|
154
|
+
TckeditParamsDictTagged = typing.TypedDict('TckeditParamsDictTagged', {
|
|
155
|
+
"@type": typing.Literal["mrtrix/tckedit"],
|
|
156
|
+
"include": typing.NotRequired[list[TckeditIncludeParamsDict] | None],
|
|
157
|
+
"include_ordered": typing.NotRequired[list[TckeditIncludeOrderedParamsDict] | None],
|
|
158
|
+
"exclude": typing.NotRequired[list[TckeditExcludeParamsDict] | None],
|
|
159
|
+
"mask": typing.NotRequired[list[TckeditMaskParamsDict] | None],
|
|
160
|
+
"maxlength": typing.NotRequired[float | None],
|
|
161
|
+
"minlength": typing.NotRequired[float | None],
|
|
162
|
+
"number": typing.NotRequired[int | None],
|
|
163
|
+
"skip": typing.NotRequired[int | None],
|
|
164
|
+
"maxweight": typing.NotRequired[float | None],
|
|
165
|
+
"minweight": typing.NotRequired[float | None],
|
|
166
|
+
"inverse": bool,
|
|
167
|
+
"ends_only": bool,
|
|
168
|
+
"tck_weights_in": typing.NotRequired[InputPathType | None],
|
|
169
|
+
"tck_weights_out": typing.NotRequired[str | None],
|
|
170
|
+
"info": bool,
|
|
171
|
+
"quiet": bool,
|
|
172
|
+
"debug": bool,
|
|
173
|
+
"force": bool,
|
|
174
|
+
"nthreads": typing.NotRequired[int | None],
|
|
175
|
+
"config": typing.NotRequired[list[TckeditConfigParamsDict] | None],
|
|
176
|
+
"help": bool,
|
|
177
|
+
"version": bool,
|
|
178
|
+
"tracks_in": list[InputPathType],
|
|
179
|
+
"tracks_out": str,
|
|
180
|
+
})
|
|
181
|
+
TckeditParamsDict = _TckeditParamsDictNoTag | TckeditParamsDictTagged
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def tckedit_spec_cargs_dyn_fn(
|
|
185
|
+
t: str,
|
|
186
|
+
) -> typing.Any:
|
|
187
|
+
"""
|
|
188
|
+
Get build cargs function by command type.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
t: Command type.
|
|
192
|
+
Returns:
|
|
193
|
+
Build cargs function.
|
|
194
|
+
"""
|
|
195
|
+
return {
|
|
196
|
+
"VariousString": tckedit_various_string_cargs,
|
|
197
|
+
"VariousFile": tckedit_various_file_cargs,
|
|
198
|
+
}.get(t)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def tckedit_spec_validate_dyn_fn(
|
|
202
|
+
t: str,
|
|
203
|
+
) -> typing.Any:
|
|
204
|
+
"""
|
|
205
|
+
Get validate params function by command type.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
t: Command type.
|
|
209
|
+
Returns:
|
|
210
|
+
Validate params function.
|
|
211
|
+
"""
|
|
212
|
+
return {
|
|
213
|
+
"VariousString": tckedit_various_string_validate,
|
|
214
|
+
"VariousFile": tckedit_various_file_validate,
|
|
215
|
+
}.get(t)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def tckedit_spec_cargs_dyn_fn_(
|
|
219
|
+
t: str,
|
|
220
|
+
) -> typing.Any:
|
|
221
|
+
"""
|
|
222
|
+
Get build cargs function by command type.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
t: Command type.
|
|
226
|
+
Returns:
|
|
227
|
+
Build cargs function.
|
|
228
|
+
"""
|
|
229
|
+
return {
|
|
230
|
+
"VariousString_1": tckedit_various_string_1_cargs,
|
|
231
|
+
"VariousFile_1": tckedit_various_file_1_cargs,
|
|
232
|
+
}.get(t)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def tckedit_spec_validate_dyn_fn_(
|
|
236
|
+
t: str,
|
|
237
|
+
) -> typing.Any:
|
|
238
|
+
"""
|
|
239
|
+
Get validate params function by command type.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
t: Command type.
|
|
243
|
+
Returns:
|
|
244
|
+
Validate params function.
|
|
245
|
+
"""
|
|
246
|
+
return {
|
|
247
|
+
"VariousString_1": tckedit_various_string_1_validate,
|
|
248
|
+
"VariousFile_1": tckedit_various_file_1_validate,
|
|
249
|
+
}.get(t)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def tckedit_spec_cargs_dyn_fn_2(
|
|
253
|
+
t: str,
|
|
254
|
+
) -> typing.Any:
|
|
255
|
+
"""
|
|
256
|
+
Get build cargs function by command type.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
t: Command type.
|
|
260
|
+
Returns:
|
|
261
|
+
Build cargs function.
|
|
262
|
+
"""
|
|
263
|
+
return {
|
|
264
|
+
"VariousString_2": tckedit_various_string_2_cargs,
|
|
265
|
+
"VariousFile_2": tckedit_various_file_2_cargs,
|
|
266
|
+
}.get(t)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def tckedit_spec_validate_dyn_fn_2(
|
|
270
|
+
t: str,
|
|
271
|
+
) -> typing.Any:
|
|
272
|
+
"""
|
|
273
|
+
Get validate params function by command type.
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
t: Command type.
|
|
277
|
+
Returns:
|
|
278
|
+
Validate params function.
|
|
279
|
+
"""
|
|
280
|
+
return {
|
|
281
|
+
"VariousString_2": tckedit_various_string_2_validate,
|
|
282
|
+
"VariousFile_2": tckedit_various_file_2_validate,
|
|
283
|
+
}.get(t)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
def tckedit_various_string(
|
|
287
|
+
obj: str,
|
|
288
|
+
) -> TckeditVariousStringParamsDictTagged:
|
|
289
|
+
"""
|
|
290
|
+
Build parameters.
|
|
291
|
+
|
|
292
|
+
Args:
|
|
293
|
+
obj: String object.
|
|
294
|
+
Returns:
|
|
295
|
+
Parameter dictionary
|
|
296
|
+
"""
|
|
297
|
+
params = {
|
|
298
|
+
"@type": "VariousString",
|
|
299
|
+
"obj": obj,
|
|
300
|
+
}
|
|
301
|
+
return params
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def tckedit_various_string_validate(
|
|
305
|
+
params: typing.Any,
|
|
306
|
+
) -> None:
|
|
307
|
+
"""
|
|
308
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
309
|
+
`TckeditVariousStringParamsDict` object.
|
|
310
|
+
|
|
311
|
+
Args:
|
|
312
|
+
params: The parameters object to validate.
|
|
313
|
+
"""
|
|
314
|
+
if params is None or not isinstance(params, dict):
|
|
315
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
316
|
+
if params.get("obj", None) is None:
|
|
317
|
+
raise StyxValidationError("`obj` must not be None")
|
|
318
|
+
if not isinstance(params["obj"], str):
|
|
319
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `str`')
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def tckedit_various_string_cargs(
|
|
323
|
+
params: TckeditVariousStringParamsDict,
|
|
324
|
+
execution: Execution,
|
|
325
|
+
) -> list[str]:
|
|
326
|
+
"""
|
|
327
|
+
Build command-line arguments from parameters.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
params: The parameters.
|
|
331
|
+
execution: The execution object for resolving input paths.
|
|
332
|
+
Returns:
|
|
333
|
+
Command-line arguments.
|
|
334
|
+
"""
|
|
335
|
+
cargs = []
|
|
336
|
+
cargs.append(params.get("obj", None))
|
|
337
|
+
return cargs
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def tckedit_various_file(
|
|
341
|
+
obj: InputPathType,
|
|
342
|
+
) -> TckeditVariousFileParamsDictTagged:
|
|
343
|
+
"""
|
|
344
|
+
Build parameters.
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
obj: File object.
|
|
348
|
+
Returns:
|
|
349
|
+
Parameter dictionary
|
|
350
|
+
"""
|
|
351
|
+
params = {
|
|
352
|
+
"@type": "VariousFile",
|
|
353
|
+
"obj": obj,
|
|
354
|
+
}
|
|
355
|
+
return params
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def tckedit_various_file_validate(
|
|
359
|
+
params: typing.Any,
|
|
360
|
+
) -> None:
|
|
361
|
+
"""
|
|
362
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
363
|
+
`TckeditVariousFileParamsDict` object.
|
|
364
|
+
|
|
365
|
+
Args:
|
|
366
|
+
params: The parameters object to validate.
|
|
367
|
+
"""
|
|
368
|
+
if params is None or not isinstance(params, dict):
|
|
369
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
370
|
+
if params.get("obj", None) is None:
|
|
371
|
+
raise StyxValidationError("`obj` must not be None")
|
|
372
|
+
if not isinstance(params["obj"], (pathlib.Path, str)):
|
|
373
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `InputPathType`')
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def tckedit_various_file_cargs(
|
|
377
|
+
params: TckeditVariousFileParamsDict,
|
|
378
|
+
execution: Execution,
|
|
379
|
+
) -> list[str]:
|
|
380
|
+
"""
|
|
381
|
+
Build command-line arguments from parameters.
|
|
382
|
+
|
|
383
|
+
Args:
|
|
384
|
+
params: The parameters.
|
|
385
|
+
execution: The execution object for resolving input paths.
|
|
386
|
+
Returns:
|
|
387
|
+
Command-line arguments.
|
|
388
|
+
"""
|
|
389
|
+
cargs = []
|
|
390
|
+
cargs.append(execution.input_file(params.get("obj", None)))
|
|
391
|
+
return cargs
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
def tckedit_include(
|
|
395
|
+
spec: typing.Union[TckeditVariousStringParamsDictTagged, TckeditVariousFileParamsDictTagged],
|
|
396
|
+
) -> TckeditIncludeParamsDictTagged:
|
|
397
|
+
"""
|
|
398
|
+
Build parameters.
|
|
399
|
+
|
|
400
|
+
Args:
|
|
401
|
+
spec: specify an inclusion region of interest, as either a binary mask\
|
|
402
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius).\
|
|
403
|
+
Streamlines must traverse ALL inclusion regions to be accepted.
|
|
404
|
+
Returns:
|
|
405
|
+
Parameter dictionary
|
|
406
|
+
"""
|
|
407
|
+
params = {
|
|
408
|
+
"@type": "include",
|
|
409
|
+
"spec": spec,
|
|
410
|
+
}
|
|
411
|
+
return params
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
def tckedit_include_validate(
|
|
415
|
+
params: typing.Any,
|
|
416
|
+
) -> None:
|
|
417
|
+
"""
|
|
418
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
419
|
+
`TckeditIncludeParamsDict` object.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
params: The parameters object to validate.
|
|
423
|
+
"""
|
|
424
|
+
if params is None or not isinstance(params, dict):
|
|
425
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
426
|
+
if params.get("spec", None) is None:
|
|
427
|
+
raise StyxValidationError("`spec` must not be None")
|
|
428
|
+
if not isinstance(params["spec"], dict):
|
|
429
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params["spec"])}\'')
|
|
430
|
+
if "@type" not in params["spec"]:
|
|
431
|
+
raise StyxValidationError("Params object is missing `@type`")
|
|
432
|
+
if params["spec"]["@type"] not in ["VariousString", "VariousFile"]:
|
|
433
|
+
raise StyxValidationError("Parameter `spec`s `@type` must be one of [\"VariousString\", \"VariousFile\"]")
|
|
434
|
+
tckedit_spec_validate_dyn_fn(params["spec"]["@type"])(params["spec"])
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
def tckedit_include_cargs(
|
|
438
|
+
params: TckeditIncludeParamsDict,
|
|
439
|
+
execution: Execution,
|
|
440
|
+
) -> list[str]:
|
|
441
|
+
"""
|
|
442
|
+
Build command-line arguments from parameters.
|
|
443
|
+
|
|
444
|
+
Args:
|
|
445
|
+
params: The parameters.
|
|
446
|
+
execution: The execution object for resolving input paths.
|
|
447
|
+
Returns:
|
|
448
|
+
Command-line arguments.
|
|
449
|
+
"""
|
|
450
|
+
cargs = []
|
|
451
|
+
cargs.append("-include")
|
|
452
|
+
cargs.extend(tckedit_spec_cargs_dyn_fn(params.get("spec", None)["@type"])(params.get("spec", None), execution))
|
|
453
|
+
return cargs
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def tckedit_include_ordered(
|
|
457
|
+
image: str,
|
|
458
|
+
) -> TckeditIncludeOrderedParamsDictTagged:
|
|
459
|
+
"""
|
|
460
|
+
Build parameters.
|
|
461
|
+
|
|
462
|
+
Args:
|
|
463
|
+
image: specify an inclusion region of interest, as either a binary mask\
|
|
464
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius).\
|
|
465
|
+
Streamlines must traverse ALL inclusion_ordered regions in the order\
|
|
466
|
+
they are specified in order to be accepted.
|
|
467
|
+
Returns:
|
|
468
|
+
Parameter dictionary
|
|
469
|
+
"""
|
|
470
|
+
params = {
|
|
471
|
+
"@type": "include_ordered",
|
|
472
|
+
"image": image,
|
|
473
|
+
}
|
|
474
|
+
return params
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def tckedit_include_ordered_validate(
|
|
478
|
+
params: typing.Any,
|
|
479
|
+
) -> None:
|
|
480
|
+
"""
|
|
481
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
482
|
+
`TckeditIncludeOrderedParamsDict` object.
|
|
483
|
+
|
|
484
|
+
Args:
|
|
485
|
+
params: The parameters object to validate.
|
|
486
|
+
"""
|
|
487
|
+
if params is None or not isinstance(params, dict):
|
|
488
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
489
|
+
if params.get("image", None) is None:
|
|
490
|
+
raise StyxValidationError("`image` must not be None")
|
|
491
|
+
if not isinstance(params["image"], str):
|
|
492
|
+
raise StyxValidationError(f'`image` has the wrong type: Received `{type(params.get("image", None))}` expected `str`')
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
def tckedit_include_ordered_cargs(
|
|
496
|
+
params: TckeditIncludeOrderedParamsDict,
|
|
497
|
+
execution: Execution,
|
|
498
|
+
) -> list[str]:
|
|
499
|
+
"""
|
|
500
|
+
Build command-line arguments from parameters.
|
|
501
|
+
|
|
502
|
+
Args:
|
|
503
|
+
params: The parameters.
|
|
504
|
+
execution: The execution object for resolving input paths.
|
|
505
|
+
Returns:
|
|
506
|
+
Command-line arguments.
|
|
507
|
+
"""
|
|
508
|
+
cargs = []
|
|
509
|
+
cargs.append("-include_ordered")
|
|
510
|
+
cargs.append(params.get("image", None))
|
|
511
|
+
return cargs
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def tckedit_various_string_1(
|
|
515
|
+
obj: str,
|
|
516
|
+
) -> TckeditVariousString1ParamsDictTagged:
|
|
517
|
+
"""
|
|
518
|
+
Build parameters.
|
|
519
|
+
|
|
520
|
+
Args:
|
|
521
|
+
obj: String object.
|
|
522
|
+
Returns:
|
|
523
|
+
Parameter dictionary
|
|
524
|
+
"""
|
|
525
|
+
params = {
|
|
526
|
+
"@type": "VariousString_1",
|
|
527
|
+
"obj": obj,
|
|
528
|
+
}
|
|
529
|
+
return params
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
def tckedit_various_string_1_validate(
|
|
533
|
+
params: typing.Any,
|
|
534
|
+
) -> None:
|
|
535
|
+
"""
|
|
536
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
537
|
+
`TckeditVariousString1ParamsDict` object.
|
|
538
|
+
|
|
539
|
+
Args:
|
|
540
|
+
params: The parameters object to validate.
|
|
541
|
+
"""
|
|
542
|
+
if params is None or not isinstance(params, dict):
|
|
543
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
544
|
+
if params.get("obj", None) is None:
|
|
545
|
+
raise StyxValidationError("`obj` must not be None")
|
|
546
|
+
if not isinstance(params["obj"], str):
|
|
547
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `str`')
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def tckedit_various_string_1_cargs(
|
|
551
|
+
params: TckeditVariousString1ParamsDict,
|
|
552
|
+
execution: Execution,
|
|
553
|
+
) -> list[str]:
|
|
554
|
+
"""
|
|
555
|
+
Build command-line arguments from parameters.
|
|
556
|
+
|
|
557
|
+
Args:
|
|
558
|
+
params: The parameters.
|
|
559
|
+
execution: The execution object for resolving input paths.
|
|
560
|
+
Returns:
|
|
561
|
+
Command-line arguments.
|
|
562
|
+
"""
|
|
563
|
+
cargs = []
|
|
564
|
+
cargs.append(params.get("obj", None))
|
|
565
|
+
return cargs
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
def tckedit_various_file_1(
|
|
569
|
+
obj: InputPathType,
|
|
570
|
+
) -> TckeditVariousFile1ParamsDictTagged:
|
|
571
|
+
"""
|
|
572
|
+
Build parameters.
|
|
573
|
+
|
|
574
|
+
Args:
|
|
575
|
+
obj: File object.
|
|
576
|
+
Returns:
|
|
577
|
+
Parameter dictionary
|
|
578
|
+
"""
|
|
579
|
+
params = {
|
|
580
|
+
"@type": "VariousFile_1",
|
|
581
|
+
"obj": obj,
|
|
582
|
+
}
|
|
583
|
+
return params
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def tckedit_various_file_1_validate(
|
|
587
|
+
params: typing.Any,
|
|
588
|
+
) -> None:
|
|
589
|
+
"""
|
|
590
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
591
|
+
`TckeditVariousFile1ParamsDict` object.
|
|
592
|
+
|
|
593
|
+
Args:
|
|
594
|
+
params: The parameters object to validate.
|
|
595
|
+
"""
|
|
596
|
+
if params is None or not isinstance(params, dict):
|
|
597
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
598
|
+
if params.get("obj", None) is None:
|
|
599
|
+
raise StyxValidationError("`obj` must not be None")
|
|
600
|
+
if not isinstance(params["obj"], (pathlib.Path, str)):
|
|
601
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `InputPathType`')
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def tckedit_various_file_1_cargs(
|
|
605
|
+
params: TckeditVariousFile1ParamsDict,
|
|
606
|
+
execution: Execution,
|
|
607
|
+
) -> list[str]:
|
|
608
|
+
"""
|
|
609
|
+
Build command-line arguments from parameters.
|
|
610
|
+
|
|
611
|
+
Args:
|
|
612
|
+
params: The parameters.
|
|
613
|
+
execution: The execution object for resolving input paths.
|
|
614
|
+
Returns:
|
|
615
|
+
Command-line arguments.
|
|
616
|
+
"""
|
|
617
|
+
cargs = []
|
|
618
|
+
cargs.append(execution.input_file(params.get("obj", None)))
|
|
619
|
+
return cargs
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def tckedit_exclude(
|
|
623
|
+
spec: typing.Union[TckeditVariousString1ParamsDictTagged, TckeditVariousFile1ParamsDictTagged],
|
|
624
|
+
) -> TckeditExcludeParamsDictTagged:
|
|
625
|
+
"""
|
|
626
|
+
Build parameters.
|
|
627
|
+
|
|
628
|
+
Args:
|
|
629
|
+
spec: specify an exclusion region of interest, as either a binary mask\
|
|
630
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius).\
|
|
631
|
+
Streamlines that enter ANY exclude region will be discarded.
|
|
632
|
+
Returns:
|
|
633
|
+
Parameter dictionary
|
|
634
|
+
"""
|
|
635
|
+
params = {
|
|
636
|
+
"@type": "exclude",
|
|
637
|
+
"spec": spec,
|
|
638
|
+
}
|
|
639
|
+
return params
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
def tckedit_exclude_validate(
|
|
643
|
+
params: typing.Any,
|
|
644
|
+
) -> None:
|
|
645
|
+
"""
|
|
646
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
647
|
+
`TckeditExcludeParamsDict` object.
|
|
648
|
+
|
|
649
|
+
Args:
|
|
650
|
+
params: The parameters object to validate.
|
|
651
|
+
"""
|
|
652
|
+
if params is None or not isinstance(params, dict):
|
|
653
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
654
|
+
if params.get("spec", None) is None:
|
|
655
|
+
raise StyxValidationError("`spec` must not be None")
|
|
656
|
+
if not isinstance(params["spec"], dict):
|
|
657
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params["spec"])}\'')
|
|
658
|
+
if "@type" not in params["spec"]:
|
|
659
|
+
raise StyxValidationError("Params object is missing `@type`")
|
|
660
|
+
if params["spec"]["@type"] not in ["VariousString_1", "VariousFile_1"]:
|
|
661
|
+
raise StyxValidationError("Parameter `spec`s `@type` must be one of [\"VariousString_1\", \"VariousFile_1\"]")
|
|
662
|
+
tckedit_spec_validate_dyn_fn_(params["spec"]["@type"])(params["spec"])
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
def tckedit_exclude_cargs(
|
|
666
|
+
params: TckeditExcludeParamsDict,
|
|
667
|
+
execution: Execution,
|
|
668
|
+
) -> list[str]:
|
|
669
|
+
"""
|
|
670
|
+
Build command-line arguments from parameters.
|
|
671
|
+
|
|
672
|
+
Args:
|
|
673
|
+
params: The parameters.
|
|
674
|
+
execution: The execution object for resolving input paths.
|
|
675
|
+
Returns:
|
|
676
|
+
Command-line arguments.
|
|
677
|
+
"""
|
|
678
|
+
cargs = []
|
|
679
|
+
cargs.append("-exclude")
|
|
680
|
+
cargs.extend(tckedit_spec_cargs_dyn_fn_(params.get("spec", None)["@type"])(params.get("spec", None), execution))
|
|
681
|
+
return cargs
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
def tckedit_various_string_2(
|
|
685
|
+
obj: str,
|
|
686
|
+
) -> TckeditVariousString2ParamsDictTagged:
|
|
687
|
+
"""
|
|
688
|
+
Build parameters.
|
|
689
|
+
|
|
690
|
+
Args:
|
|
691
|
+
obj: String object.
|
|
692
|
+
Returns:
|
|
693
|
+
Parameter dictionary
|
|
694
|
+
"""
|
|
695
|
+
params = {
|
|
696
|
+
"@type": "VariousString_2",
|
|
697
|
+
"obj": obj,
|
|
698
|
+
}
|
|
699
|
+
return params
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
def tckedit_various_string_2_validate(
|
|
703
|
+
params: typing.Any,
|
|
704
|
+
) -> None:
|
|
705
|
+
"""
|
|
706
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
707
|
+
`TckeditVariousString2ParamsDict` object.
|
|
708
|
+
|
|
709
|
+
Args:
|
|
710
|
+
params: The parameters object to validate.
|
|
711
|
+
"""
|
|
712
|
+
if params is None or not isinstance(params, dict):
|
|
713
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
714
|
+
if params.get("obj", None) is None:
|
|
715
|
+
raise StyxValidationError("`obj` must not be None")
|
|
716
|
+
if not isinstance(params["obj"], str):
|
|
717
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `str`')
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def tckedit_various_string_2_cargs(
|
|
721
|
+
params: TckeditVariousString2ParamsDict,
|
|
722
|
+
execution: Execution,
|
|
723
|
+
) -> list[str]:
|
|
724
|
+
"""
|
|
725
|
+
Build command-line arguments from parameters.
|
|
726
|
+
|
|
727
|
+
Args:
|
|
728
|
+
params: The parameters.
|
|
729
|
+
execution: The execution object for resolving input paths.
|
|
730
|
+
Returns:
|
|
731
|
+
Command-line arguments.
|
|
732
|
+
"""
|
|
733
|
+
cargs = []
|
|
734
|
+
cargs.append(params.get("obj", None))
|
|
735
|
+
return cargs
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
def tckedit_various_file_2(
|
|
739
|
+
obj: InputPathType,
|
|
740
|
+
) -> TckeditVariousFile2ParamsDictTagged:
|
|
741
|
+
"""
|
|
742
|
+
Build parameters.
|
|
743
|
+
|
|
744
|
+
Args:
|
|
745
|
+
obj: File object.
|
|
746
|
+
Returns:
|
|
747
|
+
Parameter dictionary
|
|
748
|
+
"""
|
|
749
|
+
params = {
|
|
750
|
+
"@type": "VariousFile_2",
|
|
751
|
+
"obj": obj,
|
|
752
|
+
}
|
|
753
|
+
return params
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
def tckedit_various_file_2_validate(
|
|
757
|
+
params: typing.Any,
|
|
758
|
+
) -> None:
|
|
759
|
+
"""
|
|
760
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
761
|
+
`TckeditVariousFile2ParamsDict` object.
|
|
762
|
+
|
|
763
|
+
Args:
|
|
764
|
+
params: The parameters object to validate.
|
|
765
|
+
"""
|
|
766
|
+
if params is None or not isinstance(params, dict):
|
|
767
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
768
|
+
if params.get("obj", None) is None:
|
|
769
|
+
raise StyxValidationError("`obj` must not be None")
|
|
770
|
+
if not isinstance(params["obj"], (pathlib.Path, str)):
|
|
771
|
+
raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `InputPathType`')
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
def tckedit_various_file_2_cargs(
|
|
775
|
+
params: TckeditVariousFile2ParamsDict,
|
|
776
|
+
execution: Execution,
|
|
777
|
+
) -> list[str]:
|
|
778
|
+
"""
|
|
779
|
+
Build command-line arguments from parameters.
|
|
780
|
+
|
|
781
|
+
Args:
|
|
782
|
+
params: The parameters.
|
|
783
|
+
execution: The execution object for resolving input paths.
|
|
784
|
+
Returns:
|
|
785
|
+
Command-line arguments.
|
|
786
|
+
"""
|
|
787
|
+
cargs = []
|
|
788
|
+
cargs.append(execution.input_file(params.get("obj", None)))
|
|
789
|
+
return cargs
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
def tckedit_mask(
|
|
793
|
+
spec: typing.Union[TckeditVariousString2ParamsDictTagged, TckeditVariousFile2ParamsDictTagged],
|
|
794
|
+
) -> TckeditMaskParamsDictTagged:
|
|
795
|
+
"""
|
|
796
|
+
Build parameters.
|
|
797
|
+
|
|
798
|
+
Args:
|
|
799
|
+
spec: specify a masking region of interest, as either a binary mask\
|
|
800
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius). If\
|
|
801
|
+
defined, streamlines exiting the mask will be truncated.
|
|
802
|
+
Returns:
|
|
803
|
+
Parameter dictionary
|
|
804
|
+
"""
|
|
805
|
+
params = {
|
|
806
|
+
"@type": "mask",
|
|
807
|
+
"spec": spec,
|
|
808
|
+
}
|
|
809
|
+
return params
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def tckedit_mask_validate(
|
|
813
|
+
params: typing.Any,
|
|
814
|
+
) -> None:
|
|
815
|
+
"""
|
|
816
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
817
|
+
`TckeditMaskParamsDict` object.
|
|
818
|
+
|
|
819
|
+
Args:
|
|
820
|
+
params: The parameters object to validate.
|
|
821
|
+
"""
|
|
822
|
+
if params is None or not isinstance(params, dict):
|
|
823
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
824
|
+
if params.get("spec", None) is None:
|
|
825
|
+
raise StyxValidationError("`spec` must not be None")
|
|
826
|
+
if not isinstance(params["spec"], dict):
|
|
827
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params["spec"])}\'')
|
|
828
|
+
if "@type" not in params["spec"]:
|
|
829
|
+
raise StyxValidationError("Params object is missing `@type`")
|
|
830
|
+
if params["spec"]["@type"] not in ["VariousString_2", "VariousFile_2"]:
|
|
831
|
+
raise StyxValidationError("Parameter `spec`s `@type` must be one of [\"VariousString_2\", \"VariousFile_2\"]")
|
|
832
|
+
tckedit_spec_validate_dyn_fn_2(params["spec"]["@type"])(params["spec"])
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
def tckedit_mask_cargs(
|
|
836
|
+
params: TckeditMaskParamsDict,
|
|
837
|
+
execution: Execution,
|
|
838
|
+
) -> list[str]:
|
|
839
|
+
"""
|
|
840
|
+
Build command-line arguments from parameters.
|
|
841
|
+
|
|
842
|
+
Args:
|
|
843
|
+
params: The parameters.
|
|
844
|
+
execution: The execution object for resolving input paths.
|
|
845
|
+
Returns:
|
|
846
|
+
Command-line arguments.
|
|
847
|
+
"""
|
|
848
|
+
cargs = []
|
|
849
|
+
cargs.append("-mask")
|
|
850
|
+
cargs.extend(tckedit_spec_cargs_dyn_fn_2(params.get("spec", None)["@type"])(params.get("spec", None), execution))
|
|
851
|
+
return cargs
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
def tckedit_config(
|
|
855
|
+
key: str,
|
|
856
|
+
value: str,
|
|
857
|
+
) -> TckeditConfigParamsDictTagged:
|
|
858
|
+
"""
|
|
859
|
+
Build parameters.
|
|
860
|
+
|
|
861
|
+
Args:
|
|
862
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
863
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
864
|
+
Returns:
|
|
865
|
+
Parameter dictionary
|
|
866
|
+
"""
|
|
867
|
+
params = {
|
|
868
|
+
"@type": "config",
|
|
869
|
+
"key": key,
|
|
870
|
+
"value": value,
|
|
871
|
+
}
|
|
872
|
+
return params
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
def tckedit_config_validate(
|
|
876
|
+
params: typing.Any,
|
|
877
|
+
) -> None:
|
|
878
|
+
"""
|
|
879
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
880
|
+
`TckeditConfigParamsDict` object.
|
|
881
|
+
|
|
882
|
+
Args:
|
|
883
|
+
params: The parameters object to validate.
|
|
884
|
+
"""
|
|
885
|
+
if params is None or not isinstance(params, dict):
|
|
886
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
887
|
+
if params.get("key", None) is None:
|
|
888
|
+
raise StyxValidationError("`key` must not be None")
|
|
889
|
+
if not isinstance(params["key"], str):
|
|
890
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
891
|
+
if params.get("value", None) is None:
|
|
892
|
+
raise StyxValidationError("`value` must not be None")
|
|
893
|
+
if not isinstance(params["value"], str):
|
|
894
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
def tckedit_config_cargs(
|
|
898
|
+
params: TckeditConfigParamsDict,
|
|
899
|
+
execution: Execution,
|
|
900
|
+
) -> list[str]:
|
|
901
|
+
"""
|
|
902
|
+
Build command-line arguments from parameters.
|
|
903
|
+
|
|
904
|
+
Args:
|
|
905
|
+
params: The parameters.
|
|
906
|
+
execution: The execution object for resolving input paths.
|
|
907
|
+
Returns:
|
|
908
|
+
Command-line arguments.
|
|
909
|
+
"""
|
|
910
|
+
cargs = []
|
|
911
|
+
cargs.append("-config")
|
|
912
|
+
cargs.append(params.get("key", None))
|
|
913
|
+
cargs.append(params.get("value", None))
|
|
914
|
+
return cargs
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
class TckeditOutputs(typing.NamedTuple):
|
|
918
|
+
"""
|
|
919
|
+
Output object returned when calling `TckeditParamsDict(...)`.
|
|
920
|
+
"""
|
|
921
|
+
root: OutputPathType
|
|
922
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
923
|
+
tracks_out: OutputPathType
|
|
924
|
+
"""the output track file"""
|
|
925
|
+
tck_weights_out: OutputPathType | None
|
|
926
|
+
"""specify the path for an output text scalar file containing streamline
|
|
927
|
+
weights """
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
def tckedit_params(
|
|
931
|
+
tracks_in: list[InputPathType],
|
|
932
|
+
tracks_out: str,
|
|
933
|
+
include: list[TckeditIncludeParamsDict] | None = None,
|
|
934
|
+
include_ordered: list[TckeditIncludeOrderedParamsDict] | None = None,
|
|
935
|
+
exclude: list[TckeditExcludeParamsDict] | None = None,
|
|
936
|
+
mask: list[TckeditMaskParamsDict] | None = None,
|
|
937
|
+
maxlength: float | None = None,
|
|
938
|
+
minlength: float | None = None,
|
|
939
|
+
number: int | None = None,
|
|
940
|
+
skip: int | None = None,
|
|
941
|
+
maxweight: float | None = None,
|
|
942
|
+
minweight: float | None = None,
|
|
943
|
+
inverse: bool = False,
|
|
944
|
+
ends_only: bool = False,
|
|
945
|
+
tck_weights_in: InputPathType | None = None,
|
|
946
|
+
tck_weights_out: str | None = None,
|
|
947
|
+
info: bool = False,
|
|
948
|
+
quiet: bool = False,
|
|
949
|
+
debug: bool = False,
|
|
950
|
+
force: bool = False,
|
|
951
|
+
nthreads: int | None = None,
|
|
952
|
+
config: list[TckeditConfigParamsDict] | None = None,
|
|
953
|
+
help_: bool = False,
|
|
954
|
+
version: bool = False,
|
|
955
|
+
) -> TckeditParamsDictTagged:
|
|
956
|
+
"""
|
|
957
|
+
Build parameters.
|
|
958
|
+
|
|
959
|
+
Args:
|
|
960
|
+
tracks_in: the input track file(s).
|
|
961
|
+
tracks_out: the output track file.
|
|
962
|
+
include: specify an inclusion region of interest, as either a binary\
|
|
963
|
+
mask image, or as a sphere using 4 comma-separared values\
|
|
964
|
+
(x,y,z,radius). Streamlines must traverse ALL inclusion regions to be\
|
|
965
|
+
accepted.
|
|
966
|
+
include_ordered: specify an inclusion region of interest, as either a\
|
|
967
|
+
binary mask image, or as a sphere using 4 comma-separared values\
|
|
968
|
+
(x,y,z,radius). Streamlines must traverse ALL inclusion_ordered regions\
|
|
969
|
+
in the order they are specified in order to be accepted.
|
|
970
|
+
exclude: specify an exclusion region of interest, as either a binary\
|
|
971
|
+
mask image, or as a sphere using 4 comma-separared values\
|
|
972
|
+
(x,y,z,radius). Streamlines that enter ANY exclude region will be\
|
|
973
|
+
discarded.
|
|
974
|
+
mask: specify a masking region of interest, as either a binary mask\
|
|
975
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius). If\
|
|
976
|
+
defined, streamlines exiting the mask will be truncated.
|
|
977
|
+
maxlength: set the maximum length of any streamline in mm.
|
|
978
|
+
minlength: set the minimum length of any streamline in mm.
|
|
979
|
+
number: set the desired number of selected streamlines to be propagated\
|
|
980
|
+
to the output file.
|
|
981
|
+
skip: omit this number of selected streamlines before commencing\
|
|
982
|
+
writing to the output file.
|
|
983
|
+
maxweight: set the maximum weight of any streamline.
|
|
984
|
+
minweight: set the minimum weight of any streamline.
|
|
985
|
+
inverse: output the inverse selection of streamlines based on the\
|
|
986
|
+
criteria provided; i.e. only those streamlines that fail at least one\
|
|
987
|
+
selection criterion, and/or vertices that are outside masks if\
|
|
988
|
+
provided, will be written to file.
|
|
989
|
+
ends_only: only test the ends of each streamline against the provided\
|
|
990
|
+
include/exclude ROIs.
|
|
991
|
+
tck_weights_in: specify a text scalar file containing the streamline\
|
|
992
|
+
weights.
|
|
993
|
+
tck_weights_out: specify the path for an output text scalar file\
|
|
994
|
+
containing streamline weights.
|
|
995
|
+
info: display information messages.
|
|
996
|
+
quiet: do not display information messages or progress status;\
|
|
997
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
998
|
+
environment variable to a non-empty string.
|
|
999
|
+
debug: display debugging messages.
|
|
1000
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
1001
|
+
input and output might cause unexpected behaviour).
|
|
1002
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
1003
|
+
(set to 0 to disable multi-threading).
|
|
1004
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
1005
|
+
help_: display this information page and exit.
|
|
1006
|
+
version: display version information and exit.
|
|
1007
|
+
Returns:
|
|
1008
|
+
Parameter dictionary
|
|
1009
|
+
"""
|
|
1010
|
+
params = {
|
|
1011
|
+
"@type": "mrtrix/tckedit",
|
|
1012
|
+
"inverse": inverse,
|
|
1013
|
+
"ends_only": ends_only,
|
|
1014
|
+
"info": info,
|
|
1015
|
+
"quiet": quiet,
|
|
1016
|
+
"debug": debug,
|
|
1017
|
+
"force": force,
|
|
1018
|
+
"help": help_,
|
|
1019
|
+
"version": version,
|
|
1020
|
+
"tracks_in": tracks_in,
|
|
1021
|
+
"tracks_out": tracks_out,
|
|
1022
|
+
}
|
|
1023
|
+
if include is not None:
|
|
1024
|
+
params["include"] = include
|
|
1025
|
+
if include_ordered is not None:
|
|
1026
|
+
params["include_ordered"] = include_ordered
|
|
1027
|
+
if exclude is not None:
|
|
1028
|
+
params["exclude"] = exclude
|
|
1029
|
+
if mask is not None:
|
|
1030
|
+
params["mask"] = mask
|
|
1031
|
+
if maxlength is not None:
|
|
1032
|
+
params["maxlength"] = maxlength
|
|
1033
|
+
if minlength is not None:
|
|
1034
|
+
params["minlength"] = minlength
|
|
1035
|
+
if number is not None:
|
|
1036
|
+
params["number"] = number
|
|
1037
|
+
if skip is not None:
|
|
1038
|
+
params["skip"] = skip
|
|
1039
|
+
if maxweight is not None:
|
|
1040
|
+
params["maxweight"] = maxweight
|
|
1041
|
+
if minweight is not None:
|
|
1042
|
+
params["minweight"] = minweight
|
|
1043
|
+
if tck_weights_in is not None:
|
|
1044
|
+
params["tck_weights_in"] = tck_weights_in
|
|
1045
|
+
if tck_weights_out is not None:
|
|
1046
|
+
params["tck_weights_out"] = tck_weights_out
|
|
1047
|
+
if nthreads is not None:
|
|
1048
|
+
params["nthreads"] = nthreads
|
|
1049
|
+
if config is not None:
|
|
1050
|
+
params["config"] = config
|
|
1051
|
+
return params
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
def tckedit_validate(
|
|
1055
|
+
params: typing.Any,
|
|
1056
|
+
) -> None:
|
|
1057
|
+
"""
|
|
1058
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
1059
|
+
`TckeditParamsDict` object.
|
|
1060
|
+
|
|
1061
|
+
Args:
|
|
1062
|
+
params: The parameters object to validate.
|
|
1063
|
+
"""
|
|
1064
|
+
if params is None or not isinstance(params, dict):
|
|
1065
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
1066
|
+
if params.get("include", None) is not None:
|
|
1067
|
+
if not isinstance(params["include"], list):
|
|
1068
|
+
raise StyxValidationError(f'`include` has the wrong type: Received `{type(params.get("include", None))}` expected `list[TckeditIncludeParamsDict] | None`')
|
|
1069
|
+
for e in params["include"]:
|
|
1070
|
+
tckedit_include_validate(e)
|
|
1071
|
+
if params.get("include_ordered", None) is not None:
|
|
1072
|
+
if not isinstance(params["include_ordered"], list):
|
|
1073
|
+
raise StyxValidationError(f'`include_ordered` has the wrong type: Received `{type(params.get("include_ordered", None))}` expected `list[TckeditIncludeOrderedParamsDict] | None`')
|
|
1074
|
+
for e in params["include_ordered"]:
|
|
1075
|
+
tckedit_include_ordered_validate(e)
|
|
1076
|
+
if params.get("exclude", None) is not None:
|
|
1077
|
+
if not isinstance(params["exclude"], list):
|
|
1078
|
+
raise StyxValidationError(f'`exclude` has the wrong type: Received `{type(params.get("exclude", None))}` expected `list[TckeditExcludeParamsDict] | None`')
|
|
1079
|
+
for e in params["exclude"]:
|
|
1080
|
+
tckedit_exclude_validate(e)
|
|
1081
|
+
if params.get("mask", None) is not None:
|
|
1082
|
+
if not isinstance(params["mask"], list):
|
|
1083
|
+
raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `list[TckeditMaskParamsDict] | None`')
|
|
1084
|
+
for e in params["mask"]:
|
|
1085
|
+
tckedit_mask_validate(e)
|
|
1086
|
+
if params.get("maxlength", None) is not None:
|
|
1087
|
+
if not isinstance(params["maxlength"], (float, int)):
|
|
1088
|
+
raise StyxValidationError(f'`maxlength` has the wrong type: Received `{type(params.get("maxlength", None))}` expected `float | None`')
|
|
1089
|
+
if params.get("minlength", None) is not None:
|
|
1090
|
+
if not isinstance(params["minlength"], (float, int)):
|
|
1091
|
+
raise StyxValidationError(f'`minlength` has the wrong type: Received `{type(params.get("minlength", None))}` expected `float | None`')
|
|
1092
|
+
if params.get("number", None) is not None:
|
|
1093
|
+
if not isinstance(params["number"], int):
|
|
1094
|
+
raise StyxValidationError(f'`number` has the wrong type: Received `{type(params.get("number", None))}` expected `int | None`')
|
|
1095
|
+
if params.get("skip", None) is not None:
|
|
1096
|
+
if not isinstance(params["skip"], int):
|
|
1097
|
+
raise StyxValidationError(f'`skip` has the wrong type: Received `{type(params.get("skip", None))}` expected `int | None`')
|
|
1098
|
+
if params.get("maxweight", None) is not None:
|
|
1099
|
+
if not isinstance(params["maxweight"], (float, int)):
|
|
1100
|
+
raise StyxValidationError(f'`maxweight` has the wrong type: Received `{type(params.get("maxweight", None))}` expected `float | None`')
|
|
1101
|
+
if params.get("minweight", None) is not None:
|
|
1102
|
+
if not isinstance(params["minweight"], (float, int)):
|
|
1103
|
+
raise StyxValidationError(f'`minweight` has the wrong type: Received `{type(params.get("minweight", None))}` expected `float | None`')
|
|
1104
|
+
if params.get("inverse", False) is None:
|
|
1105
|
+
raise StyxValidationError("`inverse` must not be None")
|
|
1106
|
+
if not isinstance(params["inverse"], bool):
|
|
1107
|
+
raise StyxValidationError(f'`inverse` has the wrong type: Received `{type(params.get("inverse", False))}` expected `bool`')
|
|
1108
|
+
if params.get("ends_only", False) is None:
|
|
1109
|
+
raise StyxValidationError("`ends_only` must not be None")
|
|
1110
|
+
if not isinstance(params["ends_only"], bool):
|
|
1111
|
+
raise StyxValidationError(f'`ends_only` has the wrong type: Received `{type(params.get("ends_only", False))}` expected `bool`')
|
|
1112
|
+
if params.get("tck_weights_in", None) is not None:
|
|
1113
|
+
if not isinstance(params["tck_weights_in"], (pathlib.Path, str)):
|
|
1114
|
+
raise StyxValidationError(f'`tck_weights_in` has the wrong type: Received `{type(params.get("tck_weights_in", None))}` expected `InputPathType | None`')
|
|
1115
|
+
if params.get("tck_weights_out", None) is not None:
|
|
1116
|
+
if not isinstance(params["tck_weights_out"], str):
|
|
1117
|
+
raise StyxValidationError(f'`tck_weights_out` has the wrong type: Received `{type(params.get("tck_weights_out", None))}` expected `str | None`')
|
|
1118
|
+
if params.get("info", False) is None:
|
|
1119
|
+
raise StyxValidationError("`info` must not be None")
|
|
1120
|
+
if not isinstance(params["info"], bool):
|
|
1121
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
1122
|
+
if params.get("quiet", False) is None:
|
|
1123
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
1124
|
+
if not isinstance(params["quiet"], bool):
|
|
1125
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
1126
|
+
if params.get("debug", False) is None:
|
|
1127
|
+
raise StyxValidationError("`debug` must not be None")
|
|
1128
|
+
if not isinstance(params["debug"], bool):
|
|
1129
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
1130
|
+
if params.get("force", False) is None:
|
|
1131
|
+
raise StyxValidationError("`force` must not be None")
|
|
1132
|
+
if not isinstance(params["force"], bool):
|
|
1133
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
1134
|
+
if params.get("nthreads", None) is not None:
|
|
1135
|
+
if not isinstance(params["nthreads"], int):
|
|
1136
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
1137
|
+
if params.get("config", None) is not None:
|
|
1138
|
+
if not isinstance(params["config"], list):
|
|
1139
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[TckeditConfigParamsDict] | None`')
|
|
1140
|
+
for e in params["config"]:
|
|
1141
|
+
tckedit_config_validate(e)
|
|
1142
|
+
if params.get("help", False) is None:
|
|
1143
|
+
raise StyxValidationError("`help` must not be None")
|
|
1144
|
+
if not isinstance(params["help"], bool):
|
|
1145
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
1146
|
+
if params.get("version", False) is None:
|
|
1147
|
+
raise StyxValidationError("`version` must not be None")
|
|
1148
|
+
if not isinstance(params["version"], bool):
|
|
1149
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
1150
|
+
if params.get("tracks_in", None) is None:
|
|
1151
|
+
raise StyxValidationError("`tracks_in` must not be None")
|
|
1152
|
+
if not isinstance(params["tracks_in"], list):
|
|
1153
|
+
raise StyxValidationError(f'`tracks_in` has the wrong type: Received `{type(params.get("tracks_in", None))}` expected `list[InputPathType]`')
|
|
1154
|
+
for e in params["tracks_in"]:
|
|
1155
|
+
if not isinstance(e, (pathlib.Path, str)):
|
|
1156
|
+
raise StyxValidationError(f'`tracks_in` has the wrong type: Received `{type(params.get("tracks_in", None))}` expected `list[InputPathType]`')
|
|
1157
|
+
if params.get("tracks_out", None) is None:
|
|
1158
|
+
raise StyxValidationError("`tracks_out` must not be None")
|
|
1159
|
+
if not isinstance(params["tracks_out"], str):
|
|
1160
|
+
raise StyxValidationError(f'`tracks_out` has the wrong type: Received `{type(params.get("tracks_out", None))}` expected `str`')
|
|
1161
|
+
|
|
1162
|
+
|
|
1163
|
+
def tckedit_cargs(
|
|
1164
|
+
params: TckeditParamsDict,
|
|
1165
|
+
execution: Execution,
|
|
1166
|
+
) -> list[str]:
|
|
1167
|
+
"""
|
|
1168
|
+
Build command-line arguments from parameters.
|
|
1169
|
+
|
|
1170
|
+
Args:
|
|
1171
|
+
params: The parameters.
|
|
1172
|
+
execution: The execution object for resolving input paths.
|
|
1173
|
+
Returns:
|
|
1174
|
+
Command-line arguments.
|
|
1175
|
+
"""
|
|
1176
|
+
cargs = []
|
|
1177
|
+
cargs.append("tckedit")
|
|
1178
|
+
if params.get("include", None) is not None:
|
|
1179
|
+
cargs.extend([a for c in [tckedit_include_cargs(s, execution) for s in params.get("include", None)] for a in c])
|
|
1180
|
+
if params.get("include_ordered", None) is not None:
|
|
1181
|
+
cargs.extend([a for c in [tckedit_include_ordered_cargs(s, execution) for s in params.get("include_ordered", None)] for a in c])
|
|
1182
|
+
if params.get("exclude", None) is not None:
|
|
1183
|
+
cargs.extend([a for c in [tckedit_exclude_cargs(s, execution) for s in params.get("exclude", None)] for a in c])
|
|
1184
|
+
if params.get("mask", None) is not None:
|
|
1185
|
+
cargs.extend([a for c in [tckedit_mask_cargs(s, execution) for s in params.get("mask", None)] for a in c])
|
|
1186
|
+
if params.get("maxlength", None) is not None:
|
|
1187
|
+
cargs.extend([
|
|
1188
|
+
"-maxlength",
|
|
1189
|
+
str(params.get("maxlength", None))
|
|
1190
|
+
])
|
|
1191
|
+
if params.get("minlength", None) is not None:
|
|
1192
|
+
cargs.extend([
|
|
1193
|
+
"-minlength",
|
|
1194
|
+
str(params.get("minlength", None))
|
|
1195
|
+
])
|
|
1196
|
+
if params.get("number", None) is not None:
|
|
1197
|
+
cargs.extend([
|
|
1198
|
+
"-number",
|
|
1199
|
+
str(params.get("number", None))
|
|
1200
|
+
])
|
|
1201
|
+
if params.get("skip", None) is not None:
|
|
1202
|
+
cargs.extend([
|
|
1203
|
+
"-skip",
|
|
1204
|
+
str(params.get("skip", None))
|
|
1205
|
+
])
|
|
1206
|
+
if params.get("maxweight", None) is not None:
|
|
1207
|
+
cargs.extend([
|
|
1208
|
+
"-maxweight",
|
|
1209
|
+
str(params.get("maxweight", None))
|
|
1210
|
+
])
|
|
1211
|
+
if params.get("minweight", None) is not None:
|
|
1212
|
+
cargs.extend([
|
|
1213
|
+
"-minweight",
|
|
1214
|
+
str(params.get("minweight", None))
|
|
1215
|
+
])
|
|
1216
|
+
if params.get("inverse", False):
|
|
1217
|
+
cargs.append("-inverse")
|
|
1218
|
+
if params.get("ends_only", False):
|
|
1219
|
+
cargs.append("-ends_only")
|
|
1220
|
+
if params.get("tck_weights_in", None) is not None:
|
|
1221
|
+
cargs.extend([
|
|
1222
|
+
"-tck_weights_in",
|
|
1223
|
+
execution.input_file(params.get("tck_weights_in", None))
|
|
1224
|
+
])
|
|
1225
|
+
if params.get("tck_weights_out", None) is not None:
|
|
1226
|
+
cargs.extend([
|
|
1227
|
+
"-tck_weights_out",
|
|
1228
|
+
params.get("tck_weights_out", None)
|
|
1229
|
+
])
|
|
1230
|
+
if params.get("info", False):
|
|
1231
|
+
cargs.append("-info")
|
|
1232
|
+
if params.get("quiet", False):
|
|
1233
|
+
cargs.append("-quiet")
|
|
1234
|
+
if params.get("debug", False):
|
|
1235
|
+
cargs.append("-debug")
|
|
1236
|
+
if params.get("force", False):
|
|
1237
|
+
cargs.append("-force")
|
|
1238
|
+
if params.get("nthreads", None) is not None:
|
|
1239
|
+
cargs.extend([
|
|
1240
|
+
"-nthreads",
|
|
1241
|
+
str(params.get("nthreads", None))
|
|
1242
|
+
])
|
|
1243
|
+
if params.get("config", None) is not None:
|
|
1244
|
+
cargs.extend([a for c in [tckedit_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
1245
|
+
if params.get("help", False):
|
|
1246
|
+
cargs.append("-help")
|
|
1247
|
+
if params.get("version", False):
|
|
1248
|
+
cargs.append("-version")
|
|
1249
|
+
cargs.extend([execution.input_file(f) for f in params.get("tracks_in", None)])
|
|
1250
|
+
cargs.append(params.get("tracks_out", None))
|
|
1251
|
+
return cargs
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
def tckedit_outputs(
|
|
1255
|
+
params: TckeditParamsDict,
|
|
1256
|
+
execution: Execution,
|
|
1257
|
+
) -> TckeditOutputs:
|
|
1258
|
+
"""
|
|
1259
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
1260
|
+
|
|
1261
|
+
Args:
|
|
1262
|
+
params: The parameters.
|
|
1263
|
+
execution: The execution object for resolving input paths.
|
|
1264
|
+
Returns:
|
|
1265
|
+
Outputs object.
|
|
1266
|
+
"""
|
|
1267
|
+
ret = TckeditOutputs(
|
|
1268
|
+
root=execution.output_file("."),
|
|
1269
|
+
tracks_out=execution.output_file(params.get("tracks_out", None)),
|
|
1270
|
+
tck_weights_out=execution.output_file(params.get("tck_weights_out", None)) if (params.get("tck_weights_out") is not None) else None,
|
|
1271
|
+
)
|
|
1272
|
+
return ret
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
def tckedit_execute(
|
|
1276
|
+
params: TckeditParamsDict,
|
|
1277
|
+
runner: Runner | None = None,
|
|
1278
|
+
) -> TckeditOutputs:
|
|
1279
|
+
"""
|
|
1280
|
+
tckedit
|
|
1281
|
+
|
|
1282
|
+
Perform various editing operations on track files.
|
|
1283
|
+
|
|
1284
|
+
This command can be used to perform various types of manipulations on track
|
|
1285
|
+
data. A range of such manipulations are demonstrated in the examples
|
|
1286
|
+
provided below.
|
|
1287
|
+
|
|
1288
|
+
References:
|
|
1289
|
+
|
|
1290
|
+
.
|
|
1291
|
+
|
|
1292
|
+
Author: MRTrix3 Developers
|
|
1293
|
+
|
|
1294
|
+
URL: https://www.mrtrix.org/
|
|
1295
|
+
|
|
1296
|
+
Args:
|
|
1297
|
+
params: The parameters.
|
|
1298
|
+
runner: Command runner.
|
|
1299
|
+
Returns:
|
|
1300
|
+
NamedTuple of outputs (described in `TckeditOutputs`).
|
|
1301
|
+
"""
|
|
1302
|
+
tckedit_validate(params)
|
|
1303
|
+
runner = runner or get_global_runner()
|
|
1304
|
+
execution = runner.start_execution(TCKEDIT_METADATA)
|
|
1305
|
+
params = execution.params(params)
|
|
1306
|
+
cargs = tckedit_cargs(params, execution)
|
|
1307
|
+
ret = tckedit_outputs(params, execution)
|
|
1308
|
+
execution.run(cargs)
|
|
1309
|
+
return ret
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
def tckedit(
|
|
1313
|
+
tracks_in: list[InputPathType],
|
|
1314
|
+
tracks_out: str,
|
|
1315
|
+
include: list[TckeditIncludeParamsDict] | None = None,
|
|
1316
|
+
include_ordered: list[TckeditIncludeOrderedParamsDict] | None = None,
|
|
1317
|
+
exclude: list[TckeditExcludeParamsDict] | None = None,
|
|
1318
|
+
mask: list[TckeditMaskParamsDict] | None = None,
|
|
1319
|
+
maxlength: float | None = None,
|
|
1320
|
+
minlength: float | None = None,
|
|
1321
|
+
number: int | None = None,
|
|
1322
|
+
skip: int | None = None,
|
|
1323
|
+
maxweight: float | None = None,
|
|
1324
|
+
minweight: float | None = None,
|
|
1325
|
+
inverse: bool = False,
|
|
1326
|
+
ends_only: bool = False,
|
|
1327
|
+
tck_weights_in: InputPathType | None = None,
|
|
1328
|
+
tck_weights_out: str | None = None,
|
|
1329
|
+
info: bool = False,
|
|
1330
|
+
quiet: bool = False,
|
|
1331
|
+
debug: bool = False,
|
|
1332
|
+
force: bool = False,
|
|
1333
|
+
nthreads: int | None = None,
|
|
1334
|
+
config: list[TckeditConfigParamsDict] | None = None,
|
|
1335
|
+
help_: bool = False,
|
|
1336
|
+
version: bool = False,
|
|
1337
|
+
runner: Runner | None = None,
|
|
1338
|
+
) -> TckeditOutputs:
|
|
1339
|
+
"""
|
|
1340
|
+
tckedit
|
|
1341
|
+
|
|
1342
|
+
Perform various editing operations on track files.
|
|
1343
|
+
|
|
1344
|
+
This command can be used to perform various types of manipulations on track
|
|
1345
|
+
data. A range of such manipulations are demonstrated in the examples
|
|
1346
|
+
provided below.
|
|
1347
|
+
|
|
1348
|
+
References:
|
|
1349
|
+
|
|
1350
|
+
.
|
|
1351
|
+
|
|
1352
|
+
Author: MRTrix3 Developers
|
|
1353
|
+
|
|
1354
|
+
URL: https://www.mrtrix.org/
|
|
1355
|
+
|
|
1356
|
+
Args:
|
|
1357
|
+
tracks_in: the input track file(s).
|
|
1358
|
+
tracks_out: the output track file.
|
|
1359
|
+
include: specify an inclusion region of interest, as either a binary\
|
|
1360
|
+
mask image, or as a sphere using 4 comma-separared values\
|
|
1361
|
+
(x,y,z,radius). Streamlines must traverse ALL inclusion regions to be\
|
|
1362
|
+
accepted.
|
|
1363
|
+
include_ordered: specify an inclusion region of interest, as either a\
|
|
1364
|
+
binary mask image, or as a sphere using 4 comma-separared values\
|
|
1365
|
+
(x,y,z,radius). Streamlines must traverse ALL inclusion_ordered regions\
|
|
1366
|
+
in the order they are specified in order to be accepted.
|
|
1367
|
+
exclude: specify an exclusion region of interest, as either a binary\
|
|
1368
|
+
mask image, or as a sphere using 4 comma-separared values\
|
|
1369
|
+
(x,y,z,radius). Streamlines that enter ANY exclude region will be\
|
|
1370
|
+
discarded.
|
|
1371
|
+
mask: specify a masking region of interest, as either a binary mask\
|
|
1372
|
+
image, or as a sphere using 4 comma-separared values (x,y,z,radius). If\
|
|
1373
|
+
defined, streamlines exiting the mask will be truncated.
|
|
1374
|
+
maxlength: set the maximum length of any streamline in mm.
|
|
1375
|
+
minlength: set the minimum length of any streamline in mm.
|
|
1376
|
+
number: set the desired number of selected streamlines to be propagated\
|
|
1377
|
+
to the output file.
|
|
1378
|
+
skip: omit this number of selected streamlines before commencing\
|
|
1379
|
+
writing to the output file.
|
|
1380
|
+
maxweight: set the maximum weight of any streamline.
|
|
1381
|
+
minweight: set the minimum weight of any streamline.
|
|
1382
|
+
inverse: output the inverse selection of streamlines based on the\
|
|
1383
|
+
criteria provided; i.e. only those streamlines that fail at least one\
|
|
1384
|
+
selection criterion, and/or vertices that are outside masks if\
|
|
1385
|
+
provided, will be written to file.
|
|
1386
|
+
ends_only: only test the ends of each streamline against the provided\
|
|
1387
|
+
include/exclude ROIs.
|
|
1388
|
+
tck_weights_in: specify a text scalar file containing the streamline\
|
|
1389
|
+
weights.
|
|
1390
|
+
tck_weights_out: specify the path for an output text scalar file\
|
|
1391
|
+
containing streamline weights.
|
|
1392
|
+
info: display information messages.
|
|
1393
|
+
quiet: do not display information messages or progress status;\
|
|
1394
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
1395
|
+
environment variable to a non-empty string.
|
|
1396
|
+
debug: display debugging messages.
|
|
1397
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
1398
|
+
input and output might cause unexpected behaviour).
|
|
1399
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
1400
|
+
(set to 0 to disable multi-threading).
|
|
1401
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
1402
|
+
help_: display this information page and exit.
|
|
1403
|
+
version: display version information and exit.
|
|
1404
|
+
runner: Command runner.
|
|
1405
|
+
Returns:
|
|
1406
|
+
NamedTuple of outputs (described in `TckeditOutputs`).
|
|
1407
|
+
"""
|
|
1408
|
+
params = tckedit_params(
|
|
1409
|
+
include=include,
|
|
1410
|
+
include_ordered=include_ordered,
|
|
1411
|
+
exclude=exclude,
|
|
1412
|
+
mask=mask,
|
|
1413
|
+
maxlength=maxlength,
|
|
1414
|
+
minlength=minlength,
|
|
1415
|
+
number=number,
|
|
1416
|
+
skip=skip,
|
|
1417
|
+
maxweight=maxweight,
|
|
1418
|
+
minweight=minweight,
|
|
1419
|
+
inverse=inverse,
|
|
1420
|
+
ends_only=ends_only,
|
|
1421
|
+
tck_weights_in=tck_weights_in,
|
|
1422
|
+
tck_weights_out=tck_weights_out,
|
|
1423
|
+
info=info,
|
|
1424
|
+
quiet=quiet,
|
|
1425
|
+
debug=debug,
|
|
1426
|
+
force=force,
|
|
1427
|
+
nthreads=nthreads,
|
|
1428
|
+
config=config,
|
|
1429
|
+
help_=help_,
|
|
1430
|
+
version=version,
|
|
1431
|
+
tracks_in=tracks_in,
|
|
1432
|
+
tracks_out=tracks_out,
|
|
1433
|
+
)
|
|
1434
|
+
return tckedit_execute(params, runner)
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
__all__ = [
|
|
1438
|
+
"TCKEDIT_METADATA",
|
|
1439
|
+
"TckeditConfigParamsDict",
|
|
1440
|
+
"TckeditConfigParamsDictTagged",
|
|
1441
|
+
"TckeditExcludeParamsDict",
|
|
1442
|
+
"TckeditExcludeParamsDictTagged",
|
|
1443
|
+
"TckeditIncludeOrderedParamsDict",
|
|
1444
|
+
"TckeditIncludeOrderedParamsDictTagged",
|
|
1445
|
+
"TckeditIncludeParamsDict",
|
|
1446
|
+
"TckeditIncludeParamsDictTagged",
|
|
1447
|
+
"TckeditMaskParamsDict",
|
|
1448
|
+
"TckeditMaskParamsDictTagged",
|
|
1449
|
+
"TckeditOutputs",
|
|
1450
|
+
"TckeditParamsDict",
|
|
1451
|
+
"TckeditParamsDictTagged",
|
|
1452
|
+
"TckeditVariousFile1ParamsDict",
|
|
1453
|
+
"TckeditVariousFile1ParamsDictTagged",
|
|
1454
|
+
"TckeditVariousFile2ParamsDict",
|
|
1455
|
+
"TckeditVariousFile2ParamsDictTagged",
|
|
1456
|
+
"TckeditVariousFileParamsDict",
|
|
1457
|
+
"TckeditVariousFileParamsDictTagged",
|
|
1458
|
+
"TckeditVariousString1ParamsDict",
|
|
1459
|
+
"TckeditVariousString1ParamsDictTagged",
|
|
1460
|
+
"TckeditVariousString2ParamsDict",
|
|
1461
|
+
"TckeditVariousString2ParamsDictTagged",
|
|
1462
|
+
"TckeditVariousStringParamsDict",
|
|
1463
|
+
"TckeditVariousStringParamsDictTagged",
|
|
1464
|
+
"tckedit",
|
|
1465
|
+
"tckedit_config",
|
|
1466
|
+
"tckedit_exclude",
|
|
1467
|
+
"tckedit_execute",
|
|
1468
|
+
"tckedit_include",
|
|
1469
|
+
"tckedit_include_ordered",
|
|
1470
|
+
"tckedit_mask",
|
|
1471
|
+
"tckedit_params",
|
|
1472
|
+
"tckedit_various_file",
|
|
1473
|
+
"tckedit_various_file_1",
|
|
1474
|
+
"tckedit_various_file_2",
|
|
1475
|
+
"tckedit_various_string",
|
|
1476
|
+
"tckedit_various_string_1",
|
|
1477
|
+
"tckedit_various_string_2",
|
|
1478
|
+
]
|