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,730 @@
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
+ TCKSIFT2_METADATA = Metadata(
9
+ id="399c2a04022ba3cedcda7e35cf69c1dae578656c.boutiques",
10
+ name="tcksift2",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ Tcksift2ConfigParameters = typing.TypedDict('Tcksift2ConfigParameters', {
17
+ "__STYX_TYPE__": typing.Literal["config"],
18
+ "key": str,
19
+ "value": str,
20
+ })
21
+
22
+
23
+ Tcksift2Parameters = typing.TypedDict('Tcksift2Parameters', {
24
+ "__STYX_TYPE__": typing.Literal["tcksift2"],
25
+ "proc_mask": typing.NotRequired[InputPathType | None],
26
+ "act": typing.NotRequired[InputPathType | None],
27
+ "fd_scale_gm": bool,
28
+ "no_dilate_lut": bool,
29
+ "make_null_lobes": bool,
30
+ "remove_untracked": bool,
31
+ "fd_thresh": typing.NotRequired[float | None],
32
+ "csv": typing.NotRequired[str | None],
33
+ "out_mu": typing.NotRequired[str | None],
34
+ "output_debug": bool,
35
+ "out_coeffs": typing.NotRequired[str | None],
36
+ "reg_tikhonov": typing.NotRequired[float | None],
37
+ "reg_tv": typing.NotRequired[float | None],
38
+ "min_td_frac": typing.NotRequired[float | None],
39
+ "min_iters": typing.NotRequired[int | None],
40
+ "max_iters": typing.NotRequired[int | None],
41
+ "min_factor": typing.NotRequired[float | None],
42
+ "min_coeff": typing.NotRequired[float | None],
43
+ "max_factor": typing.NotRequired[float | None],
44
+ "max_coeff": typing.NotRequired[float | None],
45
+ "max_coeff_step": typing.NotRequired[float | None],
46
+ "min_cf_decrease": typing.NotRequired[float | None],
47
+ "linear": bool,
48
+ "info": bool,
49
+ "quiet": bool,
50
+ "debug": bool,
51
+ "force": bool,
52
+ "nthreads": typing.NotRequired[int | None],
53
+ "config": typing.NotRequired[list[Tcksift2ConfigParameters] | None],
54
+ "help": bool,
55
+ "version": bool,
56
+ "in_tracks": InputPathType,
57
+ "in_fod": InputPathType,
58
+ "out_weights": str,
59
+ })
60
+
61
+
62
+ def dyn_cargs(
63
+ t: str,
64
+ ) -> typing.Any:
65
+ """
66
+ Get build cargs function by command type.
67
+
68
+ Args:
69
+ t: Command type.
70
+ Returns:
71
+ Build cargs function.
72
+ """
73
+ return {
74
+ "tcksift2": tcksift2_cargs,
75
+ "config": tcksift2_config_cargs,
76
+ }.get(t)
77
+
78
+
79
+ def dyn_outputs(
80
+ t: str,
81
+ ) -> typing.Any:
82
+ """
83
+ Get build outputs function by command type.
84
+
85
+ Args:
86
+ t: Command type.
87
+ Returns:
88
+ Build outputs function.
89
+ """
90
+ return {
91
+ "tcksift2": tcksift2_outputs,
92
+ }.get(t)
93
+
94
+
95
+ def tcksift2_config_params(
96
+ key: str,
97
+ value: str,
98
+ ) -> Tcksift2ConfigParameters:
99
+ """
100
+ Build parameters.
101
+
102
+ Args:
103
+ key: temporarily set the value of an MRtrix config file entry.
104
+ value: temporarily set the value of an MRtrix config file entry.
105
+ Returns:
106
+ Parameter dictionary
107
+ """
108
+ params = {
109
+ "__STYXTYPE__": "config",
110
+ "key": key,
111
+ "value": value,
112
+ }
113
+ return params
114
+
115
+
116
+ def tcksift2_config_cargs(
117
+ params: Tcksift2ConfigParameters,
118
+ execution: Execution,
119
+ ) -> list[str]:
120
+ """
121
+ Build command-line arguments from parameters.
122
+
123
+ Args:
124
+ params: The parameters.
125
+ execution: The execution object for resolving input paths.
126
+ Returns:
127
+ Command-line arguments.
128
+ """
129
+ cargs = []
130
+ cargs.append("-config")
131
+ cargs.append(params.get("key"))
132
+ cargs.append(params.get("value"))
133
+ return cargs
134
+
135
+
136
+ class Tcksift2Outputs(typing.NamedTuple):
137
+ """
138
+ Output object returned when calling `tcksift2(...)`.
139
+ """
140
+ root: OutputPathType
141
+ """Output root folder. This is the root folder for all outputs."""
142
+ out_weights: OutputPathType
143
+ """output text file containing the weighting factor for each streamline"""
144
+ csv_: OutputPathType | None
145
+ """output statistics of execution per iteration to a .csv file """
146
+ out_mu: OutputPathType | None
147
+ """output the final value of SIFT proportionality coefficient mu to a text
148
+ file """
149
+ out_coeffs: OutputPathType | None
150
+ """output text file containing the weighting coefficient for each streamline
151
+ """
152
+
153
+
154
+ def tcksift2_params(
155
+ in_tracks: InputPathType,
156
+ in_fod: InputPathType,
157
+ out_weights: str,
158
+ proc_mask: InputPathType | None = None,
159
+ act: InputPathType | None = None,
160
+ fd_scale_gm: bool = False,
161
+ no_dilate_lut: bool = False,
162
+ make_null_lobes: bool = False,
163
+ remove_untracked: bool = False,
164
+ fd_thresh: float | None = None,
165
+ csv_: str | None = None,
166
+ out_mu: str | None = None,
167
+ output_debug: bool = False,
168
+ out_coeffs: str | None = None,
169
+ reg_tikhonov: float | None = None,
170
+ reg_tv: float | None = None,
171
+ min_td_frac: float | None = None,
172
+ min_iters: int | None = None,
173
+ max_iters: int | None = None,
174
+ min_factor: float | None = None,
175
+ min_coeff: float | None = None,
176
+ max_factor: float | None = None,
177
+ max_coeff: float | None = None,
178
+ max_coeff_step: float | None = None,
179
+ min_cf_decrease: float | None = None,
180
+ linear: bool = False,
181
+ info: bool = False,
182
+ quiet: bool = False,
183
+ debug: bool = False,
184
+ force: bool = False,
185
+ nthreads: int | None = None,
186
+ config: list[Tcksift2ConfigParameters] | None = None,
187
+ help_: bool = False,
188
+ version: bool = False,
189
+ ) -> Tcksift2Parameters:
190
+ """
191
+ Build parameters.
192
+
193
+ Args:
194
+ in_tracks: the input track file.
195
+ in_fod: input image containing the spherical harmonics of the fibre\
196
+ orientation distributions.
197
+ out_weights: output text file containing the weighting factor for each\
198
+ streamline.
199
+ proc_mask: provide an image containing the processing mask weights for\
200
+ the model; image spatial dimensions must match the fixel image.
201
+ act: use an ACT five-tissue-type segmented anatomical image to derive\
202
+ the processing mask.
203
+ fd_scale_gm: provide this option (in conjunction with -act) to\
204
+ heuristically downsize the fibre density estimates based on the\
205
+ presence of GM in the voxel. This can assist in reducing tissue\
206
+ interface effects when using a single-tissue deconvolution algorithm.
207
+ no_dilate_lut: do NOT dilate FOD lobe lookup tables; only map\
208
+ streamlines to FOD lobes if the precise tangent lies within the angular\
209
+ spread of that lobe.
210
+ make_null_lobes: add an additional FOD lobe to each voxel, with zero\
211
+ integral, that covers all directions with zero / negative FOD\
212
+ amplitudes.
213
+ remove_untracked: remove FOD lobes that do not have any streamline\
214
+ density attributed to them; this improves filtering slightly, at the\
215
+ expense of longer computation time (and you can no longer do\
216
+ quantitative comparisons between reconstructions if this is enabled).
217
+ fd_thresh: fibre density threshold; exclude an FOD lobe from filtering\
218
+ processing if its integral is less than this amount (streamlines will\
219
+ still be mapped to it, but it will not contribute to the cost function\
220
+ or the filtering).
221
+ csv_: output statistics of execution per iteration to a .csv file.
222
+ out_mu: output the final value of SIFT proportionality coefficient mu\
223
+ to a text file.
224
+ output_debug: provide various output images for assessing & debugging\
225
+ performance etc.
226
+ out_coeffs: output text file containing the weighting coefficient for\
227
+ each streamline.
228
+ reg_tikhonov: provide coefficient for regularising streamline weighting\
229
+ coefficients (Tikhonov regularisation) (default: 0).
230
+ reg_tv: provide coefficient for regularising variance of streamline\
231
+ weighting coefficient to fixels along its length (Total Variation\
232
+ regularisation) (default: 0.1).
233
+ min_td_frac: minimum fraction of the FOD integral reconstructed by\
234
+ streamlines; if the reconstructed streamline density is below this\
235
+ fraction, the fixel is excluded from optimisation (default: 0.1).
236
+ min_iters: minimum number of iterations to run before testing for\
237
+ convergence; this can prevent premature termination at early iterations\
238
+ if the cost function increases slightly (default: 10).
239
+ max_iters: maximum number of iterations to run before terminating\
240
+ program.
241
+ min_factor: minimum weighting factor for an individual streamline; if\
242
+ the factor falls below this number the streamline will be rejected\
243
+ entirely (factor set to zero) (default: 0).
244
+ min_coeff: minimum weighting coefficient for an individual streamline;\
245
+ similar to the '-min_factor' option, but using the exponential\
246
+ coefficient basis of the SIFT2 model; these parameters are related as:\
247
+ factor = e^(coeff). Note that the -min_factor and -min_coeff options\
248
+ are mutually exclusive - you can only provide one. (default: -inf).
249
+ max_factor: maximum weighting factor that can be assigned to any one\
250
+ streamline (default: inf).
251
+ max_coeff: maximum weighting coefficient for an individual streamline;\
252
+ similar to the '-max_factor' option, but using the exponential\
253
+ coefficient basis of the SIFT2 model; these parameters are related as:\
254
+ factor = e^(coeff). Note that the -max_factor and -max_coeff options\
255
+ are mutually exclusive - you can only provide one. (default: inf).
256
+ max_coeff_step: maximum change to a streamline's weighting coefficient\
257
+ in a single iteration (default: 1).
258
+ min_cf_decrease: minimum decrease in the cost function (as a fraction\
259
+ of the initial value) that must occur each iteration for the algorithm\
260
+ to continue (default: 2.5e-05).
261
+ linear: perform a linear estimation of streamline weights, rather than\
262
+ the standard non-linear optimisation (typically does not provide as\
263
+ accurate a model fit; but only requires a single pass).
264
+ info: display information messages.
265
+ quiet: do not display information messages or progress status;\
266
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
267
+ environment variable to a non-empty string.
268
+ debug: display debugging messages.
269
+ force: force overwrite of output files (caution: using the same file as\
270
+ input and output might cause unexpected behaviour).
271
+ nthreads: use this number of threads in multi-threaded applications\
272
+ (set to 0 to disable multi-threading).
273
+ config: temporarily set the value of an MRtrix config file entry.
274
+ help_: display this information page and exit.
275
+ version: display version information and exit.
276
+ Returns:
277
+ Parameter dictionary
278
+ """
279
+ params = {
280
+ "__STYXTYPE__": "tcksift2",
281
+ "fd_scale_gm": fd_scale_gm,
282
+ "no_dilate_lut": no_dilate_lut,
283
+ "make_null_lobes": make_null_lobes,
284
+ "remove_untracked": remove_untracked,
285
+ "output_debug": output_debug,
286
+ "linear": linear,
287
+ "info": info,
288
+ "quiet": quiet,
289
+ "debug": debug,
290
+ "force": force,
291
+ "help": help_,
292
+ "version": version,
293
+ "in_tracks": in_tracks,
294
+ "in_fod": in_fod,
295
+ "out_weights": out_weights,
296
+ }
297
+ if proc_mask is not None:
298
+ params["proc_mask"] = proc_mask
299
+ if act is not None:
300
+ params["act"] = act
301
+ if fd_thresh is not None:
302
+ params["fd_thresh"] = fd_thresh
303
+ if csv_ is not None:
304
+ params["csv"] = csv_
305
+ if out_mu is not None:
306
+ params["out_mu"] = out_mu
307
+ if out_coeffs is not None:
308
+ params["out_coeffs"] = out_coeffs
309
+ if reg_tikhonov is not None:
310
+ params["reg_tikhonov"] = reg_tikhonov
311
+ if reg_tv is not None:
312
+ params["reg_tv"] = reg_tv
313
+ if min_td_frac is not None:
314
+ params["min_td_frac"] = min_td_frac
315
+ if min_iters is not None:
316
+ params["min_iters"] = min_iters
317
+ if max_iters is not None:
318
+ params["max_iters"] = max_iters
319
+ if min_factor is not None:
320
+ params["min_factor"] = min_factor
321
+ if min_coeff is not None:
322
+ params["min_coeff"] = min_coeff
323
+ if max_factor is not None:
324
+ params["max_factor"] = max_factor
325
+ if max_coeff is not None:
326
+ params["max_coeff"] = max_coeff
327
+ if max_coeff_step is not None:
328
+ params["max_coeff_step"] = max_coeff_step
329
+ if min_cf_decrease is not None:
330
+ params["min_cf_decrease"] = min_cf_decrease
331
+ if nthreads is not None:
332
+ params["nthreads"] = nthreads
333
+ if config is not None:
334
+ params["config"] = config
335
+ return params
336
+
337
+
338
+ def tcksift2_cargs(
339
+ params: Tcksift2Parameters,
340
+ execution: Execution,
341
+ ) -> list[str]:
342
+ """
343
+ Build command-line arguments from parameters.
344
+
345
+ Args:
346
+ params: The parameters.
347
+ execution: The execution object for resolving input paths.
348
+ Returns:
349
+ Command-line arguments.
350
+ """
351
+ cargs = []
352
+ cargs.append("tcksift2")
353
+ if params.get("proc_mask") is not None:
354
+ cargs.extend([
355
+ "-proc_mask",
356
+ execution.input_file(params.get("proc_mask"))
357
+ ])
358
+ if params.get("act") is not None:
359
+ cargs.extend([
360
+ "-act",
361
+ execution.input_file(params.get("act"))
362
+ ])
363
+ if params.get("fd_scale_gm"):
364
+ cargs.append("-fd_scale_gm")
365
+ if params.get("no_dilate_lut"):
366
+ cargs.append("-no_dilate_lut")
367
+ if params.get("make_null_lobes"):
368
+ cargs.append("-make_null_lobes")
369
+ if params.get("remove_untracked"):
370
+ cargs.append("-remove_untracked")
371
+ if params.get("fd_thresh") is not None:
372
+ cargs.extend([
373
+ "-fd_thresh",
374
+ str(params.get("fd_thresh"))
375
+ ])
376
+ if params.get("csv") is not None:
377
+ cargs.extend([
378
+ "-csv",
379
+ params.get("csv")
380
+ ])
381
+ if params.get("out_mu") is not None:
382
+ cargs.extend([
383
+ "-out_mu",
384
+ params.get("out_mu")
385
+ ])
386
+ if params.get("output_debug"):
387
+ cargs.append("-output_debug")
388
+ if params.get("out_coeffs") is not None:
389
+ cargs.extend([
390
+ "-out_coeffs",
391
+ params.get("out_coeffs")
392
+ ])
393
+ if params.get("reg_tikhonov") is not None:
394
+ cargs.extend([
395
+ "-reg_tikhonov",
396
+ str(params.get("reg_tikhonov"))
397
+ ])
398
+ if params.get("reg_tv") is not None:
399
+ cargs.extend([
400
+ "-reg_tv",
401
+ str(params.get("reg_tv"))
402
+ ])
403
+ if params.get("min_td_frac") is not None:
404
+ cargs.extend([
405
+ "-min_td_frac",
406
+ str(params.get("min_td_frac"))
407
+ ])
408
+ if params.get("min_iters") is not None:
409
+ cargs.extend([
410
+ "-min_iters",
411
+ str(params.get("min_iters"))
412
+ ])
413
+ if params.get("max_iters") is not None:
414
+ cargs.extend([
415
+ "-max_iters",
416
+ str(params.get("max_iters"))
417
+ ])
418
+ if params.get("min_factor") is not None:
419
+ cargs.extend([
420
+ "-min_factor",
421
+ str(params.get("min_factor"))
422
+ ])
423
+ if params.get("min_coeff") is not None:
424
+ cargs.extend([
425
+ "-min_coeff",
426
+ str(params.get("min_coeff"))
427
+ ])
428
+ if params.get("max_factor") is not None:
429
+ cargs.extend([
430
+ "-max_factor",
431
+ str(params.get("max_factor"))
432
+ ])
433
+ if params.get("max_coeff") is not None:
434
+ cargs.extend([
435
+ "-max_coeff",
436
+ str(params.get("max_coeff"))
437
+ ])
438
+ if params.get("max_coeff_step") is not None:
439
+ cargs.extend([
440
+ "-max_coeff_step",
441
+ str(params.get("max_coeff_step"))
442
+ ])
443
+ if params.get("min_cf_decrease") is not None:
444
+ cargs.extend([
445
+ "-min_cf_decrease",
446
+ str(params.get("min_cf_decrease"))
447
+ ])
448
+ if params.get("linear"):
449
+ cargs.append("-linear")
450
+ if params.get("info"):
451
+ cargs.append("-info")
452
+ if params.get("quiet"):
453
+ cargs.append("-quiet")
454
+ if params.get("debug"):
455
+ cargs.append("-debug")
456
+ if params.get("force"):
457
+ cargs.append("-force")
458
+ if params.get("nthreads") is not None:
459
+ cargs.extend([
460
+ "-nthreads",
461
+ str(params.get("nthreads"))
462
+ ])
463
+ if params.get("config") is not None:
464
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
465
+ if params.get("help"):
466
+ cargs.append("-help")
467
+ if params.get("version"):
468
+ cargs.append("-version")
469
+ cargs.append(execution.input_file(params.get("in_tracks")))
470
+ cargs.append(execution.input_file(params.get("in_fod")))
471
+ cargs.append(params.get("out_weights"))
472
+ return cargs
473
+
474
+
475
+ def tcksift2_outputs(
476
+ params: Tcksift2Parameters,
477
+ execution: Execution,
478
+ ) -> Tcksift2Outputs:
479
+ """
480
+ Build outputs object containing output file paths and possibly stdout/stderr.
481
+
482
+ Args:
483
+ params: The parameters.
484
+ execution: The execution object for resolving input paths.
485
+ Returns:
486
+ Outputs object.
487
+ """
488
+ ret = Tcksift2Outputs(
489
+ root=execution.output_file("."),
490
+ out_weights=execution.output_file(params.get("out_weights")),
491
+ csv_=execution.output_file(params.get("csv")) if (params.get("csv") is not None) else None,
492
+ out_mu=execution.output_file(params.get("out_mu")) if (params.get("out_mu") is not None) else None,
493
+ out_coeffs=execution.output_file(params.get("out_coeffs")) if (params.get("out_coeffs") is not None) else None,
494
+ )
495
+ return ret
496
+
497
+
498
+ def tcksift2_execute(
499
+ params: Tcksift2Parameters,
500
+ execution: Execution,
501
+ ) -> Tcksift2Outputs:
502
+ """
503
+ Optimise per-streamline cross-section multipliers to match a whole-brain
504
+ tractogram to fixel-wise fibre densities.
505
+
506
+
507
+
508
+ References:
509
+
510
+ Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT2: Enabling
511
+ dense quantitative assessment of brain white matter connectivity using
512
+ streamlines tractography. NeuroImage, 2015, 119, 338-351
513
+
514
+ * If using the -linear option:
515
+ Smith, RE; Raffelt, D; Tournier, J-D; Connelly, A. Quantitative Streamlines
516
+ Tractography: Methods and Inter-Subject Normalisation. Open Science
517
+ Framework, https://doi.org/10.31219/osf.io/c67kn.
518
+
519
+ Author: MRTrix3 Developers
520
+
521
+ URL: https://www.mrtrix.org/
522
+
523
+ Args:
524
+ params: The parameters.
525
+ execution: The execution object.
526
+ Returns:
527
+ NamedTuple of outputs (described in `Tcksift2Outputs`).
528
+ """
529
+ params = execution.params(params)
530
+ cargs = tcksift2_cargs(params, execution)
531
+ ret = tcksift2_outputs(params, execution)
532
+ execution.run(cargs)
533
+ return ret
534
+
535
+
536
+ def tcksift2(
537
+ in_tracks: InputPathType,
538
+ in_fod: InputPathType,
539
+ out_weights: str,
540
+ proc_mask: InputPathType | None = None,
541
+ act: InputPathType | None = None,
542
+ fd_scale_gm: bool = False,
543
+ no_dilate_lut: bool = False,
544
+ make_null_lobes: bool = False,
545
+ remove_untracked: bool = False,
546
+ fd_thresh: float | None = None,
547
+ csv_: str | None = None,
548
+ out_mu: str | None = None,
549
+ output_debug: bool = False,
550
+ out_coeffs: str | None = None,
551
+ reg_tikhonov: float | None = None,
552
+ reg_tv: float | None = None,
553
+ min_td_frac: float | None = None,
554
+ min_iters: int | None = None,
555
+ max_iters: int | None = None,
556
+ min_factor: float | None = None,
557
+ min_coeff: float | None = None,
558
+ max_factor: float | None = None,
559
+ max_coeff: float | None = None,
560
+ max_coeff_step: float | None = None,
561
+ min_cf_decrease: float | None = None,
562
+ linear: bool = False,
563
+ info: bool = False,
564
+ quiet: bool = False,
565
+ debug: bool = False,
566
+ force: bool = False,
567
+ nthreads: int | None = None,
568
+ config: list[Tcksift2ConfigParameters] | None = None,
569
+ help_: bool = False,
570
+ version: bool = False,
571
+ runner: Runner | None = None,
572
+ ) -> Tcksift2Outputs:
573
+ """
574
+ Optimise per-streamline cross-section multipliers to match a whole-brain
575
+ tractogram to fixel-wise fibre densities.
576
+
577
+
578
+
579
+ References:
580
+
581
+ Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT2: Enabling
582
+ dense quantitative assessment of brain white matter connectivity using
583
+ streamlines tractography. NeuroImage, 2015, 119, 338-351
584
+
585
+ * If using the -linear option:
586
+ Smith, RE; Raffelt, D; Tournier, J-D; Connelly, A. Quantitative Streamlines
587
+ Tractography: Methods and Inter-Subject Normalisation. Open Science
588
+ Framework, https://doi.org/10.31219/osf.io/c67kn.
589
+
590
+ Author: MRTrix3 Developers
591
+
592
+ URL: https://www.mrtrix.org/
593
+
594
+ Args:
595
+ in_tracks: the input track file.
596
+ in_fod: input image containing the spherical harmonics of the fibre\
597
+ orientation distributions.
598
+ out_weights: output text file containing the weighting factor for each\
599
+ streamline.
600
+ proc_mask: provide an image containing the processing mask weights for\
601
+ the model; image spatial dimensions must match the fixel image.
602
+ act: use an ACT five-tissue-type segmented anatomical image to derive\
603
+ the processing mask.
604
+ fd_scale_gm: provide this option (in conjunction with -act) to\
605
+ heuristically downsize the fibre density estimates based on the\
606
+ presence of GM in the voxel. This can assist in reducing tissue\
607
+ interface effects when using a single-tissue deconvolution algorithm.
608
+ no_dilate_lut: do NOT dilate FOD lobe lookup tables; only map\
609
+ streamlines to FOD lobes if the precise tangent lies within the angular\
610
+ spread of that lobe.
611
+ make_null_lobes: add an additional FOD lobe to each voxel, with zero\
612
+ integral, that covers all directions with zero / negative FOD\
613
+ amplitudes.
614
+ remove_untracked: remove FOD lobes that do not have any streamline\
615
+ density attributed to them; this improves filtering slightly, at the\
616
+ expense of longer computation time (and you can no longer do\
617
+ quantitative comparisons between reconstructions if this is enabled).
618
+ fd_thresh: fibre density threshold; exclude an FOD lobe from filtering\
619
+ processing if its integral is less than this amount (streamlines will\
620
+ still be mapped to it, but it will not contribute to the cost function\
621
+ or the filtering).
622
+ csv_: output statistics of execution per iteration to a .csv file.
623
+ out_mu: output the final value of SIFT proportionality coefficient mu\
624
+ to a text file.
625
+ output_debug: provide various output images for assessing & debugging\
626
+ performance etc.
627
+ out_coeffs: output text file containing the weighting coefficient for\
628
+ each streamline.
629
+ reg_tikhonov: provide coefficient for regularising streamline weighting\
630
+ coefficients (Tikhonov regularisation) (default: 0).
631
+ reg_tv: provide coefficient for regularising variance of streamline\
632
+ weighting coefficient to fixels along its length (Total Variation\
633
+ regularisation) (default: 0.1).
634
+ min_td_frac: minimum fraction of the FOD integral reconstructed by\
635
+ streamlines; if the reconstructed streamline density is below this\
636
+ fraction, the fixel is excluded from optimisation (default: 0.1).
637
+ min_iters: minimum number of iterations to run before testing for\
638
+ convergence; this can prevent premature termination at early iterations\
639
+ if the cost function increases slightly (default: 10).
640
+ max_iters: maximum number of iterations to run before terminating\
641
+ program.
642
+ min_factor: minimum weighting factor for an individual streamline; if\
643
+ the factor falls below this number the streamline will be rejected\
644
+ entirely (factor set to zero) (default: 0).
645
+ min_coeff: minimum weighting coefficient for an individual streamline;\
646
+ similar to the '-min_factor' option, but using the exponential\
647
+ coefficient basis of the SIFT2 model; these parameters are related as:\
648
+ factor = e^(coeff). Note that the -min_factor and -min_coeff options\
649
+ are mutually exclusive - you can only provide one. (default: -inf).
650
+ max_factor: maximum weighting factor that can be assigned to any one\
651
+ streamline (default: inf).
652
+ max_coeff: maximum weighting coefficient for an individual streamline;\
653
+ similar to the '-max_factor' option, but using the exponential\
654
+ coefficient basis of the SIFT2 model; these parameters are related as:\
655
+ factor = e^(coeff). Note that the -max_factor and -max_coeff options\
656
+ are mutually exclusive - you can only provide one. (default: inf).
657
+ max_coeff_step: maximum change to a streamline's weighting coefficient\
658
+ in a single iteration (default: 1).
659
+ min_cf_decrease: minimum decrease in the cost function (as a fraction\
660
+ of the initial value) that must occur each iteration for the algorithm\
661
+ to continue (default: 2.5e-05).
662
+ linear: perform a linear estimation of streamline weights, rather than\
663
+ the standard non-linear optimisation (typically does not provide as\
664
+ accurate a model fit; but only requires a single pass).
665
+ info: display information messages.
666
+ quiet: do not display information messages or progress status;\
667
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
668
+ environment variable to a non-empty string.
669
+ debug: display debugging messages.
670
+ force: force overwrite of output files (caution: using the same file as\
671
+ input and output might cause unexpected behaviour).
672
+ nthreads: use this number of threads in multi-threaded applications\
673
+ (set to 0 to disable multi-threading).
674
+ config: temporarily set the value of an MRtrix config file entry.
675
+ help_: display this information page and exit.
676
+ version: display version information and exit.
677
+ runner: Command runner.
678
+ Returns:
679
+ NamedTuple of outputs (described in `Tcksift2Outputs`).
680
+ """
681
+ runner = runner or get_global_runner()
682
+ execution = runner.start_execution(TCKSIFT2_METADATA)
683
+ params = tcksift2_params(
684
+ proc_mask=proc_mask,
685
+ act=act,
686
+ fd_scale_gm=fd_scale_gm,
687
+ no_dilate_lut=no_dilate_lut,
688
+ make_null_lobes=make_null_lobes,
689
+ remove_untracked=remove_untracked,
690
+ fd_thresh=fd_thresh,
691
+ csv_=csv_,
692
+ out_mu=out_mu,
693
+ output_debug=output_debug,
694
+ out_coeffs=out_coeffs,
695
+ reg_tikhonov=reg_tikhonov,
696
+ reg_tv=reg_tv,
697
+ min_td_frac=min_td_frac,
698
+ min_iters=min_iters,
699
+ max_iters=max_iters,
700
+ min_factor=min_factor,
701
+ min_coeff=min_coeff,
702
+ max_factor=max_factor,
703
+ max_coeff=max_coeff,
704
+ max_coeff_step=max_coeff_step,
705
+ min_cf_decrease=min_cf_decrease,
706
+ linear=linear,
707
+ info=info,
708
+ quiet=quiet,
709
+ debug=debug,
710
+ force=force,
711
+ nthreads=nthreads,
712
+ config=config,
713
+ help_=help_,
714
+ version=version,
715
+ in_tracks=in_tracks,
716
+ in_fod=in_fod,
717
+ out_weights=out_weights,
718
+ )
719
+ return tcksift2_execute(params, execution)
720
+
721
+
722
+ __all__ = [
723
+ "TCKSIFT2_METADATA",
724
+ "Tcksift2ConfigParameters",
725
+ "Tcksift2Outputs",
726
+ "Tcksift2Parameters",
727
+ "tcksift2",
728
+ "tcksift2_config_params",
729
+ "tcksift2_params",
730
+ ]