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