niwrap-mrtrix 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of niwrap-mrtrix might be problematic. Click here for more details.
- niwrap_mrtrix/mrtrix/__init__.py +130 -0
- niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
- niwrap_mrtrix/mrtrix/amp2response.py +453 -0
- niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
- niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
- niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
- niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
- niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
- niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
- niwrap_mrtrix/mrtrix/dirflip.py +362 -0
- niwrap_mrtrix/mrtrix/dirgen.py +423 -0
- niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
- niwrap_mrtrix/mrtrix/dirorder.py +347 -0
- niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
- niwrap_mrtrix/mrtrix/dirstat.py +530 -0
- niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
- niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
- niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
- niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
- niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
- niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
- niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
- niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
- niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
- niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
- niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
- niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
- niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
- niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
- niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
- niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
- niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
- niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
- niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
- niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
- niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
- niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
- niwrap_mrtrix/mrtrix/label2colour.py +351 -0
- niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
- niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
- niwrap_mrtrix/mrtrix/labelstats.py +344 -0
- niwrap_mrtrix/mrtrix/maskdump.py +336 -0
- niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
- niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
- niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
- niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
- niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
- niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
- niwrap_mrtrix/mrtrix/mrcat.py +382 -0
- niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
- niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
- niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
- niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
- niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
- niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
- niwrap_mrtrix/mrtrix/mrdump.py +351 -0
- niwrap_mrtrix/mrtrix/mredit.py +546 -0
- niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
- niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
- niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
- niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
- niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
- niwrap_mrtrix/mrtrix/mrmath.py +413 -0
- niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
- niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
- niwrap_mrtrix/mrtrix/mrstats.py +427 -0
- niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
- niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
- niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
- niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
- niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
- niwrap_mrtrix/mrtrix/responsemean.py +316 -0
- niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
- niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
- niwrap_mrtrix/mrtrix/sh2power.py +353 -0
- niwrap_mrtrix/mrtrix/sh2response.py +394 -0
- niwrap_mrtrix/mrtrix/shbasis.py +373 -0
- niwrap_mrtrix/mrtrix/shconv.py +498 -0
- niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
- niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
- niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
- niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
- niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
- niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
- niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
- niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
- niwrap_mrtrix/mrtrix/tckmap.py +772 -0
- niwrap_mrtrix/mrtrix/tckresample.py +580 -0
- niwrap_mrtrix/mrtrix/tcksample.py +404 -0
- niwrap_mrtrix/mrtrix/tcksift.py +592 -0
- niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
- niwrap_mrtrix/mrtrix/tckstats.py +441 -0
- niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
- niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
- niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
- niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
- niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
- niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
- niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
- niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
- niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
- niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
- niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
- niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
- niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
- niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
- niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
- niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
- niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
- niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
- niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
- niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
- niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
- niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
- niwrap_mrtrix/mrtrix/warpinit.py +356 -0
- niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
- niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
- niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
- niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,656 @@
|
|
|
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
|
+
AMP2SH_METADATA = Metadata(
|
|
9
|
+
id="739c6dd01d401b453eb41eade05065e6c9fd17b3.boutiques",
|
|
10
|
+
name="amp2sh",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Amp2shFslgradParameters = typing.TypedDict('Amp2shFslgradParameters', {
|
|
17
|
+
"__STYX_TYPE__": typing.Literal["fslgrad"],
|
|
18
|
+
"bvecs": InputPathType,
|
|
19
|
+
"bvals": InputPathType,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Amp2shVariousStringParameters = typing.TypedDict('Amp2shVariousStringParameters', {
|
|
24
|
+
"__STYX_TYPE__": typing.Literal["VariousString"],
|
|
25
|
+
"obj": str,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Amp2shVariousFileParameters = typing.TypedDict('Amp2shVariousFileParameters', {
|
|
30
|
+
"__STYX_TYPE__": typing.Literal["VariousFile"],
|
|
31
|
+
"obj": InputPathType,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Amp2shConfigParameters = typing.TypedDict('Amp2shConfigParameters', {
|
|
36
|
+
"__STYX_TYPE__": typing.Literal["config"],
|
|
37
|
+
"key": str,
|
|
38
|
+
"value": str,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Amp2shParameters = typing.TypedDict('Amp2shParameters', {
|
|
43
|
+
"__STYX_TYPE__": typing.Literal["amp2sh"],
|
|
44
|
+
"lmax": typing.NotRequired[int | None],
|
|
45
|
+
"normalise": bool,
|
|
46
|
+
"directions": typing.NotRequired[InputPathType | None],
|
|
47
|
+
"rician": typing.NotRequired[InputPathType | None],
|
|
48
|
+
"grad": typing.NotRequired[InputPathType | None],
|
|
49
|
+
"fslgrad": typing.NotRequired[Amp2shFslgradParameters | None],
|
|
50
|
+
"shells": typing.NotRequired[list[float] | None],
|
|
51
|
+
"strides": typing.NotRequired[typing.Union[Amp2shVariousStringParameters, Amp2shVariousFileParameters] | None],
|
|
52
|
+
"info": bool,
|
|
53
|
+
"quiet": bool,
|
|
54
|
+
"debug": bool,
|
|
55
|
+
"force": bool,
|
|
56
|
+
"nthreads": typing.NotRequired[int | None],
|
|
57
|
+
"config": typing.NotRequired[list[Amp2shConfigParameters] | None],
|
|
58
|
+
"help": bool,
|
|
59
|
+
"version": bool,
|
|
60
|
+
"amp": InputPathType,
|
|
61
|
+
"SH": str,
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def dyn_cargs(
|
|
66
|
+
t: str,
|
|
67
|
+
) -> typing.Any:
|
|
68
|
+
"""
|
|
69
|
+
Get build cargs function by command type.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
t: Command type.
|
|
73
|
+
Returns:
|
|
74
|
+
Build cargs function.
|
|
75
|
+
"""
|
|
76
|
+
return {
|
|
77
|
+
"amp2sh": amp2sh_cargs,
|
|
78
|
+
"fslgrad": amp2sh_fslgrad_cargs,
|
|
79
|
+
"VariousString": amp2sh_various_string_cargs,
|
|
80
|
+
"VariousFile": amp2sh_various_file_cargs,
|
|
81
|
+
"config": amp2sh_config_cargs,
|
|
82
|
+
}.get(t)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def dyn_outputs(
|
|
86
|
+
t: str,
|
|
87
|
+
) -> typing.Any:
|
|
88
|
+
"""
|
|
89
|
+
Get build outputs function by command type.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
t: Command type.
|
|
93
|
+
Returns:
|
|
94
|
+
Build outputs function.
|
|
95
|
+
"""
|
|
96
|
+
return {
|
|
97
|
+
"amp2sh": amp2sh_outputs,
|
|
98
|
+
}.get(t)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def amp2sh_fslgrad_params(
|
|
102
|
+
bvecs: InputPathType,
|
|
103
|
+
bvals: InputPathType,
|
|
104
|
+
) -> Amp2shFslgradParameters:
|
|
105
|
+
"""
|
|
106
|
+
Build parameters.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
bvecs: Provide the diffusion-weighted gradient scheme used in the\
|
|
110
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
111
|
+
scheme is present in the input image header, the data provided with\
|
|
112
|
+
this option will be instead used.
|
|
113
|
+
bvals: Provide the diffusion-weighted gradient scheme used in the\
|
|
114
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
115
|
+
scheme is present in the input image header, the data provided with\
|
|
116
|
+
this option will be instead used.
|
|
117
|
+
Returns:
|
|
118
|
+
Parameter dictionary
|
|
119
|
+
"""
|
|
120
|
+
params = {
|
|
121
|
+
"__STYXTYPE__": "fslgrad",
|
|
122
|
+
"bvecs": bvecs,
|
|
123
|
+
"bvals": bvals,
|
|
124
|
+
}
|
|
125
|
+
return params
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def amp2sh_fslgrad_cargs(
|
|
129
|
+
params: Amp2shFslgradParameters,
|
|
130
|
+
execution: Execution,
|
|
131
|
+
) -> list[str]:
|
|
132
|
+
"""
|
|
133
|
+
Build command-line arguments from parameters.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
params: The parameters.
|
|
137
|
+
execution: The execution object for resolving input paths.
|
|
138
|
+
Returns:
|
|
139
|
+
Command-line arguments.
|
|
140
|
+
"""
|
|
141
|
+
cargs = []
|
|
142
|
+
cargs.append("-fslgrad")
|
|
143
|
+
cargs.append(execution.input_file(params.get("bvecs")))
|
|
144
|
+
cargs.append(execution.input_file(params.get("bvals")))
|
|
145
|
+
return cargs
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def amp2sh_various_string_params(
|
|
149
|
+
obj: str,
|
|
150
|
+
) -> Amp2shVariousStringParameters:
|
|
151
|
+
"""
|
|
152
|
+
Build parameters.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
obj: String object.
|
|
156
|
+
Returns:
|
|
157
|
+
Parameter dictionary
|
|
158
|
+
"""
|
|
159
|
+
params = {
|
|
160
|
+
"__STYXTYPE__": "VariousString",
|
|
161
|
+
"obj": obj,
|
|
162
|
+
}
|
|
163
|
+
return params
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def amp2sh_various_string_cargs(
|
|
167
|
+
params: Amp2shVariousStringParameters,
|
|
168
|
+
execution: Execution,
|
|
169
|
+
) -> list[str]:
|
|
170
|
+
"""
|
|
171
|
+
Build command-line arguments from parameters.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
params: The parameters.
|
|
175
|
+
execution: The execution object for resolving input paths.
|
|
176
|
+
Returns:
|
|
177
|
+
Command-line arguments.
|
|
178
|
+
"""
|
|
179
|
+
cargs = []
|
|
180
|
+
cargs.append(params.get("obj"))
|
|
181
|
+
return cargs
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def amp2sh_various_file_params(
|
|
185
|
+
obj: InputPathType,
|
|
186
|
+
) -> Amp2shVariousFileParameters:
|
|
187
|
+
"""
|
|
188
|
+
Build parameters.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
obj: File object.
|
|
192
|
+
Returns:
|
|
193
|
+
Parameter dictionary
|
|
194
|
+
"""
|
|
195
|
+
params = {
|
|
196
|
+
"__STYXTYPE__": "VariousFile",
|
|
197
|
+
"obj": obj,
|
|
198
|
+
}
|
|
199
|
+
return params
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def amp2sh_various_file_cargs(
|
|
203
|
+
params: Amp2shVariousFileParameters,
|
|
204
|
+
execution: Execution,
|
|
205
|
+
) -> list[str]:
|
|
206
|
+
"""
|
|
207
|
+
Build command-line arguments from parameters.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
params: The parameters.
|
|
211
|
+
execution: The execution object for resolving input paths.
|
|
212
|
+
Returns:
|
|
213
|
+
Command-line arguments.
|
|
214
|
+
"""
|
|
215
|
+
cargs = []
|
|
216
|
+
cargs.append(execution.input_file(params.get("obj")))
|
|
217
|
+
return cargs
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def amp2sh_config_params(
|
|
221
|
+
key: str,
|
|
222
|
+
value: str,
|
|
223
|
+
) -> Amp2shConfigParameters:
|
|
224
|
+
"""
|
|
225
|
+
Build parameters.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
229
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
230
|
+
Returns:
|
|
231
|
+
Parameter dictionary
|
|
232
|
+
"""
|
|
233
|
+
params = {
|
|
234
|
+
"__STYXTYPE__": "config",
|
|
235
|
+
"key": key,
|
|
236
|
+
"value": value,
|
|
237
|
+
}
|
|
238
|
+
return params
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def amp2sh_config_cargs(
|
|
242
|
+
params: Amp2shConfigParameters,
|
|
243
|
+
execution: Execution,
|
|
244
|
+
) -> list[str]:
|
|
245
|
+
"""
|
|
246
|
+
Build command-line arguments from parameters.
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
params: The parameters.
|
|
250
|
+
execution: The execution object for resolving input paths.
|
|
251
|
+
Returns:
|
|
252
|
+
Command-line arguments.
|
|
253
|
+
"""
|
|
254
|
+
cargs = []
|
|
255
|
+
cargs.append("-config")
|
|
256
|
+
cargs.append(params.get("key"))
|
|
257
|
+
cargs.append(params.get("value"))
|
|
258
|
+
return cargs
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class Amp2shOutputs(typing.NamedTuple):
|
|
262
|
+
"""
|
|
263
|
+
Output object returned when calling `amp2sh(...)`.
|
|
264
|
+
"""
|
|
265
|
+
root: OutputPathType
|
|
266
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
267
|
+
sh: OutputPathType
|
|
268
|
+
"""the output spherical harmonics coefficients image."""
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def amp2sh_params(
|
|
272
|
+
amp: InputPathType,
|
|
273
|
+
sh: str,
|
|
274
|
+
lmax: int | None = None,
|
|
275
|
+
normalise: bool = False,
|
|
276
|
+
directions: InputPathType | None = None,
|
|
277
|
+
rician: InputPathType | None = None,
|
|
278
|
+
grad: InputPathType | None = None,
|
|
279
|
+
fslgrad: Amp2shFslgradParameters | None = None,
|
|
280
|
+
shells: list[float] | None = None,
|
|
281
|
+
strides: typing.Union[Amp2shVariousStringParameters, Amp2shVariousFileParameters] | None = None,
|
|
282
|
+
info: bool = False,
|
|
283
|
+
quiet: bool = False,
|
|
284
|
+
debug: bool = False,
|
|
285
|
+
force: bool = False,
|
|
286
|
+
nthreads: int | None = None,
|
|
287
|
+
config: list[Amp2shConfigParameters] | None = None,
|
|
288
|
+
help_: bool = False,
|
|
289
|
+
version: bool = False,
|
|
290
|
+
) -> Amp2shParameters:
|
|
291
|
+
"""
|
|
292
|
+
Build parameters.
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
amp: the input amplitude image.
|
|
296
|
+
sh: the output spherical harmonics coefficients image.
|
|
297
|
+
lmax: set the maximum harmonic order for the output series. By default,\
|
|
298
|
+
the program will use the highest possible lmax given the number of\
|
|
299
|
+
diffusion-weighted images, up to a maximum of 8.
|
|
300
|
+
normalise: normalise the DW signal to the b=0 image.
|
|
301
|
+
directions: the directions corresponding to the input amplitude image\
|
|
302
|
+
used to sample AFD. By default this option is not required providing\
|
|
303
|
+
the direction set is supplied in the amplitude image. This should be\
|
|
304
|
+
supplied as a list of directions [az el], as generated using the dirgen\
|
|
305
|
+
command, or as a list of [ x y z ] Cartesian coordinates.
|
|
306
|
+
rician: correct for Rician noise induced bias, using noise map supplied.
|
|
307
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
308
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
309
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
310
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
311
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
312
|
+
header, the data provided with this option will be instead used.
|
|
313
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
314
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
315
|
+
scheme is present in the input image header, the data provided with\
|
|
316
|
+
this option will be instead used.
|
|
317
|
+
shells: specify one or more b-values to use during processing, as a\
|
|
318
|
+
comma-separated list of the desired approximate b-values (b-values are\
|
|
319
|
+
clustered to allow for small deviations). Note that some commands are\
|
|
320
|
+
incompatible with multiple b-values, and will report an error if more\
|
|
321
|
+
than one b-value is provided.\
|
|
322
|
+
WARNING: note that, even though the b=0 volumes are never referred\
|
|
323
|
+
to as shells in the literature, they still have to be explicitly\
|
|
324
|
+
included in the list of b-values as provided to the -shell option!\
|
|
325
|
+
Several algorithms which include the b=0 volumes in their\
|
|
326
|
+
computations may otherwise return an undesired result.
|
|
327
|
+
strides: specify the strides of the output data in memory; either as a\
|
|
328
|
+
comma-separated list of (signed) integers, or as a template image from\
|
|
329
|
+
which the strides shall be extracted and used. The actual strides\
|
|
330
|
+
produced will depend on whether the output image format can support it.
|
|
331
|
+
info: display information messages.
|
|
332
|
+
quiet: do not display information messages or progress status;\
|
|
333
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
334
|
+
environment variable to a non-empty string.
|
|
335
|
+
debug: display debugging messages.
|
|
336
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
337
|
+
input and output might cause unexpected behaviour).
|
|
338
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
339
|
+
(set to 0 to disable multi-threading).
|
|
340
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
341
|
+
help_: display this information page and exit.
|
|
342
|
+
version: display version information and exit.
|
|
343
|
+
Returns:
|
|
344
|
+
Parameter dictionary
|
|
345
|
+
"""
|
|
346
|
+
params = {
|
|
347
|
+
"__STYXTYPE__": "amp2sh",
|
|
348
|
+
"normalise": normalise,
|
|
349
|
+
"info": info,
|
|
350
|
+
"quiet": quiet,
|
|
351
|
+
"debug": debug,
|
|
352
|
+
"force": force,
|
|
353
|
+
"help": help_,
|
|
354
|
+
"version": version,
|
|
355
|
+
"amp": amp,
|
|
356
|
+
"SH": sh,
|
|
357
|
+
}
|
|
358
|
+
if lmax is not None:
|
|
359
|
+
params["lmax"] = lmax
|
|
360
|
+
if directions is not None:
|
|
361
|
+
params["directions"] = directions
|
|
362
|
+
if rician is not None:
|
|
363
|
+
params["rician"] = rician
|
|
364
|
+
if grad is not None:
|
|
365
|
+
params["grad"] = grad
|
|
366
|
+
if fslgrad is not None:
|
|
367
|
+
params["fslgrad"] = fslgrad
|
|
368
|
+
if shells is not None:
|
|
369
|
+
params["shells"] = shells
|
|
370
|
+
if strides is not None:
|
|
371
|
+
params["strides"] = strides
|
|
372
|
+
if nthreads is not None:
|
|
373
|
+
params["nthreads"] = nthreads
|
|
374
|
+
if config is not None:
|
|
375
|
+
params["config"] = config
|
|
376
|
+
return params
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
def amp2sh_cargs(
|
|
380
|
+
params: Amp2shParameters,
|
|
381
|
+
execution: Execution,
|
|
382
|
+
) -> list[str]:
|
|
383
|
+
"""
|
|
384
|
+
Build command-line arguments from parameters.
|
|
385
|
+
|
|
386
|
+
Args:
|
|
387
|
+
params: The parameters.
|
|
388
|
+
execution: The execution object for resolving input paths.
|
|
389
|
+
Returns:
|
|
390
|
+
Command-line arguments.
|
|
391
|
+
"""
|
|
392
|
+
cargs = []
|
|
393
|
+
cargs.append("amp2sh")
|
|
394
|
+
if params.get("lmax") is not None:
|
|
395
|
+
cargs.extend([
|
|
396
|
+
"-lmax",
|
|
397
|
+
str(params.get("lmax"))
|
|
398
|
+
])
|
|
399
|
+
if params.get("normalise"):
|
|
400
|
+
cargs.append("-normalise")
|
|
401
|
+
if params.get("directions") is not None:
|
|
402
|
+
cargs.extend([
|
|
403
|
+
"-directions",
|
|
404
|
+
execution.input_file(params.get("directions"))
|
|
405
|
+
])
|
|
406
|
+
if params.get("rician") is not None:
|
|
407
|
+
cargs.extend([
|
|
408
|
+
"-rician",
|
|
409
|
+
execution.input_file(params.get("rician"))
|
|
410
|
+
])
|
|
411
|
+
if params.get("grad") is not None:
|
|
412
|
+
cargs.extend([
|
|
413
|
+
"-grad",
|
|
414
|
+
execution.input_file(params.get("grad"))
|
|
415
|
+
])
|
|
416
|
+
if params.get("fslgrad") is not None:
|
|
417
|
+
cargs.extend(dyn_cargs(params.get("fslgrad")["__STYXTYPE__"])(params.get("fslgrad"), execution))
|
|
418
|
+
if params.get("shells") is not None:
|
|
419
|
+
cargs.extend([
|
|
420
|
+
"-shells",
|
|
421
|
+
",".join(map(str, params.get("shells")))
|
|
422
|
+
])
|
|
423
|
+
if params.get("strides") is not None:
|
|
424
|
+
cargs.extend([
|
|
425
|
+
"-strides",
|
|
426
|
+
*dyn_cargs(params.get("strides")["__STYXTYPE__"])(params.get("strides"), execution)
|
|
427
|
+
])
|
|
428
|
+
if params.get("info"):
|
|
429
|
+
cargs.append("-info")
|
|
430
|
+
if params.get("quiet"):
|
|
431
|
+
cargs.append("-quiet")
|
|
432
|
+
if params.get("debug"):
|
|
433
|
+
cargs.append("-debug")
|
|
434
|
+
if params.get("force"):
|
|
435
|
+
cargs.append("-force")
|
|
436
|
+
if params.get("nthreads") is not None:
|
|
437
|
+
cargs.extend([
|
|
438
|
+
"-nthreads",
|
|
439
|
+
str(params.get("nthreads"))
|
|
440
|
+
])
|
|
441
|
+
if params.get("config") is not None:
|
|
442
|
+
cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
|
|
443
|
+
if params.get("help"):
|
|
444
|
+
cargs.append("-help")
|
|
445
|
+
if params.get("version"):
|
|
446
|
+
cargs.append("-version")
|
|
447
|
+
cargs.append(execution.input_file(params.get("amp")))
|
|
448
|
+
cargs.append(params.get("SH"))
|
|
449
|
+
return cargs
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def amp2sh_outputs(
|
|
453
|
+
params: Amp2shParameters,
|
|
454
|
+
execution: Execution,
|
|
455
|
+
) -> Amp2shOutputs:
|
|
456
|
+
"""
|
|
457
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
458
|
+
|
|
459
|
+
Args:
|
|
460
|
+
params: The parameters.
|
|
461
|
+
execution: The execution object for resolving input paths.
|
|
462
|
+
Returns:
|
|
463
|
+
Outputs object.
|
|
464
|
+
"""
|
|
465
|
+
ret = Amp2shOutputs(
|
|
466
|
+
root=execution.output_file("."),
|
|
467
|
+
sh=execution.output_file(params.get("SH")),
|
|
468
|
+
)
|
|
469
|
+
return ret
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
def amp2sh_execute(
|
|
473
|
+
params: Amp2shParameters,
|
|
474
|
+
execution: Execution,
|
|
475
|
+
) -> Amp2shOutputs:
|
|
476
|
+
"""
|
|
477
|
+
Convert a set of amplitudes (defined along a set of corresponding directions) to
|
|
478
|
+
their spherical harmonic representation.
|
|
479
|
+
|
|
480
|
+
The spherical harmonic decomposition is calculated by least-squares linear
|
|
481
|
+
fitting to the amplitude data.
|
|
482
|
+
|
|
483
|
+
The directions can be defined either as a DW gradient scheme (for example to
|
|
484
|
+
compute the SH representation of the DW signal), a set of [az el] pairs as
|
|
485
|
+
output by the dirgen command, or a set of [ x y z ] directions in Cartesian
|
|
486
|
+
coordinates. The DW gradient scheme or direction set can be supplied within
|
|
487
|
+
the input image header or using the -gradient or -directions option. Note
|
|
488
|
+
that if a direction set and DW gradient scheme can be found, the direction
|
|
489
|
+
set will be used by default.
|
|
490
|
+
|
|
491
|
+
The spherical harmonic coefficients are stored according the conventions
|
|
492
|
+
described the main documentation, which can be found at the following link:
|
|
493
|
+
https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
|
|
494
|
+
|
|
495
|
+
References:
|
|
496
|
+
|
|
497
|
+
.
|
|
498
|
+
|
|
499
|
+
Author: MRTrix3 Developers
|
|
500
|
+
|
|
501
|
+
URL: https://www.mrtrix.org/
|
|
502
|
+
|
|
503
|
+
Args:
|
|
504
|
+
params: The parameters.
|
|
505
|
+
execution: The execution object.
|
|
506
|
+
Returns:
|
|
507
|
+
NamedTuple of outputs (described in `Amp2shOutputs`).
|
|
508
|
+
"""
|
|
509
|
+
params = execution.params(params)
|
|
510
|
+
cargs = amp2sh_cargs(params, execution)
|
|
511
|
+
ret = amp2sh_outputs(params, execution)
|
|
512
|
+
execution.run(cargs)
|
|
513
|
+
return ret
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
def amp2sh(
|
|
517
|
+
amp: InputPathType,
|
|
518
|
+
sh: str,
|
|
519
|
+
lmax: int | None = None,
|
|
520
|
+
normalise: bool = False,
|
|
521
|
+
directions: InputPathType | None = None,
|
|
522
|
+
rician: InputPathType | None = None,
|
|
523
|
+
grad: InputPathType | None = None,
|
|
524
|
+
fslgrad: Amp2shFslgradParameters | None = None,
|
|
525
|
+
shells: list[float] | None = None,
|
|
526
|
+
strides: typing.Union[Amp2shVariousStringParameters, Amp2shVariousFileParameters] | None = None,
|
|
527
|
+
info: bool = False,
|
|
528
|
+
quiet: bool = False,
|
|
529
|
+
debug: bool = False,
|
|
530
|
+
force: bool = False,
|
|
531
|
+
nthreads: int | None = None,
|
|
532
|
+
config: list[Amp2shConfigParameters] | None = None,
|
|
533
|
+
help_: bool = False,
|
|
534
|
+
version: bool = False,
|
|
535
|
+
runner: Runner | None = None,
|
|
536
|
+
) -> Amp2shOutputs:
|
|
537
|
+
"""
|
|
538
|
+
Convert a set of amplitudes (defined along a set of corresponding directions) to
|
|
539
|
+
their spherical harmonic representation.
|
|
540
|
+
|
|
541
|
+
The spherical harmonic decomposition is calculated by least-squares linear
|
|
542
|
+
fitting to the amplitude data.
|
|
543
|
+
|
|
544
|
+
The directions can be defined either as a DW gradient scheme (for example to
|
|
545
|
+
compute the SH representation of the DW signal), a set of [az el] pairs as
|
|
546
|
+
output by the dirgen command, or a set of [ x y z ] directions in Cartesian
|
|
547
|
+
coordinates. The DW gradient scheme or direction set can be supplied within
|
|
548
|
+
the input image header or using the -gradient or -directions option. Note
|
|
549
|
+
that if a direction set and DW gradient scheme can be found, the direction
|
|
550
|
+
set will be used by default.
|
|
551
|
+
|
|
552
|
+
The spherical harmonic coefficients are stored according the conventions
|
|
553
|
+
described the main documentation, which can be found at the following link:
|
|
554
|
+
https://mrtrix.readthedocs.io/en/3.0.4/concepts/spherical_harmonics.html
|
|
555
|
+
|
|
556
|
+
References:
|
|
557
|
+
|
|
558
|
+
.
|
|
559
|
+
|
|
560
|
+
Author: MRTrix3 Developers
|
|
561
|
+
|
|
562
|
+
URL: https://www.mrtrix.org/
|
|
563
|
+
|
|
564
|
+
Args:
|
|
565
|
+
amp: the input amplitude image.
|
|
566
|
+
sh: the output spherical harmonics coefficients image.
|
|
567
|
+
lmax: set the maximum harmonic order for the output series. By default,\
|
|
568
|
+
the program will use the highest possible lmax given the number of\
|
|
569
|
+
diffusion-weighted images, up to a maximum of 8.
|
|
570
|
+
normalise: normalise the DW signal to the b=0 image.
|
|
571
|
+
directions: the directions corresponding to the input amplitude image\
|
|
572
|
+
used to sample AFD. By default this option is not required providing\
|
|
573
|
+
the direction set is supplied in the amplitude image. This should be\
|
|
574
|
+
supplied as a list of directions [az el], as generated using the dirgen\
|
|
575
|
+
command, or as a list of [ x y z ] Cartesian coordinates.
|
|
576
|
+
rician: correct for Rician noise induced bias, using noise map supplied.
|
|
577
|
+
grad: Provide the diffusion-weighted gradient scheme used in the\
|
|
578
|
+
acquisition in a text file. This should be supplied as a 4xN text file\
|
|
579
|
+
with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
|
|
580
|
+
the direction of the applied gradient, and b gives the b-value in units\
|
|
581
|
+
of s/mm^2. If a diffusion gradient scheme is present in the input image\
|
|
582
|
+
header, the data provided with this option will be instead used.
|
|
583
|
+
fslgrad: Provide the diffusion-weighted gradient scheme used in the\
|
|
584
|
+
acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
|
|
585
|
+
scheme is present in the input image header, the data provided with\
|
|
586
|
+
this option will be instead used.
|
|
587
|
+
shells: specify one or more b-values to use during processing, as a\
|
|
588
|
+
comma-separated list of the desired approximate b-values (b-values are\
|
|
589
|
+
clustered to allow for small deviations). Note that some commands are\
|
|
590
|
+
incompatible with multiple b-values, and will report an error if more\
|
|
591
|
+
than one b-value is provided.\
|
|
592
|
+
WARNING: note that, even though the b=0 volumes are never referred\
|
|
593
|
+
to as shells in the literature, they still have to be explicitly\
|
|
594
|
+
included in the list of b-values as provided to the -shell option!\
|
|
595
|
+
Several algorithms which include the b=0 volumes in their\
|
|
596
|
+
computations may otherwise return an undesired result.
|
|
597
|
+
strides: specify the strides of the output data in memory; either as a\
|
|
598
|
+
comma-separated list of (signed) integers, or as a template image from\
|
|
599
|
+
which the strides shall be extracted and used. The actual strides\
|
|
600
|
+
produced will depend on whether the output image format can support it.
|
|
601
|
+
info: display information messages.
|
|
602
|
+
quiet: do not display information messages or progress status;\
|
|
603
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
604
|
+
environment variable to a non-empty string.
|
|
605
|
+
debug: display debugging messages.
|
|
606
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
607
|
+
input and output might cause unexpected behaviour).
|
|
608
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
609
|
+
(set to 0 to disable multi-threading).
|
|
610
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
611
|
+
help_: display this information page and exit.
|
|
612
|
+
version: display version information and exit.
|
|
613
|
+
runner: Command runner.
|
|
614
|
+
Returns:
|
|
615
|
+
NamedTuple of outputs (described in `Amp2shOutputs`).
|
|
616
|
+
"""
|
|
617
|
+
runner = runner or get_global_runner()
|
|
618
|
+
execution = runner.start_execution(AMP2SH_METADATA)
|
|
619
|
+
params = amp2sh_params(
|
|
620
|
+
lmax=lmax,
|
|
621
|
+
normalise=normalise,
|
|
622
|
+
directions=directions,
|
|
623
|
+
rician=rician,
|
|
624
|
+
grad=grad,
|
|
625
|
+
fslgrad=fslgrad,
|
|
626
|
+
shells=shells,
|
|
627
|
+
strides=strides,
|
|
628
|
+
info=info,
|
|
629
|
+
quiet=quiet,
|
|
630
|
+
debug=debug,
|
|
631
|
+
force=force,
|
|
632
|
+
nthreads=nthreads,
|
|
633
|
+
config=config,
|
|
634
|
+
help_=help_,
|
|
635
|
+
version=version,
|
|
636
|
+
amp=amp,
|
|
637
|
+
sh=sh,
|
|
638
|
+
)
|
|
639
|
+
return amp2sh_execute(params, execution)
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
__all__ = [
|
|
643
|
+
"AMP2SH_METADATA",
|
|
644
|
+
"Amp2shConfigParameters",
|
|
645
|
+
"Amp2shFslgradParameters",
|
|
646
|
+
"Amp2shOutputs",
|
|
647
|
+
"Amp2shParameters",
|
|
648
|
+
"Amp2shVariousFileParameters",
|
|
649
|
+
"Amp2shVariousStringParameters",
|
|
650
|
+
"amp2sh",
|
|
651
|
+
"amp2sh_config_params",
|
|
652
|
+
"amp2sh_fslgrad_params",
|
|
653
|
+
"amp2sh_params",
|
|
654
|
+
"amp2sh_various_file_params",
|
|
655
|
+
"amp2sh_various_string_params",
|
|
656
|
+
]
|