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,596 @@
|
|
|
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
|
+
MTNORMALISE_METADATA = Metadata(
|
|
9
|
+
id="3709b0ca1455372ea3dda75e22e31168270b187c.boutiques",
|
|
10
|
+
name="mtnormalise",
|
|
11
|
+
package="mrtrix",
|
|
12
|
+
container_image_tag="mrtrix3/mrtrix3:3.0.4",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
MtnormaliseConfigParameters = typing.TypedDict('MtnormaliseConfigParameters', {
|
|
17
|
+
"__STYX_TYPE__": typing.Literal["config"],
|
|
18
|
+
"key": str,
|
|
19
|
+
"value": str,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
MtnormaliseInputOutputParameters = typing.TypedDict('MtnormaliseInputOutputParameters', {
|
|
24
|
+
"__STYX_TYPE__": typing.Literal["input_output"],
|
|
25
|
+
"input": InputPathType,
|
|
26
|
+
"output": str,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
MtnormaliseParameters = typing.TypedDict('MtnormaliseParameters', {
|
|
31
|
+
"__STYX_TYPE__": typing.Literal["mtnormalise"],
|
|
32
|
+
"mask": InputPathType,
|
|
33
|
+
"order": typing.NotRequired[str | None],
|
|
34
|
+
"niter": typing.NotRequired[list[int] | None],
|
|
35
|
+
"reference": typing.NotRequired[float | None],
|
|
36
|
+
"balanced": bool,
|
|
37
|
+
"check_norm": typing.NotRequired[str | None],
|
|
38
|
+
"check_mask": typing.NotRequired[str | None],
|
|
39
|
+
"check_factors": typing.NotRequired[str | None],
|
|
40
|
+
"info": bool,
|
|
41
|
+
"quiet": bool,
|
|
42
|
+
"debug": bool,
|
|
43
|
+
"force": bool,
|
|
44
|
+
"nthreads": typing.NotRequired[int | None],
|
|
45
|
+
"config": typing.NotRequired[list[MtnormaliseConfigParameters] | None],
|
|
46
|
+
"help": bool,
|
|
47
|
+
"version": bool,
|
|
48
|
+
"input_output": list[MtnormaliseInputOutputParameters],
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def dyn_cargs(
|
|
53
|
+
t: str,
|
|
54
|
+
) -> typing.Any:
|
|
55
|
+
"""
|
|
56
|
+
Get build cargs function by command type.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
t: Command type.
|
|
60
|
+
Returns:
|
|
61
|
+
Build cargs function.
|
|
62
|
+
"""
|
|
63
|
+
return {
|
|
64
|
+
"mtnormalise": mtnormalise_cargs,
|
|
65
|
+
"config": mtnormalise_config_cargs,
|
|
66
|
+
"input_output": mtnormalise_input_output_cargs,
|
|
67
|
+
}.get(t)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def dyn_outputs(
|
|
71
|
+
t: str,
|
|
72
|
+
) -> typing.Any:
|
|
73
|
+
"""
|
|
74
|
+
Get build outputs function by command type.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
t: Command type.
|
|
78
|
+
Returns:
|
|
79
|
+
Build outputs function.
|
|
80
|
+
"""
|
|
81
|
+
return {
|
|
82
|
+
"mtnormalise": mtnormalise_outputs,
|
|
83
|
+
"input_output": mtnormalise_input_output_outputs,
|
|
84
|
+
}.get(t)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def mtnormalise_config_params(
|
|
88
|
+
key: str,
|
|
89
|
+
value: str,
|
|
90
|
+
) -> MtnormaliseConfigParameters:
|
|
91
|
+
"""
|
|
92
|
+
Build parameters.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
key: temporarily set the value of an MRtrix config file entry.
|
|
96
|
+
value: temporarily set the value of an MRtrix config file entry.
|
|
97
|
+
Returns:
|
|
98
|
+
Parameter dictionary
|
|
99
|
+
"""
|
|
100
|
+
params = {
|
|
101
|
+
"__STYXTYPE__": "config",
|
|
102
|
+
"key": key,
|
|
103
|
+
"value": value,
|
|
104
|
+
}
|
|
105
|
+
return params
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def mtnormalise_config_cargs(
|
|
109
|
+
params: MtnormaliseConfigParameters,
|
|
110
|
+
execution: Execution,
|
|
111
|
+
) -> list[str]:
|
|
112
|
+
"""
|
|
113
|
+
Build command-line arguments from parameters.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
params: The parameters.
|
|
117
|
+
execution: The execution object for resolving input paths.
|
|
118
|
+
Returns:
|
|
119
|
+
Command-line arguments.
|
|
120
|
+
"""
|
|
121
|
+
cargs = []
|
|
122
|
+
cargs.append("-config")
|
|
123
|
+
cargs.append(params.get("key"))
|
|
124
|
+
cargs.append(params.get("value"))
|
|
125
|
+
return cargs
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class MtnormaliseInputOutputOutputs(typing.NamedTuple):
|
|
129
|
+
"""
|
|
130
|
+
Output object returned when calling `list[MtnormaliseInputOutputParameters](...)`.
|
|
131
|
+
"""
|
|
132
|
+
root: OutputPathType
|
|
133
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
134
|
+
output: OutputPathType
|
|
135
|
+
"""output normalised tissue compartment image."""
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def mtnormalise_input_output_params(
|
|
139
|
+
input_: InputPathType,
|
|
140
|
+
output: str,
|
|
141
|
+
) -> MtnormaliseInputOutputParameters:
|
|
142
|
+
"""
|
|
143
|
+
Build parameters.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
input_: input tissue compartment image.
|
|
147
|
+
output: output normalised tissue compartment image.
|
|
148
|
+
Returns:
|
|
149
|
+
Parameter dictionary
|
|
150
|
+
"""
|
|
151
|
+
params = {
|
|
152
|
+
"__STYXTYPE__": "input_output",
|
|
153
|
+
"input": input_,
|
|
154
|
+
"output": output,
|
|
155
|
+
}
|
|
156
|
+
return params
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def mtnormalise_input_output_cargs(
|
|
160
|
+
params: MtnormaliseInputOutputParameters,
|
|
161
|
+
execution: Execution,
|
|
162
|
+
) -> list[str]:
|
|
163
|
+
"""
|
|
164
|
+
Build command-line arguments from parameters.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
params: The parameters.
|
|
168
|
+
execution: The execution object for resolving input paths.
|
|
169
|
+
Returns:
|
|
170
|
+
Command-line arguments.
|
|
171
|
+
"""
|
|
172
|
+
cargs = []
|
|
173
|
+
cargs.append(execution.input_file(params.get("input")))
|
|
174
|
+
cargs.append(params.get("output"))
|
|
175
|
+
return cargs
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def mtnormalise_input_output_outputs(
|
|
179
|
+
params: MtnormaliseInputOutputParameters,
|
|
180
|
+
execution: Execution,
|
|
181
|
+
) -> MtnormaliseInputOutputOutputs:
|
|
182
|
+
"""
|
|
183
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
params: The parameters.
|
|
187
|
+
execution: The execution object for resolving input paths.
|
|
188
|
+
Returns:
|
|
189
|
+
Outputs object.
|
|
190
|
+
"""
|
|
191
|
+
ret = MtnormaliseInputOutputOutputs(
|
|
192
|
+
root=execution.output_file("."),
|
|
193
|
+
output=execution.output_file(params.get("output")),
|
|
194
|
+
)
|
|
195
|
+
return ret
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class MtnormaliseOutputs(typing.NamedTuple):
|
|
199
|
+
"""
|
|
200
|
+
Output object returned when calling `mtnormalise(...)`.
|
|
201
|
+
"""
|
|
202
|
+
root: OutputPathType
|
|
203
|
+
"""Output root folder. This is the root folder for all outputs."""
|
|
204
|
+
check_norm: OutputPathType | None
|
|
205
|
+
"""output the final estimated spatially varying intensity level that is used
|
|
206
|
+
for normalisation. """
|
|
207
|
+
check_mask: OutputPathType | None
|
|
208
|
+
"""output the final mask used to compute the normalisation. This mask
|
|
209
|
+
excludes regions identified as outliers by the optimisation process. """
|
|
210
|
+
check_factors: OutputPathType | None
|
|
211
|
+
"""output the tissue balance factors computed during normalisation. """
|
|
212
|
+
input_output: list[MtnormaliseInputOutputOutputs]
|
|
213
|
+
"""Outputs from `mtnormalise_input_output_outputs`.This is a list of outputs
|
|
214
|
+
with the same length and order as the inputs."""
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def mtnormalise_params(
|
|
218
|
+
mask: InputPathType,
|
|
219
|
+
input_output: list[MtnormaliseInputOutputParameters],
|
|
220
|
+
order: str | None = None,
|
|
221
|
+
niter: list[int] | None = None,
|
|
222
|
+
reference: float | None = None,
|
|
223
|
+
balanced: bool = False,
|
|
224
|
+
check_norm: str | None = None,
|
|
225
|
+
check_mask: str | None = None,
|
|
226
|
+
check_factors: str | None = None,
|
|
227
|
+
info: bool = False,
|
|
228
|
+
quiet: bool = False,
|
|
229
|
+
debug: bool = False,
|
|
230
|
+
force: bool = False,
|
|
231
|
+
nthreads: int | None = None,
|
|
232
|
+
config: list[MtnormaliseConfigParameters] | None = None,
|
|
233
|
+
help_: bool = False,
|
|
234
|
+
version: bool = False,
|
|
235
|
+
) -> MtnormaliseParameters:
|
|
236
|
+
"""
|
|
237
|
+
Build parameters.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
mask: the mask defines the data used to compute the intensity\
|
|
241
|
+
normalisation. This option is mandatory.
|
|
242
|
+
input_output: list of all input and output tissue compartment files\
|
|
243
|
+
(see example usage).
|
|
244
|
+
order: the maximum order of the polynomial basis used to fit the\
|
|
245
|
+
normalisation field in the log-domain. An order of 0 is equivalent to\
|
|
246
|
+
not allowing spatial variance of the intensity normalisation factor.\
|
|
247
|
+
(default: 3).
|
|
248
|
+
niter: set the number of iterations. The first (and potentially only)\
|
|
249
|
+
entry applies to the main loop. If supplied as a comma-separated list\
|
|
250
|
+
of integers, the second entry applies to the inner loop to update the\
|
|
251
|
+
balance factors (default: 15,7).
|
|
252
|
+
reference: specify the (positive) reference value to which the summed\
|
|
253
|
+
tissue compartments will be normalised. (default: 0.282095, SH DC term\
|
|
254
|
+
for unit angular integral).
|
|
255
|
+
balanced: incorporate the per-tissue balancing factors into scaling of\
|
|
256
|
+
the output images (NOTE: use of this option has critical consequences\
|
|
257
|
+
for AFD intensity normalisation; should not be used unless these\
|
|
258
|
+
consequences are fully understood).
|
|
259
|
+
check_norm: output the final estimated spatially varying intensity\
|
|
260
|
+
level that is used for normalisation.
|
|
261
|
+
check_mask: output the final mask used to compute the normalisation.\
|
|
262
|
+
This mask excludes regions identified as outliers by the optimisation\
|
|
263
|
+
process.
|
|
264
|
+
check_factors: output the tissue balance factors computed during\
|
|
265
|
+
normalisation.
|
|
266
|
+
info: display information messages.
|
|
267
|
+
quiet: do not display information messages or progress status;\
|
|
268
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
269
|
+
environment variable to a non-empty string.
|
|
270
|
+
debug: display debugging messages.
|
|
271
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
272
|
+
input and output might cause unexpected behaviour).
|
|
273
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
274
|
+
(set to 0 to disable multi-threading).
|
|
275
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
276
|
+
help_: display this information page and exit.
|
|
277
|
+
version: display version information and exit.
|
|
278
|
+
Returns:
|
|
279
|
+
Parameter dictionary
|
|
280
|
+
"""
|
|
281
|
+
params = {
|
|
282
|
+
"__STYXTYPE__": "mtnormalise",
|
|
283
|
+
"mask": mask,
|
|
284
|
+
"balanced": balanced,
|
|
285
|
+
"info": info,
|
|
286
|
+
"quiet": quiet,
|
|
287
|
+
"debug": debug,
|
|
288
|
+
"force": force,
|
|
289
|
+
"help": help_,
|
|
290
|
+
"version": version,
|
|
291
|
+
"input_output": input_output,
|
|
292
|
+
}
|
|
293
|
+
if order is not None:
|
|
294
|
+
params["order"] = order
|
|
295
|
+
if niter is not None:
|
|
296
|
+
params["niter"] = niter
|
|
297
|
+
if reference is not None:
|
|
298
|
+
params["reference"] = reference
|
|
299
|
+
if check_norm is not None:
|
|
300
|
+
params["check_norm"] = check_norm
|
|
301
|
+
if check_mask is not None:
|
|
302
|
+
params["check_mask"] = check_mask
|
|
303
|
+
if check_factors is not None:
|
|
304
|
+
params["check_factors"] = check_factors
|
|
305
|
+
if nthreads is not None:
|
|
306
|
+
params["nthreads"] = nthreads
|
|
307
|
+
if config is not None:
|
|
308
|
+
params["config"] = config
|
|
309
|
+
return params
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def mtnormalise_cargs(
|
|
313
|
+
params: MtnormaliseParameters,
|
|
314
|
+
execution: Execution,
|
|
315
|
+
) -> list[str]:
|
|
316
|
+
"""
|
|
317
|
+
Build command-line arguments from parameters.
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
params: The parameters.
|
|
321
|
+
execution: The execution object for resolving input paths.
|
|
322
|
+
Returns:
|
|
323
|
+
Command-line arguments.
|
|
324
|
+
"""
|
|
325
|
+
cargs = []
|
|
326
|
+
cargs.append("mtnormalise")
|
|
327
|
+
cargs.extend([
|
|
328
|
+
"-mask",
|
|
329
|
+
execution.input_file(params.get("mask"))
|
|
330
|
+
])
|
|
331
|
+
if params.get("order") is not None:
|
|
332
|
+
cargs.extend([
|
|
333
|
+
"-order",
|
|
334
|
+
params.get("order")
|
|
335
|
+
])
|
|
336
|
+
if params.get("niter") is not None:
|
|
337
|
+
cargs.extend([
|
|
338
|
+
"-niter",
|
|
339
|
+
",".join(map(str, params.get("niter")))
|
|
340
|
+
])
|
|
341
|
+
if params.get("reference") is not None:
|
|
342
|
+
cargs.extend([
|
|
343
|
+
"-reference",
|
|
344
|
+
str(params.get("reference"))
|
|
345
|
+
])
|
|
346
|
+
if params.get("balanced"):
|
|
347
|
+
cargs.append("-balanced")
|
|
348
|
+
if params.get("check_norm") is not None:
|
|
349
|
+
cargs.extend([
|
|
350
|
+
"-check_norm",
|
|
351
|
+
params.get("check_norm")
|
|
352
|
+
])
|
|
353
|
+
if params.get("check_mask") is not None:
|
|
354
|
+
cargs.extend([
|
|
355
|
+
"-check_mask",
|
|
356
|
+
params.get("check_mask")
|
|
357
|
+
])
|
|
358
|
+
if params.get("check_factors") is not None:
|
|
359
|
+
cargs.extend([
|
|
360
|
+
"-check_factors",
|
|
361
|
+
params.get("check_factors")
|
|
362
|
+
])
|
|
363
|
+
if params.get("info"):
|
|
364
|
+
cargs.append("-info")
|
|
365
|
+
if params.get("quiet"):
|
|
366
|
+
cargs.append("-quiet")
|
|
367
|
+
if params.get("debug"):
|
|
368
|
+
cargs.append("-debug")
|
|
369
|
+
if params.get("force"):
|
|
370
|
+
cargs.append("-force")
|
|
371
|
+
if params.get("nthreads") is not None:
|
|
372
|
+
cargs.extend([
|
|
373
|
+
"-nthreads",
|
|
374
|
+
str(params.get("nthreads"))
|
|
375
|
+
])
|
|
376
|
+
if params.get("config") is not None:
|
|
377
|
+
cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
|
|
378
|
+
if params.get("help"):
|
|
379
|
+
cargs.append("-help")
|
|
380
|
+
if params.get("version"):
|
|
381
|
+
cargs.append("-version")
|
|
382
|
+
cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("input_output")] for a in c])
|
|
383
|
+
return cargs
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def mtnormalise_outputs(
|
|
387
|
+
params: MtnormaliseParameters,
|
|
388
|
+
execution: Execution,
|
|
389
|
+
) -> MtnormaliseOutputs:
|
|
390
|
+
"""
|
|
391
|
+
Build outputs object containing output file paths and possibly stdout/stderr.
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
params: The parameters.
|
|
395
|
+
execution: The execution object for resolving input paths.
|
|
396
|
+
Returns:
|
|
397
|
+
Outputs object.
|
|
398
|
+
"""
|
|
399
|
+
ret = MtnormaliseOutputs(
|
|
400
|
+
root=execution.output_file("."),
|
|
401
|
+
check_norm=execution.output_file(params.get("check_norm")) if (params.get("check_norm") is not None) else None,
|
|
402
|
+
check_mask=execution.output_file(params.get("check_mask")) if (params.get("check_mask") is not None) else None,
|
|
403
|
+
check_factors=execution.output_file(params.get("check_factors")) if (params.get("check_factors") is not None) else None,
|
|
404
|
+
input_output=[dyn_outputs(i["__STYXTYPE__"])(i, execution) if dyn_outputs(i["__STYXTYPE__"]) else None for i in params.get("input_output")],
|
|
405
|
+
)
|
|
406
|
+
return ret
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def mtnormalise_execute(
|
|
410
|
+
params: MtnormaliseParameters,
|
|
411
|
+
execution: Execution,
|
|
412
|
+
) -> MtnormaliseOutputs:
|
|
413
|
+
"""
|
|
414
|
+
Multi-tissue informed log-domain intensity normalisation.
|
|
415
|
+
|
|
416
|
+
This command takes as input any number of tissue components (e.g. from
|
|
417
|
+
multi-tissue CSD) and outputs corresponding normalised tissue components
|
|
418
|
+
corrected for the effects of (residual) intensity inhomogeneities. Intensity
|
|
419
|
+
normalisation is performed by optimising the voxel-wise sum of all tissue
|
|
420
|
+
compartments towards a constant value, under constraints of spatial
|
|
421
|
+
smoothness (polynomial basis of a given order). Different to the Raffelt et
|
|
422
|
+
al. 2017 abstract, this algorithm performs this task in the log-domain
|
|
423
|
+
instead, with added gradual outlier rejection, different handling of the
|
|
424
|
+
balancing factors between tissue compartments and a different iteration
|
|
425
|
+
structure.
|
|
426
|
+
|
|
427
|
+
The -mask option is mandatory and is optimally provided with a brain mask
|
|
428
|
+
(such as the one obtained from dwi2mask earlier in the processing pipeline).
|
|
429
|
+
Outlier areas with exceptionally low or high combined tissue contributions
|
|
430
|
+
are accounted for and reoptimised as the intensity inhomogeneity estimation
|
|
431
|
+
becomes more accurate.
|
|
432
|
+
|
|
433
|
+
References:
|
|
434
|
+
|
|
435
|
+
Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.;
|
|
436
|
+
Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation
|
|
437
|
+
for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017,
|
|
438
|
+
26, 3541
|
|
439
|
+
|
|
440
|
+
Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.;
|
|
441
|
+
Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and
|
|
442
|
+
inhomogeneity normalisation for quantitative apparent fibre density. In
|
|
443
|
+
Proc. ISMRM, 2021, 29, 2472.
|
|
444
|
+
|
|
445
|
+
Author: MRTrix3 Developers
|
|
446
|
+
|
|
447
|
+
URL: https://www.mrtrix.org/
|
|
448
|
+
|
|
449
|
+
Args:
|
|
450
|
+
params: The parameters.
|
|
451
|
+
execution: The execution object.
|
|
452
|
+
Returns:
|
|
453
|
+
NamedTuple of outputs (described in `MtnormaliseOutputs`).
|
|
454
|
+
"""
|
|
455
|
+
params = execution.params(params)
|
|
456
|
+
cargs = mtnormalise_cargs(params, execution)
|
|
457
|
+
ret = mtnormalise_outputs(params, execution)
|
|
458
|
+
execution.run(cargs)
|
|
459
|
+
return ret
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def mtnormalise(
|
|
463
|
+
mask: InputPathType,
|
|
464
|
+
input_output: list[MtnormaliseInputOutputParameters],
|
|
465
|
+
order: str | None = None,
|
|
466
|
+
niter: list[int] | None = None,
|
|
467
|
+
reference: float | None = None,
|
|
468
|
+
balanced: bool = False,
|
|
469
|
+
check_norm: str | None = None,
|
|
470
|
+
check_mask: str | None = None,
|
|
471
|
+
check_factors: str | None = None,
|
|
472
|
+
info: bool = False,
|
|
473
|
+
quiet: bool = False,
|
|
474
|
+
debug: bool = False,
|
|
475
|
+
force: bool = False,
|
|
476
|
+
nthreads: int | None = None,
|
|
477
|
+
config: list[MtnormaliseConfigParameters] | None = None,
|
|
478
|
+
help_: bool = False,
|
|
479
|
+
version: bool = False,
|
|
480
|
+
runner: Runner | None = None,
|
|
481
|
+
) -> MtnormaliseOutputs:
|
|
482
|
+
"""
|
|
483
|
+
Multi-tissue informed log-domain intensity normalisation.
|
|
484
|
+
|
|
485
|
+
This command takes as input any number of tissue components (e.g. from
|
|
486
|
+
multi-tissue CSD) and outputs corresponding normalised tissue components
|
|
487
|
+
corrected for the effects of (residual) intensity inhomogeneities. Intensity
|
|
488
|
+
normalisation is performed by optimising the voxel-wise sum of all tissue
|
|
489
|
+
compartments towards a constant value, under constraints of spatial
|
|
490
|
+
smoothness (polynomial basis of a given order). Different to the Raffelt et
|
|
491
|
+
al. 2017 abstract, this algorithm performs this task in the log-domain
|
|
492
|
+
instead, with added gradual outlier rejection, different handling of the
|
|
493
|
+
balancing factors between tissue compartments and a different iteration
|
|
494
|
+
structure.
|
|
495
|
+
|
|
496
|
+
The -mask option is mandatory and is optimally provided with a brain mask
|
|
497
|
+
(such as the one obtained from dwi2mask earlier in the processing pipeline).
|
|
498
|
+
Outlier areas with exceptionally low or high combined tissue contributions
|
|
499
|
+
are accounted for and reoptimised as the intensity inhomogeneity estimation
|
|
500
|
+
becomes more accurate.
|
|
501
|
+
|
|
502
|
+
References:
|
|
503
|
+
|
|
504
|
+
Raffelt, D.; Dhollander, T.; Tournier, J.-D.; Tabbara, R.; Smith, R. E.;
|
|
505
|
+
Pierre, E. & Connelly, A. Bias Field Correction and Intensity Normalisation
|
|
506
|
+
for Quantitative Analysis of Apparent Fibre Density. In Proc. ISMRM, 2017,
|
|
507
|
+
26, 3541
|
|
508
|
+
|
|
509
|
+
Dhollander, T.; Tabbara, R.; Rosnarho-Tornstrand, J.; Tournier, J.-D.;
|
|
510
|
+
Raffelt, D. & Connelly, A. Multi-tissue log-domain intensity and
|
|
511
|
+
inhomogeneity normalisation for quantitative apparent fibre density. In
|
|
512
|
+
Proc. ISMRM, 2021, 29, 2472.
|
|
513
|
+
|
|
514
|
+
Author: MRTrix3 Developers
|
|
515
|
+
|
|
516
|
+
URL: https://www.mrtrix.org/
|
|
517
|
+
|
|
518
|
+
Args:
|
|
519
|
+
mask: the mask defines the data used to compute the intensity\
|
|
520
|
+
normalisation. This option is mandatory.
|
|
521
|
+
input_output: list of all input and output tissue compartment files\
|
|
522
|
+
(see example usage).
|
|
523
|
+
order: the maximum order of the polynomial basis used to fit the\
|
|
524
|
+
normalisation field in the log-domain. An order of 0 is equivalent to\
|
|
525
|
+
not allowing spatial variance of the intensity normalisation factor.\
|
|
526
|
+
(default: 3).
|
|
527
|
+
niter: set the number of iterations. The first (and potentially only)\
|
|
528
|
+
entry applies to the main loop. If supplied as a comma-separated list\
|
|
529
|
+
of integers, the second entry applies to the inner loop to update the\
|
|
530
|
+
balance factors (default: 15,7).
|
|
531
|
+
reference: specify the (positive) reference value to which the summed\
|
|
532
|
+
tissue compartments will be normalised. (default: 0.282095, SH DC term\
|
|
533
|
+
for unit angular integral).
|
|
534
|
+
balanced: incorporate the per-tissue balancing factors into scaling of\
|
|
535
|
+
the output images (NOTE: use of this option has critical consequences\
|
|
536
|
+
for AFD intensity normalisation; should not be used unless these\
|
|
537
|
+
consequences are fully understood).
|
|
538
|
+
check_norm: output the final estimated spatially varying intensity\
|
|
539
|
+
level that is used for normalisation.
|
|
540
|
+
check_mask: output the final mask used to compute the normalisation.\
|
|
541
|
+
This mask excludes regions identified as outliers by the optimisation\
|
|
542
|
+
process.
|
|
543
|
+
check_factors: output the tissue balance factors computed during\
|
|
544
|
+
normalisation.
|
|
545
|
+
info: display information messages.
|
|
546
|
+
quiet: do not display information messages or progress status;\
|
|
547
|
+
alternatively, this can be achieved by setting the MRTRIX_QUIET\
|
|
548
|
+
environment variable to a non-empty string.
|
|
549
|
+
debug: display debugging messages.
|
|
550
|
+
force: force overwrite of output files (caution: using the same file as\
|
|
551
|
+
input and output might cause unexpected behaviour).
|
|
552
|
+
nthreads: use this number of threads in multi-threaded applications\
|
|
553
|
+
(set to 0 to disable multi-threading).
|
|
554
|
+
config: temporarily set the value of an MRtrix config file entry.
|
|
555
|
+
help_: display this information page and exit.
|
|
556
|
+
version: display version information and exit.
|
|
557
|
+
runner: Command runner.
|
|
558
|
+
Returns:
|
|
559
|
+
NamedTuple of outputs (described in `MtnormaliseOutputs`).
|
|
560
|
+
"""
|
|
561
|
+
runner = runner or get_global_runner()
|
|
562
|
+
execution = runner.start_execution(MTNORMALISE_METADATA)
|
|
563
|
+
params = mtnormalise_params(
|
|
564
|
+
mask=mask,
|
|
565
|
+
order=order,
|
|
566
|
+
niter=niter,
|
|
567
|
+
reference=reference,
|
|
568
|
+
balanced=balanced,
|
|
569
|
+
check_norm=check_norm,
|
|
570
|
+
check_mask=check_mask,
|
|
571
|
+
check_factors=check_factors,
|
|
572
|
+
info=info,
|
|
573
|
+
quiet=quiet,
|
|
574
|
+
debug=debug,
|
|
575
|
+
force=force,
|
|
576
|
+
nthreads=nthreads,
|
|
577
|
+
config=config,
|
|
578
|
+
help_=help_,
|
|
579
|
+
version=version,
|
|
580
|
+
input_output=input_output,
|
|
581
|
+
)
|
|
582
|
+
return mtnormalise_execute(params, execution)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
__all__ = [
|
|
586
|
+
"MTNORMALISE_METADATA",
|
|
587
|
+
"MtnormaliseConfigParameters",
|
|
588
|
+
"MtnormaliseInputOutputOutputs",
|
|
589
|
+
"MtnormaliseInputOutputParameters",
|
|
590
|
+
"MtnormaliseOutputs",
|
|
591
|
+
"MtnormaliseParameters",
|
|
592
|
+
"mtnormalise",
|
|
593
|
+
"mtnormalise_config_params",
|
|
594
|
+
"mtnormalise_input_output_params",
|
|
595
|
+
"mtnormalise_params",
|
|
596
|
+
]
|