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,944 @@
|
|
|
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
|
+
TCKGLOBAL_METADATA = Metadata(
|
|
9
|
+
id="31e24266a6d4374cd9c0a8ed5d9d697b1c511208.boutiques",
|
|
10
|
+
name="tckglobal",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_TckglobalRisoParamsDictNoTag = typing.TypedDict('_TckglobalRisoParamsDictNoTag', {
|
|
17
|
+
"response": InputPathType,
|
|
18
|
+
})
|
|
19
|
+
TckglobalRisoParamsDictTagged = typing.TypedDict('TckglobalRisoParamsDictTagged', {
|
|
20
|
+
"@type": typing.Literal["riso"],
|
|
21
|
+
"response": InputPathType,
|
|
22
|
+
})
|
|
23
|
+
TckglobalRisoParamsDict = _TckglobalRisoParamsDictNoTag | TckglobalRisoParamsDictTagged
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
_TckglobalConfigParamsDictNoTag = typing.TypedDict('_TckglobalConfigParamsDictNoTag', {
|
|
27
|
+
"key": str,
|
|
28
|
+
"value": str,
|
|
29
|
+
})
|
|
30
|
+
TckglobalConfigParamsDictTagged = typing.TypedDict('TckglobalConfigParamsDictTagged', {
|
|
31
|
+
"@type": typing.Literal["config"],
|
|
32
|
+
"key": str,
|
|
33
|
+
"value": str,
|
|
34
|
+
})
|
|
35
|
+
TckglobalConfigParamsDict = _TckglobalConfigParamsDictNoTag | TckglobalConfigParamsDictTagged
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
_TckglobalParamsDictNoTag = typing.TypedDict('_TckglobalParamsDictNoTag', {
|
|
39
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
40
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
41
|
+
"riso": typing.NotRequired[list[TckglobalRisoParamsDict] | None],
|
|
42
|
+
"lmax": typing.NotRequired[int | None],
|
|
43
|
+
"length": typing.NotRequired[float | None],
|
|
44
|
+
"weight": typing.NotRequired[float | None],
|
|
45
|
+
"ppot": typing.NotRequired[float | None],
|
|
46
|
+
"cpot": typing.NotRequired[float | None],
|
|
47
|
+
"t0": typing.NotRequired[float | None],
|
|
48
|
+
"t1": typing.NotRequired[float | None],
|
|
49
|
+
"niter": typing.NotRequired[int | None],
|
|
50
|
+
"fod": typing.NotRequired[str | None],
|
|
51
|
+
"noapo": bool,
|
|
52
|
+
"fiso": typing.NotRequired[str | None],
|
|
53
|
+
"eext": typing.NotRequired[str | None],
|
|
54
|
+
"etrend": typing.NotRequired[str | None],
|
|
55
|
+
"balance": typing.NotRequired[float | None],
|
|
56
|
+
"density": typing.NotRequired[float | None],
|
|
57
|
+
"prob": typing.NotRequired[list[float] | None],
|
|
58
|
+
"beta": typing.NotRequired[float | None],
|
|
59
|
+
"lambda": typing.NotRequired[float | None],
|
|
60
|
+
"info": bool,
|
|
61
|
+
"quiet": bool,
|
|
62
|
+
"debug": bool,
|
|
63
|
+
"force": bool,
|
|
64
|
+
"nthreads": typing.NotRequired[int | None],
|
|
65
|
+
"config": typing.NotRequired[list[TckglobalConfigParamsDict] | None],
|
|
66
|
+
"help": bool,
|
|
67
|
+
"version": bool,
|
|
68
|
+
"source": InputPathType,
|
|
69
|
+
"response": InputPathType,
|
|
70
|
+
"tracks": str,
|
|
71
|
+
})
|
|
72
|
+
TckglobalParamsDictTagged = typing.TypedDict('TckglobalParamsDictTagged', {
|
|
73
|
+
"@type": typing.Literal["mrtrix/tckglobal"],
|
|
74
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
75
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
76
|
+
"riso": typing.NotRequired[list[TckglobalRisoParamsDict] | None],
|
|
77
|
+
"lmax": typing.NotRequired[int | None],
|
|
78
|
+
"length": typing.NotRequired[float | None],
|
|
79
|
+
"weight": typing.NotRequired[float | None],
|
|
80
|
+
"ppot": typing.NotRequired[float | None],
|
|
81
|
+
"cpot": typing.NotRequired[float | None],
|
|
82
|
+
"t0": typing.NotRequired[float | None],
|
|
83
|
+
"t1": typing.NotRequired[float | None],
|
|
84
|
+
"niter": typing.NotRequired[int | None],
|
|
85
|
+
"fod": typing.NotRequired[str | None],
|
|
86
|
+
"noapo": bool,
|
|
87
|
+
"fiso": typing.NotRequired[str | None],
|
|
88
|
+
"eext": typing.NotRequired[str | None],
|
|
89
|
+
"etrend": typing.NotRequired[str | None],
|
|
90
|
+
"balance": typing.NotRequired[float | None],
|
|
91
|
+
"density": typing.NotRequired[float | None],
|
|
92
|
+
"prob": typing.NotRequired[list[float] | None],
|
|
93
|
+
"beta": typing.NotRequired[float | None],
|
|
94
|
+
"lambda": typing.NotRequired[float | None],
|
|
95
|
+
"info": bool,
|
|
96
|
+
"quiet": bool,
|
|
97
|
+
"debug": bool,
|
|
98
|
+
"force": bool,
|
|
99
|
+
"nthreads": typing.NotRequired[int | None],
|
|
100
|
+
"config": typing.NotRequired[list[TckglobalConfigParamsDict] | None],
|
|
101
|
+
"help": bool,
|
|
102
|
+
"version": bool,
|
|
103
|
+
"source": InputPathType,
|
|
104
|
+
"response": InputPathType,
|
|
105
|
+
"tracks": str,
|
|
106
|
+
})
|
|
107
|
+
TckglobalParamsDict = _TckglobalParamsDictNoTag | TckglobalParamsDictTagged
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def tckglobal_riso(
|
|
111
|
+
response: InputPathType,
|
|
112
|
+
) -> TckglobalRisoParamsDictTagged:
|
|
113
|
+
"""
|
|
114
|
+
Build parameters.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
response: set one or more isotropic response functions. (multiple\
|
|
118
|
+
allowed).
|
|
119
|
+
Returns:
|
|
120
|
+
Parameter dictionary
|
|
121
|
+
"""
|
|
122
|
+
params = {
|
|
123
|
+
"@type": "riso",
|
|
124
|
+
"response": response,
|
|
125
|
+
}
|
|
126
|
+
return params
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def tckglobal_riso_validate(
|
|
130
|
+
params: typing.Any,
|
|
131
|
+
) -> None:
|
|
132
|
+
"""
|
|
133
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
134
|
+
`TckglobalRisoParamsDict` object.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
params: The parameters object to validate.
|
|
138
|
+
"""
|
|
139
|
+
if params is None or not isinstance(params, dict):
|
|
140
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
141
|
+
if params.get("response", None) is None:
|
|
142
|
+
raise StyxValidationError("`response` must not be None")
|
|
143
|
+
if not isinstance(params["response"], (pathlib.Path, str)):
|
|
144
|
+
raise StyxValidationError(f'`response` has the wrong type: Received `{type(params.get("response", None))}` expected `InputPathType`')
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def tckglobal_riso_cargs(
|
|
148
|
+
params: TckglobalRisoParamsDict,
|
|
149
|
+
execution: Execution,
|
|
150
|
+
) -> list[str]:
|
|
151
|
+
"""
|
|
152
|
+
Build command-line arguments from parameters.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
params: The parameters.
|
|
156
|
+
execution: The execution object for resolving input paths.
|
|
157
|
+
Returns:
|
|
158
|
+
Command-line arguments.
|
|
159
|
+
"""
|
|
160
|
+
cargs = []
|
|
161
|
+
cargs.append("-riso")
|
|
162
|
+
cargs.append(execution.input_file(params.get("response", None)))
|
|
163
|
+
return cargs
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def tckglobal_config(
|
|
167
|
+
key: str,
|
|
168
|
+
value: str,
|
|
169
|
+
) -> TckglobalConfigParamsDictTagged:
|
|
170
|
+
"""
|
|
171
|
+
Build parameters.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
175
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
176
|
+
Returns:
|
|
177
|
+
Parameter dictionary
|
|
178
|
+
"""
|
|
179
|
+
params = {
|
|
180
|
+
"@type": "config",
|
|
181
|
+
"key": key,
|
|
182
|
+
"value": value,
|
|
183
|
+
}
|
|
184
|
+
return params
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def tckglobal_config_validate(
|
|
188
|
+
params: typing.Any,
|
|
189
|
+
) -> None:
|
|
190
|
+
"""
|
|
191
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
192
|
+
`TckglobalConfigParamsDict` object.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
params: The parameters object to validate.
|
|
196
|
+
"""
|
|
197
|
+
if params is None or not isinstance(params, dict):
|
|
198
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
199
|
+
if params.get("key", None) is None:
|
|
200
|
+
raise StyxValidationError("`key` must not be None")
|
|
201
|
+
if not isinstance(params["key"], str):
|
|
202
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
203
|
+
if params.get("value", None) is None:
|
|
204
|
+
raise StyxValidationError("`value` must not be None")
|
|
205
|
+
if not isinstance(params["value"], str):
|
|
206
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def tckglobal_config_cargs(
|
|
210
|
+
params: TckglobalConfigParamsDict,
|
|
211
|
+
execution: Execution,
|
|
212
|
+
) -> list[str]:
|
|
213
|
+
"""
|
|
214
|
+
Build command-line arguments from parameters.
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
params: The parameters.
|
|
218
|
+
execution: The execution object for resolving input paths.
|
|
219
|
+
Returns:
|
|
220
|
+
Command-line arguments.
|
|
221
|
+
"""
|
|
222
|
+
cargs = []
|
|
223
|
+
cargs.append("-config")
|
|
224
|
+
cargs.append(params.get("key", None))
|
|
225
|
+
cargs.append(params.get("value", None))
|
|
226
|
+
return cargs
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class TckglobalOutputs(typing.NamedTuple):
|
|
230
|
+
"""
|
|
231
|
+
Output object returned when calling `TckglobalParamsDict(...)`.
|
|
232
|
+
"""
|
|
233
|
+
root: OutputPathType
|
|
234
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
235
|
+
tracks: OutputPathType
|
|
236
|
+
"""the output file containing the tracks generated."""
|
|
237
|
+
fod: OutputPathType | None
|
|
238
|
+
"""Predicted fibre orientation distribution function (fODF).
|
|
239
|
+
This fODF is estimated as part of the global track optimization, and
|
|
240
|
+
therefore incorporates the spatial regularization that it imposes.
|
|
241
|
+
Internally, the fODF is represented as a discrete sum of apodized point
|
|
242
|
+
spread functions (aPSF) oriented along the directions of all particles in
|
|
243
|
+
the voxel, used to predict the DWI signal from the particle configuration.
|
|
244
|
+
"""
|
|
245
|
+
fiso: OutputPathType | None
|
|
246
|
+
"""Predicted isotropic fractions of the tissues for which response functions
|
|
247
|
+
were provided with -riso. Typically, these are CSF and GM. """
|
|
248
|
+
eext: OutputPathType | None
|
|
249
|
+
"""Residual external energy in every voxel. """
|
|
250
|
+
etrend: OutputPathType | None
|
|
251
|
+
"""internal and external energy trend and cooling statistics. """
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def tckglobal_params(
|
|
255
|
+
source: InputPathType,
|
|
256
|
+
response: InputPathType,
|
|
257
|
+
tracks: str,
|
|
258
|
+
grad: InputPathType | None = None,
|
|
259
|
+
mask: InputPathType | None = None,
|
|
260
|
+
riso: list[TckglobalRisoParamsDict] | None = None,
|
|
261
|
+
lmax: int | None = None,
|
|
262
|
+
length: float | None = None,
|
|
263
|
+
weight: float | None = None,
|
|
264
|
+
ppot: float | None = None,
|
|
265
|
+
cpot: float | None = None,
|
|
266
|
+
t0: float | None = None,
|
|
267
|
+
t1: float | None = None,
|
|
268
|
+
niter: int | None = None,
|
|
269
|
+
fod: str | None = None,
|
|
270
|
+
noapo: bool = False,
|
|
271
|
+
fiso: str | None = None,
|
|
272
|
+
eext: str | None = None,
|
|
273
|
+
etrend: str | None = None,
|
|
274
|
+
balance: float | None = None,
|
|
275
|
+
density: float | None = None,
|
|
276
|
+
prob: list[float] | None = None,
|
|
277
|
+
beta: float | None = None,
|
|
278
|
+
lambda_: float | None = None,
|
|
279
|
+
info: bool = False,
|
|
280
|
+
quiet: bool = False,
|
|
281
|
+
debug: bool = False,
|
|
282
|
+
force: bool = False,
|
|
283
|
+
nthreads: int | None = None,
|
|
284
|
+
config: list[TckglobalConfigParamsDict] | None = None,
|
|
285
|
+
help_: bool = False,
|
|
286
|
+
version: bool = False,
|
|
287
|
+
) -> TckglobalParamsDictTagged:
|
|
288
|
+
"""
|
|
289
|
+
Build parameters.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
source: the image containing the raw DWI data.
|
|
293
|
+
response: the response of a track segment on the DWI signal.
|
|
294
|
+
tracks: the output file containing the tracks generated.
|
|
295
|
+
grad: specify the diffusion encoding scheme (required if not supplied\
|
|
296
|
+
in the header).
|
|
297
|
+
mask: only reconstruct the tractogram within the specified brain mask\
|
|
298
|
+
image.
|
|
299
|
+
riso: set one or more isotropic response functions. (multiple allowed).
|
|
300
|
+
lmax: set the maximum harmonic order for the output series. (default =\
|
|
301
|
+
8).
|
|
302
|
+
length: set the length of the particles (fibre segments). (default =\
|
|
303
|
+
1mm).
|
|
304
|
+
weight: set the weight by which particles contribute to the model.\
|
|
305
|
+
(default = 0.1).
|
|
306
|
+
ppot: set the particle potential, i.e., the cost of adding one segment,\
|
|
307
|
+
relative to the particle weight. (default = 0.05).
|
|
308
|
+
cpot: set the connection potential, i.e., the energy term that drives\
|
|
309
|
+
two segments together. (default = 0.5).
|
|
310
|
+
t0: set the initial temperature of the metropolis hastings optimizer.\
|
|
311
|
+
(default = 0.1).
|
|
312
|
+
t1: set the final temperature of the metropolis hastings optimizer.\
|
|
313
|
+
(default = 0.001).
|
|
314
|
+
niter: set the number of iterations of the metropolis hastings\
|
|
315
|
+
optimizer. (default = 10M).
|
|
316
|
+
fod: Predicted fibre orientation distribution function (fODF).\
|
|
317
|
+
This fODF is estimated as part of the global track optimization,\
|
|
318
|
+
and therefore incorporates the spatial regularization that it\
|
|
319
|
+
imposes. Internally, the fODF is represented as a discrete sum of\
|
|
320
|
+
apodized point spread functions (aPSF) oriented along the\
|
|
321
|
+
directions of all particles in the voxel, used to predict the DWI\
|
|
322
|
+
signal from the particle configuration.
|
|
323
|
+
noapo: disable spherical convolution of fODF with apodized PSF, to\
|
|
324
|
+
output a sum of delta functions rather than a sum of aPSFs.
|
|
325
|
+
fiso: Predicted isotropic fractions of the tissues for which response\
|
|
326
|
+
functions were provided with -riso. Typically, these are CSF and GM.
|
|
327
|
+
eext: Residual external energy in every voxel.
|
|
328
|
+
etrend: internal and external energy trend and cooling statistics.
|
|
329
|
+
balance: balance internal and external energy. (default = 0)\
|
|
330
|
+
Negative values give more weight to the internal energy, positive\
|
|
331
|
+
to the external energy.
|
|
332
|
+
density: set the desired density of the free Poisson process. (default\
|
|
333
|
+
= 1).
|
|
334
|
+
prob: set the probabilities of generating birth, death, randshift,\
|
|
335
|
+
optshift and connect proposals respectively. (default =\
|
|
336
|
+
0.25,0.05,0.25,0.1,0.35).
|
|
337
|
+
beta: set the width of the Hanning interpolation window. (in [0, 1],\
|
|
338
|
+
default = 0)\
|
|
339
|
+
If used, a mask is required, and this mask must keep at least one\
|
|
340
|
+
voxel distance to the image bounding box.
|
|
341
|
+
lambda_: set the weight of the internal energy directly. (default = 1)\
|
|
342
|
+
If provided, any value of -balance will be ignored.
|
|
343
|
+
info: display information messages.
|
|
344
|
+
quiet: do not display information messages or progress status;\
|
|
345
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
346
|
+
environment variable to a non-empty string.
|
|
347
|
+
debug: display debugging messages.
|
|
348
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
349
|
+
input and output might cause unexpected behaviour).
|
|
350
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
351
|
+
(set to 0 to disable multi-threading).
|
|
352
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
353
|
+
help_: display this information page and exit.
|
|
354
|
+
version: display version information and exit.
|
|
355
|
+
Returns:
|
|
356
|
+
Parameter dictionary
|
|
357
|
+
"""
|
|
358
|
+
params = {
|
|
359
|
+
"@type": "mrtrix/tckglobal",
|
|
360
|
+
"noapo": noapo,
|
|
361
|
+
"info": info,
|
|
362
|
+
"quiet": quiet,
|
|
363
|
+
"debug": debug,
|
|
364
|
+
"force": force,
|
|
365
|
+
"help": help_,
|
|
366
|
+
"version": version,
|
|
367
|
+
"source": source,
|
|
368
|
+
"response": response,
|
|
369
|
+
"tracks": tracks,
|
|
370
|
+
}
|
|
371
|
+
if grad is not None:
|
|
372
|
+
params["grad"] = grad
|
|
373
|
+
if mask is not None:
|
|
374
|
+
params["mask"] = mask
|
|
375
|
+
if riso is not None:
|
|
376
|
+
params["riso"] = riso
|
|
377
|
+
if lmax is not None:
|
|
378
|
+
params["lmax"] = lmax
|
|
379
|
+
if length is not None:
|
|
380
|
+
params["length"] = length
|
|
381
|
+
if weight is not None:
|
|
382
|
+
params["weight"] = weight
|
|
383
|
+
if ppot is not None:
|
|
384
|
+
params["ppot"] = ppot
|
|
385
|
+
if cpot is not None:
|
|
386
|
+
params["cpot"] = cpot
|
|
387
|
+
if t0 is not None:
|
|
388
|
+
params["t0"] = t0
|
|
389
|
+
if t1 is not None:
|
|
390
|
+
params["t1"] = t1
|
|
391
|
+
if niter is not None:
|
|
392
|
+
params["niter"] = niter
|
|
393
|
+
if fod is not None:
|
|
394
|
+
params["fod"] = fod
|
|
395
|
+
if fiso is not None:
|
|
396
|
+
params["fiso"] = fiso
|
|
397
|
+
if eext is not None:
|
|
398
|
+
params["eext"] = eext
|
|
399
|
+
if etrend is not None:
|
|
400
|
+
params["etrend"] = etrend
|
|
401
|
+
if balance is not None:
|
|
402
|
+
params["balance"] = balance
|
|
403
|
+
if density is not None:
|
|
404
|
+
params["density"] = density
|
|
405
|
+
if prob is not None:
|
|
406
|
+
params["prob"] = prob
|
|
407
|
+
if beta is not None:
|
|
408
|
+
params["beta"] = beta
|
|
409
|
+
if lambda_ is not None:
|
|
410
|
+
params["lambda"] = lambda_
|
|
411
|
+
if nthreads is not None:
|
|
412
|
+
params["nthreads"] = nthreads
|
|
413
|
+
if config is not None:
|
|
414
|
+
params["config"] = config
|
|
415
|
+
return params
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def tckglobal_validate(
|
|
419
|
+
params: typing.Any,
|
|
420
|
+
) -> None:
|
|
421
|
+
"""
|
|
422
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
423
|
+
`TckglobalParamsDict` object.
|
|
424
|
+
|
|
425
|
+
Args:
|
|
426
|
+
params: The parameters object to validate.
|
|
427
|
+
"""
|
|
428
|
+
if params is None or not isinstance(params, dict):
|
|
429
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
430
|
+
if params.get("grad", None) is not None:
|
|
431
|
+
if not isinstance(params["grad"], (pathlib.Path, str)):
|
|
432
|
+
raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
|
|
433
|
+
if params.get("mask", None) is not None:
|
|
434
|
+
if not isinstance(params["mask"], (pathlib.Path, str)):
|
|
435
|
+
raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
|
|
436
|
+
if params.get("riso", None) is not None:
|
|
437
|
+
if not isinstance(params["riso"], list):
|
|
438
|
+
raise StyxValidationError(f'`riso` has the wrong type: Received `{type(params.get("riso", None))}` expected `list[TckglobalRisoParamsDict] | None`')
|
|
439
|
+
for e in params["riso"]:
|
|
440
|
+
tckglobal_riso_validate(e)
|
|
441
|
+
if params.get("lmax", None) is not None:
|
|
442
|
+
if not isinstance(params["lmax"], int):
|
|
443
|
+
raise StyxValidationError(f'`lmax` has the wrong type: Received `{type(params.get("lmax", None))}` expected `int | None`')
|
|
444
|
+
if params.get("length", None) is not None:
|
|
445
|
+
if not isinstance(params["length"], (float, int)):
|
|
446
|
+
raise StyxValidationError(f'`length` has the wrong type: Received `{type(params.get("length", None))}` expected `float | None`')
|
|
447
|
+
if params.get("weight", None) is not None:
|
|
448
|
+
if not isinstance(params["weight"], (float, int)):
|
|
449
|
+
raise StyxValidationError(f'`weight` has the wrong type: Received `{type(params.get("weight", None))}` expected `float | None`')
|
|
450
|
+
if params.get("ppot", None) is not None:
|
|
451
|
+
if not isinstance(params["ppot"], (float, int)):
|
|
452
|
+
raise StyxValidationError(f'`ppot` has the wrong type: Received `{type(params.get("ppot", None))}` expected `float | None`')
|
|
453
|
+
if params.get("cpot", None) is not None:
|
|
454
|
+
if not isinstance(params["cpot"], (float, int)):
|
|
455
|
+
raise StyxValidationError(f'`cpot` has the wrong type: Received `{type(params.get("cpot", None))}` expected `float | None`')
|
|
456
|
+
if params.get("t0", None) is not None:
|
|
457
|
+
if not isinstance(params["t0"], (float, int)):
|
|
458
|
+
raise StyxValidationError(f'`t0` has the wrong type: Received `{type(params.get("t0", None))}` expected `float | None`')
|
|
459
|
+
if params.get("t1", None) is not None:
|
|
460
|
+
if not isinstance(params["t1"], (float, int)):
|
|
461
|
+
raise StyxValidationError(f'`t1` has the wrong type: Received `{type(params.get("t1", None))}` expected `float | None`')
|
|
462
|
+
if params.get("niter", None) is not None:
|
|
463
|
+
if not isinstance(params["niter"], int):
|
|
464
|
+
raise StyxValidationError(f'`niter` has the wrong type: Received `{type(params.get("niter", None))}` expected `int | None`')
|
|
465
|
+
if params.get("fod", None) is not None:
|
|
466
|
+
if not isinstance(params["fod"], str):
|
|
467
|
+
raise StyxValidationError(f'`fod` has the wrong type: Received `{type(params.get("fod", None))}` expected `str | None`')
|
|
468
|
+
if params.get("noapo", False) is None:
|
|
469
|
+
raise StyxValidationError("`noapo` must not be None")
|
|
470
|
+
if not isinstance(params["noapo"], bool):
|
|
471
|
+
raise StyxValidationError(f'`noapo` has the wrong type: Received `{type(params.get("noapo", False))}` expected `bool`')
|
|
472
|
+
if params.get("fiso", None) is not None:
|
|
473
|
+
if not isinstance(params["fiso"], str):
|
|
474
|
+
raise StyxValidationError(f'`fiso` has the wrong type: Received `{type(params.get("fiso", None))}` expected `str | None`')
|
|
475
|
+
if params.get("eext", None) is not None:
|
|
476
|
+
if not isinstance(params["eext"], str):
|
|
477
|
+
raise StyxValidationError(f'`eext` has the wrong type: Received `{type(params.get("eext", None))}` expected `str | None`')
|
|
478
|
+
if params.get("etrend", None) is not None:
|
|
479
|
+
if not isinstance(params["etrend"], str):
|
|
480
|
+
raise StyxValidationError(f'`etrend` has the wrong type: Received `{type(params.get("etrend", None))}` expected `str | None`')
|
|
481
|
+
if params.get("balance", None) is not None:
|
|
482
|
+
if not isinstance(params["balance"], (float, int)):
|
|
483
|
+
raise StyxValidationError(f'`balance` has the wrong type: Received `{type(params.get("balance", None))}` expected `float | None`')
|
|
484
|
+
if params.get("density", None) is not None:
|
|
485
|
+
if not isinstance(params["density"], (float, int)):
|
|
486
|
+
raise StyxValidationError(f'`density` has the wrong type: Received `{type(params.get("density", None))}` expected `float | None`')
|
|
487
|
+
if params.get("prob", None) is not None:
|
|
488
|
+
if not isinstance(params["prob"], list):
|
|
489
|
+
raise StyxValidationError(f'`prob` has the wrong type: Received `{type(params.get("prob", None))}` expected `list[float] | None`')
|
|
490
|
+
for e in params["prob"]:
|
|
491
|
+
if not isinstance(e, (float, int)):
|
|
492
|
+
raise StyxValidationError(f'`prob` has the wrong type: Received `{type(params.get("prob", None))}` expected `list[float] | None`')
|
|
493
|
+
if params.get("beta", None) is not None:
|
|
494
|
+
if not isinstance(params["beta"], (float, int)):
|
|
495
|
+
raise StyxValidationError(f'`beta` has the wrong type: Received `{type(params.get("beta", None))}` expected `float | None`')
|
|
496
|
+
if params.get("lambda", None) is not None:
|
|
497
|
+
if not isinstance(params["lambda"], (float, int)):
|
|
498
|
+
raise StyxValidationError(f'`lambda` has the wrong type: Received `{type(params.get("lambda", None))}` expected `float | None`')
|
|
499
|
+
if params.get("info", False) is None:
|
|
500
|
+
raise StyxValidationError("`info` must not be None")
|
|
501
|
+
if not isinstance(params["info"], bool):
|
|
502
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
503
|
+
if params.get("quiet", False) is None:
|
|
504
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
505
|
+
if not isinstance(params["quiet"], bool):
|
|
506
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
507
|
+
if params.get("debug", False) is None:
|
|
508
|
+
raise StyxValidationError("`debug` must not be None")
|
|
509
|
+
if not isinstance(params["debug"], bool):
|
|
510
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
511
|
+
if params.get("force", False) is None:
|
|
512
|
+
raise StyxValidationError("`force` must not be None")
|
|
513
|
+
if not isinstance(params["force"], bool):
|
|
514
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
515
|
+
if params.get("nthreads", None) is not None:
|
|
516
|
+
if not isinstance(params["nthreads"], int):
|
|
517
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
518
|
+
if params.get("config", None) is not None:
|
|
519
|
+
if not isinstance(params["config"], list):
|
|
520
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[TckglobalConfigParamsDict] | None`')
|
|
521
|
+
for e in params["config"]:
|
|
522
|
+
tckglobal_config_validate(e)
|
|
523
|
+
if params.get("help", False) is None:
|
|
524
|
+
raise StyxValidationError("`help` must not be None")
|
|
525
|
+
if not isinstance(params["help"], bool):
|
|
526
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
527
|
+
if params.get("version", False) is None:
|
|
528
|
+
raise StyxValidationError("`version` must not be None")
|
|
529
|
+
if not isinstance(params["version"], bool):
|
|
530
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
531
|
+
if params.get("source", None) is None:
|
|
532
|
+
raise StyxValidationError("`source` must not be None")
|
|
533
|
+
if not isinstance(params["source"], (pathlib.Path, str)):
|
|
534
|
+
raise StyxValidationError(f'`source` has the wrong type: Received `{type(params.get("source", None))}` expected `InputPathType`')
|
|
535
|
+
if params.get("response", None) is None:
|
|
536
|
+
raise StyxValidationError("`response` must not be None")
|
|
537
|
+
if not isinstance(params["response"], (pathlib.Path, str)):
|
|
538
|
+
raise StyxValidationError(f'`response` has the wrong type: Received `{type(params.get("response", None))}` expected `InputPathType`')
|
|
539
|
+
if params.get("tracks", None) is None:
|
|
540
|
+
raise StyxValidationError("`tracks` must not be None")
|
|
541
|
+
if not isinstance(params["tracks"], str):
|
|
542
|
+
raise StyxValidationError(f'`tracks` has the wrong type: Received `{type(params.get("tracks", None))}` expected `str`')
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
def tckglobal_cargs(
|
|
546
|
+
params: TckglobalParamsDict,
|
|
547
|
+
execution: Execution,
|
|
548
|
+
) -> list[str]:
|
|
549
|
+
"""
|
|
550
|
+
Build command-line arguments from parameters.
|
|
551
|
+
|
|
552
|
+
Args:
|
|
553
|
+
params: The parameters.
|
|
554
|
+
execution: The execution object for resolving input paths.
|
|
555
|
+
Returns:
|
|
556
|
+
Command-line arguments.
|
|
557
|
+
"""
|
|
558
|
+
cargs = []
|
|
559
|
+
cargs.append("tckglobal")
|
|
560
|
+
if params.get("grad", None) is not None:
|
|
561
|
+
cargs.extend([
|
|
562
|
+
"-grad",
|
|
563
|
+
execution.input_file(params.get("grad", None))
|
|
564
|
+
])
|
|
565
|
+
if params.get("mask", None) is not None:
|
|
566
|
+
cargs.extend([
|
|
567
|
+
"-mask",
|
|
568
|
+
execution.input_file(params.get("mask", None))
|
|
569
|
+
])
|
|
570
|
+
if params.get("riso", None) is not None:
|
|
571
|
+
cargs.extend([a for c in [tckglobal_riso_cargs(s, execution) for s in params.get("riso", None)] for a in c])
|
|
572
|
+
if params.get("lmax", None) is not None:
|
|
573
|
+
cargs.extend([
|
|
574
|
+
"-lmax",
|
|
575
|
+
str(params.get("lmax", None))
|
|
576
|
+
])
|
|
577
|
+
if params.get("length", None) is not None:
|
|
578
|
+
cargs.extend([
|
|
579
|
+
"-length",
|
|
580
|
+
str(params.get("length", None))
|
|
581
|
+
])
|
|
582
|
+
if params.get("weight", None) is not None:
|
|
583
|
+
cargs.extend([
|
|
584
|
+
"-weight",
|
|
585
|
+
str(params.get("weight", None))
|
|
586
|
+
])
|
|
587
|
+
if params.get("ppot", None) is not None:
|
|
588
|
+
cargs.extend([
|
|
589
|
+
"-ppot",
|
|
590
|
+
str(params.get("ppot", None))
|
|
591
|
+
])
|
|
592
|
+
if params.get("cpot", None) is not None:
|
|
593
|
+
cargs.extend([
|
|
594
|
+
"-cpot",
|
|
595
|
+
str(params.get("cpot", None))
|
|
596
|
+
])
|
|
597
|
+
if params.get("t0", None) is not None:
|
|
598
|
+
cargs.extend([
|
|
599
|
+
"-t0",
|
|
600
|
+
str(params.get("t0", None))
|
|
601
|
+
])
|
|
602
|
+
if params.get("t1", None) is not None:
|
|
603
|
+
cargs.extend([
|
|
604
|
+
"-t1",
|
|
605
|
+
str(params.get("t1", None))
|
|
606
|
+
])
|
|
607
|
+
if params.get("niter", None) is not None:
|
|
608
|
+
cargs.extend([
|
|
609
|
+
"-niter",
|
|
610
|
+
str(params.get("niter", None))
|
|
611
|
+
])
|
|
612
|
+
if params.get("fod", None) is not None:
|
|
613
|
+
cargs.extend([
|
|
614
|
+
"-fod",
|
|
615
|
+
params.get("fod", None)
|
|
616
|
+
])
|
|
617
|
+
if params.get("noapo", False):
|
|
618
|
+
cargs.append("-noapo")
|
|
619
|
+
if params.get("fiso", None) is not None:
|
|
620
|
+
cargs.extend([
|
|
621
|
+
"-fiso",
|
|
622
|
+
params.get("fiso", None)
|
|
623
|
+
])
|
|
624
|
+
if params.get("eext", None) is not None:
|
|
625
|
+
cargs.extend([
|
|
626
|
+
"-eext",
|
|
627
|
+
params.get("eext", None)
|
|
628
|
+
])
|
|
629
|
+
if params.get("etrend", None) is not None:
|
|
630
|
+
cargs.extend([
|
|
631
|
+
"-etrend",
|
|
632
|
+
params.get("etrend", None)
|
|
633
|
+
])
|
|
634
|
+
if params.get("balance", None) is not None:
|
|
635
|
+
cargs.extend([
|
|
636
|
+
"-balance",
|
|
637
|
+
str(params.get("balance", None))
|
|
638
|
+
])
|
|
639
|
+
if params.get("density", None) is not None:
|
|
640
|
+
cargs.extend([
|
|
641
|
+
"-density",
|
|
642
|
+
str(params.get("density", None))
|
|
643
|
+
])
|
|
644
|
+
if params.get("prob", None) is not None:
|
|
645
|
+
cargs.extend([
|
|
646
|
+
"-prob",
|
|
647
|
+
*map(str, params.get("prob", None))
|
|
648
|
+
])
|
|
649
|
+
if params.get("beta", None) is not None:
|
|
650
|
+
cargs.extend([
|
|
651
|
+
"-beta",
|
|
652
|
+
str(params.get("beta", None))
|
|
653
|
+
])
|
|
654
|
+
if params.get("lambda", None) is not None:
|
|
655
|
+
cargs.extend([
|
|
656
|
+
"-lambda",
|
|
657
|
+
str(params.get("lambda", None))
|
|
658
|
+
])
|
|
659
|
+
if params.get("info", False):
|
|
660
|
+
cargs.append("-info")
|
|
661
|
+
if params.get("quiet", False):
|
|
662
|
+
cargs.append("-quiet")
|
|
663
|
+
if params.get("debug", False):
|
|
664
|
+
cargs.append("-debug")
|
|
665
|
+
if params.get("force", False):
|
|
666
|
+
cargs.append("-force")
|
|
667
|
+
if params.get("nthreads", None) is not None:
|
|
668
|
+
cargs.extend([
|
|
669
|
+
"-nthreads",
|
|
670
|
+
str(params.get("nthreads", None))
|
|
671
|
+
])
|
|
672
|
+
if params.get("config", None) is not None:
|
|
673
|
+
cargs.extend([a for c in [tckglobal_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
674
|
+
if params.get("help", False):
|
|
675
|
+
cargs.append("-help")
|
|
676
|
+
if params.get("version", False):
|
|
677
|
+
cargs.append("-version")
|
|
678
|
+
cargs.append(execution.input_file(params.get("source", None)))
|
|
679
|
+
cargs.append(execution.input_file(params.get("response", None)))
|
|
680
|
+
cargs.append(params.get("tracks", None))
|
|
681
|
+
return cargs
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
def tckglobal_outputs(
|
|
685
|
+
params: TckglobalParamsDict,
|
|
686
|
+
execution: Execution,
|
|
687
|
+
) -> TckglobalOutputs:
|
|
688
|
+
"""
|
|
689
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
690
|
+
|
|
691
|
+
Args:
|
|
692
|
+
params: The parameters.
|
|
693
|
+
execution: The execution object for resolving input paths.
|
|
694
|
+
Returns:
|
|
695
|
+
Outputs object.
|
|
696
|
+
"""
|
|
697
|
+
ret = TckglobalOutputs(
|
|
698
|
+
root=execution.output_file("."),
|
|
699
|
+
tracks=execution.output_file(params.get("tracks", None)),
|
|
700
|
+
fod=execution.output_file(params.get("fod", None)) if (params.get("fod") is not None) else None,
|
|
701
|
+
fiso=execution.output_file(params.get("fiso", None)) if (params.get("fiso") is not None) else None,
|
|
702
|
+
eext=execution.output_file(params.get("eext", None)) if (params.get("eext") is not None) else None,
|
|
703
|
+
etrend=execution.output_file(params.get("etrend", None)) if (params.get("etrend") is not None) else None,
|
|
704
|
+
)
|
|
705
|
+
return ret
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
def tckglobal_execute(
|
|
709
|
+
params: TckglobalParamsDict,
|
|
710
|
+
runner: Runner | None = None,
|
|
711
|
+
) -> TckglobalOutputs:
|
|
712
|
+
"""
|
|
713
|
+
tckglobal
|
|
714
|
+
|
|
715
|
+
Multi-Shell Multi-Tissue Global Tractography.
|
|
716
|
+
|
|
717
|
+
This command will reconstruct the global white matter fibre tractogram that
|
|
718
|
+
best explains the input DWI data, using a multi-tissue spherical convolution
|
|
719
|
+
model.
|
|
720
|
+
|
|
721
|
+
Example use:
|
|
722
|
+
|
|
723
|
+
$ tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif
|
|
724
|
+
-niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck
|
|
725
|
+
|
|
726
|
+
in which dwi.mif is the input image, wmr.txt is an anisotropic, multi-shell
|
|
727
|
+
response function for WM, and csfr.txt and gmr.txt are isotropic response
|
|
728
|
+
functions for CSF and GM. The output tractogram is saved to tracks.tck.
|
|
729
|
+
Optional output images fod.mif and fiso.mif contain the predicted WM fODF
|
|
730
|
+
and isotropic tissue fractions of CSF and GM respectively, estimated as part
|
|
731
|
+
of the global optimization and thus affected by spatial regularization.
|
|
732
|
+
|
|
733
|
+
References:
|
|
734
|
+
|
|
735
|
+
Christiaens, D.; Reisert, M.; Dhollander, T.; Sunaert, S.; Suetens, P. &
|
|
736
|
+
Maes, F. Global tractography of multi-shell diffusion-weighted imaging data
|
|
737
|
+
using a multi-tissue model. NeuroImage, 2015, 123, 89-101.
|
|
738
|
+
|
|
739
|
+
Author: MRTrix3 Developers
|
|
740
|
+
|
|
741
|
+
URL: https://www.mrtrix.org/
|
|
742
|
+
|
|
743
|
+
Args:
|
|
744
|
+
params: The parameters.
|
|
745
|
+
runner: Command runner.
|
|
746
|
+
Returns:
|
|
747
|
+
NamedTuple of outputs (described in `TckglobalOutputs`).
|
|
748
|
+
"""
|
|
749
|
+
tckglobal_validate(params)
|
|
750
|
+
runner = runner or get_global_runner()
|
|
751
|
+
execution = runner.start_execution(TCKGLOBAL_METADATA)
|
|
752
|
+
params = execution.params(params)
|
|
753
|
+
cargs = tckglobal_cargs(params, execution)
|
|
754
|
+
ret = tckglobal_outputs(params, execution)
|
|
755
|
+
execution.run(cargs)
|
|
756
|
+
return ret
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
def tckglobal(
|
|
760
|
+
source: InputPathType,
|
|
761
|
+
response: InputPathType,
|
|
762
|
+
tracks: str,
|
|
763
|
+
grad: InputPathType | None = None,
|
|
764
|
+
mask: InputPathType | None = None,
|
|
765
|
+
riso: list[TckglobalRisoParamsDict] | None = None,
|
|
766
|
+
lmax: int | None = None,
|
|
767
|
+
length: float | None = None,
|
|
768
|
+
weight: float | None = None,
|
|
769
|
+
ppot: float | None = None,
|
|
770
|
+
cpot: float | None = None,
|
|
771
|
+
t0: float | None = None,
|
|
772
|
+
t1: float | None = None,
|
|
773
|
+
niter: int | None = None,
|
|
774
|
+
fod: str | None = None,
|
|
775
|
+
noapo: bool = False,
|
|
776
|
+
fiso: str | None = None,
|
|
777
|
+
eext: str | None = None,
|
|
778
|
+
etrend: str | None = None,
|
|
779
|
+
balance: float | None = None,
|
|
780
|
+
density: float | None = None,
|
|
781
|
+
prob: list[float] | None = None,
|
|
782
|
+
beta: float | None = None,
|
|
783
|
+
lambda_: float | None = None,
|
|
784
|
+
info: bool = False,
|
|
785
|
+
quiet: bool = False,
|
|
786
|
+
debug: bool = False,
|
|
787
|
+
force: bool = False,
|
|
788
|
+
nthreads: int | None = None,
|
|
789
|
+
config: list[TckglobalConfigParamsDict] | None = None,
|
|
790
|
+
help_: bool = False,
|
|
791
|
+
version: bool = False,
|
|
792
|
+
runner: Runner | None = None,
|
|
793
|
+
) -> TckglobalOutputs:
|
|
794
|
+
"""
|
|
795
|
+
tckglobal
|
|
796
|
+
|
|
797
|
+
Multi-Shell Multi-Tissue Global Tractography.
|
|
798
|
+
|
|
799
|
+
This command will reconstruct the global white matter fibre tractogram that
|
|
800
|
+
best explains the input DWI data, using a multi-tissue spherical convolution
|
|
801
|
+
model.
|
|
802
|
+
|
|
803
|
+
Example use:
|
|
804
|
+
|
|
805
|
+
$ tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif
|
|
806
|
+
-niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck
|
|
807
|
+
|
|
808
|
+
in which dwi.mif is the input image, wmr.txt is an anisotropic, multi-shell
|
|
809
|
+
response function for WM, and csfr.txt and gmr.txt are isotropic response
|
|
810
|
+
functions for CSF and GM. The output tractogram is saved to tracks.tck.
|
|
811
|
+
Optional output images fod.mif and fiso.mif contain the predicted WM fODF
|
|
812
|
+
and isotropic tissue fractions of CSF and GM respectively, estimated as part
|
|
813
|
+
of the global optimization and thus affected by spatial regularization.
|
|
814
|
+
|
|
815
|
+
References:
|
|
816
|
+
|
|
817
|
+
Christiaens, D.; Reisert, M.; Dhollander, T.; Sunaert, S.; Suetens, P. &
|
|
818
|
+
Maes, F. Global tractography of multi-shell diffusion-weighted imaging data
|
|
819
|
+
using a multi-tissue model. NeuroImage, 2015, 123, 89-101.
|
|
820
|
+
|
|
821
|
+
Author: MRTrix3 Developers
|
|
822
|
+
|
|
823
|
+
URL: https://www.mrtrix.org/
|
|
824
|
+
|
|
825
|
+
Args:
|
|
826
|
+
source: the image containing the raw DWI data.
|
|
827
|
+
response: the response of a track segment on the DWI signal.
|
|
828
|
+
tracks: the output file containing the tracks generated.
|
|
829
|
+
grad: specify the diffusion encoding scheme (required if not supplied\
|
|
830
|
+
in the header).
|
|
831
|
+
mask: only reconstruct the tractogram within the specified brain mask\
|
|
832
|
+
image.
|
|
833
|
+
riso: set one or more isotropic response functions. (multiple allowed).
|
|
834
|
+
lmax: set the maximum harmonic order for the output series. (default =\
|
|
835
|
+
8).
|
|
836
|
+
length: set the length of the particles (fibre segments). (default =\
|
|
837
|
+
1mm).
|
|
838
|
+
weight: set the weight by which particles contribute to the model.\
|
|
839
|
+
(default = 0.1).
|
|
840
|
+
ppot: set the particle potential, i.e., the cost of adding one segment,\
|
|
841
|
+
relative to the particle weight. (default = 0.05).
|
|
842
|
+
cpot: set the connection potential, i.e., the energy term that drives\
|
|
843
|
+
two segments together. (default = 0.5).
|
|
844
|
+
t0: set the initial temperature of the metropolis hastings optimizer.\
|
|
845
|
+
(default = 0.1).
|
|
846
|
+
t1: set the final temperature of the metropolis hastings optimizer.\
|
|
847
|
+
(default = 0.001).
|
|
848
|
+
niter: set the number of iterations of the metropolis hastings\
|
|
849
|
+
optimizer. (default = 10M).
|
|
850
|
+
fod: Predicted fibre orientation distribution function (fODF).\
|
|
851
|
+
This fODF is estimated as part of the global track optimization,\
|
|
852
|
+
and therefore incorporates the spatial regularization that it\
|
|
853
|
+
imposes. Internally, the fODF is represented as a discrete sum of\
|
|
854
|
+
apodized point spread functions (aPSF) oriented along the\
|
|
855
|
+
directions of all particles in the voxel, used to predict the DWI\
|
|
856
|
+
signal from the particle configuration.
|
|
857
|
+
noapo: disable spherical convolution of fODF with apodized PSF, to\
|
|
858
|
+
output a sum of delta functions rather than a sum of aPSFs.
|
|
859
|
+
fiso: Predicted isotropic fractions of the tissues for which response\
|
|
860
|
+
functions were provided with -riso. Typically, these are CSF and GM.
|
|
861
|
+
eext: Residual external energy in every voxel.
|
|
862
|
+
etrend: internal and external energy trend and cooling statistics.
|
|
863
|
+
balance: balance internal and external energy. (default = 0)\
|
|
864
|
+
Negative values give more weight to the internal energy, positive\
|
|
865
|
+
to the external energy.
|
|
866
|
+
density: set the desired density of the free Poisson process. (default\
|
|
867
|
+
= 1).
|
|
868
|
+
prob: set the probabilities of generating birth, death, randshift,\
|
|
869
|
+
optshift and connect proposals respectively. (default =\
|
|
870
|
+
0.25,0.05,0.25,0.1,0.35).
|
|
871
|
+
beta: set the width of the Hanning interpolation window. (in [0, 1],\
|
|
872
|
+
default = 0)\
|
|
873
|
+
If used, a mask is required, and this mask must keep at least one\
|
|
874
|
+
voxel distance to the image bounding box.
|
|
875
|
+
lambda_: set the weight of the internal energy directly. (default = 1)\
|
|
876
|
+
If provided, any value of -balance will be ignored.
|
|
877
|
+
info: display information messages.
|
|
878
|
+
quiet: do not display information messages or progress status;\
|
|
879
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
880
|
+
environment variable to a non-empty string.
|
|
881
|
+
debug: display debugging messages.
|
|
882
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
883
|
+
input and output might cause unexpected behaviour).
|
|
884
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
885
|
+
(set to 0 to disable multi-threading).
|
|
886
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
887
|
+
help_: display this information page and exit.
|
|
888
|
+
version: display version information and exit.
|
|
889
|
+
runner: Command runner.
|
|
890
|
+
Returns:
|
|
891
|
+
NamedTuple of outputs (described in `TckglobalOutputs`).
|
|
892
|
+
"""
|
|
893
|
+
params = tckglobal_params(
|
|
894
|
+
grad=grad,
|
|
895
|
+
mask=mask,
|
|
896
|
+
riso=riso,
|
|
897
|
+
lmax=lmax,
|
|
898
|
+
length=length,
|
|
899
|
+
weight=weight,
|
|
900
|
+
ppot=ppot,
|
|
901
|
+
cpot=cpot,
|
|
902
|
+
t0=t0,
|
|
903
|
+
t1=t1,
|
|
904
|
+
niter=niter,
|
|
905
|
+
fod=fod,
|
|
906
|
+
noapo=noapo,
|
|
907
|
+
fiso=fiso,
|
|
908
|
+
eext=eext,
|
|
909
|
+
etrend=etrend,
|
|
910
|
+
balance=balance,
|
|
911
|
+
density=density,
|
|
912
|
+
prob=prob,
|
|
913
|
+
beta=beta,
|
|
914
|
+
lambda_=lambda_,
|
|
915
|
+
info=info,
|
|
916
|
+
quiet=quiet,
|
|
917
|
+
debug=debug,
|
|
918
|
+
force=force,
|
|
919
|
+
nthreads=nthreads,
|
|
920
|
+
config=config,
|
|
921
|
+
help_=help_,
|
|
922
|
+
version=version,
|
|
923
|
+
source=source,
|
|
924
|
+
response=response,
|
|
925
|
+
tracks=tracks,
|
|
926
|
+
)
|
|
927
|
+
return tckglobal_execute(params, runner)
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
__all__ = [
|
|
931
|
+
"TCKGLOBAL_METADATA",
|
|
932
|
+
"TckglobalConfigParamsDict",
|
|
933
|
+
"TckglobalConfigParamsDictTagged",
|
|
934
|
+
"TckglobalOutputs",
|
|
935
|
+
"TckglobalParamsDict",
|
|
936
|
+
"TckglobalParamsDictTagged",
|
|
937
|
+
"TckglobalRisoParamsDict",
|
|
938
|
+
"TckglobalRisoParamsDictTagged",
|
|
939
|
+
"tckglobal",
|
|
940
|
+
"tckglobal_config",
|
|
941
|
+
"tckglobal_execute",
|
|
942
|
+
"tckglobal_params",
|
|
943
|
+
"tckglobal_riso",
|
|
944
|
+
]
|