niwrap-mrtrix 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. niwrap_mrtrix/mrtrix/__init__.py +263 -0
  2. niwrap_mrtrix/mrtrix/afdconnectivity.py +527 -0
  3. niwrap_mrtrix/mrtrix/amp2response.py +560 -0
  4. niwrap_mrtrix/mrtrix/amp2sh.py +870 -0
  5. niwrap_mrtrix/mrtrix/connectome2tck.py +583 -0
  6. niwrap_mrtrix/mrtrix/connectomeedit.py +413 -0
  7. niwrap_mrtrix/mrtrix/connectomestats.py +956 -0
  8. niwrap_mrtrix/mrtrix/dcmedit.py +552 -0
  9. niwrap_mrtrix/mrtrix/dcminfo.py +529 -0
  10. niwrap_mrtrix/mrtrix/dirflip.py +440 -0
  11. niwrap_mrtrix/mrtrix/dirgen.py +514 -0
  12. niwrap_mrtrix/mrtrix/dirmerge.py +446 -0
  13. niwrap_mrtrix/mrtrix/dirorder.py +421 -0
  14. niwrap_mrtrix/mrtrix/dirsplit.py +436 -0
  15. niwrap_mrtrix/mrtrix/dirstat.py +640 -0
  16. niwrap_mrtrix/mrtrix/dwi2adc.py +531 -0
  17. niwrap_mrtrix/mrtrix/dwi2fod.py +1156 -0
  18. niwrap_mrtrix/mrtrix/dwi2mask.py +570 -0
  19. niwrap_mrtrix/mrtrix/dwi2response.py +1774 -0
  20. niwrap_mrtrix/mrtrix/dwi2tensor.py +715 -0
  21. niwrap_mrtrix/mrtrix/dwibiascorrect.py +673 -0
  22. niwrap_mrtrix/mrtrix/dwidenoise.py +570 -0
  23. niwrap_mrtrix/mrtrix/dwiextract.py +1111 -0
  24. niwrap_mrtrix/mrtrix/dwigradcheck.py +665 -0
  25. niwrap_mrtrix/mrtrix/fixel2peaks.py +613 -0
  26. niwrap_mrtrix/mrtrix/fixel2sh.py +430 -0
  27. niwrap_mrtrix/mrtrix/fixel2tsf.py +435 -0
  28. niwrap_mrtrix/mrtrix/fixel2voxel.py +523 -0
  29. niwrap_mrtrix/mrtrix/fixelcfestats.py +1179 -0
  30. niwrap_mrtrix/mrtrix/fixelconnectivity.py +477 -0
  31. niwrap_mrtrix/mrtrix/fixelconvert.py +850 -0
  32. niwrap_mrtrix/mrtrix/fixelcorrespondence.py +455 -0
  33. niwrap_mrtrix/mrtrix/fixelcrop.py +422 -0
  34. niwrap_mrtrix/mrtrix/fixelfilter.py +882 -0
  35. niwrap_mrtrix/mrtrix/fixelreorient.py +435 -0
  36. niwrap_mrtrix/mrtrix/fod2dec.py +571 -0
  37. niwrap_mrtrix/mrtrix/fod2fixel.py +646 -0
  38. niwrap_mrtrix/mrtrix/label2colour.py +426 -0
  39. niwrap_mrtrix/mrtrix/label2mesh.py +417 -0
  40. niwrap_mrtrix/mrtrix/labelconvert.py +460 -0
  41. niwrap_mrtrix/mrtrix/labelstats.py +418 -0
  42. niwrap_mrtrix/mrtrix/maskdump.py +404 -0
  43. niwrap_mrtrix/mrtrix/maskfilter.py +730 -0
  44. niwrap_mrtrix/mrtrix/mesh2voxel.py +422 -0
  45. niwrap_mrtrix/mrtrix/meshconvert.py +514 -0
  46. niwrap_mrtrix/mrtrix/meshfilter.py +452 -0
  47. niwrap_mrtrix/mrtrix/mraverageheader.py +485 -0
  48. niwrap_mrtrix/mrtrix/mrcalc.py +4302 -0
  49. niwrap_mrtrix/mrtrix/mrcat.py +467 -0
  50. niwrap_mrtrix/mrtrix/mrcentroid.py +418 -0
  51. niwrap_mrtrix/mrtrix/mrcheckerboardmask.py +446 -0
  52. niwrap_mrtrix/mrtrix/mrclusterstats.py +930 -0
  53. niwrap_mrtrix/mrtrix/mrcolour.py +490 -0
  54. niwrap_mrtrix/mrtrix/mrconvert.py +1967 -0
  55. niwrap_mrtrix/mrtrix/mrdegibbs.py +535 -0
  56. niwrap_mrtrix/mrtrix/mrdump.py +423 -0
  57. niwrap_mrtrix/mrtrix/mredit.py +737 -0
  58. niwrap_mrtrix/mrtrix/mrfilter.py +971 -0
  59. niwrap_mrtrix/mrtrix/mrgrid.py +1079 -0
  60. niwrap_mrtrix/mrtrix/mrhistmatch.py +494 -0
  61. niwrap_mrtrix/mrtrix/mrhistogram.py +484 -0
  62. niwrap_mrtrix/mrtrix/mrinfo.py +1282 -0
  63. niwrap_mrtrix/mrtrix/mrmath.py +503 -0
  64. niwrap_mrtrix/mrtrix/mrmetric.py +525 -0
  65. niwrap_mrtrix/mrtrix/mrregister.py +2098 -0
  66. niwrap_mrtrix/mrtrix/mrstats.py +534 -0
  67. niwrap_mrtrix/mrtrix/mrthreshold.py +666 -0
  68. niwrap_mrtrix/mrtrix/mrtransform.py +1372 -0
  69. niwrap_mrtrix/mrtrix/mtnormalise.py +725 -0
  70. niwrap_mrtrix/mrtrix/peaks2amp.py +403 -0
  71. niwrap_mrtrix/mrtrix/peaks2fixel.py +422 -0
  72. niwrap_mrtrix/mrtrix/responsemean.py +385 -0
  73. niwrap_mrtrix/mrtrix/sh2amp.py +844 -0
  74. niwrap_mrtrix/mrtrix/sh2peaks.py +632 -0
  75. niwrap_mrtrix/mrtrix/sh2power.py +427 -0
  76. niwrap_mrtrix/mrtrix/sh2response.py +481 -0
  77. niwrap_mrtrix/mrtrix/shbasis.py +445 -0
  78. niwrap_mrtrix/mrtrix/shconv.py +661 -0
  79. niwrap_mrtrix/mrtrix/tck2connectome.py +727 -0
  80. niwrap_mrtrix/mrtrix/tck2fixel.py +447 -0
  81. niwrap_mrtrix/mrtrix/tckconvert.py +775 -0
  82. niwrap_mrtrix/mrtrix/tckdfc.py +684 -0
  83. niwrap_mrtrix/mrtrix/tckedit.py +1478 -0
  84. niwrap_mrtrix/mrtrix/tckgen.py +2733 -0
  85. niwrap_mrtrix/mrtrix/tckglobal.py +944 -0
  86. niwrap_mrtrix/mrtrix/tckinfo.py +402 -0
  87. niwrap_mrtrix/mrtrix/tckmap.py +1004 -0
  88. niwrap_mrtrix/mrtrix/tckresample.py +760 -0
  89. niwrap_mrtrix/mrtrix/tcksample.py +497 -0
  90. niwrap_mrtrix/mrtrix/tcksift.py +739 -0
  91. niwrap_mrtrix/mrtrix/tcksift2.py +902 -0
  92. niwrap_mrtrix/mrtrix/tckstats.py +550 -0
  93. niwrap_mrtrix/mrtrix/tcktransform.py +414 -0
  94. niwrap_mrtrix/mrtrix/tensor2metric.py +659 -0
  95. niwrap_mrtrix/mrtrix/transformcalc.py +421 -0
  96. niwrap_mrtrix/mrtrix/transformcompose.py +625 -0
  97. niwrap_mrtrix/mrtrix/transformconvert.py +423 -0
  98. niwrap_mrtrix/mrtrix/tsfdivide.py +414 -0
  99. niwrap_mrtrix/mrtrix/tsfinfo.py +421 -0
  100. niwrap_mrtrix/mrtrix/tsfmult.py +401 -0
  101. niwrap_mrtrix/mrtrix/tsfsmooth.py +420 -0
  102. niwrap_mrtrix/mrtrix/tsfthreshold.py +428 -0
  103. niwrap_mrtrix/mrtrix/tsfvalidate.py +398 -0
  104. niwrap_mrtrix/mrtrix/v_5tt2gmwmi.py +432 -0
  105. niwrap_mrtrix/mrtrix/v_5tt2vis.py +505 -0
  106. niwrap_mrtrix/mrtrix/v_5ttcheck.py +409 -0
  107. niwrap_mrtrix/mrtrix/v_5ttedit.py +513 -0
  108. niwrap_mrtrix/mrtrix/v_5ttgen.py +1107 -0
  109. niwrap_mrtrix/mrtrix/vectorstats.py +736 -0
  110. niwrap_mrtrix/mrtrix/voxel2fixel.py +430 -0
  111. niwrap_mrtrix/mrtrix/voxel2mesh.py +454 -0
  112. niwrap_mrtrix/mrtrix/warp2metric.py +556 -0
  113. niwrap_mrtrix/mrtrix/warpconvert.py +498 -0
  114. niwrap_mrtrix/mrtrix/warpcorrect.py +448 -0
  115. niwrap_mrtrix/mrtrix/warpinit.py +425 -0
  116. niwrap_mrtrix/mrtrix/warpinvert.py +448 -0
  117. niwrap_mrtrix-0.8.0.dist-info/METADATA +8 -0
  118. niwrap_mrtrix-0.8.0.dist-info/RECORD +119 -0
  119. niwrap_mrtrix-0.8.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,727 @@
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
+ TCK2CONNECTOME_METADATA = Metadata(
9
+ id="a66d5312bce1284177c4cf9ad60b3718c4a1a2b0.boutiques",
10
+ name="tck2connectome",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _Tck2connectomeConfigParamsDictNoTag = typing.TypedDict('_Tck2connectomeConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ Tck2connectomeConfigParamsDictTagged = typing.TypedDict('Tck2connectomeConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ Tck2connectomeConfigParamsDict = _Tck2connectomeConfigParamsDictNoTag | Tck2connectomeConfigParamsDictTagged
26
+
27
+
28
+ _Tck2connectomeParamsDictNoTag = typing.TypedDict('_Tck2connectomeParamsDictNoTag', {
29
+ "assignment_end_voxels": bool,
30
+ "assignment_radial_search": typing.NotRequired[float | None],
31
+ "assignment_reverse_search": typing.NotRequired[float | None],
32
+ "assignment_forward_search": typing.NotRequired[float | None],
33
+ "assignment_all_voxels": bool,
34
+ "scale_length": bool,
35
+ "scale_invlength": bool,
36
+ "scale_invnodevol": bool,
37
+ "scale_file": typing.NotRequired[InputPathType | None],
38
+ "symmetric": bool,
39
+ "zero_diagonal": bool,
40
+ "stat_edge": typing.NotRequired[str | None],
41
+ "tck_weights_in": typing.NotRequired[InputPathType | None],
42
+ "keep_unassigned": bool,
43
+ "out_assignments": typing.NotRequired[str | None],
44
+ "vector": bool,
45
+ "info": bool,
46
+ "quiet": bool,
47
+ "debug": bool,
48
+ "force": bool,
49
+ "nthreads": typing.NotRequired[int | None],
50
+ "config": typing.NotRequired[list[Tck2connectomeConfigParamsDict] | None],
51
+ "help": bool,
52
+ "version": bool,
53
+ "tracks_in": InputPathType,
54
+ "nodes_in": InputPathType,
55
+ "connectome_out": str,
56
+ })
57
+ Tck2connectomeParamsDictTagged = typing.TypedDict('Tck2connectomeParamsDictTagged', {
58
+ "@type": typing.Literal["mrtrix/tck2connectome"],
59
+ "assignment_end_voxels": bool,
60
+ "assignment_radial_search": typing.NotRequired[float | None],
61
+ "assignment_reverse_search": typing.NotRequired[float | None],
62
+ "assignment_forward_search": typing.NotRequired[float | None],
63
+ "assignment_all_voxels": bool,
64
+ "scale_length": bool,
65
+ "scale_invlength": bool,
66
+ "scale_invnodevol": bool,
67
+ "scale_file": typing.NotRequired[InputPathType | None],
68
+ "symmetric": bool,
69
+ "zero_diagonal": bool,
70
+ "stat_edge": typing.NotRequired[str | None],
71
+ "tck_weights_in": typing.NotRequired[InputPathType | None],
72
+ "keep_unassigned": bool,
73
+ "out_assignments": typing.NotRequired[str | None],
74
+ "vector": bool,
75
+ "info": bool,
76
+ "quiet": bool,
77
+ "debug": bool,
78
+ "force": bool,
79
+ "nthreads": typing.NotRequired[int | None],
80
+ "config": typing.NotRequired[list[Tck2connectomeConfigParamsDict] | None],
81
+ "help": bool,
82
+ "version": bool,
83
+ "tracks_in": InputPathType,
84
+ "nodes_in": InputPathType,
85
+ "connectome_out": str,
86
+ })
87
+ Tck2connectomeParamsDict = _Tck2connectomeParamsDictNoTag | Tck2connectomeParamsDictTagged
88
+
89
+
90
+ def tck2connectome_config(
91
+ key: str,
92
+ value: str,
93
+ ) -> Tck2connectomeConfigParamsDictTagged:
94
+ """
95
+ Build parameters.
96
+
97
+ Args:
98
+ key: temporarily set the value of an MRtrix config file entry.
99
+ value: temporarily set the value of an MRtrix config file entry.
100
+ Returns:
101
+ Parameter dictionary
102
+ """
103
+ params = {
104
+ "@type": "config",
105
+ "key": key,
106
+ "value": value,
107
+ }
108
+ return params
109
+
110
+
111
+ def tck2connectome_config_validate(
112
+ params: typing.Any,
113
+ ) -> None:
114
+ """
115
+ Validate parameters. Throws an error if `params` is not a valid
116
+ `Tck2connectomeConfigParamsDict` object.
117
+
118
+ Args:
119
+ params: The parameters object to validate.
120
+ """
121
+ if params is None or not isinstance(params, dict):
122
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
123
+ if params.get("key", None) is None:
124
+ raise StyxValidationError("`key` must not be None")
125
+ if not isinstance(params["key"], str):
126
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
127
+ if params.get("value", None) is None:
128
+ raise StyxValidationError("`value` must not be None")
129
+ if not isinstance(params["value"], str):
130
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
131
+
132
+
133
+ def tck2connectome_config_cargs(
134
+ params: Tck2connectomeConfigParamsDict,
135
+ execution: Execution,
136
+ ) -> list[str]:
137
+ """
138
+ Build command-line arguments from parameters.
139
+
140
+ Args:
141
+ params: The parameters.
142
+ execution: The execution object for resolving input paths.
143
+ Returns:
144
+ Command-line arguments.
145
+ """
146
+ cargs = []
147
+ cargs.append("-config")
148
+ cargs.append(params.get("key", None))
149
+ cargs.append(params.get("value", None))
150
+ return cargs
151
+
152
+
153
+ class Tck2connectomeOutputs(typing.NamedTuple):
154
+ """
155
+ Output object returned when calling `Tck2connectomeParamsDict(...)`.
156
+ """
157
+ root: OutputPathType
158
+ """Output root folder. This is the root folder for all outputs."""
159
+ connectome_out: OutputPathType
160
+ """the output .csv file containing edge weights"""
161
+ out_assignments: OutputPathType | None
162
+ """output the node assignments of each streamline to a file; this can be
163
+ used subsequently e.g. by the command connectome2tck """
164
+
165
+
166
+ def tck2connectome_params(
167
+ tracks_in: InputPathType,
168
+ nodes_in: InputPathType,
169
+ connectome_out: str,
170
+ assignment_end_voxels: bool = False,
171
+ assignment_radial_search: float | None = None,
172
+ assignment_reverse_search: float | None = None,
173
+ assignment_forward_search: float | None = None,
174
+ assignment_all_voxels: bool = False,
175
+ scale_length: bool = False,
176
+ scale_invlength: bool = False,
177
+ scale_invnodevol: bool = False,
178
+ scale_file: InputPathType | None = None,
179
+ symmetric: bool = False,
180
+ zero_diagonal: bool = False,
181
+ stat_edge: str | None = None,
182
+ tck_weights_in: InputPathType | None = None,
183
+ keep_unassigned: bool = False,
184
+ out_assignments: str | None = None,
185
+ vector: bool = False,
186
+ info: bool = False,
187
+ quiet: bool = False,
188
+ debug: bool = False,
189
+ force: bool = False,
190
+ nthreads: int | None = None,
191
+ config: list[Tck2connectomeConfigParamsDict] | None = None,
192
+ help_: bool = False,
193
+ version: bool = False,
194
+ ) -> Tck2connectomeParamsDictTagged:
195
+ """
196
+ Build parameters.
197
+
198
+ Args:
199
+ tracks_in: the input track file.
200
+ nodes_in: the input node parcellation image.
201
+ connectome_out: the output .csv file containing edge weights.
202
+ assignment_end_voxels: use a simple voxel lookup value at each\
203
+ streamline endpoint.
204
+ assignment_radial_search: perform a radial search from each streamline\
205
+ endpoint to locate the nearest node. Argument is the maximum radius in\
206
+ mm; if no node is found within this radius, the streamline endpoint is\
207
+ not assigned to any node. Default search distance is 4mm.
208
+ assignment_reverse_search: traverse from each streamline endpoint\
209
+ inwards along the streamline, in search of the last node traversed by\
210
+ the streamline. Argument is the maximum traversal length in mm (set to\
211
+ 0 to allow search to continue to the streamline midpoint).
212
+ assignment_forward_search: project the streamline forwards from the\
213
+ endpoint in search of a parcellation node voxel. Argument is the\
214
+ maximum traversal length in mm.
215
+ assignment_all_voxels: assign the streamline to all nodes it intersects\
216
+ along its length (note that this means a streamline may be assigned to\
217
+ more than two nodes, or indeed none at all).
218
+ scale_length: scale each contribution to the connectome edge by the\
219
+ length of the streamline.
220
+ scale_invlength: scale each contribution to the connectome edge by the\
221
+ inverse of the streamline length.
222
+ scale_invnodevol: scale each contribution to the connectome edge by the\
223
+ inverse of the two node volumes.
224
+ scale_file: scale each contribution to the connectome edge according to\
225
+ the values in a vector file.
226
+ symmetric: Make matrices symmetric on output.
227
+ zero_diagonal: Set matrix diagonal to zero on output.
228
+ stat_edge: statistic for combining the values from all streamlines in\
229
+ an edge into a single scale value for that edge (options are:\
230
+ sum,mean,min,max; default=sum).
231
+ tck_weights_in: specify a text scalar file containing the streamline\
232
+ weights.
233
+ keep_unassigned: By default, the program discards the information\
234
+ regarding those streamlines that are not successfully assigned to a\
235
+ node pair. Set this option to keep these values (will be the first\
236
+ row/column in the output matrix).
237
+ out_assignments: output the node assignments of each streamline to a\
238
+ file; this can be used subsequently e.g. by the command connectome2tck.
239
+ vector: output a vector representing connectivities from a given seed\
240
+ point to target nodes, rather than a matrix of node-node connectivities.
241
+ info: display information messages.
242
+ quiet: do not display information messages or progress status;\
243
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
244
+ environment variable to a non-empty string.
245
+ debug: display debugging messages.
246
+ force: force overwrite of output files (caution: using the same file as\
247
+ input and output might cause unexpected behaviour).
248
+ nthreads: use this number of threads in multi-threaded applications\
249
+ (set to 0 to disable multi-threading).
250
+ config: temporarily set the value of an MRtrix config file entry.
251
+ help_: display this information page and exit.
252
+ version: display version information and exit.
253
+ Returns:
254
+ Parameter dictionary
255
+ """
256
+ params = {
257
+ "@type": "mrtrix/tck2connectome",
258
+ "assignment_end_voxels": assignment_end_voxels,
259
+ "assignment_all_voxels": assignment_all_voxels,
260
+ "scale_length": scale_length,
261
+ "scale_invlength": scale_invlength,
262
+ "scale_invnodevol": scale_invnodevol,
263
+ "symmetric": symmetric,
264
+ "zero_diagonal": zero_diagonal,
265
+ "keep_unassigned": keep_unassigned,
266
+ "vector": vector,
267
+ "info": info,
268
+ "quiet": quiet,
269
+ "debug": debug,
270
+ "force": force,
271
+ "help": help_,
272
+ "version": version,
273
+ "tracks_in": tracks_in,
274
+ "nodes_in": nodes_in,
275
+ "connectome_out": connectome_out,
276
+ }
277
+ if assignment_radial_search is not None:
278
+ params["assignment_radial_search"] = assignment_radial_search
279
+ if assignment_reverse_search is not None:
280
+ params["assignment_reverse_search"] = assignment_reverse_search
281
+ if assignment_forward_search is not None:
282
+ params["assignment_forward_search"] = assignment_forward_search
283
+ if scale_file is not None:
284
+ params["scale_file"] = scale_file
285
+ if stat_edge is not None:
286
+ params["stat_edge"] = stat_edge
287
+ if tck_weights_in is not None:
288
+ params["tck_weights_in"] = tck_weights_in
289
+ if out_assignments is not None:
290
+ params["out_assignments"] = out_assignments
291
+ if nthreads is not None:
292
+ params["nthreads"] = nthreads
293
+ if config is not None:
294
+ params["config"] = config
295
+ return params
296
+
297
+
298
+ def tck2connectome_validate(
299
+ params: typing.Any,
300
+ ) -> None:
301
+ """
302
+ Validate parameters. Throws an error if `params` is not a valid
303
+ `Tck2connectomeParamsDict` object.
304
+
305
+ Args:
306
+ params: The parameters object to validate.
307
+ """
308
+ if params is None or not isinstance(params, dict):
309
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
310
+ if params.get("assignment_end_voxels", False) is None:
311
+ raise StyxValidationError("`assignment_end_voxels` must not be None")
312
+ if not isinstance(params["assignment_end_voxels"], bool):
313
+ raise StyxValidationError(f'`assignment_end_voxels` has the wrong type: Received `{type(params.get("assignment_end_voxels", False))}` expected `bool`')
314
+ if params.get("assignment_radial_search", None) is not None:
315
+ if not isinstance(params["assignment_radial_search"], (float, int)):
316
+ raise StyxValidationError(f'`assignment_radial_search` has the wrong type: Received `{type(params.get("assignment_radial_search", None))}` expected `float | None`')
317
+ if params.get("assignment_reverse_search", None) is not None:
318
+ if not isinstance(params["assignment_reverse_search"], (float, int)):
319
+ raise StyxValidationError(f'`assignment_reverse_search` has the wrong type: Received `{type(params.get("assignment_reverse_search", None))}` expected `float | None`')
320
+ if params.get("assignment_forward_search", None) is not None:
321
+ if not isinstance(params["assignment_forward_search"], (float, int)):
322
+ raise StyxValidationError(f'`assignment_forward_search` has the wrong type: Received `{type(params.get("assignment_forward_search", None))}` expected `float | None`')
323
+ if params.get("assignment_all_voxels", False) is None:
324
+ raise StyxValidationError("`assignment_all_voxels` must not be None")
325
+ if not isinstance(params["assignment_all_voxels"], bool):
326
+ raise StyxValidationError(f'`assignment_all_voxels` has the wrong type: Received `{type(params.get("assignment_all_voxels", False))}` expected `bool`')
327
+ if params.get("scale_length", False) is None:
328
+ raise StyxValidationError("`scale_length` must not be None")
329
+ if not isinstance(params["scale_length"], bool):
330
+ raise StyxValidationError(f'`scale_length` has the wrong type: Received `{type(params.get("scale_length", False))}` expected `bool`')
331
+ if params.get("scale_invlength", False) is None:
332
+ raise StyxValidationError("`scale_invlength` must not be None")
333
+ if not isinstance(params["scale_invlength"], bool):
334
+ raise StyxValidationError(f'`scale_invlength` has the wrong type: Received `{type(params.get("scale_invlength", False))}` expected `bool`')
335
+ if params.get("scale_invnodevol", False) is None:
336
+ raise StyxValidationError("`scale_invnodevol` must not be None")
337
+ if not isinstance(params["scale_invnodevol"], bool):
338
+ raise StyxValidationError(f'`scale_invnodevol` has the wrong type: Received `{type(params.get("scale_invnodevol", False))}` expected `bool`')
339
+ if params.get("scale_file", None) is not None:
340
+ if not isinstance(params["scale_file"], (pathlib.Path, str)):
341
+ raise StyxValidationError(f'`scale_file` has the wrong type: Received `{type(params.get("scale_file", None))}` expected `InputPathType | None`')
342
+ if params.get("symmetric", False) is None:
343
+ raise StyxValidationError("`symmetric` must not be None")
344
+ if not isinstance(params["symmetric"], bool):
345
+ raise StyxValidationError(f'`symmetric` has the wrong type: Received `{type(params.get("symmetric", False))}` expected `bool`')
346
+ if params.get("zero_diagonal", False) is None:
347
+ raise StyxValidationError("`zero_diagonal` must not be None")
348
+ if not isinstance(params["zero_diagonal"], bool):
349
+ raise StyxValidationError(f'`zero_diagonal` has the wrong type: Received `{type(params.get("zero_diagonal", False))}` expected `bool`')
350
+ if params.get("stat_edge", None) is not None:
351
+ if not isinstance(params["stat_edge"], str):
352
+ raise StyxValidationError(f'`stat_edge` has the wrong type: Received `{type(params.get("stat_edge", None))}` expected `str | None`')
353
+ if params.get("tck_weights_in", None) is not None:
354
+ if not isinstance(params["tck_weights_in"], (pathlib.Path, str)):
355
+ raise StyxValidationError(f'`tck_weights_in` has the wrong type: Received `{type(params.get("tck_weights_in", None))}` expected `InputPathType | None`')
356
+ if params.get("keep_unassigned", False) is None:
357
+ raise StyxValidationError("`keep_unassigned` must not be None")
358
+ if not isinstance(params["keep_unassigned"], bool):
359
+ raise StyxValidationError(f'`keep_unassigned` has the wrong type: Received `{type(params.get("keep_unassigned", False))}` expected `bool`')
360
+ if params.get("out_assignments", None) is not None:
361
+ if not isinstance(params["out_assignments"], str):
362
+ raise StyxValidationError(f'`out_assignments` has the wrong type: Received `{type(params.get("out_assignments", None))}` expected `str | None`')
363
+ if params.get("vector", False) is None:
364
+ raise StyxValidationError("`vector` must not be None")
365
+ if not isinstance(params["vector"], bool):
366
+ raise StyxValidationError(f'`vector` has the wrong type: Received `{type(params.get("vector", False))}` expected `bool`')
367
+ if params.get("info", False) is None:
368
+ raise StyxValidationError("`info` must not be None")
369
+ if not isinstance(params["info"], bool):
370
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
371
+ if params.get("quiet", False) is None:
372
+ raise StyxValidationError("`quiet` must not be None")
373
+ if not isinstance(params["quiet"], bool):
374
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
375
+ if params.get("debug", False) is None:
376
+ raise StyxValidationError("`debug` must not be None")
377
+ if not isinstance(params["debug"], bool):
378
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
379
+ if params.get("force", False) is None:
380
+ raise StyxValidationError("`force` must not be None")
381
+ if not isinstance(params["force"], bool):
382
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
383
+ if params.get("nthreads", None) is not None:
384
+ if not isinstance(params["nthreads"], int):
385
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
386
+ if params.get("config", None) is not None:
387
+ if not isinstance(params["config"], list):
388
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Tck2connectomeConfigParamsDict] | None`')
389
+ for e in params["config"]:
390
+ tck2connectome_config_validate(e)
391
+ if params.get("help", False) is None:
392
+ raise StyxValidationError("`help` must not be None")
393
+ if not isinstance(params["help"], bool):
394
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
395
+ if params.get("version", False) is None:
396
+ raise StyxValidationError("`version` must not be None")
397
+ if not isinstance(params["version"], bool):
398
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
399
+ if params.get("tracks_in", None) is None:
400
+ raise StyxValidationError("`tracks_in` must not be None")
401
+ if not isinstance(params["tracks_in"], (pathlib.Path, str)):
402
+ raise StyxValidationError(f'`tracks_in` has the wrong type: Received `{type(params.get("tracks_in", None))}` expected `InputPathType`')
403
+ if params.get("nodes_in", None) is None:
404
+ raise StyxValidationError("`nodes_in` must not be None")
405
+ if not isinstance(params["nodes_in"], (pathlib.Path, str)):
406
+ raise StyxValidationError(f'`nodes_in` has the wrong type: Received `{type(params.get("nodes_in", None))}` expected `InputPathType`')
407
+ if params.get("connectome_out", None) is None:
408
+ raise StyxValidationError("`connectome_out` must not be None")
409
+ if not isinstance(params["connectome_out"], str):
410
+ raise StyxValidationError(f'`connectome_out` has the wrong type: Received `{type(params.get("connectome_out", None))}` expected `str`')
411
+
412
+
413
+ def tck2connectome_cargs(
414
+ params: Tck2connectomeParamsDict,
415
+ execution: Execution,
416
+ ) -> list[str]:
417
+ """
418
+ Build command-line arguments from parameters.
419
+
420
+ Args:
421
+ params: The parameters.
422
+ execution: The execution object for resolving input paths.
423
+ Returns:
424
+ Command-line arguments.
425
+ """
426
+ cargs = []
427
+ cargs.append("tck2connectome")
428
+ if params.get("assignment_end_voxels", False):
429
+ cargs.append("-assignment_end_voxels")
430
+ if params.get("assignment_radial_search", None) is not None:
431
+ cargs.extend([
432
+ "-assignment_radial_search",
433
+ str(params.get("assignment_radial_search", None))
434
+ ])
435
+ if params.get("assignment_reverse_search", None) is not None:
436
+ cargs.extend([
437
+ "-assignment_reverse_search",
438
+ str(params.get("assignment_reverse_search", None))
439
+ ])
440
+ if params.get("assignment_forward_search", None) is not None:
441
+ cargs.extend([
442
+ "-assignment_forward_search",
443
+ str(params.get("assignment_forward_search", None))
444
+ ])
445
+ if params.get("assignment_all_voxels", False):
446
+ cargs.append("-assignment_all_voxels")
447
+ if params.get("scale_length", False):
448
+ cargs.append("-scale_length")
449
+ if params.get("scale_invlength", False):
450
+ cargs.append("-scale_invlength")
451
+ if params.get("scale_invnodevol", False):
452
+ cargs.append("-scale_invnodevol")
453
+ if params.get("scale_file", None) is not None:
454
+ cargs.extend([
455
+ "-scale_file",
456
+ execution.input_file(params.get("scale_file", None))
457
+ ])
458
+ if params.get("symmetric", False):
459
+ cargs.append("-symmetric")
460
+ if params.get("zero_diagonal", False):
461
+ cargs.append("-zero_diagonal")
462
+ if params.get("stat_edge", None) is not None:
463
+ cargs.extend([
464
+ "-stat_edge",
465
+ params.get("stat_edge", None)
466
+ ])
467
+ if params.get("tck_weights_in", None) is not None:
468
+ cargs.extend([
469
+ "-tck_weights_in",
470
+ execution.input_file(params.get("tck_weights_in", None))
471
+ ])
472
+ if params.get("keep_unassigned", False):
473
+ cargs.append("-keep_unassigned")
474
+ if params.get("out_assignments", None) is not None:
475
+ cargs.extend([
476
+ "-out_assignments",
477
+ params.get("out_assignments", None)
478
+ ])
479
+ if params.get("vector", False):
480
+ cargs.append("-vector")
481
+ if params.get("info", False):
482
+ cargs.append("-info")
483
+ if params.get("quiet", False):
484
+ cargs.append("-quiet")
485
+ if params.get("debug", False):
486
+ cargs.append("-debug")
487
+ if params.get("force", False):
488
+ cargs.append("-force")
489
+ if params.get("nthreads", None) is not None:
490
+ cargs.extend([
491
+ "-nthreads",
492
+ str(params.get("nthreads", None))
493
+ ])
494
+ if params.get("config", None) is not None:
495
+ cargs.extend([a for c in [tck2connectome_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
496
+ if params.get("help", False):
497
+ cargs.append("-help")
498
+ if params.get("version", False):
499
+ cargs.append("-version")
500
+ cargs.append(execution.input_file(params.get("tracks_in", None)))
501
+ cargs.append(execution.input_file(params.get("nodes_in", None)))
502
+ cargs.append(params.get("connectome_out", None))
503
+ return cargs
504
+
505
+
506
+ def tck2connectome_outputs(
507
+ params: Tck2connectomeParamsDict,
508
+ execution: Execution,
509
+ ) -> Tck2connectomeOutputs:
510
+ """
511
+ Build outputs object containing output file paths and possibly stdout/stderr.
512
+
513
+ Args:
514
+ params: The parameters.
515
+ execution: The execution object for resolving input paths.
516
+ Returns:
517
+ Outputs object.
518
+ """
519
+ ret = Tck2connectomeOutputs(
520
+ root=execution.output_file("."),
521
+ connectome_out=execution.output_file(params.get("connectome_out", None)),
522
+ out_assignments=execution.output_file(params.get("out_assignments", None)) if (params.get("out_assignments") is not None) else None,
523
+ )
524
+ return ret
525
+
526
+
527
+ def tck2connectome_execute(
528
+ params: Tck2connectomeParamsDict,
529
+ runner: Runner | None = None,
530
+ ) -> Tck2connectomeOutputs:
531
+ """
532
+ tck2connectome
533
+
534
+ Generate a connectome matrix from a streamlines file and a node parcellation
535
+ image.
536
+
537
+
538
+
539
+ References:
540
+
541
+ If using the default streamline-parcel assignment mechanism (or
542
+ -assignment_radial_search option): Smith, R. E.; Tournier, J.-D.; Calamante,
543
+ F. & Connelly, A. The effects of SIFT on the reproducibility and biological
544
+ accuracy of the structural connectome. NeuroImage, 2015, 104, 253-265
545
+
546
+ If using -scale_invlength or -scale_invnodevol options: Hagmann, P.;
547
+ Cammoun, L.; Gigandet, X.; Meuli, R.; Honey, C.; Wedeen, V. & Sporns, O.
548
+ Mapping the Structural Core of Human Cerebral Cortex. PLoS Biology 6(7),
549
+ e159.
550
+
551
+ Author: MRTrix3 Developers
552
+
553
+ URL: https://www.mrtrix.org/
554
+
555
+ Args:
556
+ params: The parameters.
557
+ runner: Command runner.
558
+ Returns:
559
+ NamedTuple of outputs (described in `Tck2connectomeOutputs`).
560
+ """
561
+ tck2connectome_validate(params)
562
+ runner = runner or get_global_runner()
563
+ execution = runner.start_execution(TCK2CONNECTOME_METADATA)
564
+ params = execution.params(params)
565
+ cargs = tck2connectome_cargs(params, execution)
566
+ ret = tck2connectome_outputs(params, execution)
567
+ execution.run(cargs)
568
+ return ret
569
+
570
+
571
+ def tck2connectome(
572
+ tracks_in: InputPathType,
573
+ nodes_in: InputPathType,
574
+ connectome_out: str,
575
+ assignment_end_voxels: bool = False,
576
+ assignment_radial_search: float | None = None,
577
+ assignment_reverse_search: float | None = None,
578
+ assignment_forward_search: float | None = None,
579
+ assignment_all_voxels: bool = False,
580
+ scale_length: bool = False,
581
+ scale_invlength: bool = False,
582
+ scale_invnodevol: bool = False,
583
+ scale_file: InputPathType | None = None,
584
+ symmetric: bool = False,
585
+ zero_diagonal: bool = False,
586
+ stat_edge: str | None = None,
587
+ tck_weights_in: InputPathType | None = None,
588
+ keep_unassigned: bool = False,
589
+ out_assignments: str | None = None,
590
+ vector: bool = False,
591
+ info: bool = False,
592
+ quiet: bool = False,
593
+ debug: bool = False,
594
+ force: bool = False,
595
+ nthreads: int | None = None,
596
+ config: list[Tck2connectomeConfigParamsDict] | None = None,
597
+ help_: bool = False,
598
+ version: bool = False,
599
+ runner: Runner | None = None,
600
+ ) -> Tck2connectomeOutputs:
601
+ """
602
+ tck2connectome
603
+
604
+ Generate a connectome matrix from a streamlines file and a node parcellation
605
+ image.
606
+
607
+
608
+
609
+ References:
610
+
611
+ If using the default streamline-parcel assignment mechanism (or
612
+ -assignment_radial_search option): Smith, R. E.; Tournier, J.-D.; Calamante,
613
+ F. & Connelly, A. The effects of SIFT on the reproducibility and biological
614
+ accuracy of the structural connectome. NeuroImage, 2015, 104, 253-265
615
+
616
+ If using -scale_invlength or -scale_invnodevol options: Hagmann, P.;
617
+ Cammoun, L.; Gigandet, X.; Meuli, R.; Honey, C.; Wedeen, V. & Sporns, O.
618
+ Mapping the Structural Core of Human Cerebral Cortex. PLoS Biology 6(7),
619
+ e159.
620
+
621
+ Author: MRTrix3 Developers
622
+
623
+ URL: https://www.mrtrix.org/
624
+
625
+ Args:
626
+ tracks_in: the input track file.
627
+ nodes_in: the input node parcellation image.
628
+ connectome_out: the output .csv file containing edge weights.
629
+ assignment_end_voxels: use a simple voxel lookup value at each\
630
+ streamline endpoint.
631
+ assignment_radial_search: perform a radial search from each streamline\
632
+ endpoint to locate the nearest node. Argument is the maximum radius in\
633
+ mm; if no node is found within this radius, the streamline endpoint is\
634
+ not assigned to any node. Default search distance is 4mm.
635
+ assignment_reverse_search: traverse from each streamline endpoint\
636
+ inwards along the streamline, in search of the last node traversed by\
637
+ the streamline. Argument is the maximum traversal length in mm (set to\
638
+ 0 to allow search to continue to the streamline midpoint).
639
+ assignment_forward_search: project the streamline forwards from the\
640
+ endpoint in search of a parcellation node voxel. Argument is the\
641
+ maximum traversal length in mm.
642
+ assignment_all_voxels: assign the streamline to all nodes it intersects\
643
+ along its length (note that this means a streamline may be assigned to\
644
+ more than two nodes, or indeed none at all).
645
+ scale_length: scale each contribution to the connectome edge by the\
646
+ length of the streamline.
647
+ scale_invlength: scale each contribution to the connectome edge by the\
648
+ inverse of the streamline length.
649
+ scale_invnodevol: scale each contribution to the connectome edge by the\
650
+ inverse of the two node volumes.
651
+ scale_file: scale each contribution to the connectome edge according to\
652
+ the values in a vector file.
653
+ symmetric: Make matrices symmetric on output.
654
+ zero_diagonal: Set matrix diagonal to zero on output.
655
+ stat_edge: statistic for combining the values from all streamlines in\
656
+ an edge into a single scale value for that edge (options are:\
657
+ sum,mean,min,max; default=sum).
658
+ tck_weights_in: specify a text scalar file containing the streamline\
659
+ weights.
660
+ keep_unassigned: By default, the program discards the information\
661
+ regarding those streamlines that are not successfully assigned to a\
662
+ node pair. Set this option to keep these values (will be the first\
663
+ row/column in the output matrix).
664
+ out_assignments: output the node assignments of each streamline to a\
665
+ file; this can be used subsequently e.g. by the command connectome2tck.
666
+ vector: output a vector representing connectivities from a given seed\
667
+ point to target nodes, rather than a matrix of node-node connectivities.
668
+ info: display information messages.
669
+ quiet: do not display information messages or progress status;\
670
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
671
+ environment variable to a non-empty string.
672
+ debug: display debugging messages.
673
+ force: force overwrite of output files (caution: using the same file as\
674
+ input and output might cause unexpected behaviour).
675
+ nthreads: use this number of threads in multi-threaded applications\
676
+ (set to 0 to disable multi-threading).
677
+ config: temporarily set the value of an MRtrix config file entry.
678
+ help_: display this information page and exit.
679
+ version: display version information and exit.
680
+ runner: Command runner.
681
+ Returns:
682
+ NamedTuple of outputs (described in `Tck2connectomeOutputs`).
683
+ """
684
+ params = tck2connectome_params(
685
+ assignment_end_voxels=assignment_end_voxels,
686
+ assignment_radial_search=assignment_radial_search,
687
+ assignment_reverse_search=assignment_reverse_search,
688
+ assignment_forward_search=assignment_forward_search,
689
+ assignment_all_voxels=assignment_all_voxels,
690
+ scale_length=scale_length,
691
+ scale_invlength=scale_invlength,
692
+ scale_invnodevol=scale_invnodevol,
693
+ scale_file=scale_file,
694
+ symmetric=symmetric,
695
+ zero_diagonal=zero_diagonal,
696
+ stat_edge=stat_edge,
697
+ tck_weights_in=tck_weights_in,
698
+ keep_unassigned=keep_unassigned,
699
+ out_assignments=out_assignments,
700
+ vector=vector,
701
+ info=info,
702
+ quiet=quiet,
703
+ debug=debug,
704
+ force=force,
705
+ nthreads=nthreads,
706
+ config=config,
707
+ help_=help_,
708
+ version=version,
709
+ tracks_in=tracks_in,
710
+ nodes_in=nodes_in,
711
+ connectome_out=connectome_out,
712
+ )
713
+ return tck2connectome_execute(params, runner)
714
+
715
+
716
+ __all__ = [
717
+ "TCK2CONNECTOME_METADATA",
718
+ "Tck2connectomeConfigParamsDict",
719
+ "Tck2connectomeConfigParamsDictTagged",
720
+ "Tck2connectomeOutputs",
721
+ "Tck2connectomeParamsDict",
722
+ "Tck2connectomeParamsDictTagged",
723
+ "tck2connectome",
724
+ "tck2connectome_config",
725
+ "tck2connectome_execute",
726
+ "tck2connectome_params",
727
+ ]