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,556 @@
|
|
|
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
|
+
WARP2METRIC_METADATA = Metadata(
|
|
9
|
+
id="6239916d39fe990e43c4b408dab7798207712e0c.boutiques",
|
|
10
|
+
name="warp2metric",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_Warp2metricFcParamsDictNoTag = typing.TypedDict('_Warp2metricFcParamsDictNoTag', {
|
|
17
|
+
"template_fixel_directory": InputPathType,
|
|
18
|
+
"output_fixel_directory": str,
|
|
19
|
+
"output_fixel_data": str,
|
|
20
|
+
})
|
|
21
|
+
Warp2metricFcParamsDictTagged = typing.TypedDict('Warp2metricFcParamsDictTagged', {
|
|
22
|
+
"@type": typing.Literal["fc"],
|
|
23
|
+
"template_fixel_directory": InputPathType,
|
|
24
|
+
"output_fixel_directory": str,
|
|
25
|
+
"output_fixel_data": str,
|
|
26
|
+
})
|
|
27
|
+
Warp2metricFcParamsDict = _Warp2metricFcParamsDictNoTag | Warp2metricFcParamsDictTagged
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_Warp2metricConfigParamsDictNoTag = typing.TypedDict('_Warp2metricConfigParamsDictNoTag', {
|
|
31
|
+
"key": str,
|
|
32
|
+
"value": str,
|
|
33
|
+
})
|
|
34
|
+
Warp2metricConfigParamsDictTagged = typing.TypedDict('Warp2metricConfigParamsDictTagged', {
|
|
35
|
+
"@type": typing.Literal["config"],
|
|
36
|
+
"key": str,
|
|
37
|
+
"value": str,
|
|
38
|
+
})
|
|
39
|
+
Warp2metricConfigParamsDict = _Warp2metricConfigParamsDictNoTag | Warp2metricConfigParamsDictTagged
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
_Warp2metricParamsDictNoTag = typing.TypedDict('_Warp2metricParamsDictNoTag', {
|
|
43
|
+
"fc": typing.NotRequired[Warp2metricFcParamsDict | None],
|
|
44
|
+
"jmat": typing.NotRequired[str | None],
|
|
45
|
+
"jdet": typing.NotRequired[str | None],
|
|
46
|
+
"info": bool,
|
|
47
|
+
"quiet": bool,
|
|
48
|
+
"debug": bool,
|
|
49
|
+
"force": bool,
|
|
50
|
+
"nthreads": typing.NotRequired[int | None],
|
|
51
|
+
"config": typing.NotRequired[list[Warp2metricConfigParamsDict] | None],
|
|
52
|
+
"help": bool,
|
|
53
|
+
"version": bool,
|
|
54
|
+
"in": InputPathType,
|
|
55
|
+
})
|
|
56
|
+
Warp2metricParamsDictTagged = typing.TypedDict('Warp2metricParamsDictTagged', {
|
|
57
|
+
"@type": typing.Literal["mrtrix/warp2metric"],
|
|
58
|
+
"fc": typing.NotRequired[Warp2metricFcParamsDict | None],
|
|
59
|
+
"jmat": typing.NotRequired[str | None],
|
|
60
|
+
"jdet": typing.NotRequired[str | None],
|
|
61
|
+
"info": bool,
|
|
62
|
+
"quiet": bool,
|
|
63
|
+
"debug": bool,
|
|
64
|
+
"force": bool,
|
|
65
|
+
"nthreads": typing.NotRequired[int | None],
|
|
66
|
+
"config": typing.NotRequired[list[Warp2metricConfigParamsDict] | None],
|
|
67
|
+
"help": bool,
|
|
68
|
+
"version": bool,
|
|
69
|
+
"in": InputPathType,
|
|
70
|
+
})
|
|
71
|
+
Warp2metricParamsDict = _Warp2metricParamsDictNoTag | Warp2metricParamsDictTagged
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def warp2metric_fc(
|
|
75
|
+
template_fixel_directory: InputPathType,
|
|
76
|
+
output_fixel_directory: str,
|
|
77
|
+
output_fixel_data: str,
|
|
78
|
+
) -> Warp2metricFcParamsDictTagged:
|
|
79
|
+
"""
|
|
80
|
+
Build parameters.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
template_fixel_directory: use an input template fixel image to define\
|
|
84
|
+
fibre orientations and output a fixel image describing the change in\
|
|
85
|
+
fibre cross-section (FC) in the perpendicular plane to the fixel\
|
|
86
|
+
orientation. e.g. warp2metric warp.mif -fc fixel_template_directory\
|
|
87
|
+
output_fixel_directory fc.mif.
|
|
88
|
+
output_fixel_directory: use an input template fixel image to define\
|
|
89
|
+
fibre orientations and output a fixel image describing the change in\
|
|
90
|
+
fibre cross-section (FC) in the perpendicular plane to the fixel\
|
|
91
|
+
orientation. e.g. warp2metric warp.mif -fc fixel_template_directory\
|
|
92
|
+
output_fixel_directory fc.mif.
|
|
93
|
+
output_fixel_data: use an input template fixel image to define fibre\
|
|
94
|
+
orientations and output a fixel image describing the change in fibre\
|
|
95
|
+
cross-section (FC) in the perpendicular plane to the fixel orientation.\
|
|
96
|
+
e.g. warp2metric warp.mif -fc fixel_template_directory\
|
|
97
|
+
output_fixel_directory fc.mif.
|
|
98
|
+
Returns:
|
|
99
|
+
Parameter dictionary
|
|
100
|
+
"""
|
|
101
|
+
params = {
|
|
102
|
+
"@type": "fc",
|
|
103
|
+
"template_fixel_directory": template_fixel_directory,
|
|
104
|
+
"output_fixel_directory": output_fixel_directory,
|
|
105
|
+
"output_fixel_data": output_fixel_data,
|
|
106
|
+
}
|
|
107
|
+
return params
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def warp2metric_fc_validate(
|
|
111
|
+
params: typing.Any,
|
|
112
|
+
) -> None:
|
|
113
|
+
"""
|
|
114
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
115
|
+
`Warp2metricFcParamsDict` object.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
params: The parameters object to validate.
|
|
119
|
+
"""
|
|
120
|
+
if params is None or not isinstance(params, dict):
|
|
121
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
122
|
+
if params.get("template_fixel_directory", None) is None:
|
|
123
|
+
raise StyxValidationError("`template_fixel_directory` must not be None")
|
|
124
|
+
if not isinstance(params["template_fixel_directory"], (pathlib.Path, str)):
|
|
125
|
+
raise StyxValidationError(f'`template_fixel_directory` has the wrong type: Received `{type(params.get("template_fixel_directory", None))}` expected `InputPathType`')
|
|
126
|
+
if params.get("output_fixel_directory", None) is None:
|
|
127
|
+
raise StyxValidationError("`output_fixel_directory` must not be None")
|
|
128
|
+
if not isinstance(params["output_fixel_directory"], str):
|
|
129
|
+
raise StyxValidationError(f'`output_fixel_directory` has the wrong type: Received `{type(params.get("output_fixel_directory", None))}` expected `str`')
|
|
130
|
+
if params.get("output_fixel_data", None) is None:
|
|
131
|
+
raise StyxValidationError("`output_fixel_data` must not be None")
|
|
132
|
+
if not isinstance(params["output_fixel_data"], str):
|
|
133
|
+
raise StyxValidationError(f'`output_fixel_data` has the wrong type: Received `{type(params.get("output_fixel_data", None))}` expected `str`')
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def warp2metric_fc_cargs(
|
|
137
|
+
params: Warp2metricFcParamsDict,
|
|
138
|
+
execution: Execution,
|
|
139
|
+
) -> list[str]:
|
|
140
|
+
"""
|
|
141
|
+
Build command-line arguments from parameters.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
params: The parameters.
|
|
145
|
+
execution: The execution object for resolving input paths.
|
|
146
|
+
Returns:
|
|
147
|
+
Command-line arguments.
|
|
148
|
+
"""
|
|
149
|
+
cargs = []
|
|
150
|
+
cargs.append("-fc")
|
|
151
|
+
cargs.append(execution.input_file(params.get("template_fixel_directory", None)))
|
|
152
|
+
cargs.append(params.get("output_fixel_directory", None))
|
|
153
|
+
cargs.append(params.get("output_fixel_data", None))
|
|
154
|
+
return cargs
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def warp2metric_config(
|
|
158
|
+
key: str,
|
|
159
|
+
value: str,
|
|
160
|
+
) -> Warp2metricConfigParamsDictTagged:
|
|
161
|
+
"""
|
|
162
|
+
Build parameters.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
166
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
167
|
+
Returns:
|
|
168
|
+
Parameter dictionary
|
|
169
|
+
"""
|
|
170
|
+
params = {
|
|
171
|
+
"@type": "config",
|
|
172
|
+
"key": key,
|
|
173
|
+
"value": value,
|
|
174
|
+
}
|
|
175
|
+
return params
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def warp2metric_config_validate(
|
|
179
|
+
params: typing.Any,
|
|
180
|
+
) -> None:
|
|
181
|
+
"""
|
|
182
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
183
|
+
`Warp2metricConfigParamsDict` object.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
params: The parameters object to validate.
|
|
187
|
+
"""
|
|
188
|
+
if params is None or not isinstance(params, dict):
|
|
189
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
190
|
+
if params.get("key", None) is None:
|
|
191
|
+
raise StyxValidationError("`key` must not be None")
|
|
192
|
+
if not isinstance(params["key"], str):
|
|
193
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
194
|
+
if params.get("value", None) is None:
|
|
195
|
+
raise StyxValidationError("`value` must not be None")
|
|
196
|
+
if not isinstance(params["value"], str):
|
|
197
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def warp2metric_config_cargs(
|
|
201
|
+
params: Warp2metricConfigParamsDict,
|
|
202
|
+
execution: Execution,
|
|
203
|
+
) -> list[str]:
|
|
204
|
+
"""
|
|
205
|
+
Build command-line arguments from parameters.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
params: The parameters.
|
|
209
|
+
execution: The execution object for resolving input paths.
|
|
210
|
+
Returns:
|
|
211
|
+
Command-line arguments.
|
|
212
|
+
"""
|
|
213
|
+
cargs = []
|
|
214
|
+
cargs.append("-config")
|
|
215
|
+
cargs.append(params.get("key", None))
|
|
216
|
+
cargs.append(params.get("value", None))
|
|
217
|
+
return cargs
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class Warp2metricOutputs(typing.NamedTuple):
|
|
221
|
+
"""
|
|
222
|
+
Output object returned when calling `Warp2metricParamsDict(...)`.
|
|
223
|
+
"""
|
|
224
|
+
root: OutputPathType
|
|
225
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
226
|
+
jmat: OutputPathType | None
|
|
227
|
+
"""output a Jacobian matrix image stored in column-major order along the 4th
|
|
228
|
+
dimension.Note the output jacobian describes the warp gradient w.r.t the
|
|
229
|
+
scanner space coordinate system """
|
|
230
|
+
jdet: OutputPathType | None
|
|
231
|
+
"""output the Jacobian determinant instead of the full matrix """
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def warp2metric_params(
|
|
235
|
+
in_: InputPathType,
|
|
236
|
+
fc: Warp2metricFcParamsDict | None = None,
|
|
237
|
+
jmat: str | None = None,
|
|
238
|
+
jdet: str | None = None,
|
|
239
|
+
info: bool = False,
|
|
240
|
+
quiet: bool = False,
|
|
241
|
+
debug: bool = False,
|
|
242
|
+
force: bool = False,
|
|
243
|
+
nthreads: int | None = None,
|
|
244
|
+
config: list[Warp2metricConfigParamsDict] | None = None,
|
|
245
|
+
help_: bool = False,
|
|
246
|
+
version: bool = False,
|
|
247
|
+
) -> Warp2metricParamsDictTagged:
|
|
248
|
+
"""
|
|
249
|
+
Build parameters.
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
in_: the input deformation field.
|
|
253
|
+
fc: use an input template fixel image to define fibre orientations and\
|
|
254
|
+
output a fixel image describing the change in fibre cross-section (FC)\
|
|
255
|
+
in the perpendicular plane to the fixel orientation. e.g. warp2metric\
|
|
256
|
+
warp.mif -fc fixel_template_directory output_fixel_directory fc.mif.
|
|
257
|
+
jmat: output a Jacobian matrix image stored in column-major order along\
|
|
258
|
+
the 4th dimension.Note the output jacobian describes the warp gradient\
|
|
259
|
+
w.r.t the scanner space coordinate system.
|
|
260
|
+
jdet: output the Jacobian determinant instead of the full matrix.
|
|
261
|
+
info: display information messages.
|
|
262
|
+
quiet: do not display information messages or progress status;\
|
|
263
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
264
|
+
environment variable to a non-empty string.
|
|
265
|
+
debug: display debugging messages.
|
|
266
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
267
|
+
input and output might cause unexpected behaviour).
|
|
268
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
269
|
+
(set to 0 to disable multi-threading).
|
|
270
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
271
|
+
help_: display this information page and exit.
|
|
272
|
+
version: display version information and exit.
|
|
273
|
+
Returns:
|
|
274
|
+
Parameter dictionary
|
|
275
|
+
"""
|
|
276
|
+
params = {
|
|
277
|
+
"@type": "mrtrix/warp2metric",
|
|
278
|
+
"info": info,
|
|
279
|
+
"quiet": quiet,
|
|
280
|
+
"debug": debug,
|
|
281
|
+
"force": force,
|
|
282
|
+
"help": help_,
|
|
283
|
+
"version": version,
|
|
284
|
+
"in": in_,
|
|
285
|
+
}
|
|
286
|
+
if fc is not None:
|
|
287
|
+
params["fc"] = fc
|
|
288
|
+
if jmat is not None:
|
|
289
|
+
params["jmat"] = jmat
|
|
290
|
+
if jdet is not None:
|
|
291
|
+
params["jdet"] = jdet
|
|
292
|
+
if nthreads is not None:
|
|
293
|
+
params["nthreads"] = nthreads
|
|
294
|
+
if config is not None:
|
|
295
|
+
params["config"] = config
|
|
296
|
+
return params
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def warp2metric_validate(
|
|
300
|
+
params: typing.Any,
|
|
301
|
+
) -> None:
|
|
302
|
+
"""
|
|
303
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
304
|
+
`Warp2metricParamsDict` object.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
params: The parameters object to validate.
|
|
308
|
+
"""
|
|
309
|
+
if params is None or not isinstance(params, dict):
|
|
310
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
311
|
+
if params.get("fc", None) is not None:
|
|
312
|
+
warp2metric_fc_validate(params["fc"])
|
|
313
|
+
if params.get("jmat", None) is not None:
|
|
314
|
+
if not isinstance(params["jmat"], str):
|
|
315
|
+
raise StyxValidationError(f'`jmat` has the wrong type: Received `{type(params.get("jmat", None))}` expected `str | None`')
|
|
316
|
+
if params.get("jdet", None) is not None:
|
|
317
|
+
if not isinstance(params["jdet"], str):
|
|
318
|
+
raise StyxValidationError(f'`jdet` has the wrong type: Received `{type(params.get("jdet", None))}` expected `str | None`')
|
|
319
|
+
if params.get("info", False) is None:
|
|
320
|
+
raise StyxValidationError("`info` must not be None")
|
|
321
|
+
if not isinstance(params["info"], bool):
|
|
322
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
323
|
+
if params.get("quiet", False) is None:
|
|
324
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
325
|
+
if not isinstance(params["quiet"], bool):
|
|
326
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
327
|
+
if params.get("debug", False) is None:
|
|
328
|
+
raise StyxValidationError("`debug` must not be None")
|
|
329
|
+
if not isinstance(params["debug"], bool):
|
|
330
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
331
|
+
if params.get("force", False) is None:
|
|
332
|
+
raise StyxValidationError("`force` must not be None")
|
|
333
|
+
if not isinstance(params["force"], bool):
|
|
334
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
335
|
+
if params.get("nthreads", None) is not None:
|
|
336
|
+
if not isinstance(params["nthreads"], int):
|
|
337
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
338
|
+
if params.get("config", None) is not None:
|
|
339
|
+
if not isinstance(params["config"], list):
|
|
340
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Warp2metricConfigParamsDict] | None`')
|
|
341
|
+
for e in params["config"]:
|
|
342
|
+
warp2metric_config_validate(e)
|
|
343
|
+
if params.get("help", False) is None:
|
|
344
|
+
raise StyxValidationError("`help` must not be None")
|
|
345
|
+
if not isinstance(params["help"], bool):
|
|
346
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
347
|
+
if params.get("version", False) is None:
|
|
348
|
+
raise StyxValidationError("`version` must not be None")
|
|
349
|
+
if not isinstance(params["version"], bool):
|
|
350
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
351
|
+
if params.get("in", None) is None:
|
|
352
|
+
raise StyxValidationError("`in` must not be None")
|
|
353
|
+
if not isinstance(params["in"], (pathlib.Path, str)):
|
|
354
|
+
raise StyxValidationError(f'`in` has the wrong type: Received `{type(params.get("in", None))}` expected `InputPathType`')
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def warp2metric_cargs(
|
|
358
|
+
params: Warp2metricParamsDict,
|
|
359
|
+
execution: Execution,
|
|
360
|
+
) -> list[str]:
|
|
361
|
+
"""
|
|
362
|
+
Build command-line arguments from parameters.
|
|
363
|
+
|
|
364
|
+
Args:
|
|
365
|
+
params: The parameters.
|
|
366
|
+
execution: The execution object for resolving input paths.
|
|
367
|
+
Returns:
|
|
368
|
+
Command-line arguments.
|
|
369
|
+
"""
|
|
370
|
+
cargs = []
|
|
371
|
+
cargs.append("warp2metric")
|
|
372
|
+
if params.get("fc", None) is not None:
|
|
373
|
+
cargs.extend(warp2metric_fc_cargs(params.get("fc", None), execution))
|
|
374
|
+
if params.get("jmat", None) is not None:
|
|
375
|
+
cargs.extend([
|
|
376
|
+
"-jmat",
|
|
377
|
+
params.get("jmat", None)
|
|
378
|
+
])
|
|
379
|
+
if params.get("jdet", None) is not None:
|
|
380
|
+
cargs.extend([
|
|
381
|
+
"-jdet",
|
|
382
|
+
params.get("jdet", None)
|
|
383
|
+
])
|
|
384
|
+
if params.get("info", False):
|
|
385
|
+
cargs.append("-info")
|
|
386
|
+
if params.get("quiet", False):
|
|
387
|
+
cargs.append("-quiet")
|
|
388
|
+
if params.get("debug", False):
|
|
389
|
+
cargs.append("-debug")
|
|
390
|
+
if params.get("force", False):
|
|
391
|
+
cargs.append("-force")
|
|
392
|
+
if params.get("nthreads", None) is not None:
|
|
393
|
+
cargs.extend([
|
|
394
|
+
"-nthreads",
|
|
395
|
+
str(params.get("nthreads", None))
|
|
396
|
+
])
|
|
397
|
+
if params.get("config", None) is not None:
|
|
398
|
+
cargs.extend([a for c in [warp2metric_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
399
|
+
if params.get("help", False):
|
|
400
|
+
cargs.append("-help")
|
|
401
|
+
if params.get("version", False):
|
|
402
|
+
cargs.append("-version")
|
|
403
|
+
cargs.append(execution.input_file(params.get("in", None)))
|
|
404
|
+
return cargs
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def warp2metric_outputs(
|
|
408
|
+
params: Warp2metricParamsDict,
|
|
409
|
+
execution: Execution,
|
|
410
|
+
) -> Warp2metricOutputs:
|
|
411
|
+
"""
|
|
412
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
413
|
+
|
|
414
|
+
Args:
|
|
415
|
+
params: The parameters.
|
|
416
|
+
execution: The execution object for resolving input paths.
|
|
417
|
+
Returns:
|
|
418
|
+
Outputs object.
|
|
419
|
+
"""
|
|
420
|
+
ret = Warp2metricOutputs(
|
|
421
|
+
root=execution.output_file("."),
|
|
422
|
+
jmat=execution.output_file(params.get("jmat", None)) if (params.get("jmat") is not None) else None,
|
|
423
|
+
jdet=execution.output_file(params.get("jdet", None)) if (params.get("jdet") is not None) else None,
|
|
424
|
+
)
|
|
425
|
+
return ret
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def warp2metric_execute(
|
|
429
|
+
params: Warp2metricParamsDict,
|
|
430
|
+
runner: Runner | None = None,
|
|
431
|
+
) -> Warp2metricOutputs:
|
|
432
|
+
"""
|
|
433
|
+
warp2metric
|
|
434
|
+
|
|
435
|
+
Compute fixel-wise or voxel-wise metrics from a 4D deformation field.
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
References:
|
|
440
|
+
|
|
441
|
+
Raffelt, D.; Tournier, JD/; Smith, RE.; Vaughan, DN.; Jackson, G.; Ridgway,
|
|
442
|
+
GR. Connelly, A.Investigating White Matter Fibre Density and Morphology
|
|
443
|
+
using Fixel-Based Analysis. Neuroimage, 2017, 144, 58-73, doi:
|
|
444
|
+
10.1016/j.neuroimage.2016.09.029.
|
|
445
|
+
|
|
446
|
+
Author: MRTrix3 Developers
|
|
447
|
+
|
|
448
|
+
URL: https://www.mrtrix.org/
|
|
449
|
+
|
|
450
|
+
Args:
|
|
451
|
+
params: The parameters.
|
|
452
|
+
runner: Command runner.
|
|
453
|
+
Returns:
|
|
454
|
+
NamedTuple of outputs (described in `Warp2metricOutputs`).
|
|
455
|
+
"""
|
|
456
|
+
warp2metric_validate(params)
|
|
457
|
+
runner = runner or get_global_runner()
|
|
458
|
+
execution = runner.start_execution(WARP2METRIC_METADATA)
|
|
459
|
+
params = execution.params(params)
|
|
460
|
+
cargs = warp2metric_cargs(params, execution)
|
|
461
|
+
ret = warp2metric_outputs(params, execution)
|
|
462
|
+
execution.run(cargs)
|
|
463
|
+
return ret
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def warp2metric(
|
|
467
|
+
in_: InputPathType,
|
|
468
|
+
fc: Warp2metricFcParamsDict | None = None,
|
|
469
|
+
jmat: str | None = None,
|
|
470
|
+
jdet: str | None = None,
|
|
471
|
+
info: bool = False,
|
|
472
|
+
quiet: bool = False,
|
|
473
|
+
debug: bool = False,
|
|
474
|
+
force: bool = False,
|
|
475
|
+
nthreads: int | None = None,
|
|
476
|
+
config: list[Warp2metricConfigParamsDict] | None = None,
|
|
477
|
+
help_: bool = False,
|
|
478
|
+
version: bool = False,
|
|
479
|
+
runner: Runner | None = None,
|
|
480
|
+
) -> Warp2metricOutputs:
|
|
481
|
+
"""
|
|
482
|
+
warp2metric
|
|
483
|
+
|
|
484
|
+
Compute fixel-wise or voxel-wise metrics from a 4D deformation field.
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
References:
|
|
489
|
+
|
|
490
|
+
Raffelt, D.; Tournier, JD/; Smith, RE.; Vaughan, DN.; Jackson, G.; Ridgway,
|
|
491
|
+
GR. Connelly, A.Investigating White Matter Fibre Density and Morphology
|
|
492
|
+
using Fixel-Based Analysis. Neuroimage, 2017, 144, 58-73, doi:
|
|
493
|
+
10.1016/j.neuroimage.2016.09.029.
|
|
494
|
+
|
|
495
|
+
Author: MRTrix3 Developers
|
|
496
|
+
|
|
497
|
+
URL: https://www.mrtrix.org/
|
|
498
|
+
|
|
499
|
+
Args:
|
|
500
|
+
in_: the input deformation field.
|
|
501
|
+
fc: use an input template fixel image to define fibre orientations and\
|
|
502
|
+
output a fixel image describing the change in fibre cross-section (FC)\
|
|
503
|
+
in the perpendicular plane to the fixel orientation. e.g. warp2metric\
|
|
504
|
+
warp.mif -fc fixel_template_directory output_fixel_directory fc.mif.
|
|
505
|
+
jmat: output a Jacobian matrix image stored in column-major order along\
|
|
506
|
+
the 4th dimension.Note the output jacobian describes the warp gradient\
|
|
507
|
+
w.r.t the scanner space coordinate system.
|
|
508
|
+
jdet: output the Jacobian determinant instead of the full matrix.
|
|
509
|
+
info: display information messages.
|
|
510
|
+
quiet: do not display information messages or progress status;\
|
|
511
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
512
|
+
environment variable to a non-empty string.
|
|
513
|
+
debug: display debugging messages.
|
|
514
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
515
|
+
input and output might cause unexpected behaviour).
|
|
516
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
517
|
+
(set to 0 to disable multi-threading).
|
|
518
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
519
|
+
help_: display this information page and exit.
|
|
520
|
+
version: display version information and exit.
|
|
521
|
+
runner: Command runner.
|
|
522
|
+
Returns:
|
|
523
|
+
NamedTuple of outputs (described in `Warp2metricOutputs`).
|
|
524
|
+
"""
|
|
525
|
+
params = warp2metric_params(
|
|
526
|
+
fc=fc,
|
|
527
|
+
jmat=jmat,
|
|
528
|
+
jdet=jdet,
|
|
529
|
+
info=info,
|
|
530
|
+
quiet=quiet,
|
|
531
|
+
debug=debug,
|
|
532
|
+
force=force,
|
|
533
|
+
nthreads=nthreads,
|
|
534
|
+
config=config,
|
|
535
|
+
help_=help_,
|
|
536
|
+
version=version,
|
|
537
|
+
in_=in_,
|
|
538
|
+
)
|
|
539
|
+
return warp2metric_execute(params, runner)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
__all__ = [
|
|
543
|
+
"WARP2METRIC_METADATA",
|
|
544
|
+
"Warp2metricConfigParamsDict",
|
|
545
|
+
"Warp2metricConfigParamsDictTagged",
|
|
546
|
+
"Warp2metricFcParamsDict",
|
|
547
|
+
"Warp2metricFcParamsDictTagged",
|
|
548
|
+
"Warp2metricOutputs",
|
|
549
|
+
"Warp2metricParamsDict",
|
|
550
|
+
"Warp2metricParamsDictTagged",
|
|
551
|
+
"warp2metric",
|
|
552
|
+
"warp2metric_config",
|
|
553
|
+
"warp2metric_execute",
|
|
554
|
+
"warp2metric_fc",
|
|
555
|
+
"warp2metric_params",
|
|
556
|
+
]
|