niwrap-mrtrix 0.5.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.
Potentially problematic release.
This version of niwrap-mrtrix might be problematic. Click here for more details.
- niwrap_mrtrix/mrtrix/__init__.py +130 -0
- niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
- niwrap_mrtrix/mrtrix/amp2response.py +453 -0
- niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
- niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
- niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
- niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
- niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
- niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
- niwrap_mrtrix/mrtrix/dirflip.py +362 -0
- niwrap_mrtrix/mrtrix/dirgen.py +423 -0
- niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
- niwrap_mrtrix/mrtrix/dirorder.py +347 -0
- niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
- niwrap_mrtrix/mrtrix/dirstat.py +530 -0
- niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
- niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
- niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
- niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
- niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
- niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
- niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
- niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
- niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
- niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
- niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
- niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
- niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
- niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
- niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
- niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
- niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
- niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
- niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
- niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
- niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
- niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
- niwrap_mrtrix/mrtrix/label2colour.py +351 -0
- niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
- niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
- niwrap_mrtrix/mrtrix/labelstats.py +344 -0
- niwrap_mrtrix/mrtrix/maskdump.py +336 -0
- niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
- niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
- niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
- niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
- niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
- niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
- niwrap_mrtrix/mrtrix/mrcat.py +382 -0
- niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
- niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
- niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
- niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
- niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
- niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
- niwrap_mrtrix/mrtrix/mrdump.py +351 -0
- niwrap_mrtrix/mrtrix/mredit.py +546 -0
- niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
- niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
- niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
- niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
- niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
- niwrap_mrtrix/mrtrix/mrmath.py +413 -0
- niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
- niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
- niwrap_mrtrix/mrtrix/mrstats.py +427 -0
- niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
- niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
- niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
- niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
- niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
- niwrap_mrtrix/mrtrix/responsemean.py +316 -0
- niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
- niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
- niwrap_mrtrix/mrtrix/sh2power.py +353 -0
- niwrap_mrtrix/mrtrix/sh2response.py +394 -0
- niwrap_mrtrix/mrtrix/shbasis.py +373 -0
- niwrap_mrtrix/mrtrix/shconv.py +498 -0
- niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
- niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
- niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
- niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
- niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
- niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
- niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
- niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
- niwrap_mrtrix/mrtrix/tckmap.py +772 -0
- niwrap_mrtrix/mrtrix/tckresample.py +580 -0
- niwrap_mrtrix/mrtrix/tcksample.py +404 -0
- niwrap_mrtrix/mrtrix/tcksift.py +592 -0
- niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
- niwrap_mrtrix/mrtrix/tckstats.py +441 -0
- niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
- niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
- niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
- niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
- niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
- niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
- niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
- niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
- niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
- niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
- niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
- niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
- niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
- niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
- niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
- niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
- niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
- niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
- niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
- niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
- niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
- niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
- niwrap_mrtrix/mrtrix/warpinit.py +356 -0
- niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
- niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
- niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
- niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,537 @@
|
|
|
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
|
+
MASKFILTER_METADATA = Metadata(
|
|
9
|
+
id="0f58b29a006fb07347957237ea8b1bd75f33ff41.boutiques",
|
|
10
|
+
name="maskfilter",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
MaskfilterVariousStringParameters = typing.TypedDict('MaskfilterVariousStringParameters', {
|
|
17
|
+
"__STYX_TYPE__": typing.Literal["VariousString"],
|
|
18
|
+
"obj": str,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
MaskfilterVariousFileParameters = typing.TypedDict('MaskfilterVariousFileParameters', {
|
|
23
|
+
"__STYX_TYPE__": typing.Literal["VariousFile"],
|
|
24
|
+
"obj": InputPathType,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
MaskfilterConfigParameters = typing.TypedDict('MaskfilterConfigParameters', {
|
|
29
|
+
"__STYX_TYPE__": typing.Literal["config"],
|
|
30
|
+
"key": str,
|
|
31
|
+
"value": str,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
MaskfilterParameters = typing.TypedDict('MaskfilterParameters', {
|
|
36
|
+
"__STYX_TYPE__": typing.Literal["maskfilter"],
|
|
37
|
+
"scale": typing.NotRequired[int | None],
|
|
38
|
+
"axes": typing.NotRequired[list[int] | None],
|
|
39
|
+
"largest": bool,
|
|
40
|
+
"connectivity": bool,
|
|
41
|
+
"npass": typing.NotRequired[int | None],
|
|
42
|
+
"extent": typing.NotRequired[list[int] | None],
|
|
43
|
+
"strides": typing.NotRequired[typing.Union[MaskfilterVariousStringParameters, MaskfilterVariousFileParameters] | None],
|
|
44
|
+
"info": bool,
|
|
45
|
+
"quiet": bool,
|
|
46
|
+
"debug": bool,
|
|
47
|
+
"force": bool,
|
|
48
|
+
"nthreads": typing.NotRequired[int | None],
|
|
49
|
+
"config": typing.NotRequired[list[MaskfilterConfigParameters] | None],
|
|
50
|
+
"help": bool,
|
|
51
|
+
"version": bool,
|
|
52
|
+
"input": InputPathType,
|
|
53
|
+
"filter": str,
|
|
54
|
+
"output": str,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def dyn_cargs(
|
|
59
|
+
t: str,
|
|
60
|
+
) -> typing.Any:
|
|
61
|
+
"""
|
|
62
|
+
Get build cargs function by command type.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
t: Command type.
|
|
66
|
+
Returns:
|
|
67
|
+
Build cargs function.
|
|
68
|
+
"""
|
|
69
|
+
return {
|
|
70
|
+
"maskfilter": maskfilter_cargs,
|
|
71
|
+
"VariousString": maskfilter_various_string_cargs,
|
|
72
|
+
"VariousFile": maskfilter_various_file_cargs,
|
|
73
|
+
"config": maskfilter_config_cargs,
|
|
74
|
+
}.get(t)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def dyn_outputs(
|
|
78
|
+
t: str,
|
|
79
|
+
) -> typing.Any:
|
|
80
|
+
"""
|
|
81
|
+
Get build outputs function by command type.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
t: Command type.
|
|
85
|
+
Returns:
|
|
86
|
+
Build outputs function.
|
|
87
|
+
"""
|
|
88
|
+
return {
|
|
89
|
+
"maskfilter": maskfilter_outputs,
|
|
90
|
+
}.get(t)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def maskfilter_various_string_params(
|
|
94
|
+
obj: str,
|
|
95
|
+
) -> MaskfilterVariousStringParameters:
|
|
96
|
+
"""
|
|
97
|
+
Build parameters.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
obj: String object.
|
|
101
|
+
Returns:
|
|
102
|
+
Parameter dictionary
|
|
103
|
+
"""
|
|
104
|
+
params = {
|
|
105
|
+
"__STYXTYPE__": "VariousString",
|
|
106
|
+
"obj": obj,
|
|
107
|
+
}
|
|
108
|
+
return params
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def maskfilter_various_string_cargs(
|
|
112
|
+
params: MaskfilterVariousStringParameters,
|
|
113
|
+
execution: Execution,
|
|
114
|
+
) -> list[str]:
|
|
115
|
+
"""
|
|
116
|
+
Build command-line arguments from parameters.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
params: The parameters.
|
|
120
|
+
execution: The execution object for resolving input paths.
|
|
121
|
+
Returns:
|
|
122
|
+
Command-line arguments.
|
|
123
|
+
"""
|
|
124
|
+
cargs = []
|
|
125
|
+
cargs.append(params.get("obj"))
|
|
126
|
+
return cargs
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def maskfilter_various_file_params(
|
|
130
|
+
obj: InputPathType,
|
|
131
|
+
) -> MaskfilterVariousFileParameters:
|
|
132
|
+
"""
|
|
133
|
+
Build parameters.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
obj: File object.
|
|
137
|
+
Returns:
|
|
138
|
+
Parameter dictionary
|
|
139
|
+
"""
|
|
140
|
+
params = {
|
|
141
|
+
"__STYXTYPE__": "VariousFile",
|
|
142
|
+
"obj": obj,
|
|
143
|
+
}
|
|
144
|
+
return params
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def maskfilter_various_file_cargs(
|
|
148
|
+
params: MaskfilterVariousFileParameters,
|
|
149
|
+
execution: Execution,
|
|
150
|
+
) -> list[str]:
|
|
151
|
+
"""
|
|
152
|
+
Build command-line arguments from parameters.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
params: The parameters.
|
|
156
|
+
execution: The execution object for resolving input paths.
|
|
157
|
+
Returns:
|
|
158
|
+
Command-line arguments.
|
|
159
|
+
"""
|
|
160
|
+
cargs = []
|
|
161
|
+
cargs.append(execution.input_file(params.get("obj")))
|
|
162
|
+
return cargs
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def maskfilter_config_params(
|
|
166
|
+
key: str,
|
|
167
|
+
value: str,
|
|
168
|
+
) -> MaskfilterConfigParameters:
|
|
169
|
+
"""
|
|
170
|
+
Build parameters.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
174
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
175
|
+
Returns:
|
|
176
|
+
Parameter dictionary
|
|
177
|
+
"""
|
|
178
|
+
params = {
|
|
179
|
+
"__STYXTYPE__": "config",
|
|
180
|
+
"key": key,
|
|
181
|
+
"value": value,
|
|
182
|
+
}
|
|
183
|
+
return params
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def maskfilter_config_cargs(
|
|
187
|
+
params: MaskfilterConfigParameters,
|
|
188
|
+
execution: Execution,
|
|
189
|
+
) -> list[str]:
|
|
190
|
+
"""
|
|
191
|
+
Build command-line arguments from parameters.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
params: The parameters.
|
|
195
|
+
execution: The execution object for resolving input paths.
|
|
196
|
+
Returns:
|
|
197
|
+
Command-line arguments.
|
|
198
|
+
"""
|
|
199
|
+
cargs = []
|
|
200
|
+
cargs.append("-config")
|
|
201
|
+
cargs.append(params.get("key"))
|
|
202
|
+
cargs.append(params.get("value"))
|
|
203
|
+
return cargs
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class MaskfilterOutputs(typing.NamedTuple):
|
|
207
|
+
"""
|
|
208
|
+
Output object returned when calling `maskfilter(...)`.
|
|
209
|
+
"""
|
|
210
|
+
root: OutputPathType
|
|
211
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
212
|
+
output: OutputPathType
|
|
213
|
+
"""the output image."""
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def maskfilter_params(
|
|
217
|
+
input_: InputPathType,
|
|
218
|
+
filter_: str,
|
|
219
|
+
output: str,
|
|
220
|
+
scale: int | None = None,
|
|
221
|
+
axes: list[int] | None = None,
|
|
222
|
+
largest: bool = False,
|
|
223
|
+
connectivity: bool = False,
|
|
224
|
+
npass: int | None = None,
|
|
225
|
+
extent: list[int] | None = None,
|
|
226
|
+
strides: typing.Union[MaskfilterVariousStringParameters, MaskfilterVariousFileParameters] | None = None,
|
|
227
|
+
info: bool = False,
|
|
228
|
+
quiet: bool = False,
|
|
229
|
+
debug: bool = False,
|
|
230
|
+
force: bool = False,
|
|
231
|
+
nthreads: int | None = None,
|
|
232
|
+
config: list[MaskfilterConfigParameters] | None = None,
|
|
233
|
+
help_: bool = False,
|
|
234
|
+
version: bool = False,
|
|
235
|
+
) -> MaskfilterParameters:
|
|
236
|
+
"""
|
|
237
|
+
Build parameters.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
input_: the input image.
|
|
241
|
+
filter_: the type of filter to be applied (clean, connect, dilate,\
|
|
242
|
+
erode, median).
|
|
243
|
+
output: the output image.
|
|
244
|
+
scale: the maximum scale used to cut bridges. A certain maximum scale\
|
|
245
|
+
cuts bridges up to a width (in voxels) of 2x the provided scale.\
|
|
246
|
+
(Default: 2).
|
|
247
|
+
axes: specify which axes should be included in the connected\
|
|
248
|
+
components. By default only the first 3 axes are included. The axes\
|
|
249
|
+
should be provided as a comma-separated list of values.
|
|
250
|
+
largest: only retain the largest connected component.
|
|
251
|
+
connectivity: use 26-voxel-neighbourhood connectivity (Default: 6).
|
|
252
|
+
npass: the number of times to repeatedly apply the filter.
|
|
253
|
+
extent: specify the extent (width) of kernel size in voxels. This can\
|
|
254
|
+
be specified either as a single value to be used for all axes, or as a\
|
|
255
|
+
comma-separated list of the extent for each axis. The default is 3x3x3.
|
|
256
|
+
strides: specify the strides of the output data in memory; either as a\
|
|
257
|
+
comma-separated list of (signed) integers, or as a template image from\
|
|
258
|
+
which the strides shall be extracted and used. The actual strides\
|
|
259
|
+
produced will depend on whether the output image format can support it.
|
|
260
|
+
info: display information messages.
|
|
261
|
+
quiet: do not display information messages or progress status;\
|
|
262
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
263
|
+
environment variable to a non-empty string.
|
|
264
|
+
debug: display debugging messages.
|
|
265
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
266
|
+
input and output might cause unexpected behaviour).
|
|
267
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
268
|
+
(set to 0 to disable multi-threading).
|
|
269
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
270
|
+
help_: display this information page and exit.
|
|
271
|
+
version: display version information and exit.
|
|
272
|
+
Returns:
|
|
273
|
+
Parameter dictionary
|
|
274
|
+
"""
|
|
275
|
+
params = {
|
|
276
|
+
"__STYXTYPE__": "maskfilter",
|
|
277
|
+
"largest": largest,
|
|
278
|
+
"connectivity": connectivity,
|
|
279
|
+
"info": info,
|
|
280
|
+
"quiet": quiet,
|
|
281
|
+
"debug": debug,
|
|
282
|
+
"force": force,
|
|
283
|
+
"help": help_,
|
|
284
|
+
"version": version,
|
|
285
|
+
"input": input_,
|
|
286
|
+
"filter": filter_,
|
|
287
|
+
"output": output,
|
|
288
|
+
}
|
|
289
|
+
if scale is not None:
|
|
290
|
+
params["scale"] = scale
|
|
291
|
+
if axes is not None:
|
|
292
|
+
params["axes"] = axes
|
|
293
|
+
if npass is not None:
|
|
294
|
+
params["npass"] = npass
|
|
295
|
+
if extent is not None:
|
|
296
|
+
params["extent"] = extent
|
|
297
|
+
if strides is not None:
|
|
298
|
+
params["strides"] = strides
|
|
299
|
+
if nthreads is not None:
|
|
300
|
+
params["nthreads"] = nthreads
|
|
301
|
+
if config is not None:
|
|
302
|
+
params["config"] = config
|
|
303
|
+
return params
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def maskfilter_cargs(
|
|
307
|
+
params: MaskfilterParameters,
|
|
308
|
+
execution: Execution,
|
|
309
|
+
) -> list[str]:
|
|
310
|
+
"""
|
|
311
|
+
Build command-line arguments from parameters.
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
params: The parameters.
|
|
315
|
+
execution: The execution object for resolving input paths.
|
|
316
|
+
Returns:
|
|
317
|
+
Command-line arguments.
|
|
318
|
+
"""
|
|
319
|
+
cargs = []
|
|
320
|
+
cargs.append("maskfilter")
|
|
321
|
+
if params.get("scale") is not None:
|
|
322
|
+
cargs.extend([
|
|
323
|
+
"-scale",
|
|
324
|
+
str(params.get("scale"))
|
|
325
|
+
])
|
|
326
|
+
if params.get("axes") is not None:
|
|
327
|
+
cargs.extend([
|
|
328
|
+
"-axes",
|
|
329
|
+
",".join(map(str, params.get("axes")))
|
|
330
|
+
])
|
|
331
|
+
if params.get("largest"):
|
|
332
|
+
cargs.append("-largest")
|
|
333
|
+
if params.get("connectivity"):
|
|
334
|
+
cargs.append("-connectivity")
|
|
335
|
+
if params.get("npass") is not None:
|
|
336
|
+
cargs.extend([
|
|
337
|
+
"-npass",
|
|
338
|
+
str(params.get("npass"))
|
|
339
|
+
])
|
|
340
|
+
if params.get("extent") is not None:
|
|
341
|
+
cargs.extend([
|
|
342
|
+
"-extent",
|
|
343
|
+
",".join(map(str, params.get("extent")))
|
|
344
|
+
])
|
|
345
|
+
if params.get("strides") is not None:
|
|
346
|
+
cargs.extend([
|
|
347
|
+
"-strides",
|
|
348
|
+
*dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
|
|
349
|
+
])
|
|
350
|
+
if params.get("info"):
|
|
351
|
+
cargs.append("-info")
|
|
352
|
+
if params.get("quiet"):
|
|
353
|
+
cargs.append("-quiet")
|
|
354
|
+
if params.get("debug"):
|
|
355
|
+
cargs.append("-debug")
|
|
356
|
+
if params.get("force"):
|
|
357
|
+
cargs.append("-force")
|
|
358
|
+
if params.get("nthreads") is not None:
|
|
359
|
+
cargs.extend([
|
|
360
|
+
"-nthreads",
|
|
361
|
+
str(params.get("nthreads"))
|
|
362
|
+
])
|
|
363
|
+
if params.get("config") is not None:
|
|
364
|
+
cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
|
|
365
|
+
if params.get("help"):
|
|
366
|
+
cargs.append("-help")
|
|
367
|
+
if params.get("version"):
|
|
368
|
+
cargs.append("-version")
|
|
369
|
+
cargs.append(execution.input_file(params.get("input")))
|
|
370
|
+
cargs.append(params.get("filter"))
|
|
371
|
+
cargs.append(params.get("output"))
|
|
372
|
+
return cargs
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def maskfilter_outputs(
|
|
376
|
+
params: MaskfilterParameters,
|
|
377
|
+
execution: Execution,
|
|
378
|
+
) -> MaskfilterOutputs:
|
|
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 = MaskfilterOutputs(
|
|
389
|
+
root=execution.output_file("."),
|
|
390
|
+
output=execution.output_file(params.get("output")),
|
|
391
|
+
)
|
|
392
|
+
return ret
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def maskfilter_execute(
|
|
396
|
+
params: MaskfilterParameters,
|
|
397
|
+
execution: Execution,
|
|
398
|
+
) -> MaskfilterOutputs:
|
|
399
|
+
"""
|
|
400
|
+
Perform filtering operations on 3D / 4D mask images.
|
|
401
|
+
|
|
402
|
+
The available filters are: clean, connect, dilate, erode, median.
|
|
403
|
+
|
|
404
|
+
Each filter has its own unique set of optional parameters.
|
|
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
|
+
execution: The execution object.
|
|
417
|
+
Returns:
|
|
418
|
+
NamedTuple of outputs (described in `MaskfilterOutputs`).
|
|
419
|
+
"""
|
|
420
|
+
params = execution.params(params)
|
|
421
|
+
cargs = maskfilter_cargs(params, execution)
|
|
422
|
+
ret = maskfilter_outputs(params, execution)
|
|
423
|
+
execution.run(cargs)
|
|
424
|
+
return ret
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
def maskfilter(
|
|
428
|
+
input_: InputPathType,
|
|
429
|
+
filter_: str,
|
|
430
|
+
output: str,
|
|
431
|
+
scale: int | None = None,
|
|
432
|
+
axes: list[int] | None = None,
|
|
433
|
+
largest: bool = False,
|
|
434
|
+
connectivity: bool = False,
|
|
435
|
+
npass: int | None = None,
|
|
436
|
+
extent: list[int] | None = None,
|
|
437
|
+
strides: typing.Union[MaskfilterVariousStringParameters, MaskfilterVariousFileParameters] | None = None,
|
|
438
|
+
info: bool = False,
|
|
439
|
+
quiet: bool = False,
|
|
440
|
+
debug: bool = False,
|
|
441
|
+
force: bool = False,
|
|
442
|
+
nthreads: int | None = None,
|
|
443
|
+
config: list[MaskfilterConfigParameters] | None = None,
|
|
444
|
+
help_: bool = False,
|
|
445
|
+
version: bool = False,
|
|
446
|
+
runner: Runner | None = None,
|
|
447
|
+
) -> MaskfilterOutputs:
|
|
448
|
+
"""
|
|
449
|
+
Perform filtering operations on 3D / 4D mask images.
|
|
450
|
+
|
|
451
|
+
The available filters are: clean, connect, dilate, erode, median.
|
|
452
|
+
|
|
453
|
+
Each filter has its own unique set of optional parameters.
|
|
454
|
+
|
|
455
|
+
References:
|
|
456
|
+
|
|
457
|
+
.
|
|
458
|
+
|
|
459
|
+
Author: MRTrix3 Developers
|
|
460
|
+
|
|
461
|
+
URL: https://www.mrtrix.org/
|
|
462
|
+
|
|
463
|
+
Args:
|
|
464
|
+
input_: the input image.
|
|
465
|
+
filter_: the type of filter to be applied (clean, connect, dilate,\
|
|
466
|
+
erode, median).
|
|
467
|
+
output: the output image.
|
|
468
|
+
scale: the maximum scale used to cut bridges. A certain maximum scale\
|
|
469
|
+
cuts bridges up to a width (in voxels) of 2x the provided scale.\
|
|
470
|
+
(Default: 2).
|
|
471
|
+
axes: specify which axes should be included in the connected\
|
|
472
|
+
components. By default only the first 3 axes are included. The axes\
|
|
473
|
+
should be provided as a comma-separated list of values.
|
|
474
|
+
largest: only retain the largest connected component.
|
|
475
|
+
connectivity: use 26-voxel-neighbourhood connectivity (Default: 6).
|
|
476
|
+
npass: the number of times to repeatedly apply the filter.
|
|
477
|
+
extent: specify the extent (width) of kernel size in voxels. This can\
|
|
478
|
+
be specified either as a single value to be used for all axes, or as a\
|
|
479
|
+
comma-separated list of the extent for each axis. The default is 3x3x3.
|
|
480
|
+
strides: specify the strides of the output data in memory; either as a\
|
|
481
|
+
comma-separated list of (signed) integers, or as a template image from\
|
|
482
|
+
which the strides shall be extracted and used. The actual strides\
|
|
483
|
+
produced will depend on whether the output image format can support it.
|
|
484
|
+
info: display information messages.
|
|
485
|
+
quiet: do not display information messages or progress status;\
|
|
486
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
487
|
+
environment variable to a non-empty string.
|
|
488
|
+
debug: display debugging messages.
|
|
489
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
490
|
+
input and output might cause unexpected behaviour).
|
|
491
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
492
|
+
(set to 0 to disable multi-threading).
|
|
493
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
494
|
+
help_: display this information page and exit.
|
|
495
|
+
version: display version information and exit.
|
|
496
|
+
runner: Command runner.
|
|
497
|
+
Returns:
|
|
498
|
+
NamedTuple of outputs (described in `MaskfilterOutputs`).
|
|
499
|
+
"""
|
|
500
|
+
runner = runner or get_global_runner()
|
|
501
|
+
execution = runner.start_execution(MASKFILTER_METADATA)
|
|
502
|
+
params = maskfilter_params(
|
|
503
|
+
scale=scale,
|
|
504
|
+
axes=axes,
|
|
505
|
+
largest=largest,
|
|
506
|
+
connectivity=connectivity,
|
|
507
|
+
npass=npass,
|
|
508
|
+
extent=extent,
|
|
509
|
+
strides=strides,
|
|
510
|
+
info=info,
|
|
511
|
+
quiet=quiet,
|
|
512
|
+
debug=debug,
|
|
513
|
+
force=force,
|
|
514
|
+
nthreads=nthreads,
|
|
515
|
+
config=config,
|
|
516
|
+
help_=help_,
|
|
517
|
+
version=version,
|
|
518
|
+
input_=input_,
|
|
519
|
+
filter_=filter_,
|
|
520
|
+
output=output,
|
|
521
|
+
)
|
|
522
|
+
return maskfilter_execute(params, execution)
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
__all__ = [
|
|
526
|
+
"MASKFILTER_METADATA",
|
|
527
|
+
"MaskfilterConfigParameters",
|
|
528
|
+
"MaskfilterOutputs",
|
|
529
|
+
"MaskfilterParameters",
|
|
530
|
+
"MaskfilterVariousFileParameters",
|
|
531
|
+
"MaskfilterVariousStringParameters",
|
|
532
|
+
"maskfilter",
|
|
533
|
+
"maskfilter_config_params",
|
|
534
|
+
"maskfilter_params",
|
|
535
|
+
"maskfilter_various_file_params",
|
|
536
|
+
"maskfilter_various_string_params",
|
|
537
|
+
]
|