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,571 @@
|
|
|
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
|
+
FOD2DEC_METADATA = Metadata(
|
|
9
|
+
id="56fd41eb31bb1240fd6341ac5abf21815b0e9dac.boutiques",
|
|
10
|
+
name="fod2dec",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Fod2decConfigParamsDictNoTag = typing.TypedDict('_Fod2decConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
Fod2decConfigParamsDictTagged = typing.TypedDict('Fod2decConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
Fod2decConfigParamsDict = _Fod2decConfigParamsDictNoTag | Fod2decConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_Fod2decParamsDictNoTag = typing.TypedDict('_Fod2decParamsDictNoTag', {
|
|
29
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
30
|
+
"contrast": typing.NotRequired[InputPathType | None],
|
|
31
|
+
"lum": bool,
|
|
32
|
+
"lum_coefs": typing.NotRequired[list[float] | None],
|
|
33
|
+
"lum_gamma": typing.NotRequired[float | None],
|
|
34
|
+
"threshold": typing.NotRequired[float | None],
|
|
35
|
+
"no_weight": bool,
|
|
36
|
+
"info": bool,
|
|
37
|
+
"quiet": bool,
|
|
38
|
+
"debug": bool,
|
|
39
|
+
"force": bool,
|
|
40
|
+
"nthreads": typing.NotRequired[int | None],
|
|
41
|
+
"config": typing.NotRequired[list[Fod2decConfigParamsDict] | None],
|
|
42
|
+
"help": bool,
|
|
43
|
+
"version": bool,
|
|
44
|
+
"input": InputPathType,
|
|
45
|
+
"output": str,
|
|
46
|
+
})
|
|
47
|
+
Fod2decParamsDictTagged = typing.TypedDict('Fod2decParamsDictTagged', {
|
|
48
|
+
"@type": typing.Literal["mrtrix/fod2dec"],
|
|
49
|
+
"mask": typing.NotRequired[InputPathType | None],
|
|
50
|
+
"contrast": typing.NotRequired[InputPathType | None],
|
|
51
|
+
"lum": bool,
|
|
52
|
+
"lum_coefs": typing.NotRequired[list[float] | None],
|
|
53
|
+
"lum_gamma": typing.NotRequired[float | None],
|
|
54
|
+
"threshold": typing.NotRequired[float | None],
|
|
55
|
+
"no_weight": bool,
|
|
56
|
+
"info": bool,
|
|
57
|
+
"quiet": bool,
|
|
58
|
+
"debug": bool,
|
|
59
|
+
"force": bool,
|
|
60
|
+
"nthreads": typing.NotRequired[int | None],
|
|
61
|
+
"config": typing.NotRequired[list[Fod2decConfigParamsDict] | None],
|
|
62
|
+
"help": bool,
|
|
63
|
+
"version": bool,
|
|
64
|
+
"input": InputPathType,
|
|
65
|
+
"output": str,
|
|
66
|
+
})
|
|
67
|
+
Fod2decParamsDict = _Fod2decParamsDictNoTag | Fod2decParamsDictTagged
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def fod2dec_config(
|
|
71
|
+
key: str,
|
|
72
|
+
value: str,
|
|
73
|
+
) -> Fod2decConfigParamsDictTagged:
|
|
74
|
+
"""
|
|
75
|
+
Build parameters.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
79
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
80
|
+
Returns:
|
|
81
|
+
Parameter dictionary
|
|
82
|
+
"""
|
|
83
|
+
params = {
|
|
84
|
+
"@type": "config",
|
|
85
|
+
"key": key,
|
|
86
|
+
"value": value,
|
|
87
|
+
}
|
|
88
|
+
return params
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def fod2dec_config_validate(
|
|
92
|
+
params: typing.Any,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""
|
|
95
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
96
|
+
`Fod2decConfigParamsDict` object.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
params: The parameters object to validate.
|
|
100
|
+
"""
|
|
101
|
+
if params is None or not isinstance(params, dict):
|
|
102
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
103
|
+
if params.get("key", None) is None:
|
|
104
|
+
raise StyxValidationError("`key` must not be None")
|
|
105
|
+
if not isinstance(params["key"], str):
|
|
106
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
107
|
+
if params.get("value", None) is None:
|
|
108
|
+
raise StyxValidationError("`value` must not be None")
|
|
109
|
+
if not isinstance(params["value"], str):
|
|
110
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def fod2dec_config_cargs(
|
|
114
|
+
params: Fod2decConfigParamsDict,
|
|
115
|
+
execution: Execution,
|
|
116
|
+
) -> list[str]:
|
|
117
|
+
"""
|
|
118
|
+
Build command-line arguments from parameters.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
params: The parameters.
|
|
122
|
+
execution: The execution object for resolving input paths.
|
|
123
|
+
Returns:
|
|
124
|
+
Command-line arguments.
|
|
125
|
+
"""
|
|
126
|
+
cargs = []
|
|
127
|
+
cargs.append("-config")
|
|
128
|
+
cargs.append(params.get("key", None))
|
|
129
|
+
cargs.append(params.get("value", None))
|
|
130
|
+
return cargs
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class Fod2decOutputs(typing.NamedTuple):
|
|
134
|
+
"""
|
|
135
|
+
Output object returned when calling `Fod2decParamsDict(...)`.
|
|
136
|
+
"""
|
|
137
|
+
root: OutputPathType
|
|
138
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
139
|
+
output: OutputPathType
|
|
140
|
+
"""The output DEC image (weighted RGB triplets)."""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def fod2dec_params(
|
|
144
|
+
input_: InputPathType,
|
|
145
|
+
output: str,
|
|
146
|
+
mask: InputPathType | None = None,
|
|
147
|
+
contrast: InputPathType | None = None,
|
|
148
|
+
lum: bool = False,
|
|
149
|
+
lum_coefs: list[float] | None = None,
|
|
150
|
+
lum_gamma: float | None = None,
|
|
151
|
+
threshold: float | None = None,
|
|
152
|
+
no_weight: bool = False,
|
|
153
|
+
info: bool = False,
|
|
154
|
+
quiet: bool = False,
|
|
155
|
+
debug: bool = False,
|
|
156
|
+
force: bool = False,
|
|
157
|
+
nthreads: int | None = None,
|
|
158
|
+
config: list[Fod2decConfigParamsDict] | None = None,
|
|
159
|
+
help_: bool = False,
|
|
160
|
+
version: bool = False,
|
|
161
|
+
) -> Fod2decParamsDictTagged:
|
|
162
|
+
"""
|
|
163
|
+
Build parameters.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
input_: The input FOD image (spherical harmonic coefficients).
|
|
167
|
+
output: The output DEC image (weighted RGB triplets).
|
|
168
|
+
mask: Only perform DEC computation within the specified mask image.
|
|
169
|
+
contrast: Weight the computed DEC map by the provided image contrast.\
|
|
170
|
+
If the contrast has a different image grid, the DEC map is first\
|
|
171
|
+
resliced and renormalised. To achieve panchromatic sharpening, provide\
|
|
172
|
+
an image with a higher spatial resolution than the input FOD image;\
|
|
173
|
+
e.g., a T1 anatomical volume. Only the DEC is subject to the mask, so\
|
|
174
|
+
as to allow for partial colouring of the contrast image.\
|
|
175
|
+
Default when this option is *not* provided: integral of input FOD,\
|
|
176
|
+
subject to the same mask/threshold as used for DEC computation.
|
|
177
|
+
lum: Correct for luminance/perception, using default values Cr,Cg,Cb =\
|
|
178
|
+
0.3,0.5,0.2 and gamma = 2.2 (*not* correcting is the theoretical\
|
|
179
|
+
equivalent of Cr,Cg,Cb = 1,1,1 and gamma = 2).
|
|
180
|
+
lum_coefs: The coefficients Cr,Cg,Cb to correct for\
|
|
181
|
+
luminance/perception.\
|
|
182
|
+
Note: this implicitly switches on luminance/perception correction,\
|
|
183
|
+
using a default gamma = 2.2 unless specified otherwise.
|
|
184
|
+
lum_gamma: The gamma value to correct for luminance/perception.\
|
|
185
|
+
Note: this implicitly switches on luminance/perception correction,\
|
|
186
|
+
using a default Cr,Cg,Cb = 0.3,0.5,0.2 unless specified otherwise.
|
|
187
|
+
threshold: FOD amplitudes below the threshold value are considered\
|
|
188
|
+
zero.
|
|
189
|
+
no_weight: Do not weight the DEC map; just output the unweighted\
|
|
190
|
+
colours. Reslicing and renormalising of colours will still happen when\
|
|
191
|
+
providing the -contrast option as a template.
|
|
192
|
+
info: display information messages.
|
|
193
|
+
quiet: do not display information messages or progress status;\
|
|
194
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
195
|
+
environment variable to a non-empty string.
|
|
196
|
+
debug: display debugging messages.
|
|
197
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
198
|
+
input and output might cause unexpected behaviour).
|
|
199
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
200
|
+
(set to 0 to disable multi-threading).
|
|
201
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
202
|
+
help_: display this information page and exit.
|
|
203
|
+
version: display version information and exit.
|
|
204
|
+
Returns:
|
|
205
|
+
Parameter dictionary
|
|
206
|
+
"""
|
|
207
|
+
params = {
|
|
208
|
+
"@type": "mrtrix/fod2dec",
|
|
209
|
+
"lum": lum,
|
|
210
|
+
"no_weight": no_weight,
|
|
211
|
+
"info": info,
|
|
212
|
+
"quiet": quiet,
|
|
213
|
+
"debug": debug,
|
|
214
|
+
"force": force,
|
|
215
|
+
"help": help_,
|
|
216
|
+
"version": version,
|
|
217
|
+
"input": input_,
|
|
218
|
+
"output": output,
|
|
219
|
+
}
|
|
220
|
+
if mask is not None:
|
|
221
|
+
params["mask"] = mask
|
|
222
|
+
if contrast is not None:
|
|
223
|
+
params["contrast"] = contrast
|
|
224
|
+
if lum_coefs is not None:
|
|
225
|
+
params["lum_coefs"] = lum_coefs
|
|
226
|
+
if lum_gamma is not None:
|
|
227
|
+
params["lum_gamma"] = lum_gamma
|
|
228
|
+
if threshold is not None:
|
|
229
|
+
params["threshold"] = threshold
|
|
230
|
+
if nthreads is not None:
|
|
231
|
+
params["nthreads"] = nthreads
|
|
232
|
+
if config is not None:
|
|
233
|
+
params["config"] = config
|
|
234
|
+
return params
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def fod2dec_validate(
|
|
238
|
+
params: typing.Any,
|
|
239
|
+
) -> None:
|
|
240
|
+
"""
|
|
241
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
242
|
+
`Fod2decParamsDict` object.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
params: The parameters object to validate.
|
|
246
|
+
"""
|
|
247
|
+
if params is None or not isinstance(params, dict):
|
|
248
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
249
|
+
if params.get("mask", None) is not None:
|
|
250
|
+
if not isinstance(params["mask"], (pathlib.Path, str)):
|
|
251
|
+
raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
|
|
252
|
+
if params.get("contrast", None) is not None:
|
|
253
|
+
if not isinstance(params["contrast"], (pathlib.Path, str)):
|
|
254
|
+
raise StyxValidationError(f'`contrast` has the wrong type: Received `{type(params.get("contrast", None))}` expected `InputPathType | None`')
|
|
255
|
+
if params.get("lum", False) is None:
|
|
256
|
+
raise StyxValidationError("`lum` must not be None")
|
|
257
|
+
if not isinstance(params["lum"], bool):
|
|
258
|
+
raise StyxValidationError(f'`lum` has the wrong type: Received `{type(params.get("lum", False))}` expected `bool`')
|
|
259
|
+
if params.get("lum_coefs", None) is not None:
|
|
260
|
+
if not isinstance(params["lum_coefs"], list):
|
|
261
|
+
raise StyxValidationError(f'`lum_coefs` has the wrong type: Received `{type(params.get("lum_coefs", None))}` expected `list[float] | None`')
|
|
262
|
+
for e in params["lum_coefs"]:
|
|
263
|
+
if not isinstance(e, (float, int)):
|
|
264
|
+
raise StyxValidationError(f'`lum_coefs` has the wrong type: Received `{type(params.get("lum_coefs", None))}` expected `list[float] | None`')
|
|
265
|
+
if params.get("lum_gamma", None) is not None:
|
|
266
|
+
if not isinstance(params["lum_gamma"], (float, int)):
|
|
267
|
+
raise StyxValidationError(f'`lum_gamma` has the wrong type: Received `{type(params.get("lum_gamma", None))}` expected `float | None`')
|
|
268
|
+
if params.get("threshold", None) is not None:
|
|
269
|
+
if not isinstance(params["threshold"], (float, int)):
|
|
270
|
+
raise StyxValidationError(f'`threshold` has the wrong type: Received `{type(params.get("threshold", None))}` expected `float | None`')
|
|
271
|
+
if params.get("no_weight", False) is None:
|
|
272
|
+
raise StyxValidationError("`no_weight` must not be None")
|
|
273
|
+
if not isinstance(params["no_weight"], bool):
|
|
274
|
+
raise StyxValidationError(f'`no_weight` has the wrong type: Received `{type(params.get("no_weight", False))}` expected `bool`')
|
|
275
|
+
if params.get("info", False) is None:
|
|
276
|
+
raise StyxValidationError("`info` must not be None")
|
|
277
|
+
if not isinstance(params["info"], bool):
|
|
278
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
279
|
+
if params.get("quiet", False) is None:
|
|
280
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
281
|
+
if not isinstance(params["quiet"], bool):
|
|
282
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
283
|
+
if params.get("debug", False) is None:
|
|
284
|
+
raise StyxValidationError("`debug` must not be None")
|
|
285
|
+
if not isinstance(params["debug"], bool):
|
|
286
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
287
|
+
if params.get("force", False) is None:
|
|
288
|
+
raise StyxValidationError("`force` must not be None")
|
|
289
|
+
if not isinstance(params["force"], bool):
|
|
290
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
291
|
+
if params.get("nthreads", None) is not None:
|
|
292
|
+
if not isinstance(params["nthreads"], int):
|
|
293
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
294
|
+
if params.get("config", None) is not None:
|
|
295
|
+
if not isinstance(params["config"], list):
|
|
296
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Fod2decConfigParamsDict] | None`')
|
|
297
|
+
for e in params["config"]:
|
|
298
|
+
fod2dec_config_validate(e)
|
|
299
|
+
if params.get("help", False) is None:
|
|
300
|
+
raise StyxValidationError("`help` must not be None")
|
|
301
|
+
if not isinstance(params["help"], bool):
|
|
302
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
303
|
+
if params.get("version", False) is None:
|
|
304
|
+
raise StyxValidationError("`version` must not be None")
|
|
305
|
+
if not isinstance(params["version"], bool):
|
|
306
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
307
|
+
if params.get("input", None) is None:
|
|
308
|
+
raise StyxValidationError("`input` must not be None")
|
|
309
|
+
if not isinstance(params["input"], (pathlib.Path, str)):
|
|
310
|
+
raise StyxValidationError(f'`input` has the wrong type: Received `{type(params.get("input", None))}` expected `InputPathType`')
|
|
311
|
+
if params.get("output", None) is None:
|
|
312
|
+
raise StyxValidationError("`output` must not be None")
|
|
313
|
+
if not isinstance(params["output"], str):
|
|
314
|
+
raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def fod2dec_cargs(
|
|
318
|
+
params: Fod2decParamsDict,
|
|
319
|
+
execution: Execution,
|
|
320
|
+
) -> list[str]:
|
|
321
|
+
"""
|
|
322
|
+
Build command-line arguments from parameters.
|
|
323
|
+
|
|
324
|
+
Args:
|
|
325
|
+
params: The parameters.
|
|
326
|
+
execution: The execution object for resolving input paths.
|
|
327
|
+
Returns:
|
|
328
|
+
Command-line arguments.
|
|
329
|
+
"""
|
|
330
|
+
cargs = []
|
|
331
|
+
cargs.append("fod2dec")
|
|
332
|
+
if params.get("mask", None) is not None:
|
|
333
|
+
cargs.extend([
|
|
334
|
+
"-mask",
|
|
335
|
+
execution.input_file(params.get("mask", None))
|
|
336
|
+
])
|
|
337
|
+
if params.get("contrast", None) is not None:
|
|
338
|
+
cargs.extend([
|
|
339
|
+
"-contrast",
|
|
340
|
+
execution.input_file(params.get("contrast", None))
|
|
341
|
+
])
|
|
342
|
+
if params.get("lum", False):
|
|
343
|
+
cargs.append("-lum")
|
|
344
|
+
if params.get("lum_coefs", None) is not None:
|
|
345
|
+
cargs.extend([
|
|
346
|
+
"-lum_coefs",
|
|
347
|
+
*map(str, params.get("lum_coefs", None))
|
|
348
|
+
])
|
|
349
|
+
if params.get("lum_gamma", None) is not None:
|
|
350
|
+
cargs.extend([
|
|
351
|
+
"-lum_gamma",
|
|
352
|
+
str(params.get("lum_gamma", None))
|
|
353
|
+
])
|
|
354
|
+
if params.get("threshold", None) is not None:
|
|
355
|
+
cargs.extend([
|
|
356
|
+
"-threshold",
|
|
357
|
+
str(params.get("threshold", None))
|
|
358
|
+
])
|
|
359
|
+
if params.get("no_weight", False):
|
|
360
|
+
cargs.append("-no_weight")
|
|
361
|
+
if params.get("info", False):
|
|
362
|
+
cargs.append("-info")
|
|
363
|
+
if params.get("quiet", False):
|
|
364
|
+
cargs.append("-quiet")
|
|
365
|
+
if params.get("debug", False):
|
|
366
|
+
cargs.append("-debug")
|
|
367
|
+
if params.get("force", False):
|
|
368
|
+
cargs.append("-force")
|
|
369
|
+
if params.get("nthreads", None) is not None:
|
|
370
|
+
cargs.extend([
|
|
371
|
+
"-nthreads",
|
|
372
|
+
str(params.get("nthreads", None))
|
|
373
|
+
])
|
|
374
|
+
if params.get("config", None) is not None:
|
|
375
|
+
cargs.extend([a for c in [fod2dec_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
376
|
+
if params.get("help", False):
|
|
377
|
+
cargs.append("-help")
|
|
378
|
+
if params.get("version", False):
|
|
379
|
+
cargs.append("-version")
|
|
380
|
+
cargs.append(execution.input_file(params.get("input", None)))
|
|
381
|
+
cargs.append(params.get("output", None))
|
|
382
|
+
return cargs
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def fod2dec_outputs(
|
|
386
|
+
params: Fod2decParamsDict,
|
|
387
|
+
execution: Execution,
|
|
388
|
+
) -> Fod2decOutputs:
|
|
389
|
+
"""
|
|
390
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
391
|
+
|
|
392
|
+
Args:
|
|
393
|
+
params: The parameters.
|
|
394
|
+
execution: The execution object for resolving input paths.
|
|
395
|
+
Returns:
|
|
396
|
+
Outputs object.
|
|
397
|
+
"""
|
|
398
|
+
ret = Fod2decOutputs(
|
|
399
|
+
root=execution.output_file("."),
|
|
400
|
+
output=execution.output_file(params.get("output", None)),
|
|
401
|
+
)
|
|
402
|
+
return ret
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def fod2dec_execute(
|
|
406
|
+
params: Fod2decParamsDict,
|
|
407
|
+
runner: Runner | None = None,
|
|
408
|
+
) -> Fod2decOutputs:
|
|
409
|
+
"""
|
|
410
|
+
fod2dec
|
|
411
|
+
|
|
412
|
+
Generate FOD-based DEC maps, with optional panchromatic sharpening and/or
|
|
413
|
+
luminance/perception correction.
|
|
414
|
+
|
|
415
|
+
By default, the FOD-based DEC is weighted by the integral of the FOD. To
|
|
416
|
+
weight by another scalar map, use the -contrast option. This option can also
|
|
417
|
+
be used for panchromatic sharpening, e.g., by supplying a T1 (or other
|
|
418
|
+
sensible) anatomical volume with a higher spatial resolution.
|
|
419
|
+
|
|
420
|
+
References:
|
|
421
|
+
|
|
422
|
+
Dhollander T, Smith RE, Tournier JD, Jeurissen B, Connelly A. Time to move
|
|
423
|
+
on: an FOD-based DEC map to replace DTI's trademark DEC FA. Proc Intl Soc
|
|
424
|
+
Mag Reson Med, 2015, 23, 1027
|
|
425
|
+
|
|
426
|
+
Dhollander T, Raffelt D, Smith RE, Connelly A. Panchromatic sharpening of
|
|
427
|
+
FOD-based DEC maps by structural T1 information. Proc Intl Soc Mag Reson
|
|
428
|
+
Med, 2015, 23, 566.
|
|
429
|
+
|
|
430
|
+
Author: MRTrix3 Developers
|
|
431
|
+
|
|
432
|
+
URL: https://www.mrtrix.org/
|
|
433
|
+
|
|
434
|
+
Args:
|
|
435
|
+
params: The parameters.
|
|
436
|
+
runner: Command runner.
|
|
437
|
+
Returns:
|
|
438
|
+
NamedTuple of outputs (described in `Fod2decOutputs`).
|
|
439
|
+
"""
|
|
440
|
+
fod2dec_validate(params)
|
|
441
|
+
runner = runner or get_global_runner()
|
|
442
|
+
execution = runner.start_execution(FOD2DEC_METADATA)
|
|
443
|
+
params = execution.params(params)
|
|
444
|
+
cargs = fod2dec_cargs(params, execution)
|
|
445
|
+
ret = fod2dec_outputs(params, execution)
|
|
446
|
+
execution.run(cargs)
|
|
447
|
+
return ret
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def fod2dec(
|
|
451
|
+
input_: InputPathType,
|
|
452
|
+
output: str,
|
|
453
|
+
mask: InputPathType | None = None,
|
|
454
|
+
contrast: InputPathType | None = None,
|
|
455
|
+
lum: bool = False,
|
|
456
|
+
lum_coefs: list[float] | None = None,
|
|
457
|
+
lum_gamma: float | None = None,
|
|
458
|
+
threshold: float | None = None,
|
|
459
|
+
no_weight: bool = False,
|
|
460
|
+
info: bool = False,
|
|
461
|
+
quiet: bool = False,
|
|
462
|
+
debug: bool = False,
|
|
463
|
+
force: bool = False,
|
|
464
|
+
nthreads: int | None = None,
|
|
465
|
+
config: list[Fod2decConfigParamsDict] | None = None,
|
|
466
|
+
help_: bool = False,
|
|
467
|
+
version: bool = False,
|
|
468
|
+
runner: Runner | None = None,
|
|
469
|
+
) -> Fod2decOutputs:
|
|
470
|
+
"""
|
|
471
|
+
fod2dec
|
|
472
|
+
|
|
473
|
+
Generate FOD-based DEC maps, with optional panchromatic sharpening and/or
|
|
474
|
+
luminance/perception correction.
|
|
475
|
+
|
|
476
|
+
By default, the FOD-based DEC is weighted by the integral of the FOD. To
|
|
477
|
+
weight by another scalar map, use the -contrast option. This option can also
|
|
478
|
+
be used for panchromatic sharpening, e.g., by supplying a T1 (or other
|
|
479
|
+
sensible) anatomical volume with a higher spatial resolution.
|
|
480
|
+
|
|
481
|
+
References:
|
|
482
|
+
|
|
483
|
+
Dhollander T, Smith RE, Tournier JD, Jeurissen B, Connelly A. Time to move
|
|
484
|
+
on: an FOD-based DEC map to replace DTI's trademark DEC FA. Proc Intl Soc
|
|
485
|
+
Mag Reson Med, 2015, 23, 1027
|
|
486
|
+
|
|
487
|
+
Dhollander T, Raffelt D, Smith RE, Connelly A. Panchromatic sharpening of
|
|
488
|
+
FOD-based DEC maps by structural T1 information. Proc Intl Soc Mag Reson
|
|
489
|
+
Med, 2015, 23, 566.
|
|
490
|
+
|
|
491
|
+
Author: MRTrix3 Developers
|
|
492
|
+
|
|
493
|
+
URL: https://www.mrtrix.org/
|
|
494
|
+
|
|
495
|
+
Args:
|
|
496
|
+
input_: The input FOD image (spherical harmonic coefficients).
|
|
497
|
+
output: The output DEC image (weighted RGB triplets).
|
|
498
|
+
mask: Only perform DEC computation within the specified mask image.
|
|
499
|
+
contrast: Weight the computed DEC map by the provided image contrast.\
|
|
500
|
+
If the contrast has a different image grid, the DEC map is first\
|
|
501
|
+
resliced and renormalised. To achieve panchromatic sharpening, provide\
|
|
502
|
+
an image with a higher spatial resolution than the input FOD image;\
|
|
503
|
+
e.g., a T1 anatomical volume. Only the DEC is subject to the mask, so\
|
|
504
|
+
as to allow for partial colouring of the contrast image.\
|
|
505
|
+
Default when this option is *not* provided: integral of input FOD,\
|
|
506
|
+
subject to the same mask/threshold as used for DEC computation.
|
|
507
|
+
lum: Correct for luminance/perception, using default values Cr,Cg,Cb =\
|
|
508
|
+
0.3,0.5,0.2 and gamma = 2.2 (*not* correcting is the theoretical\
|
|
509
|
+
equivalent of Cr,Cg,Cb = 1,1,1 and gamma = 2).
|
|
510
|
+
lum_coefs: The coefficients Cr,Cg,Cb to correct for\
|
|
511
|
+
luminance/perception.\
|
|
512
|
+
Note: this implicitly switches on luminance/perception correction,\
|
|
513
|
+
using a default gamma = 2.2 unless specified otherwise.
|
|
514
|
+
lum_gamma: The gamma value to correct for luminance/perception.\
|
|
515
|
+
Note: this implicitly switches on luminance/perception correction,\
|
|
516
|
+
using a default Cr,Cg,Cb = 0.3,0.5,0.2 unless specified otherwise.
|
|
517
|
+
threshold: FOD amplitudes below the threshold value are considered\
|
|
518
|
+
zero.
|
|
519
|
+
no_weight: Do not weight the DEC map; just output the unweighted\
|
|
520
|
+
colours. Reslicing and renormalising of colours will still happen when\
|
|
521
|
+
providing the -contrast option as a template.
|
|
522
|
+
info: display information messages.
|
|
523
|
+
quiet: do not display information messages or progress status;\
|
|
524
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
525
|
+
environment variable to a non-empty string.
|
|
526
|
+
debug: display debugging messages.
|
|
527
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
528
|
+
input and output might cause unexpected behaviour).
|
|
529
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
530
|
+
(set to 0 to disable multi-threading).
|
|
531
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
532
|
+
help_: display this information page and exit.
|
|
533
|
+
version: display version information and exit.
|
|
534
|
+
runner: Command runner.
|
|
535
|
+
Returns:
|
|
536
|
+
NamedTuple of outputs (described in `Fod2decOutputs`).
|
|
537
|
+
"""
|
|
538
|
+
params = fod2dec_params(
|
|
539
|
+
mask=mask,
|
|
540
|
+
contrast=contrast,
|
|
541
|
+
lum=lum,
|
|
542
|
+
lum_coefs=lum_coefs,
|
|
543
|
+
lum_gamma=lum_gamma,
|
|
544
|
+
threshold=threshold,
|
|
545
|
+
no_weight=no_weight,
|
|
546
|
+
info=info,
|
|
547
|
+
quiet=quiet,
|
|
548
|
+
debug=debug,
|
|
549
|
+
force=force,
|
|
550
|
+
nthreads=nthreads,
|
|
551
|
+
config=config,
|
|
552
|
+
help_=help_,
|
|
553
|
+
version=version,
|
|
554
|
+
input_=input_,
|
|
555
|
+
output=output,
|
|
556
|
+
)
|
|
557
|
+
return fod2dec_execute(params, runner)
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
__all__ = [
|
|
561
|
+
"FOD2DEC_METADATA",
|
|
562
|
+
"Fod2decConfigParamsDict",
|
|
563
|
+
"Fod2decConfigParamsDictTagged",
|
|
564
|
+
"Fod2decOutputs",
|
|
565
|
+
"Fod2decParamsDict",
|
|
566
|
+
"Fod2decParamsDictTagged",
|
|
567
|
+
"fod2dec",
|
|
568
|
+
"fod2dec_config",
|
|
569
|
+
"fod2dec_execute",
|
|
570
|
+
"fod2dec_params",
|
|
571
|
+
]
|