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,446 @@
|
|
|
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
|
+
DIRMERGE_METADATA = Metadata(
|
|
9
|
+
id="40d07b2a5fb8d4016b42c7968c68cb8ea4d70a1a.boutiques",
|
|
10
|
+
name="dirmerge",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_DirmergeConfigParamsDictNoTag = typing.TypedDict('_DirmergeConfigParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
"value": str,
|
|
19
|
+
})
|
|
20
|
+
DirmergeConfigParamsDictTagged = typing.TypedDict('DirmergeConfigParamsDictTagged', {
|
|
21
|
+
"@type": typing.Literal["config"],
|
|
22
|
+
"key": str,
|
|
23
|
+
"value": str,
|
|
24
|
+
})
|
|
25
|
+
DirmergeConfigParamsDict = _DirmergeConfigParamsDictNoTag | DirmergeConfigParamsDictTagged
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_DirmergeParamsDictNoTag = typing.TypedDict('_DirmergeParamsDictNoTag', {
|
|
29
|
+
"unipolar_weight": typing.NotRequired[float | None],
|
|
30
|
+
"info": bool,
|
|
31
|
+
"quiet": bool,
|
|
32
|
+
"debug": bool,
|
|
33
|
+
"force": bool,
|
|
34
|
+
"nthreads": typing.NotRequired[int | None],
|
|
35
|
+
"config": typing.NotRequired[list[DirmergeConfigParamsDict] | None],
|
|
36
|
+
"help": bool,
|
|
37
|
+
"version": bool,
|
|
38
|
+
"subsets": int,
|
|
39
|
+
"bvalue_files": list[str],
|
|
40
|
+
"out": str,
|
|
41
|
+
})
|
|
42
|
+
DirmergeParamsDictTagged = typing.TypedDict('DirmergeParamsDictTagged', {
|
|
43
|
+
"@type": typing.Literal["mrtrix/dirmerge"],
|
|
44
|
+
"unipolar_weight": typing.NotRequired[float | None],
|
|
45
|
+
"info": bool,
|
|
46
|
+
"quiet": bool,
|
|
47
|
+
"debug": bool,
|
|
48
|
+
"force": bool,
|
|
49
|
+
"nthreads": typing.NotRequired[int | None],
|
|
50
|
+
"config": typing.NotRequired[list[DirmergeConfigParamsDict] | None],
|
|
51
|
+
"help": bool,
|
|
52
|
+
"version": bool,
|
|
53
|
+
"subsets": int,
|
|
54
|
+
"bvalue_files": list[str],
|
|
55
|
+
"out": str,
|
|
56
|
+
})
|
|
57
|
+
DirmergeParamsDict = _DirmergeParamsDictNoTag | DirmergeParamsDictTagged
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def dirmerge_config(
|
|
61
|
+
key: str,
|
|
62
|
+
value: str,
|
|
63
|
+
) -> DirmergeConfigParamsDictTagged:
|
|
64
|
+
"""
|
|
65
|
+
Build parameters.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
69
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
70
|
+
Returns:
|
|
71
|
+
Parameter dictionary
|
|
72
|
+
"""
|
|
73
|
+
params = {
|
|
74
|
+
"@type": "config",
|
|
75
|
+
"key": key,
|
|
76
|
+
"value": value,
|
|
77
|
+
}
|
|
78
|
+
return params
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def dirmerge_config_validate(
|
|
82
|
+
params: typing.Any,
|
|
83
|
+
) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
86
|
+
`DirmergeConfigParamsDict` object.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
params: The parameters object to validate.
|
|
90
|
+
"""
|
|
91
|
+
if params is None or not isinstance(params, dict):
|
|
92
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
93
|
+
if params.get("key", None) is None:
|
|
94
|
+
raise StyxValidationError("`key` must not be None")
|
|
95
|
+
if not isinstance(params["key"], str):
|
|
96
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
97
|
+
if params.get("value", None) is None:
|
|
98
|
+
raise StyxValidationError("`value` must not be None")
|
|
99
|
+
if not isinstance(params["value"], str):
|
|
100
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def dirmerge_config_cargs(
|
|
104
|
+
params: DirmergeConfigParamsDict,
|
|
105
|
+
execution: Execution,
|
|
106
|
+
) -> list[str]:
|
|
107
|
+
"""
|
|
108
|
+
Build command-line arguments from parameters.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
params: The parameters.
|
|
112
|
+
execution: The execution object for resolving input paths.
|
|
113
|
+
Returns:
|
|
114
|
+
Command-line arguments.
|
|
115
|
+
"""
|
|
116
|
+
cargs = []
|
|
117
|
+
cargs.append("-config")
|
|
118
|
+
cargs.append(params.get("key", None))
|
|
119
|
+
cargs.append(params.get("value", None))
|
|
120
|
+
return cargs
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class DirmergeOutputs(typing.NamedTuple):
|
|
124
|
+
"""
|
|
125
|
+
Output object returned when calling `DirmergeParamsDict(...)`.
|
|
126
|
+
"""
|
|
127
|
+
root: OutputPathType
|
|
128
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
129
|
+
out: OutputPathType
|
|
130
|
+
"""the output directions file, with each row listing the X Y Z gradient
|
|
131
|
+
directions, the b-value, and an index representing the phase encode
|
|
132
|
+
direction"""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def dirmerge_params(
|
|
136
|
+
subsets: int,
|
|
137
|
+
bvalue_files: list[str],
|
|
138
|
+
out: str,
|
|
139
|
+
unipolar_weight: float | None = None,
|
|
140
|
+
info: bool = False,
|
|
141
|
+
quiet: bool = False,
|
|
142
|
+
debug: bool = False,
|
|
143
|
+
force: bool = False,
|
|
144
|
+
nthreads: int | None = None,
|
|
145
|
+
config: list[DirmergeConfigParamsDict] | None = None,
|
|
146
|
+
help_: bool = False,
|
|
147
|
+
version: bool = False,
|
|
148
|
+
) -> DirmergeParamsDictTagged:
|
|
149
|
+
"""
|
|
150
|
+
Build parameters.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
subsets: the number of subsets (eg. phase encoding directions) per\
|
|
154
|
+
b-value.
|
|
155
|
+
bvalue_files: the b-value and sets of corresponding files, in order.
|
|
156
|
+
out: the output directions file, with each row listing the X Y Z\
|
|
157
|
+
gradient directions, the b-value, and an index representing the phase\
|
|
158
|
+
encode direction.
|
|
159
|
+
unipolar_weight: set the weight given to the unipolar electrostatic\
|
|
160
|
+
repulsion model compared to the bipolar model (default: 0.2).
|
|
161
|
+
info: display information messages.
|
|
162
|
+
quiet: do not display information messages or progress status;\
|
|
163
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
164
|
+
environment variable to a non-empty string.
|
|
165
|
+
debug: display debugging messages.
|
|
166
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
167
|
+
input and output might cause unexpected behaviour).
|
|
168
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
169
|
+
(set to 0 to disable multi-threading).
|
|
170
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
171
|
+
help_: display this information page and exit.
|
|
172
|
+
version: display version information and exit.
|
|
173
|
+
Returns:
|
|
174
|
+
Parameter dictionary
|
|
175
|
+
"""
|
|
176
|
+
params = {
|
|
177
|
+
"@type": "mrtrix/dirmerge",
|
|
178
|
+
"info": info,
|
|
179
|
+
"quiet": quiet,
|
|
180
|
+
"debug": debug,
|
|
181
|
+
"force": force,
|
|
182
|
+
"help": help_,
|
|
183
|
+
"version": version,
|
|
184
|
+
"subsets": subsets,
|
|
185
|
+
"bvalue_files": bvalue_files,
|
|
186
|
+
"out": out,
|
|
187
|
+
}
|
|
188
|
+
if unipolar_weight is not None:
|
|
189
|
+
params["unipolar_weight"] = unipolar_weight
|
|
190
|
+
if nthreads is not None:
|
|
191
|
+
params["nthreads"] = nthreads
|
|
192
|
+
if config is not None:
|
|
193
|
+
params["config"] = config
|
|
194
|
+
return params
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def dirmerge_validate(
|
|
198
|
+
params: typing.Any,
|
|
199
|
+
) -> None:
|
|
200
|
+
"""
|
|
201
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
202
|
+
`DirmergeParamsDict` object.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
params: The parameters object to validate.
|
|
206
|
+
"""
|
|
207
|
+
if params is None or not isinstance(params, dict):
|
|
208
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
209
|
+
if params.get("unipolar_weight", None) is not None:
|
|
210
|
+
if not isinstance(params["unipolar_weight"], (float, int)):
|
|
211
|
+
raise StyxValidationError(f'`unipolar_weight` has the wrong type: Received `{type(params.get("unipolar_weight", None))}` expected `float | None`')
|
|
212
|
+
if params.get("info", False) is None:
|
|
213
|
+
raise StyxValidationError("`info` must not be None")
|
|
214
|
+
if not isinstance(params["info"], bool):
|
|
215
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
216
|
+
if params.get("quiet", False) is None:
|
|
217
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
218
|
+
if not isinstance(params["quiet"], bool):
|
|
219
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
220
|
+
if params.get("debug", False) is None:
|
|
221
|
+
raise StyxValidationError("`debug` must not be None")
|
|
222
|
+
if not isinstance(params["debug"], bool):
|
|
223
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
224
|
+
if params.get("force", False) is None:
|
|
225
|
+
raise StyxValidationError("`force` must not be None")
|
|
226
|
+
if not isinstance(params["force"], bool):
|
|
227
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
228
|
+
if params.get("nthreads", None) is not None:
|
|
229
|
+
if not isinstance(params["nthreads"], int):
|
|
230
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
231
|
+
if params.get("config", None) is not None:
|
|
232
|
+
if not isinstance(params["config"], list):
|
|
233
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[DirmergeConfigParamsDict] | None`')
|
|
234
|
+
for e in params["config"]:
|
|
235
|
+
dirmerge_config_validate(e)
|
|
236
|
+
if params.get("help", False) is None:
|
|
237
|
+
raise StyxValidationError("`help` must not be None")
|
|
238
|
+
if not isinstance(params["help"], bool):
|
|
239
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
240
|
+
if params.get("version", False) is None:
|
|
241
|
+
raise StyxValidationError("`version` must not be None")
|
|
242
|
+
if not isinstance(params["version"], bool):
|
|
243
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
244
|
+
if params.get("subsets", None) is None:
|
|
245
|
+
raise StyxValidationError("`subsets` must not be None")
|
|
246
|
+
if not isinstance(params["subsets"], int):
|
|
247
|
+
raise StyxValidationError(f'`subsets` has the wrong type: Received `{type(params.get("subsets", None))}` expected `int`')
|
|
248
|
+
if params.get("bvalue_files", None) is None:
|
|
249
|
+
raise StyxValidationError("`bvalue_files` must not be None")
|
|
250
|
+
if not isinstance(params["bvalue_files"], list):
|
|
251
|
+
raise StyxValidationError(f'`bvalue_files` has the wrong type: Received `{type(params.get("bvalue_files", None))}` expected `list[str]`')
|
|
252
|
+
for e in params["bvalue_files"]:
|
|
253
|
+
if not isinstance(e, str):
|
|
254
|
+
raise StyxValidationError(f'`bvalue_files` has the wrong type: Received `{type(params.get("bvalue_files", None))}` expected `list[str]`')
|
|
255
|
+
if params.get("out", None) is None:
|
|
256
|
+
raise StyxValidationError("`out` must not be None")
|
|
257
|
+
if not isinstance(params["out"], str):
|
|
258
|
+
raise StyxValidationError(f'`out` has the wrong type: Received `{type(params.get("out", None))}` expected `str`')
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def dirmerge_cargs(
|
|
262
|
+
params: DirmergeParamsDict,
|
|
263
|
+
execution: Execution,
|
|
264
|
+
) -> list[str]:
|
|
265
|
+
"""
|
|
266
|
+
Build command-line arguments from parameters.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
params: The parameters.
|
|
270
|
+
execution: The execution object for resolving input paths.
|
|
271
|
+
Returns:
|
|
272
|
+
Command-line arguments.
|
|
273
|
+
"""
|
|
274
|
+
cargs = []
|
|
275
|
+
cargs.append("dirmerge")
|
|
276
|
+
if params.get("unipolar_weight", None) is not None:
|
|
277
|
+
cargs.extend([
|
|
278
|
+
"-unipolar_weight",
|
|
279
|
+
str(params.get("unipolar_weight", None))
|
|
280
|
+
])
|
|
281
|
+
if params.get("info", False):
|
|
282
|
+
cargs.append("-info")
|
|
283
|
+
if params.get("quiet", False):
|
|
284
|
+
cargs.append("-quiet")
|
|
285
|
+
if params.get("debug", False):
|
|
286
|
+
cargs.append("-debug")
|
|
287
|
+
if params.get("force", False):
|
|
288
|
+
cargs.append("-force")
|
|
289
|
+
if params.get("nthreads", None) is not None:
|
|
290
|
+
cargs.extend([
|
|
291
|
+
"-nthreads",
|
|
292
|
+
str(params.get("nthreads", None))
|
|
293
|
+
])
|
|
294
|
+
if params.get("config", None) is not None:
|
|
295
|
+
cargs.extend([a for c in [dirmerge_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
296
|
+
if params.get("help", False):
|
|
297
|
+
cargs.append("-help")
|
|
298
|
+
if params.get("version", False):
|
|
299
|
+
cargs.append("-version")
|
|
300
|
+
cargs.append(str(params.get("subsets", None)))
|
|
301
|
+
cargs.extend(params.get("bvalue_files", None))
|
|
302
|
+
cargs.append(params.get("out", None))
|
|
303
|
+
return cargs
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def dirmerge_outputs(
|
|
307
|
+
params: DirmergeParamsDict,
|
|
308
|
+
execution: Execution,
|
|
309
|
+
) -> DirmergeOutputs:
|
|
310
|
+
"""
|
|
311
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
params: The parameters.
|
|
315
|
+
execution: The execution object for resolving input paths.
|
|
316
|
+
Returns:
|
|
317
|
+
Outputs object.
|
|
318
|
+
"""
|
|
319
|
+
ret = DirmergeOutputs(
|
|
320
|
+
root=execution.output_file("."),
|
|
321
|
+
out=execution.output_file(params.get("out", None)),
|
|
322
|
+
)
|
|
323
|
+
return ret
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def dirmerge_execute(
|
|
327
|
+
params: DirmergeParamsDict,
|
|
328
|
+
runner: Runner | None = None,
|
|
329
|
+
) -> DirmergeOutputs:
|
|
330
|
+
"""
|
|
331
|
+
dirmerge
|
|
332
|
+
|
|
333
|
+
Splice / merge multiple sets of directions in such a way as to maintain
|
|
334
|
+
near-optimality upon truncation.
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
References:
|
|
339
|
+
|
|
340
|
+
.
|
|
341
|
+
|
|
342
|
+
Author: MRTrix3 Developers
|
|
343
|
+
|
|
344
|
+
URL: https://www.mrtrix.org/
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
params: The parameters.
|
|
348
|
+
runner: Command runner.
|
|
349
|
+
Returns:
|
|
350
|
+
NamedTuple of outputs (described in `DirmergeOutputs`).
|
|
351
|
+
"""
|
|
352
|
+
dirmerge_validate(params)
|
|
353
|
+
runner = runner or get_global_runner()
|
|
354
|
+
execution = runner.start_execution(DIRMERGE_METADATA)
|
|
355
|
+
params = execution.params(params)
|
|
356
|
+
cargs = dirmerge_cargs(params, execution)
|
|
357
|
+
ret = dirmerge_outputs(params, execution)
|
|
358
|
+
execution.run(cargs)
|
|
359
|
+
return ret
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def dirmerge(
|
|
363
|
+
subsets: int,
|
|
364
|
+
bvalue_files: list[str],
|
|
365
|
+
out: str,
|
|
366
|
+
unipolar_weight: float | None = None,
|
|
367
|
+
info: bool = False,
|
|
368
|
+
quiet: bool = False,
|
|
369
|
+
debug: bool = False,
|
|
370
|
+
force: bool = False,
|
|
371
|
+
nthreads: int | None = None,
|
|
372
|
+
config: list[DirmergeConfigParamsDict] | None = None,
|
|
373
|
+
help_: bool = False,
|
|
374
|
+
version: bool = False,
|
|
375
|
+
runner: Runner | None = None,
|
|
376
|
+
) -> DirmergeOutputs:
|
|
377
|
+
"""
|
|
378
|
+
dirmerge
|
|
379
|
+
|
|
380
|
+
Splice / merge multiple sets of directions in such a way as to maintain
|
|
381
|
+
near-optimality upon truncation.
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
References:
|
|
386
|
+
|
|
387
|
+
.
|
|
388
|
+
|
|
389
|
+
Author: MRTrix3 Developers
|
|
390
|
+
|
|
391
|
+
URL: https://www.mrtrix.org/
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
subsets: the number of subsets (eg. phase encoding directions) per\
|
|
395
|
+
b-value.
|
|
396
|
+
bvalue_files: the b-value and sets of corresponding files, in order.
|
|
397
|
+
out: the output directions file, with each row listing the X Y Z\
|
|
398
|
+
gradient directions, the b-value, and an index representing the phase\
|
|
399
|
+
encode direction.
|
|
400
|
+
unipolar_weight: set the weight given to the unipolar electrostatic\
|
|
401
|
+
repulsion model compared to the bipolar model (default: 0.2).
|
|
402
|
+
info: display information messages.
|
|
403
|
+
quiet: do not display information messages or progress status;\
|
|
404
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
405
|
+
environment variable to a non-empty string.
|
|
406
|
+
debug: display debugging messages.
|
|
407
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
408
|
+
input and output might cause unexpected behaviour).
|
|
409
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
410
|
+
(set to 0 to disable multi-threading).
|
|
411
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
412
|
+
help_: display this information page and exit.
|
|
413
|
+
version: display version information and exit.
|
|
414
|
+
runner: Command runner.
|
|
415
|
+
Returns:
|
|
416
|
+
NamedTuple of outputs (described in `DirmergeOutputs`).
|
|
417
|
+
"""
|
|
418
|
+
params = dirmerge_params(
|
|
419
|
+
unipolar_weight=unipolar_weight,
|
|
420
|
+
info=info,
|
|
421
|
+
quiet=quiet,
|
|
422
|
+
debug=debug,
|
|
423
|
+
force=force,
|
|
424
|
+
nthreads=nthreads,
|
|
425
|
+
config=config,
|
|
426
|
+
help_=help_,
|
|
427
|
+
version=version,
|
|
428
|
+
subsets=subsets,
|
|
429
|
+
bvalue_files=bvalue_files,
|
|
430
|
+
out=out,
|
|
431
|
+
)
|
|
432
|
+
return dirmerge_execute(params, runner)
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
__all__ = [
|
|
436
|
+
"DIRMERGE_METADATA",
|
|
437
|
+
"DirmergeConfigParamsDict",
|
|
438
|
+
"DirmergeConfigParamsDictTagged",
|
|
439
|
+
"DirmergeOutputs",
|
|
440
|
+
"DirmergeParamsDict",
|
|
441
|
+
"DirmergeParamsDictTagged",
|
|
442
|
+
"dirmerge",
|
|
443
|
+
"dirmerge_config",
|
|
444
|
+
"dirmerge_execute",
|
|
445
|
+
"dirmerge_params",
|
|
446
|
+
]
|