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.

Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +130 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +445 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +453 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +656 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +470 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +338 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +767 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +440 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +416 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +362 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +423 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +365 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +347 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +358 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +530 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +428 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +879 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +463 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1295 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +587 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +467 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +478 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +825 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +534 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +452 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +357 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +357 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +437 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +893 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +391 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +588 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +371 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +348 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +616 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +361 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +469 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +530 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +351 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +343 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +377 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +344 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +336 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +537 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +348 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +410 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +370 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +396 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +3047 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +382 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +344 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +363 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +736 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +401 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1423 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +443 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +351 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +546 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +716 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +819 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +403 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +393 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +990 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +413 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +425 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +1676 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +427 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +549 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1061 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +596 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +334 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +349 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +316 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +640 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +505 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +353 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +394 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +373 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +498 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +580 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +363 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +580 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +551 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1003 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +1983 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +758 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +329 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +772 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +580 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +404 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +592 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +730 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +441 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +340 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +544 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +344 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +465 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +346 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +340 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +344 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +340 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +347 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +349 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +328 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +359 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +412 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +337 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +420 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +816 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +585 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +350 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +376 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +449 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +411 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +368 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +356 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +370 -0
  117. niwrap_mrtrix-0.5.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.5.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.5.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,758 @@
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
+ TCKGLOBAL_METADATA = Metadata(
9
+ id="83ed2ed5059d206686d68bca5253e7191f588b5d.boutiques",
10
+ name="tckglobal",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ TckglobalRisoParameters = typing.TypedDict('TckglobalRisoParameters', {
17
+ "__STYX_TYPE__": typing.Literal["riso"],
18
+ "response": InputPathType,
19
+ })
20
+
21
+
22
+ TckglobalConfigParameters = typing.TypedDict('TckglobalConfigParameters', {
23
+ "__STYX_TYPE__": typing.Literal["config"],
24
+ "key": str,
25
+ "value": str,
26
+ })
27
+
28
+
29
+ TckglobalParameters = typing.TypedDict('TckglobalParameters', {
30
+ "__STYX_TYPE__": typing.Literal["tckglobal"],
31
+ "grad": typing.NotRequired[InputPathType | None],
32
+ "mask": typing.NotRequired[InputPathType | None],
33
+ "riso": typing.NotRequired[list[TckglobalRisoParameters] | None],
34
+ "lmax": typing.NotRequired[int | None],
35
+ "length": typing.NotRequired[float | None],
36
+ "weight": typing.NotRequired[float | None],
37
+ "ppot": typing.NotRequired[float | None],
38
+ "cpot": typing.NotRequired[float | None],
39
+ "t0": typing.NotRequired[float | None],
40
+ "t1": typing.NotRequired[float | None],
41
+ "niter": typing.NotRequired[int | None],
42
+ "fod": typing.NotRequired[str | None],
43
+ "noapo": bool,
44
+ "fiso": typing.NotRequired[str | None],
45
+ "eext": typing.NotRequired[str | None],
46
+ "etrend": typing.NotRequired[str | None],
47
+ "balance": typing.NotRequired[float | None],
48
+ "density": typing.NotRequired[float | None],
49
+ "prob": typing.NotRequired[list[float] | None],
50
+ "beta": typing.NotRequired[float | None],
51
+ "lambda": typing.NotRequired[float | None],
52
+ "info": bool,
53
+ "quiet": bool,
54
+ "debug": bool,
55
+ "force": bool,
56
+ "nthreads": typing.NotRequired[int | None],
57
+ "config": typing.NotRequired[list[TckglobalConfigParameters] | None],
58
+ "help": bool,
59
+ "version": bool,
60
+ "source": InputPathType,
61
+ "response": InputPathType,
62
+ "tracks": str,
63
+ })
64
+
65
+
66
+ def dyn_cargs(
67
+ t: str,
68
+ ) -> typing.Any:
69
+ """
70
+ Get build cargs function by command type.
71
+
72
+ Args:
73
+ t: Command type.
74
+ Returns:
75
+ Build cargs function.
76
+ """
77
+ return {
78
+ "tckglobal": tckglobal_cargs,
79
+ "riso": tckglobal_riso_cargs,
80
+ "config": tckglobal_config_cargs,
81
+ }.get(t)
82
+
83
+
84
+ def dyn_outputs(
85
+ t: str,
86
+ ) -> typing.Any:
87
+ """
88
+ Get build outputs function by command type.
89
+
90
+ Args:
91
+ t: Command type.
92
+ Returns:
93
+ Build outputs function.
94
+ """
95
+ return {
96
+ "tckglobal": tckglobal_outputs,
97
+ }.get(t)
98
+
99
+
100
+ def tckglobal_riso_params(
101
+ response: InputPathType,
102
+ ) -> TckglobalRisoParameters:
103
+ """
104
+ Build parameters.
105
+
106
+ Args:
107
+ response: set one or more isotropic response functions. (multiple\
108
+ allowed).
109
+ Returns:
110
+ Parameter dictionary
111
+ """
112
+ params = {
113
+ "__STYXTYPE__": "riso",
114
+ "response": response,
115
+ }
116
+ return params
117
+
118
+
119
+ def tckglobal_riso_cargs(
120
+ params: TckglobalRisoParameters,
121
+ execution: Execution,
122
+ ) -> list[str]:
123
+ """
124
+ Build command-line arguments from parameters.
125
+
126
+ Args:
127
+ params: The parameters.
128
+ execution: The execution object for resolving input paths.
129
+ Returns:
130
+ Command-line arguments.
131
+ """
132
+ cargs = []
133
+ cargs.append("-riso")
134
+ cargs.append(execution.input_file(params.get("response")))
135
+ return cargs
136
+
137
+
138
+ def tckglobal_config_params(
139
+ key: str,
140
+ value: str,
141
+ ) -> TckglobalConfigParameters:
142
+ """
143
+ Build parameters.
144
+
145
+ Args:
146
+ key: temporarily set the value of an MRtrix config file entry.
147
+ value: temporarily set the value of an MRtrix config file entry.
148
+ Returns:
149
+ Parameter dictionary
150
+ """
151
+ params = {
152
+ "__STYXTYPE__": "config",
153
+ "key": key,
154
+ "value": value,
155
+ }
156
+ return params
157
+
158
+
159
+ def tckglobal_config_cargs(
160
+ params: TckglobalConfigParameters,
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("-config")
174
+ cargs.append(params.get("key"))
175
+ cargs.append(params.get("value"))
176
+ return cargs
177
+
178
+
179
+ class TckglobalOutputs(typing.NamedTuple):
180
+ """
181
+ Output object returned when calling `tckglobal(...)`.
182
+ """
183
+ root: OutputPathType
184
+ """Output root folder. This is the root folder for all outputs."""
185
+ tracks: OutputPathType
186
+ """the output file containing the tracks generated."""
187
+ fod: OutputPathType | None
188
+ """Predicted fibre orientation distribution function (fODF).
189
+ This fODF is estimated as part of the global track optimization, and
190
+ therefore incorporates the spatial regularization that it imposes.
191
+ Internally, the fODF is represented as a discrete sum of apodized point
192
+ spread functions (aPSF) oriented along the directions of all particles in
193
+ the voxel, used to predict the DWI signal from the particle configuration.
194
+ """
195
+ fiso: OutputPathType | None
196
+ """Predicted isotropic fractions of the tissues for which response functions
197
+ were provided with -riso. Typically, these are CSF and GM. """
198
+ eext: OutputPathType | None
199
+ """Residual external energy in every voxel. """
200
+ etrend: OutputPathType | None
201
+ """internal and external energy trend and cooling statistics. """
202
+
203
+
204
+ def tckglobal_params(
205
+ source: InputPathType,
206
+ response: InputPathType,
207
+ tracks: str,
208
+ grad: InputPathType | None = None,
209
+ mask: InputPathType | None = None,
210
+ riso: list[TckglobalRisoParameters] | None = None,
211
+ lmax: int | None = None,
212
+ length: float | None = None,
213
+ weight: float | None = None,
214
+ ppot: float | None = None,
215
+ cpot: float | None = None,
216
+ t0: float | None = None,
217
+ t1: float | None = None,
218
+ niter: int | None = None,
219
+ fod: str | None = None,
220
+ noapo: bool = False,
221
+ fiso: str | None = None,
222
+ eext: str | None = None,
223
+ etrend: str | None = None,
224
+ balance: float | None = None,
225
+ density: float | None = None,
226
+ prob: list[float] | None = None,
227
+ beta: float | None = None,
228
+ lambda_: float | None = None,
229
+ info: bool = False,
230
+ quiet: bool = False,
231
+ debug: bool = False,
232
+ force: bool = False,
233
+ nthreads: int | None = None,
234
+ config: list[TckglobalConfigParameters] | None = None,
235
+ help_: bool = False,
236
+ version: bool = False,
237
+ ) -> TckglobalParameters:
238
+ """
239
+ Build parameters.
240
+
241
+ Args:
242
+ source: the image containing the raw DWI data.
243
+ response: the response of a track segment on the DWI signal.
244
+ tracks: the output file containing the tracks generated.
245
+ grad: specify the diffusion encoding scheme (required if not supplied\
246
+ in the header).
247
+ mask: only reconstruct the tractogram within the specified brain mask\
248
+ image.
249
+ riso: set one or more isotropic response functions. (multiple allowed).
250
+ lmax: set the maximum harmonic order for the output series. (default =\
251
+ 8).
252
+ length: set the length of the particles (fibre segments). (default =\
253
+ 1mm).
254
+ weight: set the weight by which particles contribute to the model.\
255
+ (default = 0.1).
256
+ ppot: set the particle potential, i.e., the cost of adding one segment,\
257
+ relative to the particle weight. (default = 0.05).
258
+ cpot: set the connection potential, i.e., the energy term that drives\
259
+ two segments together. (default = 0.5).
260
+ t0: set the initial temperature of the metropolis hastings optimizer.\
261
+ (default = 0.1).
262
+ t1: set the final temperature of the metropolis hastings optimizer.\
263
+ (default = 0.001).
264
+ niter: set the number of iterations of the metropolis hastings\
265
+ optimizer. (default = 10M).
266
+ fod: Predicted fibre orientation distribution function (fODF).\
267
+ This fODF is estimated as part of the global track optimization,\
268
+ and therefore incorporates the spatial regularization that it\
269
+ imposes. Internally, the fODF is represented as a discrete sum of\
270
+ apodized point spread functions (aPSF) oriented along the\
271
+ directions of all particles in the voxel, used to predict the DWI\
272
+ signal from the particle configuration.
273
+ noapo: disable spherical convolution of fODF with apodized PSF, to\
274
+ output a sum of delta functions rather than a sum of aPSFs.
275
+ fiso: Predicted isotropic fractions of the tissues for which response\
276
+ functions were provided with -riso. Typically, these are CSF and GM.
277
+ eext: Residual external energy in every voxel.
278
+ etrend: internal and external energy trend and cooling statistics.
279
+ balance: balance internal and external energy. (default = 0)\
280
+ Negative values give more weight to the internal energy, positive\
281
+ to the external energy.
282
+ density: set the desired density of the free Poisson process. (default\
283
+ = 1).
284
+ prob: set the probabilities of generating birth, death, randshift,\
285
+ optshift and connect proposals respectively. (default =\
286
+ 0.25,0.05,0.25,0.1,0.35).
287
+ beta: set the width of the Hanning interpolation window. (in [0, 1],\
288
+ default = 0)\
289
+ If used, a mask is required, and this mask must keep at least one\
290
+ voxel distance to the image bounding box.
291
+ lambda_: set the weight of the internal energy directly. (default = 1)\
292
+ If provided, any value of -balance will be ignored.
293
+ info: display information messages.
294
+ quiet: do not display information messages or progress status;\
295
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
296
+ environment variable to a non-empty string.
297
+ debug: display debugging messages.
298
+ force: force overwrite of output files (caution: using the same file as\
299
+ input and output might cause unexpected behaviour).
300
+ nthreads: use this number of threads in multi-threaded applications\
301
+ (set to 0 to disable multi-threading).
302
+ config: temporarily set the value of an MRtrix config file entry.
303
+ help_: display this information page and exit.
304
+ version: display version information and exit.
305
+ Returns:
306
+ Parameter dictionary
307
+ """
308
+ params = {
309
+ "__STYXTYPE__": "tckglobal",
310
+ "noapo": noapo,
311
+ "info": info,
312
+ "quiet": quiet,
313
+ "debug": debug,
314
+ "force": force,
315
+ "help": help_,
316
+ "version": version,
317
+ "source": source,
318
+ "response": response,
319
+ "tracks": tracks,
320
+ }
321
+ if grad is not None:
322
+ params["grad"] = grad
323
+ if mask is not None:
324
+ params["mask"] = mask
325
+ if riso is not None:
326
+ params["riso"] = riso
327
+ if lmax is not None:
328
+ params["lmax"] = lmax
329
+ if length is not None:
330
+ params["length"] = length
331
+ if weight is not None:
332
+ params["weight"] = weight
333
+ if ppot is not None:
334
+ params["ppot"] = ppot
335
+ if cpot is not None:
336
+ params["cpot"] = cpot
337
+ if t0 is not None:
338
+ params["t0"] = t0
339
+ if t1 is not None:
340
+ params["t1"] = t1
341
+ if niter is not None:
342
+ params["niter"] = niter
343
+ if fod is not None:
344
+ params["fod"] = fod
345
+ if fiso is not None:
346
+ params["fiso"] = fiso
347
+ if eext is not None:
348
+ params["eext"] = eext
349
+ if etrend is not None:
350
+ params["etrend"] = etrend
351
+ if balance is not None:
352
+ params["balance"] = balance
353
+ if density is not None:
354
+ params["density"] = density
355
+ if prob is not None:
356
+ params["prob"] = prob
357
+ if beta is not None:
358
+ params["beta"] = beta
359
+ if lambda_ is not None:
360
+ params["lambda"] = lambda_
361
+ if nthreads is not None:
362
+ params["nthreads"] = nthreads
363
+ if config is not None:
364
+ params["config"] = config
365
+ return params
366
+
367
+
368
+ def tckglobal_cargs(
369
+ params: TckglobalParameters,
370
+ execution: Execution,
371
+ ) -> list[str]:
372
+ """
373
+ Build command-line arguments from parameters.
374
+
375
+ Args:
376
+ params: The parameters.
377
+ execution: The execution object for resolving input paths.
378
+ Returns:
379
+ Command-line arguments.
380
+ """
381
+ cargs = []
382
+ cargs.append("tckglobal")
383
+ if params.get("grad") is not None:
384
+ cargs.extend([
385
+ "-grad",
386
+ execution.input_file(params.get("grad"))
387
+ ])
388
+ if params.get("mask") is not None:
389
+ cargs.extend([
390
+ "-mask",
391
+ execution.input_file(params.get("mask"))
392
+ ])
393
+ if params.get("riso") is not None:
394
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("riso")] for a in c])
395
+ if params.get("lmax") is not None:
396
+ cargs.extend([
397
+ "-lmax",
398
+ str(params.get("lmax"))
399
+ ])
400
+ if params.get("length") is not None:
401
+ cargs.extend([
402
+ "-length",
403
+ str(params.get("length"))
404
+ ])
405
+ if params.get("weight") is not None:
406
+ cargs.extend([
407
+ "-weight",
408
+ str(params.get("weight"))
409
+ ])
410
+ if params.get("ppot") is not None:
411
+ cargs.extend([
412
+ "-ppot",
413
+ str(params.get("ppot"))
414
+ ])
415
+ if params.get("cpot") is not None:
416
+ cargs.extend([
417
+ "-cpot",
418
+ str(params.get("cpot"))
419
+ ])
420
+ if params.get("t0") is not None:
421
+ cargs.extend([
422
+ "-t0",
423
+ str(params.get("t0"))
424
+ ])
425
+ if params.get("t1") is not None:
426
+ cargs.extend([
427
+ "-t1",
428
+ str(params.get("t1"))
429
+ ])
430
+ if params.get("niter") is not None:
431
+ cargs.extend([
432
+ "-niter",
433
+ str(params.get("niter"))
434
+ ])
435
+ if params.get("fod") is not None:
436
+ cargs.extend([
437
+ "-fod",
438
+ params.get("fod")
439
+ ])
440
+ if params.get("noapo"):
441
+ cargs.append("-noapo")
442
+ if params.get("fiso") is not None:
443
+ cargs.extend([
444
+ "-fiso",
445
+ params.get("fiso")
446
+ ])
447
+ if params.get("eext") is not None:
448
+ cargs.extend([
449
+ "-eext",
450
+ params.get("eext")
451
+ ])
452
+ if params.get("etrend") is not None:
453
+ cargs.extend([
454
+ "-etrend",
455
+ params.get("etrend")
456
+ ])
457
+ if params.get("balance") is not None:
458
+ cargs.extend([
459
+ "-balance",
460
+ str(params.get("balance"))
461
+ ])
462
+ if params.get("density") is not None:
463
+ cargs.extend([
464
+ "-density",
465
+ str(params.get("density"))
466
+ ])
467
+ if params.get("prob") is not None:
468
+ cargs.extend([
469
+ "-prob",
470
+ *map(str, params.get("prob"))
471
+ ])
472
+ if params.get("beta") is not None:
473
+ cargs.extend([
474
+ "-beta",
475
+ str(params.get("beta"))
476
+ ])
477
+ if params.get("lambda") is not None:
478
+ cargs.extend([
479
+ "-lambda",
480
+ str(params.get("lambda"))
481
+ ])
482
+ if params.get("info"):
483
+ cargs.append("-info")
484
+ if params.get("quiet"):
485
+ cargs.append("-quiet")
486
+ if params.get("debug"):
487
+ cargs.append("-debug")
488
+ if params.get("force"):
489
+ cargs.append("-force")
490
+ if params.get("nthreads") is not None:
491
+ cargs.extend([
492
+ "-nthreads",
493
+ str(params.get("nthreads"))
494
+ ])
495
+ if params.get("config") is not None:
496
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
497
+ if params.get("help"):
498
+ cargs.append("-help")
499
+ if params.get("version"):
500
+ cargs.append("-version")
501
+ cargs.append(execution.input_file(params.get("source")))
502
+ cargs.append(execution.input_file(params.get("response")))
503
+ cargs.append(params.get("tracks"))
504
+ return cargs
505
+
506
+
507
+ def tckglobal_outputs(
508
+ params: TckglobalParameters,
509
+ execution: Execution,
510
+ ) -> TckglobalOutputs:
511
+ """
512
+ Build outputs object containing output file paths and possibly stdout/stderr.
513
+
514
+ Args:
515
+ params: The parameters.
516
+ execution: The execution object for resolving input paths.
517
+ Returns:
518
+ Outputs object.
519
+ """
520
+ ret = TckglobalOutputs(
521
+ root=execution.output_file("."),
522
+ tracks=execution.output_file(params.get("tracks")),
523
+ fod=execution.output_file(params.get("fod")) if (params.get("fod") is not None) else None,
524
+ fiso=execution.output_file(params.get("fiso")) if (params.get("fiso") is not None) else None,
525
+ eext=execution.output_file(params.get("eext")) if (params.get("eext") is not None) else None,
526
+ etrend=execution.output_file(params.get("etrend")) if (params.get("etrend") is not None) else None,
527
+ )
528
+ return ret
529
+
530
+
531
+ def tckglobal_execute(
532
+ params: TckglobalParameters,
533
+ execution: Execution,
534
+ ) -> TckglobalOutputs:
535
+ """
536
+ Multi-Shell Multi-Tissue Global Tractography.
537
+
538
+ This command will reconstruct the global white matter fibre tractogram that
539
+ best explains the input DWI data, using a multi-tissue spherical convolution
540
+ model.
541
+
542
+ Example use:
543
+
544
+ $ tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif
545
+ -niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck
546
+
547
+ in which dwi.mif is the input image, wmr.txt is an anisotropic, multi-shell
548
+ response function for WM, and csfr.txt and gmr.txt are isotropic response
549
+ functions for CSF and GM. The output tractogram is saved to tracks.tck.
550
+ Optional output images fod.mif and fiso.mif contain the predicted WM fODF
551
+ and isotropic tissue fractions of CSF and GM respectively, estimated as part
552
+ of the global optimization and thus affected by spatial regularization.
553
+
554
+ References:
555
+
556
+ Christiaens, D.; Reisert, M.; Dhollander, T.; Sunaert, S.; Suetens, P. &
557
+ Maes, F. Global tractography of multi-shell diffusion-weighted imaging data
558
+ using a multi-tissue model. NeuroImage, 2015, 123, 89-101.
559
+
560
+ Author: MRTrix3 Developers
561
+
562
+ URL: https://www.mrtrix.org/
563
+
564
+ Args:
565
+ params: The parameters.
566
+ execution: The execution object.
567
+ Returns:
568
+ NamedTuple of outputs (described in `TckglobalOutputs`).
569
+ """
570
+ params = execution.params(params)
571
+ cargs = tckglobal_cargs(params, execution)
572
+ ret = tckglobal_outputs(params, execution)
573
+ execution.run(cargs)
574
+ return ret
575
+
576
+
577
+ def tckglobal(
578
+ source: InputPathType,
579
+ response: InputPathType,
580
+ tracks: str,
581
+ grad: InputPathType | None = None,
582
+ mask: InputPathType | None = None,
583
+ riso: list[TckglobalRisoParameters] | None = None,
584
+ lmax: int | None = None,
585
+ length: float | None = None,
586
+ weight: float | None = None,
587
+ ppot: float | None = None,
588
+ cpot: float | None = None,
589
+ t0: float | None = None,
590
+ t1: float | None = None,
591
+ niter: int | None = None,
592
+ fod: str | None = None,
593
+ noapo: bool = False,
594
+ fiso: str | None = None,
595
+ eext: str | None = None,
596
+ etrend: str | None = None,
597
+ balance: float | None = None,
598
+ density: float | None = None,
599
+ prob: list[float] | None = None,
600
+ beta: float | None = None,
601
+ lambda_: float | None = None,
602
+ info: bool = False,
603
+ quiet: bool = False,
604
+ debug: bool = False,
605
+ force: bool = False,
606
+ nthreads: int | None = None,
607
+ config: list[TckglobalConfigParameters] | None = None,
608
+ help_: bool = False,
609
+ version: bool = False,
610
+ runner: Runner | None = None,
611
+ ) -> TckglobalOutputs:
612
+ """
613
+ Multi-Shell Multi-Tissue Global Tractography.
614
+
615
+ This command will reconstruct the global white matter fibre tractogram that
616
+ best explains the input DWI data, using a multi-tissue spherical convolution
617
+ model.
618
+
619
+ Example use:
620
+
621
+ $ tckglobal dwi.mif wmr.txt -riso csfr.txt -riso gmr.txt -mask mask.mif
622
+ -niter 1e9 -fod fod.mif -fiso fiso.mif tracks.tck
623
+
624
+ in which dwi.mif is the input image, wmr.txt is an anisotropic, multi-shell
625
+ response function for WM, and csfr.txt and gmr.txt are isotropic response
626
+ functions for CSF and GM. The output tractogram is saved to tracks.tck.
627
+ Optional output images fod.mif and fiso.mif contain the predicted WM fODF
628
+ and isotropic tissue fractions of CSF and GM respectively, estimated as part
629
+ of the global optimization and thus affected by spatial regularization.
630
+
631
+ References:
632
+
633
+ Christiaens, D.; Reisert, M.; Dhollander, T.; Sunaert, S.; Suetens, P. &
634
+ Maes, F. Global tractography of multi-shell diffusion-weighted imaging data
635
+ using a multi-tissue model. NeuroImage, 2015, 123, 89-101.
636
+
637
+ Author: MRTrix3 Developers
638
+
639
+ URL: https://www.mrtrix.org/
640
+
641
+ Args:
642
+ source: the image containing the raw DWI data.
643
+ response: the response of a track segment on the DWI signal.
644
+ tracks: the output file containing the tracks generated.
645
+ grad: specify the diffusion encoding scheme (required if not supplied\
646
+ in the header).
647
+ mask: only reconstruct the tractogram within the specified brain mask\
648
+ image.
649
+ riso: set one or more isotropic response functions. (multiple allowed).
650
+ lmax: set the maximum harmonic order for the output series. (default =\
651
+ 8).
652
+ length: set the length of the particles (fibre segments). (default =\
653
+ 1mm).
654
+ weight: set the weight by which particles contribute to the model.\
655
+ (default = 0.1).
656
+ ppot: set the particle potential, i.e., the cost of adding one segment,\
657
+ relative to the particle weight. (default = 0.05).
658
+ cpot: set the connection potential, i.e., the energy term that drives\
659
+ two segments together. (default = 0.5).
660
+ t0: set the initial temperature of the metropolis hastings optimizer.\
661
+ (default = 0.1).
662
+ t1: set the final temperature of the metropolis hastings optimizer.\
663
+ (default = 0.001).
664
+ niter: set the number of iterations of the metropolis hastings\
665
+ optimizer. (default = 10M).
666
+ fod: Predicted fibre orientation distribution function (fODF).\
667
+ This fODF is estimated as part of the global track optimization,\
668
+ and therefore incorporates the spatial regularization that it\
669
+ imposes. Internally, the fODF is represented as a discrete sum of\
670
+ apodized point spread functions (aPSF) oriented along the\
671
+ directions of all particles in the voxel, used to predict the DWI\
672
+ signal from the particle configuration.
673
+ noapo: disable spherical convolution of fODF with apodized PSF, to\
674
+ output a sum of delta functions rather than a sum of aPSFs.
675
+ fiso: Predicted isotropic fractions of the tissues for which response\
676
+ functions were provided with -riso. Typically, these are CSF and GM.
677
+ eext: Residual external energy in every voxel.
678
+ etrend: internal and external energy trend and cooling statistics.
679
+ balance: balance internal and external energy. (default = 0)\
680
+ Negative values give more weight to the internal energy, positive\
681
+ to the external energy.
682
+ density: set the desired density of the free Poisson process. (default\
683
+ = 1).
684
+ prob: set the probabilities of generating birth, death, randshift,\
685
+ optshift and connect proposals respectively. (default =\
686
+ 0.25,0.05,0.25,0.1,0.35).
687
+ beta: set the width of the Hanning interpolation window. (in [0, 1],\
688
+ default = 0)\
689
+ If used, a mask is required, and this mask must keep at least one\
690
+ voxel distance to the image bounding box.
691
+ lambda_: set the weight of the internal energy directly. (default = 1)\
692
+ If provided, any value of -balance will be ignored.
693
+ info: display information messages.
694
+ quiet: do not display information messages or progress status;\
695
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
696
+ environment variable to a non-empty string.
697
+ debug: display debugging messages.
698
+ force: force overwrite of output files (caution: using the same file as\
699
+ input and output might cause unexpected behaviour).
700
+ nthreads: use this number of threads in multi-threaded applications\
701
+ (set to 0 to disable multi-threading).
702
+ config: temporarily set the value of an MRtrix config file entry.
703
+ help_: display this information page and exit.
704
+ version: display version information and exit.
705
+ runner: Command runner.
706
+ Returns:
707
+ NamedTuple of outputs (described in `TckglobalOutputs`).
708
+ """
709
+ runner = runner or get_global_runner()
710
+ execution = runner.start_execution(TCKGLOBAL_METADATA)
711
+ params = tckglobal_params(
712
+ grad=grad,
713
+ mask=mask,
714
+ riso=riso,
715
+ lmax=lmax,
716
+ length=length,
717
+ weight=weight,
718
+ ppot=ppot,
719
+ cpot=cpot,
720
+ t0=t0,
721
+ t1=t1,
722
+ niter=niter,
723
+ fod=fod,
724
+ noapo=noapo,
725
+ fiso=fiso,
726
+ eext=eext,
727
+ etrend=etrend,
728
+ balance=balance,
729
+ density=density,
730
+ prob=prob,
731
+ beta=beta,
732
+ lambda_=lambda_,
733
+ info=info,
734
+ quiet=quiet,
735
+ debug=debug,
736
+ force=force,
737
+ nthreads=nthreads,
738
+ config=config,
739
+ help_=help_,
740
+ version=version,
741
+ source=source,
742
+ response=response,
743
+ tracks=tracks,
744
+ )
745
+ return tckglobal_execute(params, execution)
746
+
747
+
748
+ __all__ = [
749
+ "TCKGLOBAL_METADATA",
750
+ "TckglobalConfigParameters",
751
+ "TckglobalOutputs",
752
+ "TckglobalParameters",
753
+ "TckglobalRisoParameters",
754
+ "tckglobal",
755
+ "tckglobal_config_params",
756
+ "tckglobal_params",
757
+ "tckglobal_riso_params",
758
+ ]