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,646 @@
|
|
|
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
|
+
FOD2FIXEL_METADATA = Metadata(
|
|
9
|
+
id="789d8f209b3fdf4c5f81cd43bcf2cd1ab6e4addc.boutiques",
|
|
10
|
+
name="fod2fixel",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Fod2fixelConfigParamsDictNoTag = typing.TypedDict('_Fod2fixelConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
Fod2fixelConfigParamsDictTagged = typing.TypedDict('Fod2fixelConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
Fod2fixelConfigParamsDict = _Fod2fixelConfigParamsDictNoTag | Fod2fixelConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_Fod2fixelParamsDictNoTag = typing.TypedDict('_Fod2fixelParamsDictNoTag', {
|
|
29
|
+
"afd": typing.NotRequired[str | None],
|
|
30
|
+
"peak_amp": typing.NotRequired[str | None],
|
|
31
|
+
"disp": typing.NotRequired[str | None],
|
|
32
|
+
"fmls_integral": typing.NotRequired[float | None],
|
|
33
|
+
"fmls_peak_value": typing.NotRequired[float | None],
|
|
34
|
+
"fmls_no_thresholds": bool,
|
|
35
|
+
"fmls_lobe_merge_ratio": typing.NotRequired[float | None],
|
|
36
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
37
|
+
"maxnum": typing.NotRequired[int | None],
|
|
38
|
+
"nii": bool,
|
|
39
|
+
"dirpeak": bool,
|
|
40
|
+
"info": bool,
|
|
41
|
+
"quiet": bool,
|
|
42
|
+
"debug": bool,
|
|
43
|
+
"force": bool,
|
|
44
|
+
"nthreads": typing.NotRequired[int | None],
|
|
45
|
+
"config": typing.NotRequired[list[Fod2fixelConfigParamsDict] | None],
|
|
46
|
+
"help": bool,
|
|
47
|
+
"version": bool,
|
|
48
|
+
"fod": InputPathType,
|
|
49
|
+
"fixel_directory": str,
|
|
50
|
+
})
|
|
51
|
+
Fod2fixelParamsDictTagged = typing.TypedDict('Fod2fixelParamsDictTagged', {
|
|
52
|
+
"@type": typing.Literal["mrtrix/fod2fixel"],
|
|
53
|
+
"afd": typing.NotRequired[str | None],
|
|
54
|
+
"peak_amp": typing.NotRequired[str | None],
|
|
55
|
+
"disp": typing.NotRequired[str | None],
|
|
56
|
+
"fmls_integral": typing.NotRequired[float | None],
|
|
57
|
+
"fmls_peak_value": typing.NotRequired[float | None],
|
|
58
|
+
"fmls_no_thresholds": bool,
|
|
59
|
+
"fmls_lobe_merge_ratio": typing.NotRequired[float | None],
|
|
60
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
61
|
+
"maxnum": typing.NotRequired[int | None],
|
|
62
|
+
"nii": bool,
|
|
63
|
+
"dirpeak": bool,
|
|
64
|
+
"info": bool,
|
|
65
|
+
"quiet": bool,
|
|
66
|
+
"debug": bool,
|
|
67
|
+
"force": bool,
|
|
68
|
+
"nthreads": typing.NotRequired[int | None],
|
|
69
|
+
"config": typing.NotRequired[list[Fod2fixelConfigParamsDict] | None],
|
|
70
|
+
"help": bool,
|
|
71
|
+
"version": bool,
|
|
72
|
+
"fod": InputPathType,
|
|
73
|
+
"fixel_directory": str,
|
|
74
|
+
})
|
|
75
|
+
Fod2fixelParamsDict = _Fod2fixelParamsDictNoTag | Fod2fixelParamsDictTagged
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def fod2fixel_config(
|
|
79
|
+
key: str,
|
|
80
|
+
value: str,
|
|
81
|
+
) -> Fod2fixelConfigParamsDictTagged:
|
|
82
|
+
"""
|
|
83
|
+
Build parameters.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
87
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
88
|
+
Returns:
|
|
89
|
+
Parameter dictionary
|
|
90
|
+
"""
|
|
91
|
+
params = {
|
|
92
|
+
"@type": "config",
|
|
93
|
+
"key": key,
|
|
94
|
+
"value": value,
|
|
95
|
+
}
|
|
96
|
+
return params
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def fod2fixel_config_validate(
|
|
100
|
+
params: typing.Any,
|
|
101
|
+
) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
104
|
+
`Fod2fixelConfigParamsDict` object.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
params: The parameters object to validate.
|
|
108
|
+
"""
|
|
109
|
+
if params is None or not isinstance(params, dict):
|
|
110
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
111
|
+
if params.get("key", None) is None:
|
|
112
|
+
raise StyxValidationError("`key` must not be None")
|
|
113
|
+
if not isinstance(params["key"], str):
|
|
114
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
115
|
+
if params.get("value", None) is None:
|
|
116
|
+
raise StyxValidationError("`value` must not be None")
|
|
117
|
+
if not isinstance(params["value"], str):
|
|
118
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def fod2fixel_config_cargs(
|
|
122
|
+
params: Fod2fixelConfigParamsDict,
|
|
123
|
+
execution: Execution,
|
|
124
|
+
) -> list[str]:
|
|
125
|
+
"""
|
|
126
|
+
Build command-line arguments from parameters.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
params: The parameters.
|
|
130
|
+
execution: The execution object for resolving input paths.
|
|
131
|
+
Returns:
|
|
132
|
+
Command-line arguments.
|
|
133
|
+
"""
|
|
134
|
+
cargs = []
|
|
135
|
+
cargs.append("-config")
|
|
136
|
+
cargs.append(params.get("key", None))
|
|
137
|
+
cargs.append(params.get("value", None))
|
|
138
|
+
return cargs
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class Fod2fixelOutputs(typing.NamedTuple):
|
|
142
|
+
"""
|
|
143
|
+
Output object returned when calling `Fod2fixelParamsDict(...)`.
|
|
144
|
+
"""
|
|
145
|
+
root: OutputPathType
|
|
146
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
147
|
+
fixel_directory: OutputPathType
|
|
148
|
+
"""the output fixel directory"""
|
|
149
|
+
afd: OutputPathType | None
|
|
150
|
+
"""output the total Apparent Fibre Density per fixel (integral of FOD lobe)
|
|
151
|
+
"""
|
|
152
|
+
peak_amp: OutputPathType | None
|
|
153
|
+
"""output the amplitude of the FOD at the maximal peak per fixel """
|
|
154
|
+
disp: OutputPathType | None
|
|
155
|
+
"""output a measure of dispersion per fixel as the ratio between FOD lobe
|
|
156
|
+
integral and maximal peak amplitude """
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def fod2fixel_params(
|
|
160
|
+
fod: InputPathType,
|
|
161
|
+
fixel_directory: str,
|
|
162
|
+
afd: str | None = None,
|
|
163
|
+
peak_amp: str | None = None,
|
|
164
|
+
disp: str | None = None,
|
|
165
|
+
fmls_integral: float | None = None,
|
|
166
|
+
fmls_peak_value: float | None = None,
|
|
167
|
+
fmls_no_thresholds: bool = False,
|
|
168
|
+
fmls_lobe_merge_ratio: float | None = None,
|
|
169
|
+
mask: InputPathType | None = None,
|
|
170
|
+
maxnum: int | None = None,
|
|
171
|
+
nii: bool = False,
|
|
172
|
+
dirpeak: bool = False,
|
|
173
|
+
info: bool = False,
|
|
174
|
+
quiet: bool = False,
|
|
175
|
+
debug: bool = False,
|
|
176
|
+
force: bool = False,
|
|
177
|
+
nthreads: int | None = None,
|
|
178
|
+
config: list[Fod2fixelConfigParamsDict] | None = None,
|
|
179
|
+
help_: bool = False,
|
|
180
|
+
version: bool = False,
|
|
181
|
+
) -> Fod2fixelParamsDictTagged:
|
|
182
|
+
"""
|
|
183
|
+
Build parameters.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
fod: the input fod image.
|
|
187
|
+
fixel_directory: the output fixel directory.
|
|
188
|
+
afd: output the total Apparent Fibre Density per fixel (integral of FOD\
|
|
189
|
+
lobe).
|
|
190
|
+
peak_amp: output the amplitude of the FOD at the maximal peak per fixel.
|
|
191
|
+
disp: output a measure of dispersion per fixel as the ratio between FOD\
|
|
192
|
+
lobe integral and maximal peak amplitude.
|
|
193
|
+
fmls_integral: threshold absolute numerical integral of positive FOD\
|
|
194
|
+
lobes. Any lobe for which the integral is smaller than this threshold\
|
|
195
|
+
will be discarded. Default: 0.
|
|
196
|
+
fmls_peak_value: threshold peak amplitude of positive FOD lobes. Any\
|
|
197
|
+
lobe for which the maximal peak amplitude is smaller than this\
|
|
198
|
+
threshold will be discarded. Default: 0.1.
|
|
199
|
+
fmls_no_thresholds: disable all FOD lobe thresholding; every lobe where\
|
|
200
|
+
the FOD is positive will be retained.
|
|
201
|
+
fmls_lobe_merge_ratio: Specify the ratio between a given FOD amplitude\
|
|
202
|
+
sample between two lobes, and the smallest peak amplitude of the\
|
|
203
|
+
adjacent lobes, above which those lobes will be merged. This is the\
|
|
204
|
+
amplitude of the FOD at the 'bridge' point between the two lobes,\
|
|
205
|
+
divided by the peak amplitude of the smaller of the two adjoining\
|
|
206
|
+
lobes. A value of 1.0 will never merge two lobes into one; a value of\
|
|
207
|
+
0.0 will always merge lobes unless they are bisected by a zero-valued\
|
|
208
|
+
crossing. Default: 1.
|
|
209
|
+
mask: only perform computation within the specified binary brain mask\
|
|
210
|
+
image.
|
|
211
|
+
maxnum: maximum number of fixels to output for any particular voxel\
|
|
212
|
+
(default: no limit).
|
|
213
|
+
nii: output the directions and index file in nii format (instead of the\
|
|
214
|
+
default mif).
|
|
215
|
+
dirpeak: define the fixel direction as that of the lobe's maximal peak\
|
|
216
|
+
as opposed to its weighted mean direction (the default).
|
|
217
|
+
info: display information messages.
|
|
218
|
+
quiet: do not display information messages or progress status;\
|
|
219
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
220
|
+
environment variable to a non-empty string.
|
|
221
|
+
debug: display debugging messages.
|
|
222
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
223
|
+
input and output might cause unexpected behaviour).
|
|
224
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
225
|
+
(set to 0 to disable multi-threading).
|
|
226
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
227
|
+
help_: display this information page and exit.
|
|
228
|
+
version: display version information and exit.
|
|
229
|
+
Returns:
|
|
230
|
+
Parameter dictionary
|
|
231
|
+
"""
|
|
232
|
+
params = {
|
|
233
|
+
"@type": "mrtrix/fod2fixel",
|
|
234
|
+
"fmls_no_thresholds": fmls_no_thresholds,
|
|
235
|
+
"nii": nii,
|
|
236
|
+
"dirpeak": dirpeak,
|
|
237
|
+
"info": info,
|
|
238
|
+
"quiet": quiet,
|
|
239
|
+
"debug": debug,
|
|
240
|
+
"force": force,
|
|
241
|
+
"help": help_,
|
|
242
|
+
"version": version,
|
|
243
|
+
"fod": fod,
|
|
244
|
+
"fixel_directory": fixel_directory,
|
|
245
|
+
}
|
|
246
|
+
if afd is not None:
|
|
247
|
+
params["afd"] = afd
|
|
248
|
+
if peak_amp is not None:
|
|
249
|
+
params["peak_amp"] = peak_amp
|
|
250
|
+
if disp is not None:
|
|
251
|
+
params["disp"] = disp
|
|
252
|
+
if fmls_integral is not None:
|
|
253
|
+
params["fmls_integral"] = fmls_integral
|
|
254
|
+
if fmls_peak_value is not None:
|
|
255
|
+
params["fmls_peak_value"] = fmls_peak_value
|
|
256
|
+
if fmls_lobe_merge_ratio is not None:
|
|
257
|
+
params["fmls_lobe_merge_ratio"] = fmls_lobe_merge_ratio
|
|
258
|
+
if mask is not None:
|
|
259
|
+
params["mask"] = mask
|
|
260
|
+
if maxnum is not None:
|
|
261
|
+
params["maxnum"] = maxnum
|
|
262
|
+
if nthreads is not None:
|
|
263
|
+
params["nthreads"] = nthreads
|
|
264
|
+
if config is not None:
|
|
265
|
+
params["config"] = config
|
|
266
|
+
return params
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def fod2fixel_validate(
|
|
270
|
+
params: typing.Any,
|
|
271
|
+
) -> None:
|
|
272
|
+
"""
|
|
273
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
274
|
+
`Fod2fixelParamsDict` object.
|
|
275
|
+
|
|
276
|
+
Args:
|
|
277
|
+
params: The parameters object to validate.
|
|
278
|
+
"""
|
|
279
|
+
if params is None or not isinstance(params, dict):
|
|
280
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
281
|
+
if params.get("afd", None) is not None:
|
|
282
|
+
if not isinstance(params["afd"], str):
|
|
283
|
+
raise StyxValidationError(f'`afd` has the wrong type: Received `{type(params.get("afd", None))}` expected `str | None`')
|
|
284
|
+
if params.get("peak_amp", None) is not None:
|
|
285
|
+
if not isinstance(params["peak_amp"], str):
|
|
286
|
+
raise StyxValidationError(f'`peak_amp` has the wrong type: Received `{type(params.get("peak_amp", None))}` expected `str | None`')
|
|
287
|
+
if params.get("disp", None) is not None:
|
|
288
|
+
if not isinstance(params["disp"], str):
|
|
289
|
+
raise StyxValidationError(f'`disp` has the wrong type: Received `{type(params.get("disp", None))}` expected `str | None`')
|
|
290
|
+
if params.get("fmls_integral", None) is not None:
|
|
291
|
+
if not isinstance(params["fmls_integral"], (float, int)):
|
|
292
|
+
raise StyxValidationError(f'`fmls_integral` has the wrong type: Received `{type(params.get("fmls_integral", None))}` expected `float | None`')
|
|
293
|
+
if params.get("fmls_peak_value", None) is not None:
|
|
294
|
+
if not isinstance(params["fmls_peak_value"], (float, int)):
|
|
295
|
+
raise StyxValidationError(f'`fmls_peak_value` has the wrong type: Received `{type(params.get("fmls_peak_value", None))}` expected `float | None`')
|
|
296
|
+
if params.get("fmls_no_thresholds", False) is None:
|
|
297
|
+
raise StyxValidationError("`fmls_no_thresholds` must not be None")
|
|
298
|
+
if not isinstance(params["fmls_no_thresholds"], bool):
|
|
299
|
+
raise StyxValidationError(f'`fmls_no_thresholds` has the wrong type: Received `{type(params.get("fmls_no_thresholds", False))}` expected `bool`')
|
|
300
|
+
if params.get("fmls_lobe_merge_ratio", None) is not None:
|
|
301
|
+
if not isinstance(params["fmls_lobe_merge_ratio"], (float, int)):
|
|
302
|
+
raise StyxValidationError(f'`fmls_lobe_merge_ratio` has the wrong type: Received `{type(params.get("fmls_lobe_merge_ratio", None))}` expected `float | None`')
|
|
303
|
+
if params.get("mask", None) is not None:
|
|
304
|
+
if not isinstance(params["mask"], (pathlib.Path, str)):
|
|
305
|
+
raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
|
|
306
|
+
if params.get("maxnum", None) is not None:
|
|
307
|
+
if not isinstance(params["maxnum"], int):
|
|
308
|
+
raise StyxValidationError(f'`maxnum` has the wrong type: Received `{type(params.get("maxnum", None))}` expected `int | None`')
|
|
309
|
+
if params.get("nii", False) is None:
|
|
310
|
+
raise StyxValidationError("`nii` must not be None")
|
|
311
|
+
if not isinstance(params["nii"], bool):
|
|
312
|
+
raise StyxValidationError(f'`nii` has the wrong type: Received `{type(params.get("nii", False))}` expected `bool`')
|
|
313
|
+
if params.get("dirpeak", False) is None:
|
|
314
|
+
raise StyxValidationError("`dirpeak` must not be None")
|
|
315
|
+
if not isinstance(params["dirpeak"], bool):
|
|
316
|
+
raise StyxValidationError(f'`dirpeak` has the wrong type: Received `{type(params.get("dirpeak", False))}` expected `bool`')
|
|
317
|
+
if params.get("info", False) is None:
|
|
318
|
+
raise StyxValidationError("`info` must not be None")
|
|
319
|
+
if not isinstance(params["info"], bool):
|
|
320
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
321
|
+
if params.get("quiet", False) is None:
|
|
322
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
323
|
+
if not isinstance(params["quiet"], bool):
|
|
324
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
325
|
+
if params.get("debug", False) is None:
|
|
326
|
+
raise StyxValidationError("`debug` must not be None")
|
|
327
|
+
if not isinstance(params["debug"], bool):
|
|
328
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
329
|
+
if params.get("force", False) is None:
|
|
330
|
+
raise StyxValidationError("`force` must not be None")
|
|
331
|
+
if not isinstance(params["force"], bool):
|
|
332
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
333
|
+
if params.get("nthreads", None) is not None:
|
|
334
|
+
if not isinstance(params["nthreads"], int):
|
|
335
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
336
|
+
if params.get("config", None) is not None:
|
|
337
|
+
if not isinstance(params["config"], list):
|
|
338
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Fod2fixelConfigParamsDict] | None`')
|
|
339
|
+
for e in params["config"]:
|
|
340
|
+
fod2fixel_config_validate(e)
|
|
341
|
+
if params.get("help", False) is None:
|
|
342
|
+
raise StyxValidationError("`help` must not be None")
|
|
343
|
+
if not isinstance(params["help"], bool):
|
|
344
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
345
|
+
if params.get("version", False) is None:
|
|
346
|
+
raise StyxValidationError("`version` must not be None")
|
|
347
|
+
if not isinstance(params["version"], bool):
|
|
348
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
349
|
+
if params.get("fod", None) is None:
|
|
350
|
+
raise StyxValidationError("`fod` must not be None")
|
|
351
|
+
if not isinstance(params["fod"], (pathlib.Path, str)):
|
|
352
|
+
raise StyxValidationError(f'`fod` has the wrong type: Received `{type(params.get("fod", None))}` expected `InputPathType`')
|
|
353
|
+
if params.get("fixel_directory", None) is None:
|
|
354
|
+
raise StyxValidationError("`fixel_directory` must not be None")
|
|
355
|
+
if not isinstance(params["fixel_directory"], str):
|
|
356
|
+
raise StyxValidationError(f'`fixel_directory` has the wrong type: Received `{type(params.get("fixel_directory", None))}` expected `str`')
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def fod2fixel_cargs(
|
|
360
|
+
params: Fod2fixelParamsDict,
|
|
361
|
+
execution: Execution,
|
|
362
|
+
) -> list[str]:
|
|
363
|
+
"""
|
|
364
|
+
Build command-line arguments from parameters.
|
|
365
|
+
|
|
366
|
+
Args:
|
|
367
|
+
params: The parameters.
|
|
368
|
+
execution: The execution object for resolving input paths.
|
|
369
|
+
Returns:
|
|
370
|
+
Command-line arguments.
|
|
371
|
+
"""
|
|
372
|
+
cargs = []
|
|
373
|
+
cargs.append("fod2fixel")
|
|
374
|
+
if params.get("afd", None) is not None:
|
|
375
|
+
cargs.extend([
|
|
376
|
+
"-afd",
|
|
377
|
+
params.get("afd", None)
|
|
378
|
+
])
|
|
379
|
+
if params.get("peak_amp", None) is not None:
|
|
380
|
+
cargs.extend([
|
|
381
|
+
"-peak_amp",
|
|
382
|
+
params.get("peak_amp", None)
|
|
383
|
+
])
|
|
384
|
+
if params.get("disp", None) is not None:
|
|
385
|
+
cargs.extend([
|
|
386
|
+
"-disp",
|
|
387
|
+
params.get("disp", None)
|
|
388
|
+
])
|
|
389
|
+
if params.get("fmls_integral", None) is not None:
|
|
390
|
+
cargs.extend([
|
|
391
|
+
"-fmls_integral",
|
|
392
|
+
str(params.get("fmls_integral", None))
|
|
393
|
+
])
|
|
394
|
+
if params.get("fmls_peak_value", None) is not None:
|
|
395
|
+
cargs.extend([
|
|
396
|
+
"-fmls_peak_value",
|
|
397
|
+
str(params.get("fmls_peak_value", None))
|
|
398
|
+
])
|
|
399
|
+
if params.get("fmls_no_thresholds", False):
|
|
400
|
+
cargs.append("-fmls_no_thresholds")
|
|
401
|
+
if params.get("fmls_lobe_merge_ratio", None) is not None:
|
|
402
|
+
cargs.extend([
|
|
403
|
+
"-fmls_lobe_merge_ratio",
|
|
404
|
+
str(params.get("fmls_lobe_merge_ratio", None))
|
|
405
|
+
])
|
|
406
|
+
if params.get("mask", None) is not None:
|
|
407
|
+
cargs.extend([
|
|
408
|
+
"-mask",
|
|
409
|
+
execution.input_file(params.get("mask", None))
|
|
410
|
+
])
|
|
411
|
+
if params.get("maxnum", None) is not None:
|
|
412
|
+
cargs.extend([
|
|
413
|
+
"-maxnum",
|
|
414
|
+
str(params.get("maxnum", None))
|
|
415
|
+
])
|
|
416
|
+
if params.get("nii", False):
|
|
417
|
+
cargs.append("-nii")
|
|
418
|
+
if params.get("dirpeak", False):
|
|
419
|
+
cargs.append("-dirpeak")
|
|
420
|
+
if params.get("info", False):
|
|
421
|
+
cargs.append("-info")
|
|
422
|
+
if params.get("quiet", False):
|
|
423
|
+
cargs.append("-quiet")
|
|
424
|
+
if params.get("debug", False):
|
|
425
|
+
cargs.append("-debug")
|
|
426
|
+
if params.get("force", False):
|
|
427
|
+
cargs.append("-force")
|
|
428
|
+
if params.get("nthreads", None) is not None:
|
|
429
|
+
cargs.extend([
|
|
430
|
+
"-nthreads",
|
|
431
|
+
str(params.get("nthreads", None))
|
|
432
|
+
])
|
|
433
|
+
if params.get("config", None) is not None:
|
|
434
|
+
cargs.extend([a for c in [fod2fixel_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
435
|
+
if params.get("help", False):
|
|
436
|
+
cargs.append("-help")
|
|
437
|
+
if params.get("version", False):
|
|
438
|
+
cargs.append("-version")
|
|
439
|
+
cargs.append(execution.input_file(params.get("fod", None)))
|
|
440
|
+
cargs.append(params.get("fixel_directory", None))
|
|
441
|
+
return cargs
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def fod2fixel_outputs(
|
|
445
|
+
params: Fod2fixelParamsDict,
|
|
446
|
+
execution: Execution,
|
|
447
|
+
) -> Fod2fixelOutputs:
|
|
448
|
+
"""
|
|
449
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
450
|
+
|
|
451
|
+
Args:
|
|
452
|
+
params: The parameters.
|
|
453
|
+
execution: The execution object for resolving input paths.
|
|
454
|
+
Returns:
|
|
455
|
+
Outputs object.
|
|
456
|
+
"""
|
|
457
|
+
ret = Fod2fixelOutputs(
|
|
458
|
+
root=execution.output_file("."),
|
|
459
|
+
fixel_directory=execution.output_file(params.get("fixel_directory", None)),
|
|
460
|
+
afd=execution.output_file(params.get("afd", None)) if (params.get("afd") is not None) else None,
|
|
461
|
+
peak_amp=execution.output_file(params.get("peak_amp", None)) if (params.get("peak_amp") is not None) else None,
|
|
462
|
+
disp=execution.output_file(params.get("disp", None)) if (params.get("disp") is not None) else None,
|
|
463
|
+
)
|
|
464
|
+
return ret
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def fod2fixel_execute(
|
|
468
|
+
params: Fod2fixelParamsDict,
|
|
469
|
+
runner: Runner | None = None,
|
|
470
|
+
) -> Fod2fixelOutputs:
|
|
471
|
+
"""
|
|
472
|
+
fod2fixel
|
|
473
|
+
|
|
474
|
+
Perform segmentation of continuous Fibre Orientation Distributions (FODs) to
|
|
475
|
+
produce discrete fixels.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
References:
|
|
480
|
+
|
|
481
|
+
* Reference for the FOD segmentation method:
|
|
482
|
+
Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT:
|
|
483
|
+
Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013,
|
|
484
|
+
67, 298-312 (Appendix 2)
|
|
485
|
+
|
|
486
|
+
* Reference for Apparent Fibre Density (AFD):
|
|
487
|
+
Raffelt, D.; Tournier, J.-D.; Rose, S.; Ridgway, G.R.; Henderson, R.;
|
|
488
|
+
Crozier, S.; Salvado, O.; Connelly, A. Apparent Fibre Density: a novel
|
|
489
|
+
measure for the analysis of diffusion-weighted magnetic resonance
|
|
490
|
+
images.Neuroimage, 2012, 15;59(4), 3976-94.
|
|
491
|
+
|
|
492
|
+
Author: MRTrix3 Developers
|
|
493
|
+
|
|
494
|
+
URL: https://www.mrtrix.org/
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
params: The parameters.
|
|
498
|
+
runner: Command runner.
|
|
499
|
+
Returns:
|
|
500
|
+
NamedTuple of outputs (described in `Fod2fixelOutputs`).
|
|
501
|
+
"""
|
|
502
|
+
fod2fixel_validate(params)
|
|
503
|
+
runner = runner or get_global_runner()
|
|
504
|
+
execution = runner.start_execution(FOD2FIXEL_METADATA)
|
|
505
|
+
params = execution.params(params)
|
|
506
|
+
cargs = fod2fixel_cargs(params, execution)
|
|
507
|
+
ret = fod2fixel_outputs(params, execution)
|
|
508
|
+
execution.run(cargs)
|
|
509
|
+
return ret
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def fod2fixel(
|
|
513
|
+
fod: InputPathType,
|
|
514
|
+
fixel_directory: str,
|
|
515
|
+
afd: str | None = None,
|
|
516
|
+
peak_amp: str | None = None,
|
|
517
|
+
disp: str | None = None,
|
|
518
|
+
fmls_integral: float | None = None,
|
|
519
|
+
fmls_peak_value: float | None = None,
|
|
520
|
+
fmls_no_thresholds: bool = False,
|
|
521
|
+
fmls_lobe_merge_ratio: float | None = None,
|
|
522
|
+
mask: InputPathType | None = None,
|
|
523
|
+
maxnum: int | None = None,
|
|
524
|
+
nii: bool = False,
|
|
525
|
+
dirpeak: bool = False,
|
|
526
|
+
info: bool = False,
|
|
527
|
+
quiet: bool = False,
|
|
528
|
+
debug: bool = False,
|
|
529
|
+
force: bool = False,
|
|
530
|
+
nthreads: int | None = None,
|
|
531
|
+
config: list[Fod2fixelConfigParamsDict] | None = None,
|
|
532
|
+
help_: bool = False,
|
|
533
|
+
version: bool = False,
|
|
534
|
+
runner: Runner | None = None,
|
|
535
|
+
) -> Fod2fixelOutputs:
|
|
536
|
+
"""
|
|
537
|
+
fod2fixel
|
|
538
|
+
|
|
539
|
+
Perform segmentation of continuous Fibre Orientation Distributions (FODs) to
|
|
540
|
+
produce discrete fixels.
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
References:
|
|
545
|
+
|
|
546
|
+
* Reference for the FOD segmentation method:
|
|
547
|
+
Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT:
|
|
548
|
+
Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013,
|
|
549
|
+
67, 298-312 (Appendix 2)
|
|
550
|
+
|
|
551
|
+
* Reference for Apparent Fibre Density (AFD):
|
|
552
|
+
Raffelt, D.; Tournier, J.-D.; Rose, S.; Ridgway, G.R.; Henderson, R.;
|
|
553
|
+
Crozier, S.; Salvado, O.; Connelly, A. Apparent Fibre Density: a novel
|
|
554
|
+
measure for the analysis of diffusion-weighted magnetic resonance
|
|
555
|
+
images.Neuroimage, 2012, 15;59(4), 3976-94.
|
|
556
|
+
|
|
557
|
+
Author: MRTrix3 Developers
|
|
558
|
+
|
|
559
|
+
URL: https://www.mrtrix.org/
|
|
560
|
+
|
|
561
|
+
Args:
|
|
562
|
+
fod: the input fod image.
|
|
563
|
+
fixel_directory: the output fixel directory.
|
|
564
|
+
afd: output the total Apparent Fibre Density per fixel (integral of FOD\
|
|
565
|
+
lobe).
|
|
566
|
+
peak_amp: output the amplitude of the FOD at the maximal peak per fixel.
|
|
567
|
+
disp: output a measure of dispersion per fixel as the ratio between FOD\
|
|
568
|
+
lobe integral and maximal peak amplitude.
|
|
569
|
+
fmls_integral: threshold absolute numerical integral of positive FOD\
|
|
570
|
+
lobes. Any lobe for which the integral is smaller than this threshold\
|
|
571
|
+
will be discarded. Default: 0.
|
|
572
|
+
fmls_peak_value: threshold peak amplitude of positive FOD lobes. Any\
|
|
573
|
+
lobe for which the maximal peak amplitude is smaller than this\
|
|
574
|
+
threshold will be discarded. Default: 0.1.
|
|
575
|
+
fmls_no_thresholds: disable all FOD lobe thresholding; every lobe where\
|
|
576
|
+
the FOD is positive will be retained.
|
|
577
|
+
fmls_lobe_merge_ratio: Specify the ratio between a given FOD amplitude\
|
|
578
|
+
sample between two lobes, and the smallest peak amplitude of the\
|
|
579
|
+
adjacent lobes, above which those lobes will be merged. This is the\
|
|
580
|
+
amplitude of the FOD at the 'bridge' point between the two lobes,\
|
|
581
|
+
divided by the peak amplitude of the smaller of the two adjoining\
|
|
582
|
+
lobes. A value of 1.0 will never merge two lobes into one; a value of\
|
|
583
|
+
0.0 will always merge lobes unless they are bisected by a zero-valued\
|
|
584
|
+
crossing. Default: 1.
|
|
585
|
+
mask: only perform computation within the specified binary brain mask\
|
|
586
|
+
image.
|
|
587
|
+
maxnum: maximum number of fixels to output for any particular voxel\
|
|
588
|
+
(default: no limit).
|
|
589
|
+
nii: output the directions and index file in nii format (instead of the\
|
|
590
|
+
default mif).
|
|
591
|
+
dirpeak: define the fixel direction as that of the lobe's maximal peak\
|
|
592
|
+
as opposed to its weighted mean direction (the default).
|
|
593
|
+
info: display information messages.
|
|
594
|
+
quiet: do not display information messages or progress status;\
|
|
595
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
596
|
+
environment variable to a non-empty string.
|
|
597
|
+
debug: display debugging messages.
|
|
598
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
599
|
+
input and output might cause unexpected behaviour).
|
|
600
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
601
|
+
(set to 0 to disable multi-threading).
|
|
602
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
603
|
+
help_: display this information page and exit.
|
|
604
|
+
version: display version information and exit.
|
|
605
|
+
runner: Command runner.
|
|
606
|
+
Returns:
|
|
607
|
+
NamedTuple of outputs (described in `Fod2fixelOutputs`).
|
|
608
|
+
"""
|
|
609
|
+
params = fod2fixel_params(
|
|
610
|
+
afd=afd,
|
|
611
|
+
peak_amp=peak_amp,
|
|
612
|
+
disp=disp,
|
|
613
|
+
fmls_integral=fmls_integral,
|
|
614
|
+
fmls_peak_value=fmls_peak_value,
|
|
615
|
+
fmls_no_thresholds=fmls_no_thresholds,
|
|
616
|
+
fmls_lobe_merge_ratio=fmls_lobe_merge_ratio,
|
|
617
|
+
mask=mask,
|
|
618
|
+
maxnum=maxnum,
|
|
619
|
+
nii=nii,
|
|
620
|
+
dirpeak=dirpeak,
|
|
621
|
+
info=info,
|
|
622
|
+
quiet=quiet,
|
|
623
|
+
debug=debug,
|
|
624
|
+
force=force,
|
|
625
|
+
nthreads=nthreads,
|
|
626
|
+
config=config,
|
|
627
|
+
help_=help_,
|
|
628
|
+
version=version,
|
|
629
|
+
fod=fod,
|
|
630
|
+
fixel_directory=fixel_directory,
|
|
631
|
+
)
|
|
632
|
+
return fod2fixel_execute(params, runner)
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
__all__ = [
|
|
636
|
+
"FOD2FIXEL_METADATA",
|
|
637
|
+
"Fod2fixelConfigParamsDict",
|
|
638
|
+
"Fod2fixelConfigParamsDictTagged",
|
|
639
|
+
"Fod2fixelOutputs",
|
|
640
|
+
"Fod2fixelParamsDict",
|
|
641
|
+
"Fod2fixelParamsDictTagged",
|
|
642
|
+
"fod2fixel",
|
|
643
|
+
"fod2fixel_config",
|
|
644
|
+
"fod2fixel_execute",
|
|
645
|
+
"fod2fixel_params",
|
|
646
|
+
]
|