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,1282 @@
|
|
|
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
|
+
MRINFO_METADATA = Metadata(
|
|
9
|
+
id="8282cf2096dd2c6c171488cc71738cd947e2697c.boutiques",
|
|
10
|
+
name="mrinfo",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_MrinfoPropertyParamsDictNoTag = typing.TypedDict('_MrinfoPropertyParamsDictNoTag', {
|
|
17
|
+
"key": str,
|
|
18
|
+
})
|
|
19
|
+
MrinfoPropertyParamsDictTagged = typing.TypedDict('MrinfoPropertyParamsDictTagged', {
|
|
20
|
+
"@type": typing.Literal["property"],
|
|
21
|
+
"key": str,
|
|
22
|
+
})
|
|
23
|
+
MrinfoPropertyParamsDict = _MrinfoPropertyParamsDictNoTag | MrinfoPropertyParamsDictTagged
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
_MrinfoFslgradParamsDictNoTag = typing.TypedDict('_MrinfoFslgradParamsDictNoTag', {
|
|
27
|
+
"bvecs": InputPathType,
|
|
28
|
+
"bvals": InputPathType,
|
|
29
|
+
})
|
|
30
|
+
MrinfoFslgradParamsDictTagged = typing.TypedDict('MrinfoFslgradParamsDictTagged', {
|
|
31
|
+
"@type": typing.Literal["fslgrad"],
|
|
32
|
+
"bvecs": InputPathType,
|
|
33
|
+
"bvals": InputPathType,
|
|
34
|
+
})
|
|
35
|
+
MrinfoFslgradParamsDict = _MrinfoFslgradParamsDictNoTag | MrinfoFslgradParamsDictTagged
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
_MrinfoExportGradFslParamsDictNoTag = typing.TypedDict('_MrinfoExportGradFslParamsDictNoTag', {
|
|
39
|
+
"bvecs_path": str,
|
|
40
|
+
"bvals_path": str,
|
|
41
|
+
})
|
|
42
|
+
MrinfoExportGradFslParamsDictTagged = typing.TypedDict('MrinfoExportGradFslParamsDictTagged', {
|
|
43
|
+
"@type": typing.Literal["export_grad_fsl"],
|
|
44
|
+
"bvecs_path": str,
|
|
45
|
+
"bvals_path": str,
|
|
46
|
+
})
|
|
47
|
+
MrinfoExportGradFslParamsDict = _MrinfoExportGradFslParamsDictNoTag | MrinfoExportGradFslParamsDictTagged
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_MrinfoExportPeEddyParamsDictNoTag = typing.TypedDict('_MrinfoExportPeEddyParamsDictNoTag', {
|
|
51
|
+
"config": str,
|
|
52
|
+
"indices": str,
|
|
53
|
+
})
|
|
54
|
+
MrinfoExportPeEddyParamsDictTagged = typing.TypedDict('MrinfoExportPeEddyParamsDictTagged', {
|
|
55
|
+
"@type": typing.Literal["export_pe_eddy"],
|
|
56
|
+
"config": str,
|
|
57
|
+
"indices": str,
|
|
58
|
+
})
|
|
59
|
+
MrinfoExportPeEddyParamsDict = _MrinfoExportPeEddyParamsDictNoTag | MrinfoExportPeEddyParamsDictTagged
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
_MrinfoConfigParamsDictNoTag = typing.TypedDict('_MrinfoConfigParamsDictNoTag', {
|
|
63
|
+
"key": str,
|
|
64
|
+
"value": str,
|
|
65
|
+
})
|
|
66
|
+
MrinfoConfigParamsDictTagged = typing.TypedDict('MrinfoConfigParamsDictTagged', {
|
|
67
|
+
"@type": typing.Literal["config"],
|
|
68
|
+
"key": str,
|
|
69
|
+
"value": str,
|
|
70
|
+
})
|
|
71
|
+
MrinfoConfigParamsDict = _MrinfoConfigParamsDictNoTag | MrinfoConfigParamsDictTagged
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
_MrinfoParamsDictNoTag = typing.TypedDict('_MrinfoParamsDictNoTag', {
|
|
75
|
+
"all": bool,
|
|
76
|
+
"name": bool,
|
|
77
|
+
"format": bool,
|
|
78
|
+
"ndim": bool,
|
|
79
|
+
"size": bool,
|
|
80
|
+
"spacing": bool,
|
|
81
|
+
"datatype": bool,
|
|
82
|
+
"strides": bool,
|
|
83
|
+
"offset": bool,
|
|
84
|
+
"multiplier": bool,
|
|
85
|
+
"transform": bool,
|
|
86
|
+
"property": typing.NotRequired[list[MrinfoPropertyParamsDict] | None],
|
|
87
|
+
"json_keyval": typing.NotRequired[str | None],
|
|
88
|
+
"json_all": typing.NotRequired[str | None],
|
|
89
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
90
|
+
"fslgrad": typing.NotRequired[MrinfoFslgradParamsDict | None],
|
|
91
|
+
"bvalue_scaling": typing.NotRequired[str | None],
|
|
92
|
+
"export_grad_mrtrix": typing.NotRequired[str | None],
|
|
93
|
+
"export_grad_fsl": typing.NotRequired[MrinfoExportGradFslParamsDict | None],
|
|
94
|
+
"dwgrad": bool,
|
|
95
|
+
"shell_bvalues": bool,
|
|
96
|
+
"shell_sizes": bool,
|
|
97
|
+
"shell_indices": bool,
|
|
98
|
+
"export_pe_table": typing.NotRequired[str | None],
|
|
99
|
+
"export_pe_eddy": typing.NotRequired[MrinfoExportPeEddyParamsDict | None],
|
|
100
|
+
"petable": bool,
|
|
101
|
+
"nodelete": bool,
|
|
102
|
+
"info": bool,
|
|
103
|
+
"quiet": bool,
|
|
104
|
+
"debug": bool,
|
|
105
|
+
"force": bool,
|
|
106
|
+
"nthreads": typing.NotRequired[int | None],
|
|
107
|
+
"config": typing.NotRequired[list[MrinfoConfigParamsDict] | None],
|
|
108
|
+
"help": bool,
|
|
109
|
+
"version": bool,
|
|
110
|
+
"image": list[InputPathType],
|
|
111
|
+
})
|
|
112
|
+
MrinfoParamsDictTagged = typing.TypedDict('MrinfoParamsDictTagged', {
|
|
113
|
+
"@type": typing.Literal["mrtrix/mrinfo"],
|
|
114
|
+
"all": bool,
|
|
115
|
+
"name": bool,
|
|
116
|
+
"format": bool,
|
|
117
|
+
"ndim": bool,
|
|
118
|
+
"size": bool,
|
|
119
|
+
"spacing": bool,
|
|
120
|
+
"datatype": bool,
|
|
121
|
+
"strides": bool,
|
|
122
|
+
"offset": bool,
|
|
123
|
+
"multiplier": bool,
|
|
124
|
+
"transform": bool,
|
|
125
|
+
"property": typing.NotRequired[list[MrinfoPropertyParamsDict] | None],
|
|
126
|
+
"json_keyval": typing.NotRequired[str | None],
|
|
127
|
+
"json_all": typing.NotRequired[str | None],
|
|
128
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
129
|
+
"fslgrad": typing.NotRequired[MrinfoFslgradParamsDict | None],
|
|
130
|
+
"bvalue_scaling": typing.NotRequired[str | None],
|
|
131
|
+
"export_grad_mrtrix": typing.NotRequired[str | None],
|
|
132
|
+
"export_grad_fsl": typing.NotRequired[MrinfoExportGradFslParamsDict | None],
|
|
133
|
+
"dwgrad": bool,
|
|
134
|
+
"shell_bvalues": bool,
|
|
135
|
+
"shell_sizes": bool,
|
|
136
|
+
"shell_indices": bool,
|
|
137
|
+
"export_pe_table": typing.NotRequired[str | None],
|
|
138
|
+
"export_pe_eddy": typing.NotRequired[MrinfoExportPeEddyParamsDict | None],
|
|
139
|
+
"petable": bool,
|
|
140
|
+
"nodelete": bool,
|
|
141
|
+
"info": bool,
|
|
142
|
+
"quiet": bool,
|
|
143
|
+
"debug": bool,
|
|
144
|
+
"force": bool,
|
|
145
|
+
"nthreads": typing.NotRequired[int | None],
|
|
146
|
+
"config": typing.NotRequired[list[MrinfoConfigParamsDict] | None],
|
|
147
|
+
"help": bool,
|
|
148
|
+
"version": bool,
|
|
149
|
+
"image": list[InputPathType],
|
|
150
|
+
})
|
|
151
|
+
MrinfoParamsDict = _MrinfoParamsDictNoTag | MrinfoParamsDictTagged
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def mrinfo_property(
|
|
155
|
+
key: str,
|
|
156
|
+
) -> MrinfoPropertyParamsDictTagged:
|
|
157
|
+
"""
|
|
158
|
+
Build parameters.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
key: any text properties embedded in the image header under the\
|
|
162
|
+
specified key (use 'all' to list all keys found).
|
|
163
|
+
Returns:
|
|
164
|
+
Parameter dictionary
|
|
165
|
+
"""
|
|
166
|
+
params = {
|
|
167
|
+
"@type": "property",
|
|
168
|
+
"key": key,
|
|
169
|
+
}
|
|
170
|
+
return params
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def mrinfo_property_validate(
|
|
174
|
+
params: typing.Any,
|
|
175
|
+
) -> None:
|
|
176
|
+
"""
|
|
177
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
178
|
+
`MrinfoPropertyParamsDict` object.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
params: The parameters object to validate.
|
|
182
|
+
"""
|
|
183
|
+
if params is None or not isinstance(params, dict):
|
|
184
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
185
|
+
if params.get("key", None) is None:
|
|
186
|
+
raise StyxValidationError("`key` must not be None")
|
|
187
|
+
if not isinstance(params["key"], str):
|
|
188
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def mrinfo_property_cargs(
|
|
192
|
+
params: MrinfoPropertyParamsDict,
|
|
193
|
+
execution: Execution,
|
|
194
|
+
) -> list[str]:
|
|
195
|
+
"""
|
|
196
|
+
Build command-line arguments from parameters.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
params: The parameters.
|
|
200
|
+
execution: The execution object for resolving input paths.
|
|
201
|
+
Returns:
|
|
202
|
+
Command-line arguments.
|
|
203
|
+
"""
|
|
204
|
+
cargs = []
|
|
205
|
+
cargs.append("-property")
|
|
206
|
+
cargs.append(params.get("key", None))
|
|
207
|
+
return cargs
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def mrinfo_fslgrad(
|
|
211
|
+
bvecs: InputPathType,
|
|
212
|
+
bvals: InputPathType,
|
|
213
|
+
) -> MrinfoFslgradParamsDictTagged:
|
|
214
|
+
"""
|
|
215
|
+
Build parameters.
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
bvecs: Provide the diffusion-weighted gradient scheme used in the\
|
|
219
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
220
|
+
scheme is present in the input image header, the data provided with\
|
|
221
|
+
this option will be instead used.
|
|
222
|
+
bvals: Provide the diffusion-weighted gradient scheme used in the\
|
|
223
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
224
|
+
scheme is present in the input image header, the data provided with\
|
|
225
|
+
this option will be instead used.
|
|
226
|
+
Returns:
|
|
227
|
+
Parameter dictionary
|
|
228
|
+
"""
|
|
229
|
+
params = {
|
|
230
|
+
"@type": "fslgrad",
|
|
231
|
+
"bvecs": bvecs,
|
|
232
|
+
"bvals": bvals,
|
|
233
|
+
}
|
|
234
|
+
return params
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def mrinfo_fslgrad_validate(
|
|
238
|
+
params: typing.Any,
|
|
239
|
+
) -> None:
|
|
240
|
+
"""
|
|
241
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
242
|
+
`MrinfoFslgradParamsDict` object.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
params: The parameters object to validate.
|
|
246
|
+
"""
|
|
247
|
+
if params is None or not isinstance(params, dict):
|
|
248
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
249
|
+
if params.get("bvecs", None) is None:
|
|
250
|
+
raise StyxValidationError("`bvecs` must not be None")
|
|
251
|
+
if not isinstance(params["bvecs"], (pathlib.Path, str)):
|
|
252
|
+
raise StyxValidationError(f'`bvecs` has the wrong type: Received `{type(params.get("bvecs", None))}` expected `InputPathType`')
|
|
253
|
+
if params.get("bvals", None) is None:
|
|
254
|
+
raise StyxValidationError("`bvals` must not be None")
|
|
255
|
+
if not isinstance(params["bvals"], (pathlib.Path, str)):
|
|
256
|
+
raise StyxValidationError(f'`bvals` has the wrong type: Received `{type(params.get("bvals", None))}` expected `InputPathType`')
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def mrinfo_fslgrad_cargs(
|
|
260
|
+
params: MrinfoFslgradParamsDict,
|
|
261
|
+
execution: Execution,
|
|
262
|
+
) -> list[str]:
|
|
263
|
+
"""
|
|
264
|
+
Build command-line arguments from parameters.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
params: The parameters.
|
|
268
|
+
execution: The execution object for resolving input paths.
|
|
269
|
+
Returns:
|
|
270
|
+
Command-line arguments.
|
|
271
|
+
"""
|
|
272
|
+
cargs = []
|
|
273
|
+
cargs.append("-fslgrad")
|
|
274
|
+
cargs.append(execution.input_file(params.get("bvecs", None)))
|
|
275
|
+
cargs.append(execution.input_file(params.get("bvals", None)))
|
|
276
|
+
return cargs
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class MrinfoExportGradFslOutputs(typing.NamedTuple):
|
|
280
|
+
"""
|
|
281
|
+
Output object returned when calling `MrinfoExportGradFslParamsDict | None(...)`.
|
|
282
|
+
"""
|
|
283
|
+
root: OutputPathType
|
|
284
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
285
|
+
bvecs_path: OutputPathType
|
|
286
|
+
"""export the diffusion-weighted gradient table to files in FSL (bvecs /
|
|
287
|
+
bvals) format"""
|
|
288
|
+
bvals_path: OutputPathType
|
|
289
|
+
"""export the diffusion-weighted gradient table to files in FSL (bvecs /
|
|
290
|
+
bvals) format"""
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def mrinfo_export_grad_fsl(
|
|
294
|
+
bvecs_path: str,
|
|
295
|
+
bvals_path: str,
|
|
296
|
+
) -> MrinfoExportGradFslParamsDictTagged:
|
|
297
|
+
"""
|
|
298
|
+
Build parameters.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
bvecs_path: export the diffusion-weighted gradient table to files in\
|
|
302
|
+
FSL (bvecs / bvals) format.
|
|
303
|
+
bvals_path: export the diffusion-weighted gradient table to files in\
|
|
304
|
+
FSL (bvecs / bvals) format.
|
|
305
|
+
Returns:
|
|
306
|
+
Parameter dictionary
|
|
307
|
+
"""
|
|
308
|
+
params = {
|
|
309
|
+
"@type": "export_grad_fsl",
|
|
310
|
+
"bvecs_path": bvecs_path,
|
|
311
|
+
"bvals_path": bvals_path,
|
|
312
|
+
}
|
|
313
|
+
return params
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def mrinfo_export_grad_fsl_validate(
|
|
317
|
+
params: typing.Any,
|
|
318
|
+
) -> None:
|
|
319
|
+
"""
|
|
320
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
321
|
+
`MrinfoExportGradFslParamsDict` object.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
params: The parameters object to validate.
|
|
325
|
+
"""
|
|
326
|
+
if params is None or not isinstance(params, dict):
|
|
327
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
328
|
+
if params.get("bvecs_path", None) is None:
|
|
329
|
+
raise StyxValidationError("`bvecs_path` must not be None")
|
|
330
|
+
if not isinstance(params["bvecs_path"], str):
|
|
331
|
+
raise StyxValidationError(f'`bvecs_path` has the wrong type: Received `{type(params.get("bvecs_path", None))}` expected `str`')
|
|
332
|
+
if params.get("bvals_path", None) is None:
|
|
333
|
+
raise StyxValidationError("`bvals_path` must not be None")
|
|
334
|
+
if not isinstance(params["bvals_path"], str):
|
|
335
|
+
raise StyxValidationError(f'`bvals_path` has the wrong type: Received `{type(params.get("bvals_path", None))}` expected `str`')
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def mrinfo_export_grad_fsl_cargs(
|
|
339
|
+
params: MrinfoExportGradFslParamsDict,
|
|
340
|
+
execution: Execution,
|
|
341
|
+
) -> list[str]:
|
|
342
|
+
"""
|
|
343
|
+
Build command-line arguments from parameters.
|
|
344
|
+
|
|
345
|
+
Args:
|
|
346
|
+
params: The parameters.
|
|
347
|
+
execution: The execution object for resolving input paths.
|
|
348
|
+
Returns:
|
|
349
|
+
Command-line arguments.
|
|
350
|
+
"""
|
|
351
|
+
cargs = []
|
|
352
|
+
cargs.append("-export_grad_fsl")
|
|
353
|
+
cargs.append(params.get("bvecs_path", None))
|
|
354
|
+
cargs.append(params.get("bvals_path", None))
|
|
355
|
+
return cargs
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def mrinfo_export_grad_fsl_outputs(
|
|
359
|
+
params: MrinfoExportGradFslParamsDict,
|
|
360
|
+
execution: Execution,
|
|
361
|
+
) -> MrinfoExportGradFslOutputs:
|
|
362
|
+
"""
|
|
363
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
364
|
+
|
|
365
|
+
Args:
|
|
366
|
+
params: The parameters.
|
|
367
|
+
execution: The execution object for resolving input paths.
|
|
368
|
+
Returns:
|
|
369
|
+
Outputs object.
|
|
370
|
+
"""
|
|
371
|
+
ret = MrinfoExportGradFslOutputs(
|
|
372
|
+
root=execution.output_file("."),
|
|
373
|
+
bvecs_path=execution.output_file(params.get("bvecs_path", None)),
|
|
374
|
+
bvals_path=execution.output_file(params.get("bvals_path", None)),
|
|
375
|
+
)
|
|
376
|
+
return ret
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class MrinfoExportPeEddyOutputs(typing.NamedTuple):
|
|
380
|
+
"""
|
|
381
|
+
Output object returned when calling `MrinfoExportPeEddyParamsDict | None(...)`.
|
|
382
|
+
"""
|
|
383
|
+
root: OutputPathType
|
|
384
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
385
|
+
config: OutputPathType
|
|
386
|
+
"""export phase-encoding information to an EDDY-style config / index file
|
|
387
|
+
pair"""
|
|
388
|
+
indices: OutputPathType
|
|
389
|
+
"""export phase-encoding information to an EDDY-style config / index file
|
|
390
|
+
pair"""
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def mrinfo_export_pe_eddy(
|
|
394
|
+
config: str,
|
|
395
|
+
indices: str,
|
|
396
|
+
) -> MrinfoExportPeEddyParamsDictTagged:
|
|
397
|
+
"""
|
|
398
|
+
Build parameters.
|
|
399
|
+
|
|
400
|
+
Args:
|
|
401
|
+
config: export phase-encoding information to an EDDY-style config /\
|
|
402
|
+
index file pair.
|
|
403
|
+
indices: export phase-encoding information to an EDDY-style config /\
|
|
404
|
+
index file pair.
|
|
405
|
+
Returns:
|
|
406
|
+
Parameter dictionary
|
|
407
|
+
"""
|
|
408
|
+
params = {
|
|
409
|
+
"@type": "export_pe_eddy",
|
|
410
|
+
"config": config,
|
|
411
|
+
"indices": indices,
|
|
412
|
+
}
|
|
413
|
+
return params
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def mrinfo_export_pe_eddy_validate(
|
|
417
|
+
params: typing.Any,
|
|
418
|
+
) -> None:
|
|
419
|
+
"""
|
|
420
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
421
|
+
`MrinfoExportPeEddyParamsDict` object.
|
|
422
|
+
|
|
423
|
+
Args:
|
|
424
|
+
params: The parameters object to validate.
|
|
425
|
+
"""
|
|
426
|
+
if params is None or not isinstance(params, dict):
|
|
427
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
428
|
+
if params.get("config", None) is None:
|
|
429
|
+
raise StyxValidationError("`config` must not be None")
|
|
430
|
+
if not isinstance(params["config"], str):
|
|
431
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `str`')
|
|
432
|
+
if params.get("indices", None) is None:
|
|
433
|
+
raise StyxValidationError("`indices` must not be None")
|
|
434
|
+
if not isinstance(params["indices"], str):
|
|
435
|
+
raise StyxValidationError(f'`indices` has the wrong type: Received `{type(params.get("indices", None))}` expected `str`')
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
def mrinfo_export_pe_eddy_cargs(
|
|
439
|
+
params: MrinfoExportPeEddyParamsDict,
|
|
440
|
+
execution: Execution,
|
|
441
|
+
) -> list[str]:
|
|
442
|
+
"""
|
|
443
|
+
Build command-line arguments from parameters.
|
|
444
|
+
|
|
445
|
+
Args:
|
|
446
|
+
params: The parameters.
|
|
447
|
+
execution: The execution object for resolving input paths.
|
|
448
|
+
Returns:
|
|
449
|
+
Command-line arguments.
|
|
450
|
+
"""
|
|
451
|
+
cargs = []
|
|
452
|
+
cargs.append("-export_pe_eddy")
|
|
453
|
+
cargs.append(params.get("config", None))
|
|
454
|
+
cargs.append(params.get("indices", None))
|
|
455
|
+
return cargs
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def mrinfo_export_pe_eddy_outputs(
|
|
459
|
+
params: MrinfoExportPeEddyParamsDict,
|
|
460
|
+
execution: Execution,
|
|
461
|
+
) -> MrinfoExportPeEddyOutputs:
|
|
462
|
+
"""
|
|
463
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
464
|
+
|
|
465
|
+
Args:
|
|
466
|
+
params: The parameters.
|
|
467
|
+
execution: The execution object for resolving input paths.
|
|
468
|
+
Returns:
|
|
469
|
+
Outputs object.
|
|
470
|
+
"""
|
|
471
|
+
ret = MrinfoExportPeEddyOutputs(
|
|
472
|
+
root=execution.output_file("."),
|
|
473
|
+
config=execution.output_file(params.get("config", None)),
|
|
474
|
+
indices=execution.output_file(params.get("indices", None)),
|
|
475
|
+
)
|
|
476
|
+
return ret
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
def mrinfo_config(
|
|
480
|
+
key: str,
|
|
481
|
+
value: str,
|
|
482
|
+
) -> MrinfoConfigParamsDictTagged:
|
|
483
|
+
"""
|
|
484
|
+
Build parameters.
|
|
485
|
+
|
|
486
|
+
Args:
|
|
487
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
488
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
489
|
+
Returns:
|
|
490
|
+
Parameter dictionary
|
|
491
|
+
"""
|
|
492
|
+
params = {
|
|
493
|
+
"@type": "config",
|
|
494
|
+
"key": key,
|
|
495
|
+
"value": value,
|
|
496
|
+
}
|
|
497
|
+
return params
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
def mrinfo_config_validate(
|
|
501
|
+
params: typing.Any,
|
|
502
|
+
) -> None:
|
|
503
|
+
"""
|
|
504
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
505
|
+
`MrinfoConfigParamsDict` object.
|
|
506
|
+
|
|
507
|
+
Args:
|
|
508
|
+
params: The parameters object to validate.
|
|
509
|
+
"""
|
|
510
|
+
if params is None or not isinstance(params, dict):
|
|
511
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
512
|
+
if params.get("key", None) is None:
|
|
513
|
+
raise StyxValidationError("`key` must not be None")
|
|
514
|
+
if not isinstance(params["key"], str):
|
|
515
|
+
raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
|
|
516
|
+
if params.get("value", None) is None:
|
|
517
|
+
raise StyxValidationError("`value` must not be None")
|
|
518
|
+
if not isinstance(params["value"], str):
|
|
519
|
+
raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
def mrinfo_config_cargs(
|
|
523
|
+
params: MrinfoConfigParamsDict,
|
|
524
|
+
execution: Execution,
|
|
525
|
+
) -> list[str]:
|
|
526
|
+
"""
|
|
527
|
+
Build command-line arguments from parameters.
|
|
528
|
+
|
|
529
|
+
Args:
|
|
530
|
+
params: The parameters.
|
|
531
|
+
execution: The execution object for resolving input paths.
|
|
532
|
+
Returns:
|
|
533
|
+
Command-line arguments.
|
|
534
|
+
"""
|
|
535
|
+
cargs = []
|
|
536
|
+
cargs.append("-config")
|
|
537
|
+
cargs.append(params.get("key", None))
|
|
538
|
+
cargs.append(params.get("value", None))
|
|
539
|
+
return cargs
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
class MrinfoOutputs(typing.NamedTuple):
|
|
543
|
+
"""
|
|
544
|
+
Output object returned when calling `MrinfoParamsDict(...)`.
|
|
545
|
+
"""
|
|
546
|
+
root: OutputPathType
|
|
547
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
548
|
+
json_keyval: OutputPathType | None
|
|
549
|
+
"""export header key/value entries to a JSON file """
|
|
550
|
+
json_all: OutputPathType | None
|
|
551
|
+
"""export all header contents to a JSON file """
|
|
552
|
+
export_grad_mrtrix: OutputPathType | None
|
|
553
|
+
"""export the diffusion-weighted gradient table to file in MRtrix format """
|
|
554
|
+
export_pe_table: OutputPathType | None
|
|
555
|
+
"""export phase-encoding table to file """
|
|
556
|
+
export_grad_fsl: MrinfoExportGradFslOutputs | None
|
|
557
|
+
"""Outputs from `mrinfo_export_grad_fsl_outputs`."""
|
|
558
|
+
export_pe_eddy: MrinfoExportPeEddyOutputs | None
|
|
559
|
+
"""Outputs from `mrinfo_export_pe_eddy_outputs`."""
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
def mrinfo_params(
|
|
563
|
+
image: list[InputPathType],
|
|
564
|
+
all_: bool = False,
|
|
565
|
+
name: bool = False,
|
|
566
|
+
format_: bool = False,
|
|
567
|
+
ndim: bool = False,
|
|
568
|
+
size: bool = False,
|
|
569
|
+
spacing: bool = False,
|
|
570
|
+
datatype: bool = False,
|
|
571
|
+
strides: bool = False,
|
|
572
|
+
offset: bool = False,
|
|
573
|
+
multiplier: bool = False,
|
|
574
|
+
transform: bool = False,
|
|
575
|
+
property_: list[MrinfoPropertyParamsDict] | None = None,
|
|
576
|
+
json_keyval: str | None = None,
|
|
577
|
+
json_all: str | None = None,
|
|
578
|
+
grad: InputPathType | None = None,
|
|
579
|
+
fslgrad: MrinfoFslgradParamsDict | None = None,
|
|
580
|
+
bvalue_scaling: str | None = None,
|
|
581
|
+
export_grad_mrtrix: str | None = None,
|
|
582
|
+
export_grad_fsl: MrinfoExportGradFslParamsDict | None = None,
|
|
583
|
+
dwgrad: bool = False,
|
|
584
|
+
shell_bvalues: bool = False,
|
|
585
|
+
shell_sizes: bool = False,
|
|
586
|
+
shell_indices: bool = False,
|
|
587
|
+
export_pe_table: str | None = None,
|
|
588
|
+
export_pe_eddy: MrinfoExportPeEddyParamsDict | None = None,
|
|
589
|
+
petable: bool = False,
|
|
590
|
+
nodelete: bool = False,
|
|
591
|
+
info: bool = False,
|
|
592
|
+
quiet: bool = False,
|
|
593
|
+
debug: bool = False,
|
|
594
|
+
force: bool = False,
|
|
595
|
+
nthreads: int | None = None,
|
|
596
|
+
config: list[MrinfoConfigParamsDict] | None = None,
|
|
597
|
+
help_: bool = False,
|
|
598
|
+
version: bool = False,
|
|
599
|
+
) -> MrinfoParamsDictTagged:
|
|
600
|
+
"""
|
|
601
|
+
Build parameters.
|
|
602
|
+
|
|
603
|
+
Args:
|
|
604
|
+
image: the input image(s).
|
|
605
|
+
all_: print all properties, rather than the first and last 2 of each.
|
|
606
|
+
name: print the file system path of the image.
|
|
607
|
+
format_: image file format.
|
|
608
|
+
ndim: number of image dimensions.
|
|
609
|
+
size: image size along each axis.
|
|
610
|
+
spacing: voxel spacing along each image dimension.
|
|
611
|
+
datatype: data type used for image data storage.
|
|
612
|
+
strides: data strides i.e. order and direction of axes data layout.
|
|
613
|
+
offset: image intensity offset.
|
|
614
|
+
multiplier: image intensity multiplier.
|
|
615
|
+
transform: the transformation from image coordinates [mm] to scanner /\
|
|
616
|
+
real world coordinates [mm].
|
|
617
|
+
property_: any text properties embedded in the image header under the\
|
|
618
|
+
specified key (use 'all' to list all keys found).
|
|
619
|
+
json_keyval: export header key/value entries to a JSON file.
|
|
620
|
+
json_all: export all header contents to a JSON file.
|
|
621
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
622
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
623
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
624
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
625
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
626
|
+
header, the data provided with this option will be instead used.
|
|
627
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
628
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
629
|
+
scheme is present in the input image header, the data provided with\
|
|
630
|
+
this option will be instead used.
|
|
631
|
+
bvalue_scaling: enable or disable scaling of diffusion b-values by the\
|
|
632
|
+
square of the corresponding DW gradient norm (see Desciption). Valid\
|
|
633
|
+
choices are yes/no, true/false, 0/1 (default: automatic).
|
|
634
|
+
export_grad_mrtrix: export the diffusion-weighted gradient table to\
|
|
635
|
+
file in MRtrix format.
|
|
636
|
+
export_grad_fsl: export the diffusion-weighted gradient table to files\
|
|
637
|
+
in FSL (bvecs / bvals) format.
|
|
638
|
+
dwgrad: the diffusion-weighting gradient table, as interpreted by\
|
|
639
|
+
MRtrix3.
|
|
640
|
+
shell_bvalues: list the average b-value of each shell.
|
|
641
|
+
shell_sizes: list the number of volumes in each shell.
|
|
642
|
+
shell_indices: list the image volumes attributed to each b-value shell.
|
|
643
|
+
export_pe_table: export phase-encoding table to file.
|
|
644
|
+
export_pe_eddy: export phase-encoding information to an EDDY-style\
|
|
645
|
+
config / index file pair.
|
|
646
|
+
petable: print the phase encoding table.
|
|
647
|
+
nodelete: don't delete temporary images or images passed to mrinfo via\
|
|
648
|
+
Unix pipes.
|
|
649
|
+
info: display information messages.
|
|
650
|
+
quiet: do not display information messages or progress status;\
|
|
651
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
652
|
+
environment variable to a non-empty string.
|
|
653
|
+
debug: display debugging messages.
|
|
654
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
655
|
+
input and output might cause unexpected behaviour).
|
|
656
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
657
|
+
(set to 0 to disable multi-threading).
|
|
658
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
659
|
+
help_: display this information page and exit.
|
|
660
|
+
version: display version information and exit.
|
|
661
|
+
Returns:
|
|
662
|
+
Parameter dictionary
|
|
663
|
+
"""
|
|
664
|
+
params = {
|
|
665
|
+
"@type": "mrtrix/mrinfo",
|
|
666
|
+
"all": all_,
|
|
667
|
+
"name": name,
|
|
668
|
+
"format": format_,
|
|
669
|
+
"ndim": ndim,
|
|
670
|
+
"size": size,
|
|
671
|
+
"spacing": spacing,
|
|
672
|
+
"datatype": datatype,
|
|
673
|
+
"strides": strides,
|
|
674
|
+
"offset": offset,
|
|
675
|
+
"multiplier": multiplier,
|
|
676
|
+
"transform": transform,
|
|
677
|
+
"dwgrad": dwgrad,
|
|
678
|
+
"shell_bvalues": shell_bvalues,
|
|
679
|
+
"shell_sizes": shell_sizes,
|
|
680
|
+
"shell_indices": shell_indices,
|
|
681
|
+
"petable": petable,
|
|
682
|
+
"nodelete": nodelete,
|
|
683
|
+
"info": info,
|
|
684
|
+
"quiet": quiet,
|
|
685
|
+
"debug": debug,
|
|
686
|
+
"force": force,
|
|
687
|
+
"help": help_,
|
|
688
|
+
"version": version,
|
|
689
|
+
"image": image,
|
|
690
|
+
}
|
|
691
|
+
if property_ is not None:
|
|
692
|
+
params["property"] = property_
|
|
693
|
+
if json_keyval is not None:
|
|
694
|
+
params["json_keyval"] = json_keyval
|
|
695
|
+
if json_all is not None:
|
|
696
|
+
params["json_all"] = json_all
|
|
697
|
+
if grad is not None:
|
|
698
|
+
params["grad"] = grad
|
|
699
|
+
if fslgrad is not None:
|
|
700
|
+
params["fslgrad"] = fslgrad
|
|
701
|
+
if bvalue_scaling is not None:
|
|
702
|
+
params["bvalue_scaling"] = bvalue_scaling
|
|
703
|
+
if export_grad_mrtrix is not None:
|
|
704
|
+
params["export_grad_mrtrix"] = export_grad_mrtrix
|
|
705
|
+
if export_grad_fsl is not None:
|
|
706
|
+
params["export_grad_fsl"] = export_grad_fsl
|
|
707
|
+
if export_pe_table is not None:
|
|
708
|
+
params["export_pe_table"] = export_pe_table
|
|
709
|
+
if export_pe_eddy is not None:
|
|
710
|
+
params["export_pe_eddy"] = export_pe_eddy
|
|
711
|
+
if nthreads is not None:
|
|
712
|
+
params["nthreads"] = nthreads
|
|
713
|
+
if config is not None:
|
|
714
|
+
params["config"] = config
|
|
715
|
+
return params
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
def mrinfo_validate(
|
|
719
|
+
params: typing.Any,
|
|
720
|
+
) -> None:
|
|
721
|
+
"""
|
|
722
|
+
Validate parameters. Throws an error if `params` is not a valid
|
|
723
|
+
`MrinfoParamsDict` object.
|
|
724
|
+
|
|
725
|
+
Args:
|
|
726
|
+
params: The parameters object to validate.
|
|
727
|
+
"""
|
|
728
|
+
if params is None or not isinstance(params, dict):
|
|
729
|
+
raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
|
|
730
|
+
if params.get("all", False) is None:
|
|
731
|
+
raise StyxValidationError("`all` must not be None")
|
|
732
|
+
if not isinstance(params["all"], bool):
|
|
733
|
+
raise StyxValidationError(f'`all` has the wrong type: Received `{type(params.get("all", False))}` expected `bool`')
|
|
734
|
+
if params.get("name", False) is None:
|
|
735
|
+
raise StyxValidationError("`name` must not be None")
|
|
736
|
+
if not isinstance(params["name"], bool):
|
|
737
|
+
raise StyxValidationError(f'`name` has the wrong type: Received `{type(params.get("name", False))}` expected `bool`')
|
|
738
|
+
if params.get("format", False) is None:
|
|
739
|
+
raise StyxValidationError("`format` must not be None")
|
|
740
|
+
if not isinstance(params["format"], bool):
|
|
741
|
+
raise StyxValidationError(f'`format` has the wrong type: Received `{type(params.get("format", False))}` expected `bool`')
|
|
742
|
+
if params.get("ndim", False) is None:
|
|
743
|
+
raise StyxValidationError("`ndim` must not be None")
|
|
744
|
+
if not isinstance(params["ndim"], bool):
|
|
745
|
+
raise StyxValidationError(f'`ndim` has the wrong type: Received `{type(params.get("ndim", False))}` expected `bool`')
|
|
746
|
+
if params.get("size", False) is None:
|
|
747
|
+
raise StyxValidationError("`size` must not be None")
|
|
748
|
+
if not isinstance(params["size"], bool):
|
|
749
|
+
raise StyxValidationError(f'`size` has the wrong type: Received `{type(params.get("size", False))}` expected `bool`')
|
|
750
|
+
if params.get("spacing", False) is None:
|
|
751
|
+
raise StyxValidationError("`spacing` must not be None")
|
|
752
|
+
if not isinstance(params["spacing"], bool):
|
|
753
|
+
raise StyxValidationError(f'`spacing` has the wrong type: Received `{type(params.get("spacing", False))}` expected `bool`')
|
|
754
|
+
if params.get("datatype", False) is None:
|
|
755
|
+
raise StyxValidationError("`datatype` must not be None")
|
|
756
|
+
if not isinstance(params["datatype"], bool):
|
|
757
|
+
raise StyxValidationError(f'`datatype` has the wrong type: Received `{type(params.get("datatype", False))}` expected `bool`')
|
|
758
|
+
if params.get("strides", False) is None:
|
|
759
|
+
raise StyxValidationError("`strides` must not be None")
|
|
760
|
+
if not isinstance(params["strides"], bool):
|
|
761
|
+
raise StyxValidationError(f'`strides` has the wrong type: Received `{type(params.get("strides", False))}` expected `bool`')
|
|
762
|
+
if params.get("offset", False) is None:
|
|
763
|
+
raise StyxValidationError("`offset` must not be None")
|
|
764
|
+
if not isinstance(params["offset"], bool):
|
|
765
|
+
raise StyxValidationError(f'`offset` has the wrong type: Received `{type(params.get("offset", False))}` expected `bool`')
|
|
766
|
+
if params.get("multiplier", False) is None:
|
|
767
|
+
raise StyxValidationError("`multiplier` must not be None")
|
|
768
|
+
if not isinstance(params["multiplier"], bool):
|
|
769
|
+
raise StyxValidationError(f'`multiplier` has the wrong type: Received `{type(params.get("multiplier", False))}` expected `bool`')
|
|
770
|
+
if params.get("transform", False) is None:
|
|
771
|
+
raise StyxValidationError("`transform` must not be None")
|
|
772
|
+
if not isinstance(params["transform"], bool):
|
|
773
|
+
raise StyxValidationError(f'`transform` has the wrong type: Received `{type(params.get("transform", False))}` expected `bool`')
|
|
774
|
+
if params.get("property", None) is not None:
|
|
775
|
+
if not isinstance(params["property"], list):
|
|
776
|
+
raise StyxValidationError(f'`property` has the wrong type: Received `{type(params.get("property", None))}` expected `list[MrinfoPropertyParamsDict] | None`')
|
|
777
|
+
for e in params["property"]:
|
|
778
|
+
mrinfo_property_validate(e)
|
|
779
|
+
if params.get("json_keyval", None) is not None:
|
|
780
|
+
if not isinstance(params["json_keyval"], str):
|
|
781
|
+
raise StyxValidationError(f'`json_keyval` has the wrong type: Received `{type(params.get("json_keyval", None))}` expected `str | None`')
|
|
782
|
+
if params.get("json_all", None) is not None:
|
|
783
|
+
if not isinstance(params["json_all"], str):
|
|
784
|
+
raise StyxValidationError(f'`json_all` has the wrong type: Received `{type(params.get("json_all", None))}` expected `str | None`')
|
|
785
|
+
if params.get("grad", None) is not None:
|
|
786
|
+
if not isinstance(params["grad"], (pathlib.Path, str)):
|
|
787
|
+
raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
|
|
788
|
+
if params.get("fslgrad", None) is not None:
|
|
789
|
+
mrinfo_fslgrad_validate(params["fslgrad"])
|
|
790
|
+
if params.get("bvalue_scaling", None) is not None:
|
|
791
|
+
if not isinstance(params["bvalue_scaling"], str):
|
|
792
|
+
raise StyxValidationError(f'`bvalue_scaling` has the wrong type: Received `{type(params.get("bvalue_scaling", None))}` expected `str | None`')
|
|
793
|
+
if params.get("export_grad_mrtrix", None) is not None:
|
|
794
|
+
if not isinstance(params["export_grad_mrtrix"], str):
|
|
795
|
+
raise StyxValidationError(f'`export_grad_mrtrix` has the wrong type: Received `{type(params.get("export_grad_mrtrix", None))}` expected `str | None`')
|
|
796
|
+
if params.get("export_grad_fsl", None) is not None:
|
|
797
|
+
mrinfo_export_grad_fsl_validate(params["export_grad_fsl"])
|
|
798
|
+
if params.get("dwgrad", False) is None:
|
|
799
|
+
raise StyxValidationError("`dwgrad` must not be None")
|
|
800
|
+
if not isinstance(params["dwgrad"], bool):
|
|
801
|
+
raise StyxValidationError(f'`dwgrad` has the wrong type: Received `{type(params.get("dwgrad", False))}` expected `bool`')
|
|
802
|
+
if params.get("shell_bvalues", False) is None:
|
|
803
|
+
raise StyxValidationError("`shell_bvalues` must not be None")
|
|
804
|
+
if not isinstance(params["shell_bvalues"], bool):
|
|
805
|
+
raise StyxValidationError(f'`shell_bvalues` has the wrong type: Received `{type(params.get("shell_bvalues", False))}` expected `bool`')
|
|
806
|
+
if params.get("shell_sizes", False) is None:
|
|
807
|
+
raise StyxValidationError("`shell_sizes` must not be None")
|
|
808
|
+
if not isinstance(params["shell_sizes"], bool):
|
|
809
|
+
raise StyxValidationError(f'`shell_sizes` has the wrong type: Received `{type(params.get("shell_sizes", False))}` expected `bool`')
|
|
810
|
+
if params.get("shell_indices", False) is None:
|
|
811
|
+
raise StyxValidationError("`shell_indices` must not be None")
|
|
812
|
+
if not isinstance(params["shell_indices"], bool):
|
|
813
|
+
raise StyxValidationError(f'`shell_indices` has the wrong type: Received `{type(params.get("shell_indices", False))}` expected `bool`')
|
|
814
|
+
if params.get("export_pe_table", None) is not None:
|
|
815
|
+
if not isinstance(params["export_pe_table"], str):
|
|
816
|
+
raise StyxValidationError(f'`export_pe_table` has the wrong type: Received `{type(params.get("export_pe_table", None))}` expected `str | None`')
|
|
817
|
+
if params.get("export_pe_eddy", None) is not None:
|
|
818
|
+
mrinfo_export_pe_eddy_validate(params["export_pe_eddy"])
|
|
819
|
+
if params.get("petable", False) is None:
|
|
820
|
+
raise StyxValidationError("`petable` must not be None")
|
|
821
|
+
if not isinstance(params["petable"], bool):
|
|
822
|
+
raise StyxValidationError(f'`petable` has the wrong type: Received `{type(params.get("petable", False))}` expected `bool`')
|
|
823
|
+
if params.get("nodelete", False) is None:
|
|
824
|
+
raise StyxValidationError("`nodelete` must not be None")
|
|
825
|
+
if not isinstance(params["nodelete"], bool):
|
|
826
|
+
raise StyxValidationError(f'`nodelete` has the wrong type: Received `{type(params.get("nodelete", False))}` expected `bool`')
|
|
827
|
+
if params.get("info", False) is None:
|
|
828
|
+
raise StyxValidationError("`info` must not be None")
|
|
829
|
+
if not isinstance(params["info"], bool):
|
|
830
|
+
raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
|
|
831
|
+
if params.get("quiet", False) is None:
|
|
832
|
+
raise StyxValidationError("`quiet` must not be None")
|
|
833
|
+
if not isinstance(params["quiet"], bool):
|
|
834
|
+
raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
|
|
835
|
+
if params.get("debug", False) is None:
|
|
836
|
+
raise StyxValidationError("`debug` must not be None")
|
|
837
|
+
if not isinstance(params["debug"], bool):
|
|
838
|
+
raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
|
|
839
|
+
if params.get("force", False) is None:
|
|
840
|
+
raise StyxValidationError("`force` must not be None")
|
|
841
|
+
if not isinstance(params["force"], bool):
|
|
842
|
+
raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
|
|
843
|
+
if params.get("nthreads", None) is not None:
|
|
844
|
+
if not isinstance(params["nthreads"], int):
|
|
845
|
+
raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
|
|
846
|
+
if params.get("config", None) is not None:
|
|
847
|
+
if not isinstance(params["config"], list):
|
|
848
|
+
raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[MrinfoConfigParamsDict] | None`')
|
|
849
|
+
for e in params["config"]:
|
|
850
|
+
mrinfo_config_validate(e)
|
|
851
|
+
if params.get("help", False) is None:
|
|
852
|
+
raise StyxValidationError("`help` must not be None")
|
|
853
|
+
if not isinstance(params["help"], bool):
|
|
854
|
+
raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
|
|
855
|
+
if params.get("version", False) is None:
|
|
856
|
+
raise StyxValidationError("`version` must not be None")
|
|
857
|
+
if not isinstance(params["version"], bool):
|
|
858
|
+
raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
|
|
859
|
+
if params.get("image", None) is None:
|
|
860
|
+
raise StyxValidationError("`image` must not be None")
|
|
861
|
+
if not isinstance(params["image"], list):
|
|
862
|
+
raise StyxValidationError(f'`image` has the wrong type: Received `{type(params.get("image", None))}` expected `list[InputPathType]`')
|
|
863
|
+
for e in params["image"]:
|
|
864
|
+
if not isinstance(e, (pathlib.Path, str)):
|
|
865
|
+
raise StyxValidationError(f'`image` has the wrong type: Received `{type(params.get("image", None))}` expected `list[InputPathType]`')
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
def mrinfo_cargs(
|
|
869
|
+
params: MrinfoParamsDict,
|
|
870
|
+
execution: Execution,
|
|
871
|
+
) -> list[str]:
|
|
872
|
+
"""
|
|
873
|
+
Build command-line arguments from parameters.
|
|
874
|
+
|
|
875
|
+
Args:
|
|
876
|
+
params: The parameters.
|
|
877
|
+
execution: The execution object for resolving input paths.
|
|
878
|
+
Returns:
|
|
879
|
+
Command-line arguments.
|
|
880
|
+
"""
|
|
881
|
+
cargs = []
|
|
882
|
+
cargs.append("mrinfo")
|
|
883
|
+
if params.get("all", False):
|
|
884
|
+
cargs.append("-all")
|
|
885
|
+
if params.get("name", False):
|
|
886
|
+
cargs.append("-name")
|
|
887
|
+
if params.get("format", False):
|
|
888
|
+
cargs.append("-format")
|
|
889
|
+
if params.get("ndim", False):
|
|
890
|
+
cargs.append("-ndim")
|
|
891
|
+
if params.get("size", False):
|
|
892
|
+
cargs.append("-size")
|
|
893
|
+
if params.get("spacing", False):
|
|
894
|
+
cargs.append("-spacing")
|
|
895
|
+
if params.get("datatype", False):
|
|
896
|
+
cargs.append("-datatype")
|
|
897
|
+
if params.get("strides", False):
|
|
898
|
+
cargs.append("-strides")
|
|
899
|
+
if params.get("offset", False):
|
|
900
|
+
cargs.append("-offset")
|
|
901
|
+
if params.get("multiplier", False):
|
|
902
|
+
cargs.append("-multiplier")
|
|
903
|
+
if params.get("transform", False):
|
|
904
|
+
cargs.append("-transform")
|
|
905
|
+
if params.get("property", None) is not None:
|
|
906
|
+
cargs.extend([a for c in [mrinfo_property_cargs(s, execution) for s in params.get("property", None)] for a in c])
|
|
907
|
+
if params.get("json_keyval", None) is not None:
|
|
908
|
+
cargs.extend([
|
|
909
|
+
"-json_keyval",
|
|
910
|
+
params.get("json_keyval", None)
|
|
911
|
+
])
|
|
912
|
+
if params.get("json_all", None) is not None:
|
|
913
|
+
cargs.extend([
|
|
914
|
+
"-json_all",
|
|
915
|
+
params.get("json_all", None)
|
|
916
|
+
])
|
|
917
|
+
if params.get("grad", None) is not None:
|
|
918
|
+
cargs.extend([
|
|
919
|
+
"-grad",
|
|
920
|
+
execution.input_file(params.get("grad", None))
|
|
921
|
+
])
|
|
922
|
+
if params.get("fslgrad", None) is not None:
|
|
923
|
+
cargs.extend(mrinfo_fslgrad_cargs(params.get("fslgrad", None), execution))
|
|
924
|
+
if params.get("bvalue_scaling", None) is not None:
|
|
925
|
+
cargs.extend([
|
|
926
|
+
"-bvalue_scaling",
|
|
927
|
+
params.get("bvalue_scaling", None)
|
|
928
|
+
])
|
|
929
|
+
if params.get("export_grad_mrtrix", None) is not None:
|
|
930
|
+
cargs.extend([
|
|
931
|
+
"-export_grad_mrtrix",
|
|
932
|
+
params.get("export_grad_mrtrix", None)
|
|
933
|
+
])
|
|
934
|
+
if params.get("export_grad_fsl", None) is not None:
|
|
935
|
+
cargs.extend(mrinfo_export_grad_fsl_cargs(params.get("export_grad_fsl", None), execution))
|
|
936
|
+
if params.get("dwgrad", False):
|
|
937
|
+
cargs.append("-dwgrad")
|
|
938
|
+
if params.get("shell_bvalues", False):
|
|
939
|
+
cargs.append("-shell_bvalues")
|
|
940
|
+
if params.get("shell_sizes", False):
|
|
941
|
+
cargs.append("-shell_sizes")
|
|
942
|
+
if params.get("shell_indices", False):
|
|
943
|
+
cargs.append("-shell_indices")
|
|
944
|
+
if params.get("export_pe_table", None) is not None:
|
|
945
|
+
cargs.extend([
|
|
946
|
+
"-export_pe_table",
|
|
947
|
+
params.get("export_pe_table", None)
|
|
948
|
+
])
|
|
949
|
+
if params.get("export_pe_eddy", None) is not None:
|
|
950
|
+
cargs.extend(mrinfo_export_pe_eddy_cargs(params.get("export_pe_eddy", None), execution))
|
|
951
|
+
if params.get("petable", False):
|
|
952
|
+
cargs.append("-petable")
|
|
953
|
+
if params.get("nodelete", False):
|
|
954
|
+
cargs.append("-nodelete")
|
|
955
|
+
if params.get("info", False):
|
|
956
|
+
cargs.append("-info")
|
|
957
|
+
if params.get("quiet", False):
|
|
958
|
+
cargs.append("-quiet")
|
|
959
|
+
if params.get("debug", False):
|
|
960
|
+
cargs.append("-debug")
|
|
961
|
+
if params.get("force", False):
|
|
962
|
+
cargs.append("-force")
|
|
963
|
+
if params.get("nthreads", None) is not None:
|
|
964
|
+
cargs.extend([
|
|
965
|
+
"-nthreads",
|
|
966
|
+
str(params.get("nthreads", None))
|
|
967
|
+
])
|
|
968
|
+
if params.get("config", None) is not None:
|
|
969
|
+
cargs.extend([a for c in [mrinfo_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
|
|
970
|
+
if params.get("help", False):
|
|
971
|
+
cargs.append("-help")
|
|
972
|
+
if params.get("version", False):
|
|
973
|
+
cargs.append("-version")
|
|
974
|
+
cargs.extend([execution.input_file(f) for f in params.get("image", None)])
|
|
975
|
+
return cargs
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def mrinfo_outputs(
|
|
979
|
+
params: MrinfoParamsDict,
|
|
980
|
+
execution: Execution,
|
|
981
|
+
) -> MrinfoOutputs:
|
|
982
|
+
"""
|
|
983
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
984
|
+
|
|
985
|
+
Args:
|
|
986
|
+
params: The parameters.
|
|
987
|
+
execution: The execution object for resolving input paths.
|
|
988
|
+
Returns:
|
|
989
|
+
Outputs object.
|
|
990
|
+
"""
|
|
991
|
+
ret = MrinfoOutputs(
|
|
992
|
+
root=execution.output_file("."),
|
|
993
|
+
json_keyval=execution.output_file(params.get("json_keyval", None)) if (params.get("json_keyval") is not None) else None,
|
|
994
|
+
json_all=execution.output_file(params.get("json_all", None)) if (params.get("json_all") is not None) else None,
|
|
995
|
+
export_grad_mrtrix=execution.output_file(params.get("export_grad_mrtrix", None)) if (params.get("export_grad_mrtrix") is not None) else None,
|
|
996
|
+
export_pe_table=execution.output_file(params.get("export_pe_table", None)) if (params.get("export_pe_table") is not None) else None,
|
|
997
|
+
export_grad_fsl=mrinfo_export_grad_fsl_outputs(params.get("export_grad_fsl"), execution) if params.get("export_grad_fsl") else None,
|
|
998
|
+
export_pe_eddy=mrinfo_export_pe_eddy_outputs(params.get("export_pe_eddy"), execution) if params.get("export_pe_eddy") else None,
|
|
999
|
+
)
|
|
1000
|
+
return ret
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
def mrinfo_execute(
|
|
1004
|
+
params: MrinfoParamsDict,
|
|
1005
|
+
runner: Runner | None = None,
|
|
1006
|
+
) -> MrinfoOutputs:
|
|
1007
|
+
"""
|
|
1008
|
+
mrinfo
|
|
1009
|
+
|
|
1010
|
+
Display image header information, or extract specific information from the
|
|
1011
|
+
header.
|
|
1012
|
+
|
|
1013
|
+
By default, all information contained in each image header will be printed
|
|
1014
|
+
to the console in a reader-friendly format.
|
|
1015
|
+
|
|
1016
|
+
Alternatively, command-line options may be used to extract specific details
|
|
1017
|
+
from the header(s); these are printed to the console in a format more
|
|
1018
|
+
appropriate for scripting purposes or piping to file. If multiple options
|
|
1019
|
+
and/or images are provided, the requested header fields will be printed in
|
|
1020
|
+
the order in which they appear in the help page, with all requested details
|
|
1021
|
+
from each input image in sequence printed before the next image is
|
|
1022
|
+
processed.
|
|
1023
|
+
|
|
1024
|
+
The command can also write the diffusion gradient table from a single input
|
|
1025
|
+
image to file; either in the MRtrix or FSL format (bvecs/bvals file pair;
|
|
1026
|
+
includes appropriate diffusion gradient vector reorientation)
|
|
1027
|
+
|
|
1028
|
+
The -dwgrad, -export_* and -shell_* options provide (information about) the
|
|
1029
|
+
diffusion weighting gradient table after it has been processed by the
|
|
1030
|
+
MRtrix3 back-end (vectors normalised, b-values scaled by the square of the
|
|
1031
|
+
vector norm, depending on the -bvalue_scaling option). To see the raw
|
|
1032
|
+
gradient table information as stored in the image header, i.e. without
|
|
1033
|
+
MRtrix3 back-end processing, use "-property dw_scheme".
|
|
1034
|
+
|
|
1035
|
+
The -bvalue_scaling option controls an aspect of the import of diffusion
|
|
1036
|
+
gradient tables. When the input diffusion-weighting direction vectors have
|
|
1037
|
+
norms that differ substantially from unity, the b-values will be scaled by
|
|
1038
|
+
the square of their corresponding vector norm (this is how multi-shell
|
|
1039
|
+
acquisitions are frequently achieved on scanner platforms). However in some
|
|
1040
|
+
rare instances, the b-values may be correct, despite the vectors not being
|
|
1041
|
+
of unit norm (or conversely, the b-values may need to be rescaled even
|
|
1042
|
+
though the vectors are close to unit norm). This option allows the user to
|
|
1043
|
+
control this operation and override MRrtix3's automatic detection.
|
|
1044
|
+
|
|
1045
|
+
References:
|
|
1046
|
+
|
|
1047
|
+
.
|
|
1048
|
+
|
|
1049
|
+
Author: MRTrix3 Developers
|
|
1050
|
+
|
|
1051
|
+
URL: https://www.mrtrix.org/
|
|
1052
|
+
|
|
1053
|
+
Args:
|
|
1054
|
+
params: The parameters.
|
|
1055
|
+
runner: Command runner.
|
|
1056
|
+
Returns:
|
|
1057
|
+
NamedTuple of outputs (described in `MrinfoOutputs`).
|
|
1058
|
+
"""
|
|
1059
|
+
mrinfo_validate(params)
|
|
1060
|
+
runner = runner or get_global_runner()
|
|
1061
|
+
execution = runner.start_execution(MRINFO_METADATA)
|
|
1062
|
+
params = execution.params(params)
|
|
1063
|
+
cargs = mrinfo_cargs(params, execution)
|
|
1064
|
+
ret = mrinfo_outputs(params, execution)
|
|
1065
|
+
execution.run(cargs)
|
|
1066
|
+
return ret
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
def mrinfo(
|
|
1070
|
+
image: list[InputPathType],
|
|
1071
|
+
all_: bool = False,
|
|
1072
|
+
name: bool = False,
|
|
1073
|
+
format_: bool = False,
|
|
1074
|
+
ndim: bool = False,
|
|
1075
|
+
size: bool = False,
|
|
1076
|
+
spacing: bool = False,
|
|
1077
|
+
datatype: bool = False,
|
|
1078
|
+
strides: bool = False,
|
|
1079
|
+
offset: bool = False,
|
|
1080
|
+
multiplier: bool = False,
|
|
1081
|
+
transform: bool = False,
|
|
1082
|
+
property_: list[MrinfoPropertyParamsDict] | None = None,
|
|
1083
|
+
json_keyval: str | None = None,
|
|
1084
|
+
json_all: str | None = None,
|
|
1085
|
+
grad: InputPathType | None = None,
|
|
1086
|
+
fslgrad: MrinfoFslgradParamsDict | None = None,
|
|
1087
|
+
bvalue_scaling: str | None = None,
|
|
1088
|
+
export_grad_mrtrix: str | None = None,
|
|
1089
|
+
export_grad_fsl: MrinfoExportGradFslParamsDict | None = None,
|
|
1090
|
+
dwgrad: bool = False,
|
|
1091
|
+
shell_bvalues: bool = False,
|
|
1092
|
+
shell_sizes: bool = False,
|
|
1093
|
+
shell_indices: bool = False,
|
|
1094
|
+
export_pe_table: str | None = None,
|
|
1095
|
+
export_pe_eddy: MrinfoExportPeEddyParamsDict | None = None,
|
|
1096
|
+
petable: bool = False,
|
|
1097
|
+
nodelete: bool = False,
|
|
1098
|
+
info: bool = False,
|
|
1099
|
+
quiet: bool = False,
|
|
1100
|
+
debug: bool = False,
|
|
1101
|
+
force: bool = False,
|
|
1102
|
+
nthreads: int | None = None,
|
|
1103
|
+
config: list[MrinfoConfigParamsDict] | None = None,
|
|
1104
|
+
help_: bool = False,
|
|
1105
|
+
version: bool = False,
|
|
1106
|
+
runner: Runner | None = None,
|
|
1107
|
+
) -> MrinfoOutputs:
|
|
1108
|
+
"""
|
|
1109
|
+
mrinfo
|
|
1110
|
+
|
|
1111
|
+
Display image header information, or extract specific information from the
|
|
1112
|
+
header.
|
|
1113
|
+
|
|
1114
|
+
By default, all information contained in each image header will be printed
|
|
1115
|
+
to the console in a reader-friendly format.
|
|
1116
|
+
|
|
1117
|
+
Alternatively, command-line options may be used to extract specific details
|
|
1118
|
+
from the header(s); these are printed to the console in a format more
|
|
1119
|
+
appropriate for scripting purposes or piping to file. If multiple options
|
|
1120
|
+
and/or images are provided, the requested header fields will be printed in
|
|
1121
|
+
the order in which they appear in the help page, with all requested details
|
|
1122
|
+
from each input image in sequence printed before the next image is
|
|
1123
|
+
processed.
|
|
1124
|
+
|
|
1125
|
+
The command can also write the diffusion gradient table from a single input
|
|
1126
|
+
image to file; either in the MRtrix or FSL format (bvecs/bvals file pair;
|
|
1127
|
+
includes appropriate diffusion gradient vector reorientation)
|
|
1128
|
+
|
|
1129
|
+
The -dwgrad, -export_* and -shell_* options provide (information about) the
|
|
1130
|
+
diffusion weighting gradient table after it has been processed by the
|
|
1131
|
+
MRtrix3 back-end (vectors normalised, b-values scaled by the square of the
|
|
1132
|
+
vector norm, depending on the -bvalue_scaling option). To see the raw
|
|
1133
|
+
gradient table information as stored in the image header, i.e. without
|
|
1134
|
+
MRtrix3 back-end processing, use "-property dw_scheme".
|
|
1135
|
+
|
|
1136
|
+
The -bvalue_scaling option controls an aspect of the import of diffusion
|
|
1137
|
+
gradient tables. When the input diffusion-weighting direction vectors have
|
|
1138
|
+
norms that differ substantially from unity, the b-values will be scaled by
|
|
1139
|
+
the square of their corresponding vector norm (this is how multi-shell
|
|
1140
|
+
acquisitions are frequently achieved on scanner platforms). However in some
|
|
1141
|
+
rare instances, the b-values may be correct, despite the vectors not being
|
|
1142
|
+
of unit norm (or conversely, the b-values may need to be rescaled even
|
|
1143
|
+
though the vectors are close to unit norm). This option allows the user to
|
|
1144
|
+
control this operation and override MRrtix3's automatic detection.
|
|
1145
|
+
|
|
1146
|
+
References:
|
|
1147
|
+
|
|
1148
|
+
.
|
|
1149
|
+
|
|
1150
|
+
Author: MRTrix3 Developers
|
|
1151
|
+
|
|
1152
|
+
URL: https://www.mrtrix.org/
|
|
1153
|
+
|
|
1154
|
+
Args:
|
|
1155
|
+
image: the input image(s).
|
|
1156
|
+
all_: print all properties, rather than the first and last 2 of each.
|
|
1157
|
+
name: print the file system path of the image.
|
|
1158
|
+
format_: image file format.
|
|
1159
|
+
ndim: number of image dimensions.
|
|
1160
|
+
size: image size along each axis.
|
|
1161
|
+
spacing: voxel spacing along each image dimension.
|
|
1162
|
+
datatype: data type used for image data storage.
|
|
1163
|
+
strides: data strides i.e. order and direction of axes data layout.
|
|
1164
|
+
offset: image intensity offset.
|
|
1165
|
+
multiplier: image intensity multiplier.
|
|
1166
|
+
transform: the transformation from image coordinates [mm] to scanner /\
|
|
1167
|
+
real world coordinates [mm].
|
|
1168
|
+
property_: any text properties embedded in the image header under the\
|
|
1169
|
+
specified key (use 'all' to list all keys found).
|
|
1170
|
+
json_keyval: export header key/value entries to a JSON file.
|
|
1171
|
+
json_all: export all header contents to a JSON file.
|
|
1172
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
1173
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
1174
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
1175
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
1176
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
1177
|
+
header, the data provided with this option will be instead used.
|
|
1178
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
1179
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
1180
|
+
scheme is present in the input image header, the data provided with\
|
|
1181
|
+
this option will be instead used.
|
|
1182
|
+
bvalue_scaling: enable or disable scaling of diffusion b-values by the\
|
|
1183
|
+
square of the corresponding DW gradient norm (see Desciption). Valid\
|
|
1184
|
+
choices are yes/no, true/false, 0/1 (default: automatic).
|
|
1185
|
+
export_grad_mrtrix: export the diffusion-weighted gradient table to\
|
|
1186
|
+
file in MRtrix format.
|
|
1187
|
+
export_grad_fsl: export the diffusion-weighted gradient table to files\
|
|
1188
|
+
in FSL (bvecs / bvals) format.
|
|
1189
|
+
dwgrad: the diffusion-weighting gradient table, as interpreted by\
|
|
1190
|
+
MRtrix3.
|
|
1191
|
+
shell_bvalues: list the average b-value of each shell.
|
|
1192
|
+
shell_sizes: list the number of volumes in each shell.
|
|
1193
|
+
shell_indices: list the image volumes attributed to each b-value shell.
|
|
1194
|
+
export_pe_table: export phase-encoding table to file.
|
|
1195
|
+
export_pe_eddy: export phase-encoding information to an EDDY-style\
|
|
1196
|
+
config / index file pair.
|
|
1197
|
+
petable: print the phase encoding table.
|
|
1198
|
+
nodelete: don't delete temporary images or images passed to mrinfo via\
|
|
1199
|
+
Unix pipes.
|
|
1200
|
+
info: display information messages.
|
|
1201
|
+
quiet: do not display information messages or progress status;\
|
|
1202
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
1203
|
+
environment variable to a non-empty string.
|
|
1204
|
+
debug: display debugging messages.
|
|
1205
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
1206
|
+
input and output might cause unexpected behaviour).
|
|
1207
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
1208
|
+
(set to 0 to disable multi-threading).
|
|
1209
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
1210
|
+
help_: display this information page and exit.
|
|
1211
|
+
version: display version information and exit.
|
|
1212
|
+
runner: Command runner.
|
|
1213
|
+
Returns:
|
|
1214
|
+
NamedTuple of outputs (described in `MrinfoOutputs`).
|
|
1215
|
+
"""
|
|
1216
|
+
params = mrinfo_params(
|
|
1217
|
+
all_=all_,
|
|
1218
|
+
name=name,
|
|
1219
|
+
format_=format_,
|
|
1220
|
+
ndim=ndim,
|
|
1221
|
+
size=size,
|
|
1222
|
+
spacing=spacing,
|
|
1223
|
+
datatype=datatype,
|
|
1224
|
+
strides=strides,
|
|
1225
|
+
offset=offset,
|
|
1226
|
+
multiplier=multiplier,
|
|
1227
|
+
transform=transform,
|
|
1228
|
+
property_=property_,
|
|
1229
|
+
json_keyval=json_keyval,
|
|
1230
|
+
json_all=json_all,
|
|
1231
|
+
grad=grad,
|
|
1232
|
+
fslgrad=fslgrad,
|
|
1233
|
+
bvalue_scaling=bvalue_scaling,
|
|
1234
|
+
export_grad_mrtrix=export_grad_mrtrix,
|
|
1235
|
+
export_grad_fsl=export_grad_fsl,
|
|
1236
|
+
dwgrad=dwgrad,
|
|
1237
|
+
shell_bvalues=shell_bvalues,
|
|
1238
|
+
shell_sizes=shell_sizes,
|
|
1239
|
+
shell_indices=shell_indices,
|
|
1240
|
+
export_pe_table=export_pe_table,
|
|
1241
|
+
export_pe_eddy=export_pe_eddy,
|
|
1242
|
+
petable=petable,
|
|
1243
|
+
nodelete=nodelete,
|
|
1244
|
+
info=info,
|
|
1245
|
+
quiet=quiet,
|
|
1246
|
+
debug=debug,
|
|
1247
|
+
force=force,
|
|
1248
|
+
nthreads=nthreads,
|
|
1249
|
+
config=config,
|
|
1250
|
+
help_=help_,
|
|
1251
|
+
version=version,
|
|
1252
|
+
image=image,
|
|
1253
|
+
)
|
|
1254
|
+
return mrinfo_execute(params, runner)
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
__all__ = [
|
|
1258
|
+
"MRINFO_METADATA",
|
|
1259
|
+
"MrinfoConfigParamsDict",
|
|
1260
|
+
"MrinfoConfigParamsDictTagged",
|
|
1261
|
+
"MrinfoExportGradFslOutputs",
|
|
1262
|
+
"MrinfoExportGradFslParamsDict",
|
|
1263
|
+
"MrinfoExportGradFslParamsDictTagged",
|
|
1264
|
+
"MrinfoExportPeEddyOutputs",
|
|
1265
|
+
"MrinfoExportPeEddyParamsDict",
|
|
1266
|
+
"MrinfoExportPeEddyParamsDictTagged",
|
|
1267
|
+
"MrinfoFslgradParamsDict",
|
|
1268
|
+
"MrinfoFslgradParamsDictTagged",
|
|
1269
|
+
"MrinfoOutputs",
|
|
1270
|
+
"MrinfoParamsDict",
|
|
1271
|
+
"MrinfoParamsDictTagged",
|
|
1272
|
+
"MrinfoPropertyParamsDict",
|
|
1273
|
+
"MrinfoPropertyParamsDictTagged",
|
|
1274
|
+
"mrinfo",
|
|
1275
|
+
"mrinfo_config",
|
|
1276
|
+
"mrinfo_execute",
|
|
1277
|
+
"mrinfo_export_grad_fsl",
|
|
1278
|
+
"mrinfo_export_pe_eddy",
|
|
1279
|
+
"mrinfo_fslgrad",
|
|
1280
|
+
"mrinfo_params",
|
|
1281
|
+
"mrinfo_property",
|
|
1282
|
+
]
|