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,481 @@
|
|
|
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
|
+
SH2RESPONSE_METADATA = Metadata(
|
|
9
|
+
id="b0158f6418a85b394a1f360188b67bbde8c8da29.boutiques",
|
|
10
|
+
name="sh2response",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Sh2responseConfigParamsDictNoTag = typing.TypedDict('_Sh2responseConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
Sh2responseConfigParamsDictTagged = typing.TypedDict('Sh2responseConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
Sh2responseConfigParamsDict = _Sh2responseConfigParamsDictNoTag | Sh2responseConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_Sh2responseParamsDictNoTag = typing.TypedDict('_Sh2responseParamsDictNoTag', {
|
|
29
|
+
"lmax": typing.NotRequired[int | None],
|
|
30
|
+
"dump": typing.NotRequired[str | None],
|
|
31
|
+
"info": bool,
|
|
32
|
+
"quiet": bool,
|
|
33
|
+
"debug": bool,
|
|
34
|
+
"force": bool,
|
|
35
|
+
"nthreads": typing.NotRequired[int | None],
|
|
36
|
+
"config": typing.NotRequired[list[Sh2responseConfigParamsDict] | None],
|
|
37
|
+
"help": bool,
|
|
38
|
+
"version": bool,
|
|
39
|
+
"SH": InputPathType,
|
|
40
|
+
"mask": InputPathType,
|
|
41
|
+
"directions": InputPathType,
|
|
42
|
+
"response": str,
|
|
43
|
+
})
|
|
44
|
+
Sh2responseParamsDictTagged = typing.TypedDict('Sh2responseParamsDictTagged', {
|
|
45
|
+
"@type": typing.Literal["mrtrix/sh2response"],
|
|
46
|
+
"lmax": typing.NotRequired[int | None],
|
|
47
|
+
"dump": typing.NotRequired[str | None],
|
|
48
|
+
"info": bool,
|
|
49
|
+
"quiet": bool,
|
|
50
|
+
"debug": bool,
|
|
51
|
+
"force": bool,
|
|
52
|
+
"nthreads": typing.NotRequired[int | None],
|
|
53
|
+
"config": typing.NotRequired[list[Sh2responseConfigParamsDict] | None],
|
|
54
|
+
"help": bool,
|
|
55
|
+
"version": bool,
|
|
56
|
+
"SH": InputPathType,
|
|
57
|
+
"mask": InputPathType,
|
|
58
|
+
"directions": InputPathType,
|
|
59
|
+
"response": str,
|
|
60
|
+
})
|
|
61
|
+
Sh2responseParamsDict = _Sh2responseParamsDictNoTag | Sh2responseParamsDictTagged
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sh2response_config(
|
|
65
|
+
key: str,
|
|
66
|
+
value: str,
|
|
67
|
+
) -> Sh2responseConfigParamsDictTagged:
|
|
68
|
+
"""
|
|
69
|
+
Build parameters.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
73
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
74
|
+
Returns:
|
|
75
|
+
Parameter dictionary
|
|
76
|
+
"""
|
|
77
|
+
params = {
|
|
78
|
+
"@type": "config",
|
|
79
|
+
"key": key,
|
|
80
|
+
"value": value,
|
|
81
|
+
}
|
|
82
|
+
return params
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def sh2response_config_validate(
|
|
86
|
+
params: typing.Any,
|
|
87
|
+
) -> None:
|
|
88
|
+
"""
|
|
89
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
90
|
+
`Sh2responseConfigParamsDict` object.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
params: The parameters object to validate.
|
|
94
|
+
"""
|
|
95
|
+
if params is None or not isinstance(params, dict):
|
|
96
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
97
|
+
if params.get("key", None) is None:
|
|
98
|
+
raise StyxValidationError("`key` must not be None")
|
|
99
|
+
if not isinstance(params["key"], str):
|
|
100
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
101
|
+
if params.get("value", None) is None:
|
|
102
|
+
raise StyxValidationError("`value` must not be None")
|
|
103
|
+
if not isinstance(params["value"], str):
|
|
104
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def sh2response_config_cargs(
|
|
108
|
+
params: Sh2responseConfigParamsDict,
|
|
109
|
+
execution: Execution,
|
|
110
|
+
) -> list[str]:
|
|
111
|
+
"""
|
|
112
|
+
Build command-line arguments from parameters.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
params: The parameters.
|
|
116
|
+
execution: The execution object for resolving input paths.
|
|
117
|
+
Returns:
|
|
118
|
+
Command-line arguments.
|
|
119
|
+
"""
|
|
120
|
+
cargs = []
|
|
121
|
+
cargs.append("-config")
|
|
122
|
+
cargs.append(params.get("key", None))
|
|
123
|
+
cargs.append(params.get("value", None))
|
|
124
|
+
return cargs
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class Sh2responseOutputs(typing.NamedTuple):
|
|
128
|
+
"""
|
|
129
|
+
Output object returned when calling `Sh2responseParamsDict(...)`.
|
|
130
|
+
"""
|
|
131
|
+
root: OutputPathType
|
|
132
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
133
|
+
response: OutputPathType
|
|
134
|
+
"""the output axially-symmetric spherical harmonic coefficients"""
|
|
135
|
+
dump: OutputPathType | None
|
|
136
|
+
"""dump the m=0 SH coefficients from all voxels in the mask to the output
|
|
137
|
+
file, rather than their mean """
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def sh2response_params(
|
|
141
|
+
sh: InputPathType,
|
|
142
|
+
mask: InputPathType,
|
|
143
|
+
directions: InputPathType,
|
|
144
|
+
response: str,
|
|
145
|
+
lmax: int | None = None,
|
|
146
|
+
dump: str | None = None,
|
|
147
|
+
info: bool = False,
|
|
148
|
+
quiet: bool = False,
|
|
149
|
+
debug: bool = False,
|
|
150
|
+
force: bool = False,
|
|
151
|
+
nthreads: int | None = None,
|
|
152
|
+
config: list[Sh2responseConfigParamsDict] | None = None,
|
|
153
|
+
help_: bool = False,
|
|
154
|
+
version: bool = False,
|
|
155
|
+
) -> Sh2responseParamsDictTagged:
|
|
156
|
+
"""
|
|
157
|
+
Build parameters.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
sh: the spherical harmonic decomposition of the diffusion-weighted\
|
|
161
|
+
images.
|
|
162
|
+
mask: the mask containing the voxels from which to estimate the\
|
|
163
|
+
response function.
|
|
164
|
+
directions: a 4D image containing the direction vectors along which to\
|
|
165
|
+
estimate the response function.
|
|
166
|
+
response: the output axially-symmetric spherical harmonic coefficients.
|
|
167
|
+
lmax: specify the maximum harmonic degree of the response function to\
|
|
168
|
+
estimate.
|
|
169
|
+
dump: dump the m=0 SH coefficients from all voxels in the mask to the\
|
|
170
|
+
output file, rather than their mean.
|
|
171
|
+
info: display information messages.
|
|
172
|
+
quiet: do not display information messages or progress status;\
|
|
173
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
174
|
+
environment variable to a non-empty string.
|
|
175
|
+
debug: display debugging messages.
|
|
176
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
177
|
+
input and output might cause unexpected behaviour).
|
|
178
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
179
|
+
(set to 0 to disable multi-threading).
|
|
180
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
181
|
+
help_: display this information page and exit.
|
|
182
|
+
version: display version information and exit.
|
|
183
|
+
Returns:
|
|
184
|
+
Parameter dictionary
|
|
185
|
+
"""
|
|
186
|
+
params = {
|
|
187
|
+
"@type": "mrtrix/sh2response",
|
|
188
|
+
"info": info,
|
|
189
|
+
"quiet": quiet,
|
|
190
|
+
"debug": debug,
|
|
191
|
+
"force": force,
|
|
192
|
+
"help": help_,
|
|
193
|
+
"version": version,
|
|
194
|
+
"SH": sh,
|
|
195
|
+
"mask": mask,
|
|
196
|
+
"directions": directions,
|
|
197
|
+
"response": response,
|
|
198
|
+
}
|
|
199
|
+
if lmax is not None:
|
|
200
|
+
params["lmax"] = lmax
|
|
201
|
+
if dump is not None:
|
|
202
|
+
params["dump"] = dump
|
|
203
|
+
if nthreads is not None:
|
|
204
|
+
params["nthreads"] = nthreads
|
|
205
|
+
if config is not None:
|
|
206
|
+
params["config"] = config
|
|
207
|
+
return params
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def sh2response_validate(
|
|
211
|
+
params: typing.Any,
|
|
212
|
+
) -> None:
|
|
213
|
+
"""
|
|
214
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
215
|
+
`Sh2responseParamsDict` object.
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
params: The parameters object to validate.
|
|
219
|
+
"""
|
|
220
|
+
if params is None or not isinstance(params, dict):
|
|
221
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
222
|
+
if params.get("lmax", None) is not None:
|
|
223
|
+
if not isinstance(params["lmax"], int):
|
|
224
|
+
raise StyxValidationError(f'`lmax` has the wrong type: Received `{type(params.get("lmax", None))}` expected `int | None`')
|
|
225
|
+
if params.get("dump", None) is not None:
|
|
226
|
+
if not isinstance(params["dump"], str):
|
|
227
|
+
raise StyxValidationError(f'`dump` has the wrong type: Received `{type(params.get("dump", None))}` expected `str | None`')
|
|
228
|
+
if params.get("info", False) is None:
|
|
229
|
+
raise StyxValidationError("`info` must not be None")
|
|
230
|
+
if not isinstance(params["info"], bool):
|
|
231
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
232
|
+
if params.get("quiet", False) is None:
|
|
233
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
234
|
+
if not isinstance(params["quiet"], bool):
|
|
235
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
236
|
+
if params.get("debug", False) is None:
|
|
237
|
+
raise StyxValidationError("`debug` must not be None")
|
|
238
|
+
if not isinstance(params["debug"], bool):
|
|
239
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
240
|
+
if params.get("force", False) is None:
|
|
241
|
+
raise StyxValidationError("`force` must not be None")
|
|
242
|
+
if not isinstance(params["force"], bool):
|
|
243
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
244
|
+
if params.get("nthreads", None) is not None:
|
|
245
|
+
if not isinstance(params["nthreads"], int):
|
|
246
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
247
|
+
if params.get("config", None) is not None:
|
|
248
|
+
if not isinstance(params["config"], list):
|
|
249
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Sh2responseConfigParamsDict] | None`')
|
|
250
|
+
for e in params["config"]:
|
|
251
|
+
sh2response_config_validate(e)
|
|
252
|
+
if params.get("help", False) is None:
|
|
253
|
+
raise StyxValidationError("`help` must not be None")
|
|
254
|
+
if not isinstance(params["help"], bool):
|
|
255
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
256
|
+
if params.get("version", False) is None:
|
|
257
|
+
raise StyxValidationError("`version` must not be None")
|
|
258
|
+
if not isinstance(params["version"], bool):
|
|
259
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
260
|
+
if params.get("SH", None) is None:
|
|
261
|
+
raise StyxValidationError("`SH` must not be None")
|
|
262
|
+
if not isinstance(params["SH"], (pathlib.Path, str)):
|
|
263
|
+
raise StyxValidationError(f'`SH` has the wrong type: Received `{type(params.get("SH", None))}` expected `InputPathType`')
|
|
264
|
+
if params.get("mask", None) is None:
|
|
265
|
+
raise StyxValidationError("`mask` must not be None")
|
|
266
|
+
if not isinstance(params["mask"], (pathlib.Path, str)):
|
|
267
|
+
raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType`')
|
|
268
|
+
if params.get("directions", None) is None:
|
|
269
|
+
raise StyxValidationError("`directions` must not be None")
|
|
270
|
+
if not isinstance(params["directions"], (pathlib.Path, str)):
|
|
271
|
+
raise StyxValidationError(f'`directions` has the wrong type: Received `{type(params.get("directions", None))}` expected `InputPathType`')
|
|
272
|
+
if params.get("response", None) is None:
|
|
273
|
+
raise StyxValidationError("`response` must not be None")
|
|
274
|
+
if not isinstance(params["response"], str):
|
|
275
|
+
raise StyxValidationError(f'`response` has the wrong type: Received `{type(params.get("response", None))}` expected `str`')
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def sh2response_cargs(
|
|
279
|
+
params: Sh2responseParamsDict,
|
|
280
|
+
execution: Execution,
|
|
281
|
+
) -> list[str]:
|
|
282
|
+
"""
|
|
283
|
+
Build command-line arguments from parameters.
|
|
284
|
+
|
|
285
|
+
Args:
|
|
286
|
+
params: The parameters.
|
|
287
|
+
execution: The execution object for resolving input paths.
|
|
288
|
+
Returns:
|
|
289
|
+
Command-line arguments.
|
|
290
|
+
"""
|
|
291
|
+
cargs = []
|
|
292
|
+
cargs.append("sh2response")
|
|
293
|
+
if params.get("lmax", None) is not None:
|
|
294
|
+
cargs.extend([
|
|
295
|
+
"-lmax",
|
|
296
|
+
str(params.get("lmax", None))
|
|
297
|
+
])
|
|
298
|
+
if params.get("dump", None) is not None:
|
|
299
|
+
cargs.extend([
|
|
300
|
+
"-dump",
|
|
301
|
+
params.get("dump", None)
|
|
302
|
+
])
|
|
303
|
+
if params.get("info", False):
|
|
304
|
+
cargs.append("-info")
|
|
305
|
+
if params.get("quiet", False):
|
|
306
|
+
cargs.append("-quiet")
|
|
307
|
+
if params.get("debug", False):
|
|
308
|
+
cargs.append("-debug")
|
|
309
|
+
if params.get("force", False):
|
|
310
|
+
cargs.append("-force")
|
|
311
|
+
if params.get("nthreads", None) is not None:
|
|
312
|
+
cargs.extend([
|
|
313
|
+
"-nthreads",
|
|
314
|
+
str(params.get("nthreads", None))
|
|
315
|
+
])
|
|
316
|
+
if params.get("config", None) is not None:
|
|
317
|
+
cargs.extend([a for c in [sh2response_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
318
|
+
if params.get("help", False):
|
|
319
|
+
cargs.append("-help")
|
|
320
|
+
if params.get("version", False):
|
|
321
|
+
cargs.append("-version")
|
|
322
|
+
cargs.append(execution.input_file(params.get("SH", None)))
|
|
323
|
+
cargs.append(execution.input_file(params.get("mask", None)))
|
|
324
|
+
cargs.append(execution.input_file(params.get("directions", None)))
|
|
325
|
+
cargs.append(params.get("response", None))
|
|
326
|
+
return cargs
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def sh2response_outputs(
|
|
330
|
+
params: Sh2responseParamsDict,
|
|
331
|
+
execution: Execution,
|
|
332
|
+
) -> Sh2responseOutputs:
|
|
333
|
+
"""
|
|
334
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
335
|
+
|
|
336
|
+
Args:
|
|
337
|
+
params: The parameters.
|
|
338
|
+
execution: The execution object for resolving input paths.
|
|
339
|
+
Returns:
|
|
340
|
+
Outputs object.
|
|
341
|
+
"""
|
|
342
|
+
ret = Sh2responseOutputs(
|
|
343
|
+
root=execution.output_file("."),
|
|
344
|
+
response=execution.output_file(params.get("response", None)),
|
|
345
|
+
dump=execution.output_file(params.get("dump", None)) if (params.get("dump") is not None) else None,
|
|
346
|
+
)
|
|
347
|
+
return ret
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def sh2response_execute(
|
|
351
|
+
params: Sh2responseParamsDict,
|
|
352
|
+
runner: Runner | None = None,
|
|
353
|
+
) -> Sh2responseOutputs:
|
|
354
|
+
"""
|
|
355
|
+
sh2response
|
|
356
|
+
|
|
357
|
+
Generate an appropriate response function from the image data for spherical
|
|
358
|
+
deconvolution.
|
|
359
|
+
|
|
360
|
+
The spherical harmonic coefficients are stored according the conventions
|
|
361
|
+
described the main documentation, which can be found at the following link:
|
|
362
|
+
https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
|
|
363
|
+
|
|
364
|
+
References:
|
|
365
|
+
|
|
366
|
+
.
|
|
367
|
+
|
|
368
|
+
Author: MRTrix3 Developers
|
|
369
|
+
|
|
370
|
+
URL: https://www.mrtrix.org/
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
params: The parameters.
|
|
374
|
+
runner: Command runner.
|
|
375
|
+
Returns:
|
|
376
|
+
NamedTuple of outputs (described in `Sh2responseOutputs`).
|
|
377
|
+
"""
|
|
378
|
+
sh2response_validate(params)
|
|
379
|
+
runner = runner or get_global_runner()
|
|
380
|
+
execution = runner.start_execution(SH2RESPONSE_METADATA)
|
|
381
|
+
params = execution.params(params)
|
|
382
|
+
cargs = sh2response_cargs(params, execution)
|
|
383
|
+
ret = sh2response_outputs(params, execution)
|
|
384
|
+
execution.run(cargs)
|
|
385
|
+
return ret
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
def sh2response(
|
|
389
|
+
sh: InputPathType,
|
|
390
|
+
mask: InputPathType,
|
|
391
|
+
directions: InputPathType,
|
|
392
|
+
response: str,
|
|
393
|
+
lmax: int | None = None,
|
|
394
|
+
dump: str | None = None,
|
|
395
|
+
info: bool = False,
|
|
396
|
+
quiet: bool = False,
|
|
397
|
+
debug: bool = False,
|
|
398
|
+
force: bool = False,
|
|
399
|
+
nthreads: int | None = None,
|
|
400
|
+
config: list[Sh2responseConfigParamsDict] | None = None,
|
|
401
|
+
help_: bool = False,
|
|
402
|
+
version: bool = False,
|
|
403
|
+
runner: Runner | None = None,
|
|
404
|
+
) -> Sh2responseOutputs:
|
|
405
|
+
"""
|
|
406
|
+
sh2response
|
|
407
|
+
|
|
408
|
+
Generate an appropriate response function from the image data for spherical
|
|
409
|
+
deconvolution.
|
|
410
|
+
|
|
411
|
+
The spherical harmonic coefficients are stored according the conventions
|
|
412
|
+
described the main documentation, which can be found at the following link:
|
|
413
|
+
https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
|
|
414
|
+
|
|
415
|
+
References:
|
|
416
|
+
|
|
417
|
+
.
|
|
418
|
+
|
|
419
|
+
Author: MRTrix3 Developers
|
|
420
|
+
|
|
421
|
+
URL: https://www.mrtrix.org/
|
|
422
|
+
|
|
423
|
+
Args:
|
|
424
|
+
sh: the spherical harmonic decomposition of the diffusion-weighted\
|
|
425
|
+
images.
|
|
426
|
+
mask: the mask containing the voxels from which to estimate the\
|
|
427
|
+
response function.
|
|
428
|
+
directions: a 4D image containing the direction vectors along which to\
|
|
429
|
+
estimate the response function.
|
|
430
|
+
response: the output axially-symmetric spherical harmonic coefficients.
|
|
431
|
+
lmax: specify the maximum harmonic degree of the response function to\
|
|
432
|
+
estimate.
|
|
433
|
+
dump: dump the m=0 SH coefficients from all voxels in the mask to the\
|
|
434
|
+
output file, rather than their mean.
|
|
435
|
+
info: display information messages.
|
|
436
|
+
quiet: do not display information messages or progress status;\
|
|
437
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
438
|
+
environment variable to a non-empty string.
|
|
439
|
+
debug: display debugging messages.
|
|
440
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
441
|
+
input and output might cause unexpected behaviour).
|
|
442
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
443
|
+
(set to 0 to disable multi-threading).
|
|
444
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
445
|
+
help_: display this information page and exit.
|
|
446
|
+
version: display version information and exit.
|
|
447
|
+
runner: Command runner.
|
|
448
|
+
Returns:
|
|
449
|
+
NamedTuple of outputs (described in `Sh2responseOutputs`).
|
|
450
|
+
"""
|
|
451
|
+
params = sh2response_params(
|
|
452
|
+
lmax=lmax,
|
|
453
|
+
dump=dump,
|
|
454
|
+
info=info,
|
|
455
|
+
quiet=quiet,
|
|
456
|
+
debug=debug,
|
|
457
|
+
force=force,
|
|
458
|
+
nthreads=nthreads,
|
|
459
|
+
config=config,
|
|
460
|
+
help_=help_,
|
|
461
|
+
version=version,
|
|
462
|
+
sh=sh,
|
|
463
|
+
mask=mask,
|
|
464
|
+
directions=directions,
|
|
465
|
+
response=response,
|
|
466
|
+
)
|
|
467
|
+
return sh2response_execute(params, runner)
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
__all__ = [
|
|
471
|
+
"SH2RESPONSE_METADATA",
|
|
472
|
+
"Sh2responseConfigParamsDict",
|
|
473
|
+
"Sh2responseConfigParamsDictTagged",
|
|
474
|
+
"Sh2responseOutputs",
|
|
475
|
+
"Sh2responseParamsDict",
|
|
476
|
+
"Sh2responseParamsDictTagged",
|
|
477
|
+
"sh2response",
|
|
478
|
+
"sh2response_config",
|
|
479
|
+
"sh2response_execute",
|
|
480
|
+
"sh2response_params",
|
|
481
|
+
]
|