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,684 @@
|
|
|
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
|
+
TCKDFC_METADATA = Metadata(
|
|
9
|
+
id="c08d7690e556dae567c956d830fbf83e42bf36aa.boutiques",
|
|
10
|
+
name="tckdfc",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_TckdfcDynamicParamsDictNoTag = typing.TypedDict('_TckdfcDynamicParamsDictNoTag', {
|
|
17
|
+
"shape": str,
|
|
18
|
+
"width": int,
|
|
19
|
+
})
|
|
20
|
+
TckdfcDynamicParamsDictTagged = typing.TypedDict('TckdfcDynamicParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["dynamic"],
|
|
22
|
+
"shape": str,
|
|
23
|
+
"width": int,
|
|
24
|
+
})
|
|
25
|
+
TckdfcDynamicParamsDict = _TckdfcDynamicParamsDictNoTag | TckdfcDynamicParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_TckdfcConfigParamsDictNoTag = typing.TypedDict('_TckdfcConfigParamsDictNoTag', {
|
|
29
|
+
"key": str,
|
|
30
|
+
"value": str,
|
|
31
|
+
})
|
|
32
|
+
TckdfcConfigParamsDictTagged = typing.TypedDict('TckdfcConfigParamsDictTagged', {
|
|
33
|
+
"@type": typing.Literal["config"],
|
|
34
|
+
"key": str,
|
|
35
|
+
"value": str,
|
|
36
|
+
})
|
|
37
|
+
TckdfcConfigParamsDict = _TckdfcConfigParamsDictNoTag | TckdfcConfigParamsDictTagged
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
_TckdfcParamsDictNoTag = typing.TypedDict('_TckdfcParamsDictNoTag', {
|
|
41
|
+
"static": bool,
|
|
42
|
+
"dynamic": typing.NotRequired[TckdfcDynamicParamsDict | None],
|
|
43
|
+
"template": typing.NotRequired[InputPathType | None],
|
|
44
|
+
"vox": typing.NotRequired[list[float] | None],
|
|
45
|
+
"stat_vox": typing.NotRequired[str | None],
|
|
46
|
+
"backtrack": bool,
|
|
47
|
+
"upsample": typing.NotRequired[int | None],
|
|
48
|
+
"info": bool,
|
|
49
|
+
"quiet": bool,
|
|
50
|
+
"debug": bool,
|
|
51
|
+
"force": bool,
|
|
52
|
+
"nthreads": typing.NotRequired[int | None],
|
|
53
|
+
"config": typing.NotRequired[list[TckdfcConfigParamsDict] | None],
|
|
54
|
+
"help": bool,
|
|
55
|
+
"version": bool,
|
|
56
|
+
"tracks": InputPathType,
|
|
57
|
+
"fmri": InputPathType,
|
|
58
|
+
"output": str,
|
|
59
|
+
})
|
|
60
|
+
TckdfcParamsDictTagged = typing.TypedDict('TckdfcParamsDictTagged', {
|
|
61
|
+
"@type": typing.Literal["mrtrix/tckdfc"],
|
|
62
|
+
"static": bool,
|
|
63
|
+
"dynamic": typing.NotRequired[TckdfcDynamicParamsDict | None],
|
|
64
|
+
"template": typing.NotRequired[InputPathType | None],
|
|
65
|
+
"vox": typing.NotRequired[list[float] | None],
|
|
66
|
+
"stat_vox": typing.NotRequired[str | None],
|
|
67
|
+
"backtrack": bool,
|
|
68
|
+
"upsample": typing.NotRequired[int | None],
|
|
69
|
+
"info": bool,
|
|
70
|
+
"quiet": bool,
|
|
71
|
+
"debug": bool,
|
|
72
|
+
"force": bool,
|
|
73
|
+
"nthreads": typing.NotRequired[int | None],
|
|
74
|
+
"config": typing.NotRequired[list[TckdfcConfigParamsDict] | None],
|
|
75
|
+
"help": bool,
|
|
76
|
+
"version": bool,
|
|
77
|
+
"tracks": InputPathType,
|
|
78
|
+
"fmri": InputPathType,
|
|
79
|
+
"output": str,
|
|
80
|
+
})
|
|
81
|
+
TckdfcParamsDict = _TckdfcParamsDictNoTag | TckdfcParamsDictTagged
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def tckdfc_dynamic(
|
|
85
|
+
shape: str,
|
|
86
|
+
width: int,
|
|
87
|
+
) -> TckdfcDynamicParamsDictTagged:
|
|
88
|
+
"""
|
|
89
|
+
Build parameters.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
shape: generate a "dynamic" (4D) output image; must additionally\
|
|
93
|
+
provide the shape and width (in volumes) of the sliding window.
|
|
94
|
+
width: generate a "dynamic" (4D) output image; must additionally\
|
|
95
|
+
provide the shape and width (in volumes) of the sliding window.
|
|
96
|
+
Returns:
|
|
97
|
+
Parameter dictionary
|
|
98
|
+
"""
|
|
99
|
+
params = {
|
|
100
|
+
"@type": "dynamic",
|
|
101
|
+
"shape": shape,
|
|
102
|
+
"width": width,
|
|
103
|
+
}
|
|
104
|
+
return params
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def tckdfc_dynamic_validate(
|
|
108
|
+
params: typing.Any,
|
|
109
|
+
) -> None:
|
|
110
|
+
"""
|
|
111
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
112
|
+
`TckdfcDynamicParamsDict` object.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
params: The parameters object to validate.
|
|
116
|
+
"""
|
|
117
|
+
if params is None or not isinstance(params, dict):
|
|
118
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
119
|
+
if params.get("shape", None) is None:
|
|
120
|
+
raise StyxValidationError("`shape` must not be None")
|
|
121
|
+
if not isinstance(params["shape"], str):
|
|
122
|
+
raise StyxValidationError(f'`shape` has the wrong type: Received `{type(params.get("shape", None))}` expected `str`')
|
|
123
|
+
if params.get("width", None) is None:
|
|
124
|
+
raise StyxValidationError("`width` must not be None")
|
|
125
|
+
if not isinstance(params["width"], int):
|
|
126
|
+
raise StyxValidationError(f'`width` has the wrong type: Received `{type(params.get("width", None))}` expected `int`')
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def tckdfc_dynamic_cargs(
|
|
130
|
+
params: TckdfcDynamicParamsDict,
|
|
131
|
+
execution: Execution,
|
|
132
|
+
) -> list[str]:
|
|
133
|
+
"""
|
|
134
|
+
Build command-line arguments from parameters.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
params: The parameters.
|
|
138
|
+
execution: The execution object for resolving input paths.
|
|
139
|
+
Returns:
|
|
140
|
+
Command-line arguments.
|
|
141
|
+
"""
|
|
142
|
+
cargs = []
|
|
143
|
+
cargs.append("-dynamic")
|
|
144
|
+
cargs.append(params.get("shape", None))
|
|
145
|
+
cargs.append(str(params.get("width", None)))
|
|
146
|
+
return cargs
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def tckdfc_config(
|
|
150
|
+
key: str,
|
|
151
|
+
value: str,
|
|
152
|
+
) -> TckdfcConfigParamsDictTagged:
|
|
153
|
+
"""
|
|
154
|
+
Build parameters.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
158
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
159
|
+
Returns:
|
|
160
|
+
Parameter dictionary
|
|
161
|
+
"""
|
|
162
|
+
params = {
|
|
163
|
+
"@type": "config",
|
|
164
|
+
"key": key,
|
|
165
|
+
"value": value,
|
|
166
|
+
}
|
|
167
|
+
return params
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def tckdfc_config_validate(
|
|
171
|
+
params: typing.Any,
|
|
172
|
+
) -> None:
|
|
173
|
+
"""
|
|
174
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
175
|
+
`TckdfcConfigParamsDict` object.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
params: The parameters object to validate.
|
|
179
|
+
"""
|
|
180
|
+
if params is None or not isinstance(params, dict):
|
|
181
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
182
|
+
if params.get("key", None) is None:
|
|
183
|
+
raise StyxValidationError("`key` must not be None")
|
|
184
|
+
if not isinstance(params["key"], str):
|
|
185
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
186
|
+
if params.get("value", None) is None:
|
|
187
|
+
raise StyxValidationError("`value` must not be None")
|
|
188
|
+
if not isinstance(params["value"], str):
|
|
189
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def tckdfc_config_cargs(
|
|
193
|
+
params: TckdfcConfigParamsDict,
|
|
194
|
+
execution: Execution,
|
|
195
|
+
) -> list[str]:
|
|
196
|
+
"""
|
|
197
|
+
Build command-line arguments from parameters.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
params: The parameters.
|
|
201
|
+
execution: The execution object for resolving input paths.
|
|
202
|
+
Returns:
|
|
203
|
+
Command-line arguments.
|
|
204
|
+
"""
|
|
205
|
+
cargs = []
|
|
206
|
+
cargs.append("-config")
|
|
207
|
+
cargs.append(params.get("key", None))
|
|
208
|
+
cargs.append(params.get("value", None))
|
|
209
|
+
return cargs
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class TckdfcOutputs(typing.NamedTuple):
|
|
213
|
+
"""
|
|
214
|
+
Output object returned when calling `TckdfcParamsDict(...)`.
|
|
215
|
+
"""
|
|
216
|
+
root: OutputPathType
|
|
217
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
218
|
+
output: OutputPathType
|
|
219
|
+
"""the output TW-dFC image"""
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def tckdfc_params(
|
|
223
|
+
tracks: InputPathType,
|
|
224
|
+
fmri: InputPathType,
|
|
225
|
+
output: str,
|
|
226
|
+
static: bool = False,
|
|
227
|
+
dynamic: TckdfcDynamicParamsDict | None = None,
|
|
228
|
+
template: InputPathType | None = None,
|
|
229
|
+
vox: list[float] | None = None,
|
|
230
|
+
stat_vox: str | None = None,
|
|
231
|
+
backtrack: bool = False,
|
|
232
|
+
upsample: int | None = None,
|
|
233
|
+
info: bool = False,
|
|
234
|
+
quiet: bool = False,
|
|
235
|
+
debug: bool = False,
|
|
236
|
+
force: bool = False,
|
|
237
|
+
nthreads: int | None = None,
|
|
238
|
+
config: list[TckdfcConfigParamsDict] | None = None,
|
|
239
|
+
help_: bool = False,
|
|
240
|
+
version: bool = False,
|
|
241
|
+
) -> TckdfcParamsDictTagged:
|
|
242
|
+
"""
|
|
243
|
+
Build parameters.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
tracks: the input track file.
|
|
247
|
+
fmri: the pre-processed fMRI time series.
|
|
248
|
+
output: the output TW-dFC image.
|
|
249
|
+
static: generate a "static" (3D) output image.
|
|
250
|
+
dynamic: generate a "dynamic" (4D) output image; must additionally\
|
|
251
|
+
provide the shape and width (in volumes) of the sliding window.
|
|
252
|
+
template: an image file to be used as a template for the output (the\
|
|
253
|
+
output image will have the same transform and field of view).
|
|
254
|
+
vox: provide either an isotropic voxel size (in mm), or comma-separated\
|
|
255
|
+
list of 3 voxel dimensions.
|
|
256
|
+
stat_vox: define the statistic for choosing the final voxel intensities\
|
|
257
|
+
for a given contrast type given the individual values from the tracks\
|
|
258
|
+
passing through each voxel\
|
|
259
|
+
Options are: sum, min, mean, max (default: mean).
|
|
260
|
+
backtrack: if no valid timeseries is found at the streamline endpoint,\
|
|
261
|
+
back-track along the streamline trajectory until a valid timeseries is\
|
|
262
|
+
found.
|
|
263
|
+
upsample: upsample the tracks by some ratio using Hermite interpolation\
|
|
264
|
+
before mapping (if omitted, an appropriate ratio will be determined\
|
|
265
|
+
automatically).
|
|
266
|
+
info: display information messages.
|
|
267
|
+
quiet: do not display information messages or progress status;\
|
|
268
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
269
|
+
environment variable to a non-empty string.
|
|
270
|
+
debug: display debugging messages.
|
|
271
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
272
|
+
input and output might cause unexpected behaviour).
|
|
273
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
274
|
+
(set to 0 to disable multi-threading).
|
|
275
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
276
|
+
help_: display this information page and exit.
|
|
277
|
+
version: display version information and exit.
|
|
278
|
+
Returns:
|
|
279
|
+
Parameter dictionary
|
|
280
|
+
"""
|
|
281
|
+
params = {
|
|
282
|
+
"@type": "mrtrix/tckdfc",
|
|
283
|
+
"static": static,
|
|
284
|
+
"backtrack": backtrack,
|
|
285
|
+
"info": info,
|
|
286
|
+
"quiet": quiet,
|
|
287
|
+
"debug": debug,
|
|
288
|
+
"force": force,
|
|
289
|
+
"help": help_,
|
|
290
|
+
"version": version,
|
|
291
|
+
"tracks": tracks,
|
|
292
|
+
"fmri": fmri,
|
|
293
|
+
"output": output,
|
|
294
|
+
}
|
|
295
|
+
if dynamic is not None:
|
|
296
|
+
params["dynamic"] = dynamic
|
|
297
|
+
if template is not None:
|
|
298
|
+
params["template"] = template
|
|
299
|
+
if vox is not None:
|
|
300
|
+
params["vox"] = vox
|
|
301
|
+
if stat_vox is not None:
|
|
302
|
+
params["stat_vox"] = stat_vox
|
|
303
|
+
if upsample is not None:
|
|
304
|
+
params["upsample"] = upsample
|
|
305
|
+
if nthreads is not None:
|
|
306
|
+
params["nthreads"] = nthreads
|
|
307
|
+
if config is not None:
|
|
308
|
+
params["config"] = config
|
|
309
|
+
return params
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def tckdfc_validate(
|
|
313
|
+
params: typing.Any,
|
|
314
|
+
) -> None:
|
|
315
|
+
"""
|
|
316
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
317
|
+
`TckdfcParamsDict` object.
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
params: The parameters object to validate.
|
|
321
|
+
"""
|
|
322
|
+
if params is None or not isinstance(params, dict):
|
|
323
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
324
|
+
if params.get("static", False) is None:
|
|
325
|
+
raise StyxValidationError("`static` must not be None")
|
|
326
|
+
if not isinstance(params["static"], bool):
|
|
327
|
+
raise StyxValidationError(f'`static` has the wrong type: Received `{type(params.get("static", False))}` expected `bool`')
|
|
328
|
+
if params.get("dynamic", None) is not None:
|
|
329
|
+
tckdfc_dynamic_validate(params["dynamic"])
|
|
330
|
+
if params.get("template", None) is not None:
|
|
331
|
+
if not isinstance(params["template"], (pathlib.Path, str)):
|
|
332
|
+
raise StyxValidationError(f'`template` has the wrong type: Received `{type(params.get("template", None))}` expected `InputPathType | None`')
|
|
333
|
+
if params.get("vox", None) is not None:
|
|
334
|
+
if not isinstance(params["vox"], list):
|
|
335
|
+
raise StyxValidationError(f'`vox` has the wrong type: Received `{type(params.get("vox", None))}` expected `list[float] | None`')
|
|
336
|
+
for e in params["vox"]:
|
|
337
|
+
if not isinstance(e, (float, int)):
|
|
338
|
+
raise StyxValidationError(f'`vox` has the wrong type: Received `{type(params.get("vox", None))}` expected `list[float] | None`')
|
|
339
|
+
if params.get("stat_vox", None) is not None:
|
|
340
|
+
if not isinstance(params["stat_vox"], str):
|
|
341
|
+
raise StyxValidationError(f'`stat_vox` has the wrong type: Received `{type(params.get("stat_vox", None))}` expected `str | None`')
|
|
342
|
+
if params.get("backtrack", False) is None:
|
|
343
|
+
raise StyxValidationError("`backtrack` must not be None")
|
|
344
|
+
if not isinstance(params["backtrack"], bool):
|
|
345
|
+
raise StyxValidationError(f'`backtrack` has the wrong type: Received `{type(params.get("backtrack", False))}` expected `bool`')
|
|
346
|
+
if params.get("upsample", None) is not None:
|
|
347
|
+
if not isinstance(params["upsample"], int):
|
|
348
|
+
raise StyxValidationError(f'`upsample` has the wrong type: Received `{type(params.get("upsample", None))}` expected `int | None`')
|
|
349
|
+
if params.get("info", False) is None:
|
|
350
|
+
raise StyxValidationError("`info` must not be None")
|
|
351
|
+
if not isinstance(params["info"], bool):
|
|
352
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
353
|
+
if params.get("quiet", False) is None:
|
|
354
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
355
|
+
if not isinstance(params["quiet"], bool):
|
|
356
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
357
|
+
if params.get("debug", False) is None:
|
|
358
|
+
raise StyxValidationError("`debug` must not be None")
|
|
359
|
+
if not isinstance(params["debug"], bool):
|
|
360
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
361
|
+
if params.get("force", False) is None:
|
|
362
|
+
raise StyxValidationError("`force` must not be None")
|
|
363
|
+
if not isinstance(params["force"], bool):
|
|
364
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
365
|
+
if params.get("nthreads", None) is not None:
|
|
366
|
+
if not isinstance(params["nthreads"], int):
|
|
367
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
368
|
+
if params.get("config", None) is not None:
|
|
369
|
+
if not isinstance(params["config"], list):
|
|
370
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[TckdfcConfigParamsDict] | None`')
|
|
371
|
+
for e in params["config"]:
|
|
372
|
+
tckdfc_config_validate(e)
|
|
373
|
+
if params.get("help", False) is None:
|
|
374
|
+
raise StyxValidationError("`help` must not be None")
|
|
375
|
+
if not isinstance(params["help"], bool):
|
|
376
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
377
|
+
if params.get("version", False) is None:
|
|
378
|
+
raise StyxValidationError("`version` must not be None")
|
|
379
|
+
if not isinstance(params["version"], bool):
|
|
380
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
381
|
+
if params.get("tracks", None) is None:
|
|
382
|
+
raise StyxValidationError("`tracks` must not be None")
|
|
383
|
+
if not isinstance(params["tracks"], (pathlib.Path, str)):
|
|
384
|
+
raise StyxValidationError(f'`tracks` has the wrong type: Received `{type(params.get("tracks", None))}` expected `InputPathType`')
|
|
385
|
+
if params.get("fmri", None) is None:
|
|
386
|
+
raise StyxValidationError("`fmri` must not be None")
|
|
387
|
+
if not isinstance(params["fmri"], (pathlib.Path, str)):
|
|
388
|
+
raise StyxValidationError(f'`fmri` has the wrong type: Received `{type(params.get("fmri", None))}` expected `InputPathType`')
|
|
389
|
+
if params.get("output", None) is None:
|
|
390
|
+
raise StyxValidationError("`output` must not be None")
|
|
391
|
+
if not isinstance(params["output"], str):
|
|
392
|
+
raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def tckdfc_cargs(
|
|
396
|
+
params: TckdfcParamsDict,
|
|
397
|
+
execution: Execution,
|
|
398
|
+
) -> list[str]:
|
|
399
|
+
"""
|
|
400
|
+
Build command-line arguments from parameters.
|
|
401
|
+
|
|
402
|
+
Args:
|
|
403
|
+
params: The parameters.
|
|
404
|
+
execution: The execution object for resolving input paths.
|
|
405
|
+
Returns:
|
|
406
|
+
Command-line arguments.
|
|
407
|
+
"""
|
|
408
|
+
cargs = []
|
|
409
|
+
cargs.append("tckdfc")
|
|
410
|
+
if params.get("static", False):
|
|
411
|
+
cargs.append("-static")
|
|
412
|
+
if params.get("dynamic", None) is not None:
|
|
413
|
+
cargs.extend(tckdfc_dynamic_cargs(params.get("dynamic", None), execution))
|
|
414
|
+
if params.get("template", None) is not None:
|
|
415
|
+
cargs.extend([
|
|
416
|
+
"-template",
|
|
417
|
+
execution.input_file(params.get("template", None))
|
|
418
|
+
])
|
|
419
|
+
if params.get("vox", None) is not None:
|
|
420
|
+
cargs.extend([
|
|
421
|
+
"-vox",
|
|
422
|
+
",".join(map(str, params.get("vox", None)))
|
|
423
|
+
])
|
|
424
|
+
if params.get("stat_vox", None) is not None:
|
|
425
|
+
cargs.extend([
|
|
426
|
+
"-stat_vox",
|
|
427
|
+
params.get("stat_vox", None)
|
|
428
|
+
])
|
|
429
|
+
if params.get("backtrack", False):
|
|
430
|
+
cargs.append("-backtrack")
|
|
431
|
+
if params.get("upsample", None) is not None:
|
|
432
|
+
cargs.extend([
|
|
433
|
+
"-upsample",
|
|
434
|
+
str(params.get("upsample", None))
|
|
435
|
+
])
|
|
436
|
+
if params.get("info", False):
|
|
437
|
+
cargs.append("-info")
|
|
438
|
+
if params.get("quiet", False):
|
|
439
|
+
cargs.append("-quiet")
|
|
440
|
+
if params.get("debug", False):
|
|
441
|
+
cargs.append("-debug")
|
|
442
|
+
if params.get("force", False):
|
|
443
|
+
cargs.append("-force")
|
|
444
|
+
if params.get("nthreads", None) is not None:
|
|
445
|
+
cargs.extend([
|
|
446
|
+
"-nthreads",
|
|
447
|
+
str(params.get("nthreads", None))
|
|
448
|
+
])
|
|
449
|
+
if params.get("config", None) is not None:
|
|
450
|
+
cargs.extend([a for c in [tckdfc_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
451
|
+
if params.get("help", False):
|
|
452
|
+
cargs.append("-help")
|
|
453
|
+
if params.get("version", False):
|
|
454
|
+
cargs.append("-version")
|
|
455
|
+
cargs.append(execution.input_file(params.get("tracks", None)))
|
|
456
|
+
cargs.append(execution.input_file(params.get("fmri", None)))
|
|
457
|
+
cargs.append(params.get("output", None))
|
|
458
|
+
return cargs
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def tckdfc_outputs(
|
|
462
|
+
params: TckdfcParamsDict,
|
|
463
|
+
execution: Execution,
|
|
464
|
+
) -> TckdfcOutputs:
|
|
465
|
+
"""
|
|
466
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
467
|
+
|
|
468
|
+
Args:
|
|
469
|
+
params: The parameters.
|
|
470
|
+
execution: The execution object for resolving input paths.
|
|
471
|
+
Returns:
|
|
472
|
+
Outputs object.
|
|
473
|
+
"""
|
|
474
|
+
ret = TckdfcOutputs(
|
|
475
|
+
root=execution.output_file("."),
|
|
476
|
+
output=execution.output_file(params.get("output", None)),
|
|
477
|
+
)
|
|
478
|
+
return ret
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
def tckdfc_execute(
|
|
482
|
+
params: TckdfcParamsDict,
|
|
483
|
+
runner: Runner | None = None,
|
|
484
|
+
) -> TckdfcOutputs:
|
|
485
|
+
"""
|
|
486
|
+
tckdfc
|
|
487
|
+
|
|
488
|
+
Perform the Track-Weighted Dynamic Functional Connectivity (TW-dFC) method.
|
|
489
|
+
|
|
490
|
+
This command generates a Track-Weighted Image (TWI), where the contribution
|
|
491
|
+
from each streamline to the image is the Pearson correlation between the
|
|
492
|
+
fMRI time series at the streamline endpoints.
|
|
493
|
+
|
|
494
|
+
The output image can be generated in one of two ways (note that one of these
|
|
495
|
+
two command-line options MUST be provided):
|
|
496
|
+
|
|
497
|
+
- "Static" functional connectivity (-static option): Each streamline
|
|
498
|
+
contributes to a static 3D output image based on the correlation between the
|
|
499
|
+
signals at the streamline endpoints using the entirety of the input time
|
|
500
|
+
series.
|
|
501
|
+
|
|
502
|
+
- "Dynamic" functional connectivity (-dynamic option): The output image is a
|
|
503
|
+
4D image, with the same number of volumes as the input fMRI time series. For
|
|
504
|
+
each volume, the contribution from each streamline is calculated based on a
|
|
505
|
+
finite-width sliding time window, centred at the timepoint corresponding to
|
|
506
|
+
that volume.
|
|
507
|
+
|
|
508
|
+
Note that the -backtrack option in this command is similar, but not
|
|
509
|
+
precisely equivalent, to back-tracking as can be used with
|
|
510
|
+
Anatomically-Constrained Tractography (ACT) in the tckgen command. However,
|
|
511
|
+
here the feature does not change the streamlines trajectories in any way; it
|
|
512
|
+
simply enables detection of the fact that the input fMRI image may not
|
|
513
|
+
contain a valid timeseries underneath the streamline endpoint, and where
|
|
514
|
+
this occurs, searches from the streamline endpoint inwards along the
|
|
515
|
+
streamline trajectory in search of a valid timeseries to sample from the
|
|
516
|
+
input image.
|
|
517
|
+
|
|
518
|
+
References:
|
|
519
|
+
|
|
520
|
+
Calamante, F.; Smith, R.E.; Liang, X.; Zalesky, A.; Connelly, A
|
|
521
|
+
Track-weighted dynamic functional connectivity (TW-dFC): a new method to
|
|
522
|
+
study time-resolved functional connectivity. Brain Struct Funct, 2017, doi:
|
|
523
|
+
10.1007/s00429-017-1431-1.
|
|
524
|
+
|
|
525
|
+
Author: MRTrix3 Developers
|
|
526
|
+
|
|
527
|
+
URL: https://www.mrtrix.org/
|
|
528
|
+
|
|
529
|
+
Args:
|
|
530
|
+
params: The parameters.
|
|
531
|
+
runner: Command runner.
|
|
532
|
+
Returns:
|
|
533
|
+
NamedTuple of outputs (described in `TckdfcOutputs`).
|
|
534
|
+
"""
|
|
535
|
+
tckdfc_validate(params)
|
|
536
|
+
runner = runner or get_global_runner()
|
|
537
|
+
execution = runner.start_execution(TCKDFC_METADATA)
|
|
538
|
+
params = execution.params(params)
|
|
539
|
+
cargs = tckdfc_cargs(params, execution)
|
|
540
|
+
ret = tckdfc_outputs(params, execution)
|
|
541
|
+
execution.run(cargs)
|
|
542
|
+
return ret
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
def tckdfc(
|
|
546
|
+
tracks: InputPathType,
|
|
547
|
+
fmri: InputPathType,
|
|
548
|
+
output: str,
|
|
549
|
+
static: bool = False,
|
|
550
|
+
dynamic: TckdfcDynamicParamsDict | None = None,
|
|
551
|
+
template: InputPathType | None = None,
|
|
552
|
+
vox: list[float] | None = None,
|
|
553
|
+
stat_vox: str | None = None,
|
|
554
|
+
backtrack: bool = False,
|
|
555
|
+
upsample: int | None = None,
|
|
556
|
+
info: bool = False,
|
|
557
|
+
quiet: bool = False,
|
|
558
|
+
debug: bool = False,
|
|
559
|
+
force: bool = False,
|
|
560
|
+
nthreads: int | None = None,
|
|
561
|
+
config: list[TckdfcConfigParamsDict] | None = None,
|
|
562
|
+
help_: bool = False,
|
|
563
|
+
version: bool = False,
|
|
564
|
+
runner: Runner | None = None,
|
|
565
|
+
) -> TckdfcOutputs:
|
|
566
|
+
"""
|
|
567
|
+
tckdfc
|
|
568
|
+
|
|
569
|
+
Perform the Track-Weighted Dynamic Functional Connectivity (TW-dFC) method.
|
|
570
|
+
|
|
571
|
+
This command generates a Track-Weighted Image (TWI), where the contribution
|
|
572
|
+
from each streamline to the image is the Pearson correlation between the
|
|
573
|
+
fMRI time series at the streamline endpoints.
|
|
574
|
+
|
|
575
|
+
The output image can be generated in one of two ways (note that one of these
|
|
576
|
+
two command-line options MUST be provided):
|
|
577
|
+
|
|
578
|
+
- "Static" functional connectivity (-static option): Each streamline
|
|
579
|
+
contributes to a static 3D output image based on the correlation between the
|
|
580
|
+
signals at the streamline endpoints using the entirety of the input time
|
|
581
|
+
series.
|
|
582
|
+
|
|
583
|
+
- "Dynamic" functional connectivity (-dynamic option): The output image is a
|
|
584
|
+
4D image, with the same number of volumes as the input fMRI time series. For
|
|
585
|
+
each volume, the contribution from each streamline is calculated based on a
|
|
586
|
+
finite-width sliding time window, centred at the timepoint corresponding to
|
|
587
|
+
that volume.
|
|
588
|
+
|
|
589
|
+
Note that the -backtrack option in this command is similar, but not
|
|
590
|
+
precisely equivalent, to back-tracking as can be used with
|
|
591
|
+
Anatomically-Constrained Tractography (ACT) in the tckgen command. However,
|
|
592
|
+
here the feature does not change the streamlines trajectories in any way; it
|
|
593
|
+
simply enables detection of the fact that the input fMRI image may not
|
|
594
|
+
contain a valid timeseries underneath the streamline endpoint, and where
|
|
595
|
+
this occurs, searches from the streamline endpoint inwards along the
|
|
596
|
+
streamline trajectory in search of a valid timeseries to sample from the
|
|
597
|
+
input image.
|
|
598
|
+
|
|
599
|
+
References:
|
|
600
|
+
|
|
601
|
+
Calamante, F.; Smith, R.E.; Liang, X.; Zalesky, A.; Connelly, A
|
|
602
|
+
Track-weighted dynamic functional connectivity (TW-dFC): a new method to
|
|
603
|
+
study time-resolved functional connectivity. Brain Struct Funct, 2017, doi:
|
|
604
|
+
10.1007/s00429-017-1431-1.
|
|
605
|
+
|
|
606
|
+
Author: MRTrix3 Developers
|
|
607
|
+
|
|
608
|
+
URL: https://www.mrtrix.org/
|
|
609
|
+
|
|
610
|
+
Args:
|
|
611
|
+
tracks: the input track file.
|
|
612
|
+
fmri: the pre-processed fMRI time series.
|
|
613
|
+
output: the output TW-dFC image.
|
|
614
|
+
static: generate a "static" (3D) output image.
|
|
615
|
+
dynamic: generate a "dynamic" (4D) output image; must additionally\
|
|
616
|
+
provide the shape and width (in volumes) of the sliding window.
|
|
617
|
+
template: an image file to be used as a template for the output (the\
|
|
618
|
+
output image will have the same transform and field of view).
|
|
619
|
+
vox: provide either an isotropic voxel size (in mm), or comma-separated\
|
|
620
|
+
list of 3 voxel dimensions.
|
|
621
|
+
stat_vox: define the statistic for choosing the final voxel intensities\
|
|
622
|
+
for a given contrast type given the individual values from the tracks\
|
|
623
|
+
passing through each voxel\
|
|
624
|
+
Options are: sum, min, mean, max (default: mean).
|
|
625
|
+
backtrack: if no valid timeseries is found at the streamline endpoint,\
|
|
626
|
+
back-track along the streamline trajectory until a valid timeseries is\
|
|
627
|
+
found.
|
|
628
|
+
upsample: upsample the tracks by some ratio using Hermite interpolation\
|
|
629
|
+
before mapping (if omitted, an appropriate ratio will be determined\
|
|
630
|
+
automatically).
|
|
631
|
+
info: display information messages.
|
|
632
|
+
quiet: do not display information messages or progress status;\
|
|
633
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
634
|
+
environment variable to a non-empty string.
|
|
635
|
+
debug: display debugging messages.
|
|
636
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
637
|
+
input and output might cause unexpected behaviour).
|
|
638
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
639
|
+
(set to 0 to disable multi-threading).
|
|
640
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
641
|
+
help_: display this information page and exit.
|
|
642
|
+
version: display version information and exit.
|
|
643
|
+
runner: Command runner.
|
|
644
|
+
Returns:
|
|
645
|
+
NamedTuple of outputs (described in `TckdfcOutputs`).
|
|
646
|
+
"""
|
|
647
|
+
params = tckdfc_params(
|
|
648
|
+
static=static,
|
|
649
|
+
dynamic=dynamic,
|
|
650
|
+
template=template,
|
|
651
|
+
vox=vox,
|
|
652
|
+
stat_vox=stat_vox,
|
|
653
|
+
backtrack=backtrack,
|
|
654
|
+
upsample=upsample,
|
|
655
|
+
info=info,
|
|
656
|
+
quiet=quiet,
|
|
657
|
+
debug=debug,
|
|
658
|
+
force=force,
|
|
659
|
+
nthreads=nthreads,
|
|
660
|
+
config=config,
|
|
661
|
+
help_=help_,
|
|
662
|
+
version=version,
|
|
663
|
+
tracks=tracks,
|
|
664
|
+
fmri=fmri,
|
|
665
|
+
output=output,
|
|
666
|
+
)
|
|
667
|
+
return tckdfc_execute(params, runner)
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
__all__ = [
|
|
671
|
+
"TCKDFC_METADATA",
|
|
672
|
+
"TckdfcConfigParamsDict",
|
|
673
|
+
"TckdfcConfigParamsDictTagged",
|
|
674
|
+
"TckdfcDynamicParamsDict",
|
|
675
|
+
"TckdfcDynamicParamsDictTagged",
|
|
676
|
+
"TckdfcOutputs",
|
|
677
|
+
"TckdfcParamsDict",
|
|
678
|
+
"TckdfcParamsDictTagged",
|
|
679
|
+
"tckdfc",
|
|
680
|
+
"tckdfc_config",
|
|
681
|
+
"tckdfc_dynamic",
|
|
682
|
+
"tckdfc_execute",
|
|
683
|
+
"tckdfc_params",
|
|
684
|
+
]
|