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,531 @@
|
|
|
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
|
+
DWI2ADC_METADATA = Metadata(
|
|
9
|
+
id="8ba8efdde3cc0a5ed2e0c5a5f36fc02ee6f162a1.boutiques",
|
|
10
|
+
name="dwi2adc",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Dwi2adcFslgradParamsDictNoTag = typing.TypedDict('_Dwi2adcFslgradParamsDictNoTag', {
|
|
17
|
+
"bvecs": InputPathType,
|
|
18
|
+
"bvals": InputPathType,
|
|
19
|
+
})
|
|
20
|
+
Dwi2adcFslgradParamsDictTagged = typing.TypedDict('Dwi2adcFslgradParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["fslgrad"],
|
|
22
|
+
"bvecs": InputPathType,
|
|
23
|
+
"bvals": InputPathType,
|
|
24
|
+
})
|
|
25
|
+
Dwi2adcFslgradParamsDict = _Dwi2adcFslgradParamsDictNoTag | Dwi2adcFslgradParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_Dwi2adcConfigParamsDictNoTag = typing.TypedDict('_Dwi2adcConfigParamsDictNoTag', {
|
|
29
|
+
"key": str,
|
|
30
|
+
"value": str,
|
|
31
|
+
})
|
|
32
|
+
Dwi2adcConfigParamsDictTagged = typing.TypedDict('Dwi2adcConfigParamsDictTagged', {
|
|
33
|
+
"@type": typing.Literal["config"],
|
|
34
|
+
"key": str,
|
|
35
|
+
"value": str,
|
|
36
|
+
})
|
|
37
|
+
Dwi2adcConfigParamsDict = _Dwi2adcConfigParamsDictNoTag | Dwi2adcConfigParamsDictTagged
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
_Dwi2adcParamsDictNoTag = typing.TypedDict('_Dwi2adcParamsDictNoTag', {
|
|
41
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
42
|
+
"fslgrad": typing.NotRequired[Dwi2adcFslgradParamsDict | None],
|
|
43
|
+
"info": bool,
|
|
44
|
+
"quiet": bool,
|
|
45
|
+
"debug": bool,
|
|
46
|
+
"force": bool,
|
|
47
|
+
"nthreads": typing.NotRequired[int | None],
|
|
48
|
+
"config": typing.NotRequired[list[Dwi2adcConfigParamsDict] | None],
|
|
49
|
+
"help": bool,
|
|
50
|
+
"version": bool,
|
|
51
|
+
"input": InputPathType,
|
|
52
|
+
"output": str,
|
|
53
|
+
})
|
|
54
|
+
Dwi2adcParamsDictTagged = typing.TypedDict('Dwi2adcParamsDictTagged', {
|
|
55
|
+
"@type": typing.Literal["mrtrix/dwi2adc"],
|
|
56
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
57
|
+
"fslgrad": typing.NotRequired[Dwi2adcFslgradParamsDict | None],
|
|
58
|
+
"info": bool,
|
|
59
|
+
"quiet": bool,
|
|
60
|
+
"debug": bool,
|
|
61
|
+
"force": bool,
|
|
62
|
+
"nthreads": typing.NotRequired[int | None],
|
|
63
|
+
"config": typing.NotRequired[list[Dwi2adcConfigParamsDict] | None],
|
|
64
|
+
"help": bool,
|
|
65
|
+
"version": bool,
|
|
66
|
+
"input": InputPathType,
|
|
67
|
+
"output": str,
|
|
68
|
+
})
|
|
69
|
+
Dwi2adcParamsDict = _Dwi2adcParamsDictNoTag | Dwi2adcParamsDictTagged
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def dwi2adc_fslgrad(
|
|
73
|
+
bvecs: InputPathType,
|
|
74
|
+
bvals: InputPathType,
|
|
75
|
+
) -> Dwi2adcFslgradParamsDictTagged:
|
|
76
|
+
"""
|
|
77
|
+
Build parameters.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
bvecs: Provide the diffusion-weighted gradient scheme used in the\
|
|
81
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
82
|
+
scheme is present in the input image header, the data provided with\
|
|
83
|
+
this option will be instead used.
|
|
84
|
+
bvals: Provide the diffusion-weighted gradient scheme used in the\
|
|
85
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
86
|
+
scheme is present in the input image header, the data provided with\
|
|
87
|
+
this option will be instead used.
|
|
88
|
+
Returns:
|
|
89
|
+
Parameter dictionary
|
|
90
|
+
"""
|
|
91
|
+
params = {
|
|
92
|
+
"@type": "fslgrad",
|
|
93
|
+
"bvecs": bvecs,
|
|
94
|
+
"bvals": bvals,
|
|
95
|
+
}
|
|
96
|
+
return params
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def dwi2adc_fslgrad_validate(
|
|
100
|
+
params: typing.Any,
|
|
101
|
+
) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
104
|
+
`Dwi2adcFslgradParamsDict` 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("bvecs", None) is None:
|
|
112
|
+
raise StyxValidationError("`bvecs` must not be None")
|
|
113
|
+
if not isinstance(params["bvecs"], (pathlib.Path, str)):
|
|
114
|
+
raise StyxValidationError(f'`bvecs` has the wrong type: Received `{type(params.get("bvecs", None))}` expected `InputPathType`')
|
|
115
|
+
if params.get("bvals", None) is None:
|
|
116
|
+
raise StyxValidationError("`bvals` must not be None")
|
|
117
|
+
if not isinstance(params["bvals"], (pathlib.Path, str)):
|
|
118
|
+
raise StyxValidationError(f'`bvals` has the wrong type: Received `{type(params.get("bvals", None))}` expected `InputPathType`')
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def dwi2adc_fslgrad_cargs(
|
|
122
|
+
params: Dwi2adcFslgradParamsDict,
|
|
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("-fslgrad")
|
|
136
|
+
cargs.append(execution.input_file(params.get("bvecs", None)))
|
|
137
|
+
cargs.append(execution.input_file(params.get("bvals", None)))
|
|
138
|
+
return cargs
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def dwi2adc_config(
|
|
142
|
+
key: str,
|
|
143
|
+
value: str,
|
|
144
|
+
) -> Dwi2adcConfigParamsDictTagged:
|
|
145
|
+
"""
|
|
146
|
+
Build parameters.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
150
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
151
|
+
Returns:
|
|
152
|
+
Parameter dictionary
|
|
153
|
+
"""
|
|
154
|
+
params = {
|
|
155
|
+
"@type": "config",
|
|
156
|
+
"key": key,
|
|
157
|
+
"value": value,
|
|
158
|
+
}
|
|
159
|
+
return params
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def dwi2adc_config_validate(
|
|
163
|
+
params: typing.Any,
|
|
164
|
+
) -> None:
|
|
165
|
+
"""
|
|
166
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
167
|
+
`Dwi2adcConfigParamsDict` object.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
params: The parameters object to validate.
|
|
171
|
+
"""
|
|
172
|
+
if params is None or not isinstance(params, dict):
|
|
173
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
174
|
+
if params.get("key", None) is None:
|
|
175
|
+
raise StyxValidationError("`key` must not be None")
|
|
176
|
+
if not isinstance(params["key"], str):
|
|
177
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
178
|
+
if params.get("value", None) is None:
|
|
179
|
+
raise StyxValidationError("`value` must not be None")
|
|
180
|
+
if not isinstance(params["value"], str):
|
|
181
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def dwi2adc_config_cargs(
|
|
185
|
+
params: Dwi2adcConfigParamsDict,
|
|
186
|
+
execution: Execution,
|
|
187
|
+
) -> list[str]:
|
|
188
|
+
"""
|
|
189
|
+
Build command-line arguments from parameters.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
params: The parameters.
|
|
193
|
+
execution: The execution object for resolving input paths.
|
|
194
|
+
Returns:
|
|
195
|
+
Command-line arguments.
|
|
196
|
+
"""
|
|
197
|
+
cargs = []
|
|
198
|
+
cargs.append("-config")
|
|
199
|
+
cargs.append(params.get("key", None))
|
|
200
|
+
cargs.append(params.get("value", None))
|
|
201
|
+
return cargs
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class Dwi2adcOutputs(typing.NamedTuple):
|
|
205
|
+
"""
|
|
206
|
+
Output object returned when calling `Dwi2adcParamsDict(...)`.
|
|
207
|
+
"""
|
|
208
|
+
root: OutputPathType
|
|
209
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
210
|
+
output: OutputPathType
|
|
211
|
+
"""the output image."""
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def dwi2adc_params(
|
|
215
|
+
input_: InputPathType,
|
|
216
|
+
output: str,
|
|
217
|
+
grad: InputPathType | None = None,
|
|
218
|
+
fslgrad: Dwi2adcFslgradParamsDict | None = None,
|
|
219
|
+
info: bool = False,
|
|
220
|
+
quiet: bool = False,
|
|
221
|
+
debug: bool = False,
|
|
222
|
+
force: bool = False,
|
|
223
|
+
nthreads: int | None = None,
|
|
224
|
+
config: list[Dwi2adcConfigParamsDict] | None = None,
|
|
225
|
+
help_: bool = False,
|
|
226
|
+
version: bool = False,
|
|
227
|
+
) -> Dwi2adcParamsDictTagged:
|
|
228
|
+
"""
|
|
229
|
+
Build parameters.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
input_: the input image.
|
|
233
|
+
output: the output image.
|
|
234
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
235
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
236
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
237
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
238
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
239
|
+
header, the data provided with this option will be instead used.
|
|
240
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
241
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
242
|
+
scheme is present in the input image header, the data provided with\
|
|
243
|
+
this option will be instead used.
|
|
244
|
+
info: display information messages.
|
|
245
|
+
quiet: do not display information messages or progress status;\
|
|
246
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
247
|
+
environment variable to a non-empty string.
|
|
248
|
+
debug: display debugging messages.
|
|
249
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
250
|
+
input and output might cause unexpected behaviour).
|
|
251
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
252
|
+
(set to 0 to disable multi-threading).
|
|
253
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
254
|
+
help_: display this information page and exit.
|
|
255
|
+
version: display version information and exit.
|
|
256
|
+
Returns:
|
|
257
|
+
Parameter dictionary
|
|
258
|
+
"""
|
|
259
|
+
params = {
|
|
260
|
+
"@type": "mrtrix/dwi2adc",
|
|
261
|
+
"info": info,
|
|
262
|
+
"quiet": quiet,
|
|
263
|
+
"debug": debug,
|
|
264
|
+
"force": force,
|
|
265
|
+
"help": help_,
|
|
266
|
+
"version": version,
|
|
267
|
+
"input": input_,
|
|
268
|
+
"output": output,
|
|
269
|
+
}
|
|
270
|
+
if grad is not None:
|
|
271
|
+
params["grad"] = grad
|
|
272
|
+
if fslgrad is not None:
|
|
273
|
+
params["fslgrad"] = fslgrad
|
|
274
|
+
if nthreads is not None:
|
|
275
|
+
params["nthreads"] = nthreads
|
|
276
|
+
if config is not None:
|
|
277
|
+
params["config"] = config
|
|
278
|
+
return params
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def dwi2adc_validate(
|
|
282
|
+
params: typing.Any,
|
|
283
|
+
) -> None:
|
|
284
|
+
"""
|
|
285
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
286
|
+
`Dwi2adcParamsDict` object.
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
params: The parameters object to validate.
|
|
290
|
+
"""
|
|
291
|
+
if params is None or not isinstance(params, dict):
|
|
292
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
293
|
+
if params.get("grad", None) is not None:
|
|
294
|
+
if not isinstance(params["grad"], (pathlib.Path, str)):
|
|
295
|
+
raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
|
|
296
|
+
if params.get("fslgrad", None) is not None:
|
|
297
|
+
dwi2adc_fslgrad_validate(params["fslgrad"])
|
|
298
|
+
if params.get("info", False) is None:
|
|
299
|
+
raise StyxValidationError("`info` must not be None")
|
|
300
|
+
if not isinstance(params["info"], bool):
|
|
301
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
302
|
+
if params.get("quiet", False) is None:
|
|
303
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
304
|
+
if not isinstance(params["quiet"], bool):
|
|
305
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
306
|
+
if params.get("debug", False) is None:
|
|
307
|
+
raise StyxValidationError("`debug` must not be None")
|
|
308
|
+
if not isinstance(params["debug"], bool):
|
|
309
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
310
|
+
if params.get("force", False) is None:
|
|
311
|
+
raise StyxValidationError("`force` must not be None")
|
|
312
|
+
if not isinstance(params["force"], bool):
|
|
313
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
314
|
+
if params.get("nthreads", None) is not None:
|
|
315
|
+
if not isinstance(params["nthreads"], int):
|
|
316
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
317
|
+
if params.get("config", None) is not None:
|
|
318
|
+
if not isinstance(params["config"], list):
|
|
319
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Dwi2adcConfigParamsDict] | None`')
|
|
320
|
+
for e in params["config"]:
|
|
321
|
+
dwi2adc_config_validate(e)
|
|
322
|
+
if params.get("help", False) is None:
|
|
323
|
+
raise StyxValidationError("`help` must not be None")
|
|
324
|
+
if not isinstance(params["help"], bool):
|
|
325
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
326
|
+
if params.get("version", False) is None:
|
|
327
|
+
raise StyxValidationError("`version` must not be None")
|
|
328
|
+
if not isinstance(params["version"], bool):
|
|
329
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
330
|
+
if params.get("input", None) is None:
|
|
331
|
+
raise StyxValidationError("`input` must not be None")
|
|
332
|
+
if not isinstance(params["input"], (pathlib.Path, str)):
|
|
333
|
+
raise StyxValidationError(f'`input` has the wrong type: Received `{type(params.get("input", None))}` expected `InputPathType`')
|
|
334
|
+
if params.get("output", None) is None:
|
|
335
|
+
raise StyxValidationError("`output` must not be None")
|
|
336
|
+
if not isinstance(params["output"], str):
|
|
337
|
+
raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def dwi2adc_cargs(
|
|
341
|
+
params: Dwi2adcParamsDict,
|
|
342
|
+
execution: Execution,
|
|
343
|
+
) -> list[str]:
|
|
344
|
+
"""
|
|
345
|
+
Build command-line arguments from parameters.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
params: The parameters.
|
|
349
|
+
execution: The execution object for resolving input paths.
|
|
350
|
+
Returns:
|
|
351
|
+
Command-line arguments.
|
|
352
|
+
"""
|
|
353
|
+
cargs = []
|
|
354
|
+
cargs.append("dwi2adc")
|
|
355
|
+
if params.get("grad", None) is not None:
|
|
356
|
+
cargs.extend([
|
|
357
|
+
"-grad",
|
|
358
|
+
execution.input_file(params.get("grad", None))
|
|
359
|
+
])
|
|
360
|
+
if params.get("fslgrad", None) is not None:
|
|
361
|
+
cargs.extend(dwi2adc_fslgrad_cargs(params.get("fslgrad", None), execution))
|
|
362
|
+
if params.get("info", False):
|
|
363
|
+
cargs.append("-info")
|
|
364
|
+
if params.get("quiet", False):
|
|
365
|
+
cargs.append("-quiet")
|
|
366
|
+
if params.get("debug", False):
|
|
367
|
+
cargs.append("-debug")
|
|
368
|
+
if params.get("force", False):
|
|
369
|
+
cargs.append("-force")
|
|
370
|
+
if params.get("nthreads", None) is not None:
|
|
371
|
+
cargs.extend([
|
|
372
|
+
"-nthreads",
|
|
373
|
+
str(params.get("nthreads", None))
|
|
374
|
+
])
|
|
375
|
+
if params.get("config", None) is not None:
|
|
376
|
+
cargs.extend([a for c in [dwi2adc_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
377
|
+
if params.get("help", False):
|
|
378
|
+
cargs.append("-help")
|
|
379
|
+
if params.get("version", False):
|
|
380
|
+
cargs.append("-version")
|
|
381
|
+
cargs.append(execution.input_file(params.get("input", None)))
|
|
382
|
+
cargs.append(params.get("output", None))
|
|
383
|
+
return cargs
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def dwi2adc_outputs(
|
|
387
|
+
params: Dwi2adcParamsDict,
|
|
388
|
+
execution: Execution,
|
|
389
|
+
) -> Dwi2adcOutputs:
|
|
390
|
+
"""
|
|
391
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
params: The parameters.
|
|
395
|
+
execution: The execution object for resolving input paths.
|
|
396
|
+
Returns:
|
|
397
|
+
Outputs object.
|
|
398
|
+
"""
|
|
399
|
+
ret = Dwi2adcOutputs(
|
|
400
|
+
root=execution.output_file("."),
|
|
401
|
+
output=execution.output_file(params.get("output", None)),
|
|
402
|
+
)
|
|
403
|
+
return ret
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def dwi2adc_execute(
|
|
407
|
+
params: Dwi2adcParamsDict,
|
|
408
|
+
runner: Runner | None = None,
|
|
409
|
+
) -> Dwi2adcOutputs:
|
|
410
|
+
"""
|
|
411
|
+
dwi2adc
|
|
412
|
+
|
|
413
|
+
Convert mean dwi (trace-weighted) images to mean ADC maps.
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
References:
|
|
418
|
+
|
|
419
|
+
.
|
|
420
|
+
|
|
421
|
+
Author: MRTrix3 Developers
|
|
422
|
+
|
|
423
|
+
URL: https://www.mrtrix.org/
|
|
424
|
+
|
|
425
|
+
Args:
|
|
426
|
+
params: The parameters.
|
|
427
|
+
runner: Command runner.
|
|
428
|
+
Returns:
|
|
429
|
+
NamedTuple of outputs (described in `Dwi2adcOutputs`).
|
|
430
|
+
"""
|
|
431
|
+
dwi2adc_validate(params)
|
|
432
|
+
runner = runner or get_global_runner()
|
|
433
|
+
execution = runner.start_execution(DWI2ADC_METADATA)
|
|
434
|
+
params = execution.params(params)
|
|
435
|
+
cargs = dwi2adc_cargs(params, execution)
|
|
436
|
+
ret = dwi2adc_outputs(params, execution)
|
|
437
|
+
execution.run(cargs)
|
|
438
|
+
return ret
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def dwi2adc(
|
|
442
|
+
input_: InputPathType,
|
|
443
|
+
output: str,
|
|
444
|
+
grad: InputPathType | None = None,
|
|
445
|
+
fslgrad: Dwi2adcFslgradParamsDict | None = None,
|
|
446
|
+
info: bool = False,
|
|
447
|
+
quiet: bool = False,
|
|
448
|
+
debug: bool = False,
|
|
449
|
+
force: bool = False,
|
|
450
|
+
nthreads: int | None = None,
|
|
451
|
+
config: list[Dwi2adcConfigParamsDict] | None = None,
|
|
452
|
+
help_: bool = False,
|
|
453
|
+
version: bool = False,
|
|
454
|
+
runner: Runner | None = None,
|
|
455
|
+
) -> Dwi2adcOutputs:
|
|
456
|
+
"""
|
|
457
|
+
dwi2adc
|
|
458
|
+
|
|
459
|
+
Convert mean dwi (trace-weighted) images to mean ADC maps.
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
References:
|
|
464
|
+
|
|
465
|
+
.
|
|
466
|
+
|
|
467
|
+
Author: MRTrix3 Developers
|
|
468
|
+
|
|
469
|
+
URL: https://www.mrtrix.org/
|
|
470
|
+
|
|
471
|
+
Args:
|
|
472
|
+
input_: the input image.
|
|
473
|
+
output: the output image.
|
|
474
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
475
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
476
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
477
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
478
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
479
|
+
header, the data provided with this option will be instead used.
|
|
480
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
481
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
482
|
+
scheme is present in the input image header, the data provided with\
|
|
483
|
+
this option will be instead used.
|
|
484
|
+
info: display information messages.
|
|
485
|
+
quiet: do not display information messages or progress status;\
|
|
486
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
487
|
+
environment variable to a non-empty string.
|
|
488
|
+
debug: display debugging messages.
|
|
489
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
490
|
+
input and output might cause unexpected behaviour).
|
|
491
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
492
|
+
(set to 0 to disable multi-threading).
|
|
493
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
494
|
+
help_: display this information page and exit.
|
|
495
|
+
version: display version information and exit.
|
|
496
|
+
runner: Command runner.
|
|
497
|
+
Returns:
|
|
498
|
+
NamedTuple of outputs (described in `Dwi2adcOutputs`).
|
|
499
|
+
"""
|
|
500
|
+
params = dwi2adc_params(
|
|
501
|
+
grad=grad,
|
|
502
|
+
fslgrad=fslgrad,
|
|
503
|
+
info=info,
|
|
504
|
+
quiet=quiet,
|
|
505
|
+
debug=debug,
|
|
506
|
+
force=force,
|
|
507
|
+
nthreads=nthreads,
|
|
508
|
+
config=config,
|
|
509
|
+
help_=help_,
|
|
510
|
+
version=version,
|
|
511
|
+
input_=input_,
|
|
512
|
+
output=output,
|
|
513
|
+
)
|
|
514
|
+
return dwi2adc_execute(params, runner)
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
__all__ = [
|
|
518
|
+
"DWI2ADC_METADATA",
|
|
519
|
+
"Dwi2adcConfigParamsDict",
|
|
520
|
+
"Dwi2adcConfigParamsDictTagged",
|
|
521
|
+
"Dwi2adcFslgradParamsDict",
|
|
522
|
+
"Dwi2adcFslgradParamsDictTagged",
|
|
523
|
+
"Dwi2adcOutputs",
|
|
524
|
+
"Dwi2adcParamsDict",
|
|
525
|
+
"Dwi2adcParamsDictTagged",
|
|
526
|
+
"dwi2adc",
|
|
527
|
+
"dwi2adc_config",
|
|
528
|
+
"dwi2adc_execute",
|
|
529
|
+
"dwi2adc_fslgrad",
|
|
530
|
+
"dwi2adc_params",
|
|
531
|
+
]
|