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