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