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,760 @@
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
+ TCKRESAMPLE_METADATA = Metadata(
9
+ id="78ef274f2a87923f211402ee1cddb82172cd3499.boutiques",
10
+ name="tckresample",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _TckresampleLineParamsDictNoTag = typing.TypedDict('_TckresampleLineParamsDictNoTag', {
17
+ "num": int,
18
+ "start": list[float],
19
+ "end": list[float],
20
+ })
21
+ TckresampleLineParamsDictTagged = typing.TypedDict('TckresampleLineParamsDictTagged', {
22
+ "@type": typing.Literal["line"],
23
+ "num": int,
24
+ "start": list[float],
25
+ "end": list[float],
26
+ })
27
+ TckresampleLineParamsDict = _TckresampleLineParamsDictNoTag | TckresampleLineParamsDictTagged
28
+
29
+
30
+ _TckresampleArcParamsDictNoTag = typing.TypedDict('_TckresampleArcParamsDictNoTag', {
31
+ "num": int,
32
+ "start": list[float],
33
+ "mid": list[float],
34
+ "end": list[float],
35
+ })
36
+ TckresampleArcParamsDictTagged = typing.TypedDict('TckresampleArcParamsDictTagged', {
37
+ "@type": typing.Literal["arc"],
38
+ "num": int,
39
+ "start": list[float],
40
+ "mid": list[float],
41
+ "end": list[float],
42
+ })
43
+ TckresampleArcParamsDict = _TckresampleArcParamsDictNoTag | TckresampleArcParamsDictTagged
44
+
45
+
46
+ _TckresampleConfigParamsDictNoTag = typing.TypedDict('_TckresampleConfigParamsDictNoTag', {
47
+ "key": str,
48
+ "value": str,
49
+ })
50
+ TckresampleConfigParamsDictTagged = typing.TypedDict('TckresampleConfigParamsDictTagged', {
51
+ "@type": typing.Literal["config"],
52
+ "key": str,
53
+ "value": str,
54
+ })
55
+ TckresampleConfigParamsDict = _TckresampleConfigParamsDictNoTag | TckresampleConfigParamsDictTagged
56
+
57
+
58
+ _TckresampleParamsDictNoTag = typing.TypedDict('_TckresampleParamsDictNoTag', {
59
+ "upsample": typing.NotRequired[int | None],
60
+ "downsample": typing.NotRequired[int | None],
61
+ "step_size": typing.NotRequired[float | None],
62
+ "num_points": typing.NotRequired[int | None],
63
+ "endpoints": bool,
64
+ "line": typing.NotRequired[TckresampleLineParamsDict | None],
65
+ "arc": typing.NotRequired[TckresampleArcParamsDict | None],
66
+ "info": bool,
67
+ "quiet": bool,
68
+ "debug": bool,
69
+ "force": bool,
70
+ "nthreads": typing.NotRequired[int | None],
71
+ "config": typing.NotRequired[list[TckresampleConfigParamsDict] | None],
72
+ "help": bool,
73
+ "version": bool,
74
+ "in_tracks": InputPathType,
75
+ "out_tracks": str,
76
+ })
77
+ TckresampleParamsDictTagged = typing.TypedDict('TckresampleParamsDictTagged', {
78
+ "@type": typing.Literal["mrtrix/tckresample"],
79
+ "upsample": typing.NotRequired[int | None],
80
+ "downsample": typing.NotRequired[int | None],
81
+ "step_size": typing.NotRequired[float | None],
82
+ "num_points": typing.NotRequired[int | None],
83
+ "endpoints": bool,
84
+ "line": typing.NotRequired[TckresampleLineParamsDict | None],
85
+ "arc": typing.NotRequired[TckresampleArcParamsDict | None],
86
+ "info": bool,
87
+ "quiet": bool,
88
+ "debug": bool,
89
+ "force": bool,
90
+ "nthreads": typing.NotRequired[int | None],
91
+ "config": typing.NotRequired[list[TckresampleConfigParamsDict] | None],
92
+ "help": bool,
93
+ "version": bool,
94
+ "in_tracks": InputPathType,
95
+ "out_tracks": str,
96
+ })
97
+ TckresampleParamsDict = _TckresampleParamsDictNoTag | TckresampleParamsDictTagged
98
+
99
+
100
+ def tckresample_line(
101
+ num: int,
102
+ start: list[float],
103
+ end: list[float],
104
+ ) -> TckresampleLineParamsDictTagged:
105
+ """
106
+ Build parameters.
107
+
108
+ Args:
109
+ num: resample tracks at 'num' equidistant locations along a line\
110
+ between 'start' and 'end' (specified as comma-separated 3-vectors in\
111
+ scanner coordinates).
112
+ start: resample tracks at 'num' equidistant locations along a line\
113
+ between 'start' and 'end' (specified as comma-separated 3-vectors in\
114
+ scanner coordinates).
115
+ end: resample tracks at 'num' equidistant locations along a line\
116
+ between 'start' and 'end' (specified as comma-separated 3-vectors in\
117
+ scanner coordinates).
118
+ Returns:
119
+ Parameter dictionary
120
+ """
121
+ params = {
122
+ "@type": "line",
123
+ "num": num,
124
+ "start": start,
125
+ "end": end,
126
+ }
127
+ return params
128
+
129
+
130
+ def tckresample_line_validate(
131
+ params: typing.Any,
132
+ ) -> None:
133
+ """
134
+ Validate parameters. Throws an error if `params` is not a valid
135
+ `TckresampleLineParamsDict` object.
136
+
137
+ Args:
138
+ params: The parameters object to validate.
139
+ """
140
+ if params is None or not isinstance(params, dict):
141
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
142
+ if params.get("num", None) is None:
143
+ raise StyxValidationError("`num` must not be None")
144
+ if not isinstance(params["num"], int):
145
+ raise StyxValidationError(f'`num` has the wrong type: Received `{type(params.get("num", None))}` expected `int`')
146
+ if params.get("start", None) is None:
147
+ raise StyxValidationError("`start` must not be None")
148
+ if not isinstance(params["start"], list):
149
+ raise StyxValidationError(f'`start` has the wrong type: Received `{type(params.get("start", None))}` expected `list[float]`')
150
+ for e in params["start"]:
151
+ if not isinstance(e, (float, int)):
152
+ raise StyxValidationError(f'`start` has the wrong type: Received `{type(params.get("start", None))}` expected `list[float]`')
153
+ if params.get("end", None) is None:
154
+ raise StyxValidationError("`end` must not be None")
155
+ if not isinstance(params["end"], list):
156
+ raise StyxValidationError(f'`end` has the wrong type: Received `{type(params.get("end", None))}` expected `list[float]`')
157
+ for e in params["end"]:
158
+ if not isinstance(e, (float, int)):
159
+ raise StyxValidationError(f'`end` has the wrong type: Received `{type(params.get("end", None))}` expected `list[float]`')
160
+
161
+
162
+ def tckresample_line_cargs(
163
+ params: TckresampleLineParamsDict,
164
+ execution: Execution,
165
+ ) -> list[str]:
166
+ """
167
+ Build command-line arguments from parameters.
168
+
169
+ Args:
170
+ params: The parameters.
171
+ execution: The execution object for resolving input paths.
172
+ Returns:
173
+ Command-line arguments.
174
+ """
175
+ cargs = []
176
+ cargs.append("-line")
177
+ cargs.append(str(params.get("num", None)))
178
+ cargs.append(",".join(map(str, params.get("start", None))))
179
+ cargs.append(",".join(map(str, params.get("end", None))))
180
+ return cargs
181
+
182
+
183
+ def tckresample_arc(
184
+ num: int,
185
+ start: list[float],
186
+ mid: list[float],
187
+ end: list[float],
188
+ ) -> TckresampleArcParamsDictTagged:
189
+ """
190
+ Build parameters.
191
+
192
+ Args:
193
+ num: resample tracks at 'num' equidistant locations along a circular\
194
+ arc specified by points 'start', 'mid' and 'end' (specified as\
195
+ comma-separated 3-vectors in scanner coordinates).
196
+ start: resample tracks at 'num' equidistant locations along a circular\
197
+ arc specified by points 'start', 'mid' and 'end' (specified as\
198
+ comma-separated 3-vectors in scanner coordinates).
199
+ mid: resample tracks at 'num' equidistant locations along a circular\
200
+ arc specified by points 'start', 'mid' and 'end' (specified as\
201
+ comma-separated 3-vectors in scanner coordinates).
202
+ end: resample tracks at 'num' equidistant locations along a circular\
203
+ arc specified by points 'start', 'mid' and 'end' (specified as\
204
+ comma-separated 3-vectors in scanner coordinates).
205
+ Returns:
206
+ Parameter dictionary
207
+ """
208
+ params = {
209
+ "@type": "arc",
210
+ "num": num,
211
+ "start": start,
212
+ "mid": mid,
213
+ "end": end,
214
+ }
215
+ return params
216
+
217
+
218
+ def tckresample_arc_validate(
219
+ params: typing.Any,
220
+ ) -> None:
221
+ """
222
+ Validate parameters. Throws an error if `params` is not a valid
223
+ `TckresampleArcParamsDict` object.
224
+
225
+ Args:
226
+ params: The parameters object to validate.
227
+ """
228
+ if params is None or not isinstance(params, dict):
229
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
230
+ if params.get("num", None) is None:
231
+ raise StyxValidationError("`num` must not be None")
232
+ if not isinstance(params["num"], int):
233
+ raise StyxValidationError(f'`num` has the wrong type: Received `{type(params.get("num", None))}` expected `int`')
234
+ if params.get("start", None) is None:
235
+ raise StyxValidationError("`start` must not be None")
236
+ if not isinstance(params["start"], list):
237
+ raise StyxValidationError(f'`start` has the wrong type: Received `{type(params.get("start", None))}` expected `list[float]`')
238
+ for e in params["start"]:
239
+ if not isinstance(e, (float, int)):
240
+ raise StyxValidationError(f'`start` has the wrong type: Received `{type(params.get("start", None))}` expected `list[float]`')
241
+ if params.get("mid", None) is None:
242
+ raise StyxValidationError("`mid` must not be None")
243
+ if not isinstance(params["mid"], list):
244
+ raise StyxValidationError(f'`mid` has the wrong type: Received `{type(params.get("mid", None))}` expected `list[float]`')
245
+ for e in params["mid"]:
246
+ if not isinstance(e, (float, int)):
247
+ raise StyxValidationError(f'`mid` has the wrong type: Received `{type(params.get("mid", None))}` expected `list[float]`')
248
+ if params.get("end", None) is None:
249
+ raise StyxValidationError("`end` must not be None")
250
+ if not isinstance(params["end"], list):
251
+ raise StyxValidationError(f'`end` has the wrong type: Received `{type(params.get("end", None))}` expected `list[float]`')
252
+ for e in params["end"]:
253
+ if not isinstance(e, (float, int)):
254
+ raise StyxValidationError(f'`end` has the wrong type: Received `{type(params.get("end", None))}` expected `list[float]`')
255
+
256
+
257
+ def tckresample_arc_cargs(
258
+ params: TckresampleArcParamsDict,
259
+ execution: Execution,
260
+ ) -> list[str]:
261
+ """
262
+ Build command-line arguments from parameters.
263
+
264
+ Args:
265
+ params: The parameters.
266
+ execution: The execution object for resolving input paths.
267
+ Returns:
268
+ Command-line arguments.
269
+ """
270
+ cargs = []
271
+ cargs.append("-arc")
272
+ cargs.append(str(params.get("num", None)))
273
+ cargs.append(",".join(map(str, params.get("start", None))))
274
+ cargs.append(",".join(map(str, params.get("mid", None))))
275
+ cargs.append(",".join(map(str, params.get("end", None))))
276
+ return cargs
277
+
278
+
279
+ def tckresample_config(
280
+ key: str,
281
+ value: str,
282
+ ) -> TckresampleConfigParamsDictTagged:
283
+ """
284
+ Build parameters.
285
+
286
+ Args:
287
+ key: temporarily set the value of an MRtrix config file entry.
288
+ value: temporarily set the value of an MRtrix config file entry.
289
+ Returns:
290
+ Parameter dictionary
291
+ """
292
+ params = {
293
+ "@type": "config",
294
+ "key": key,
295
+ "value": value,
296
+ }
297
+ return params
298
+
299
+
300
+ def tckresample_config_validate(
301
+ params: typing.Any,
302
+ ) -> None:
303
+ """
304
+ Validate parameters. Throws an error if `params` is not a valid
305
+ `TckresampleConfigParamsDict` object.
306
+
307
+ Args:
308
+ params: The parameters object to validate.
309
+ """
310
+ if params is None or not isinstance(params, dict):
311
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
312
+ if params.get("key", None) is None:
313
+ raise StyxValidationError("`key` must not be None")
314
+ if not isinstance(params["key"], str):
315
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
316
+ if params.get("value", None) is None:
317
+ raise StyxValidationError("`value` must not be None")
318
+ if not isinstance(params["value"], str):
319
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
320
+
321
+
322
+ def tckresample_config_cargs(
323
+ params: TckresampleConfigParamsDict,
324
+ execution: Execution,
325
+ ) -> list[str]:
326
+ """
327
+ Build command-line arguments from parameters.
328
+
329
+ Args:
330
+ params: The parameters.
331
+ execution: The execution object for resolving input paths.
332
+ Returns:
333
+ Command-line arguments.
334
+ """
335
+ cargs = []
336
+ cargs.append("-config")
337
+ cargs.append(params.get("key", None))
338
+ cargs.append(params.get("value", None))
339
+ return cargs
340
+
341
+
342
+ class TckresampleOutputs(typing.NamedTuple):
343
+ """
344
+ Output object returned when calling `TckresampleParamsDict(...)`.
345
+ """
346
+ root: OutputPathType
347
+ """Output root folder. This is the root folder for all outputs."""
348
+ out_tracks: OutputPathType
349
+ """the output resampled tracks"""
350
+
351
+
352
+ def tckresample_params(
353
+ in_tracks: InputPathType,
354
+ out_tracks: str,
355
+ upsample: int | None = None,
356
+ downsample: int | None = None,
357
+ step_size: float | None = None,
358
+ num_points: int | None = None,
359
+ endpoints: bool = False,
360
+ line: TckresampleLineParamsDict | None = None,
361
+ arc: TckresampleArcParamsDict | None = None,
362
+ info: bool = False,
363
+ quiet: bool = False,
364
+ debug: bool = False,
365
+ force: bool = False,
366
+ nthreads: int | None = None,
367
+ config: list[TckresampleConfigParamsDict] | None = None,
368
+ help_: bool = False,
369
+ version: bool = False,
370
+ ) -> TckresampleParamsDictTagged:
371
+ """
372
+ Build parameters.
373
+
374
+ Args:
375
+ in_tracks: the input track file.
376
+ out_tracks: the output resampled tracks.
377
+ upsample: increase the density of points along the length of each\
378
+ streamline by some factor (may improve mapping streamlines to ROIs,\
379
+ and/or visualisation).
380
+ downsample: increase the density of points along the length of each\
381
+ streamline by some factor (decreases required storage space).
382
+ step_size: re-sample the streamlines to a desired step size (in mm).
383
+ num_points: re-sample each streamline to a fixed number of points.
384
+ endpoints: only output the two endpoints of each streamline.
385
+ line: resample tracks at 'num' equidistant locations along a line\
386
+ between 'start' and 'end' (specified as comma-separated 3-vectors in\
387
+ scanner coordinates).
388
+ arc: resample tracks at 'num' equidistant locations along a circular\
389
+ arc specified by points 'start', 'mid' and 'end' (specified as\
390
+ comma-separated 3-vectors in scanner coordinates).
391
+ info: display information messages.
392
+ quiet: do not display information messages or progress status;\
393
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
394
+ environment variable to a non-empty string.
395
+ debug: display debugging messages.
396
+ force: force overwrite of output files (caution: using the same file as\
397
+ input and output might cause unexpected behaviour).
398
+ nthreads: use this number of threads in multi-threaded applications\
399
+ (set to 0 to disable multi-threading).
400
+ config: temporarily set the value of an MRtrix config file entry.
401
+ help_: display this information page and exit.
402
+ version: display version information and exit.
403
+ Returns:
404
+ Parameter dictionary
405
+ """
406
+ params = {
407
+ "@type": "mrtrix/tckresample",
408
+ "endpoints": endpoints,
409
+ "info": info,
410
+ "quiet": quiet,
411
+ "debug": debug,
412
+ "force": force,
413
+ "help": help_,
414
+ "version": version,
415
+ "in_tracks": in_tracks,
416
+ "out_tracks": out_tracks,
417
+ }
418
+ if upsample is not None:
419
+ params["upsample"] = upsample
420
+ if downsample is not None:
421
+ params["downsample"] = downsample
422
+ if step_size is not None:
423
+ params["step_size"] = step_size
424
+ if num_points is not None:
425
+ params["num_points"] = num_points
426
+ if line is not None:
427
+ params["line"] = line
428
+ if arc is not None:
429
+ params["arc"] = arc
430
+ if nthreads is not None:
431
+ params["nthreads"] = nthreads
432
+ if config is not None:
433
+ params["config"] = config
434
+ return params
435
+
436
+
437
+ def tckresample_validate(
438
+ params: typing.Any,
439
+ ) -> None:
440
+ """
441
+ Validate parameters. Throws an error if `params` is not a valid
442
+ `TckresampleParamsDict` object.
443
+
444
+ Args:
445
+ params: The parameters object to validate.
446
+ """
447
+ if params is None or not isinstance(params, dict):
448
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
449
+ if params.get("upsample", None) is not None:
450
+ if not isinstance(params["upsample"], int):
451
+ raise StyxValidationError(f'`upsample` has the wrong type: Received `{type(params.get("upsample", None))}` expected `int | None`')
452
+ if params.get("downsample", None) is not None:
453
+ if not isinstance(params["downsample"], int):
454
+ raise StyxValidationError(f'`downsample` has the wrong type: Received `{type(params.get("downsample", None))}` expected `int | None`')
455
+ if params.get("step_size", None) is not None:
456
+ if not isinstance(params["step_size"], (float, int)):
457
+ raise StyxValidationError(f'`step_size` has the wrong type: Received `{type(params.get("step_size", None))}` expected `float | None`')
458
+ if params.get("num_points", None) is not None:
459
+ if not isinstance(params["num_points"], int):
460
+ raise StyxValidationError(f'`num_points` has the wrong type: Received `{type(params.get("num_points", None))}` expected `int | None`')
461
+ if params.get("endpoints", False) is None:
462
+ raise StyxValidationError("`endpoints` must not be None")
463
+ if not isinstance(params["endpoints"], bool):
464
+ raise StyxValidationError(f'`endpoints` has the wrong type: Received `{type(params.get("endpoints", False))}` expected `bool`')
465
+ if params.get("line", None) is not None:
466
+ tckresample_line_validate(params["line"])
467
+ if params.get("arc", None) is not None:
468
+ tckresample_arc_validate(params["arc"])
469
+ if params.get("info", False) is None:
470
+ raise StyxValidationError("`info` must not be None")
471
+ if not isinstance(params["info"], bool):
472
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
473
+ if params.get("quiet", False) is None:
474
+ raise StyxValidationError("`quiet` must not be None")
475
+ if not isinstance(params["quiet"], bool):
476
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
477
+ if params.get("debug", False) is None:
478
+ raise StyxValidationError("`debug` must not be None")
479
+ if not isinstance(params["debug"], bool):
480
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
481
+ if params.get("force", False) is None:
482
+ raise StyxValidationError("`force` must not be None")
483
+ if not isinstance(params["force"], bool):
484
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
485
+ if params.get("nthreads", None) is not None:
486
+ if not isinstance(params["nthreads"], int):
487
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
488
+ if params.get("config", None) is not None:
489
+ if not isinstance(params["config"], list):
490
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[TckresampleConfigParamsDict] | None`')
491
+ for e in params["config"]:
492
+ tckresample_config_validate(e)
493
+ if params.get("help", False) is None:
494
+ raise StyxValidationError("`help` must not be None")
495
+ if not isinstance(params["help"], bool):
496
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
497
+ if params.get("version", False) is None:
498
+ raise StyxValidationError("`version` must not be None")
499
+ if not isinstance(params["version"], bool):
500
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
501
+ if params.get("in_tracks", None) is None:
502
+ raise StyxValidationError("`in_tracks` must not be None")
503
+ if not isinstance(params["in_tracks"], (pathlib.Path, str)):
504
+ raise StyxValidationError(f'`in_tracks` has the wrong type: Received `{type(params.get("in_tracks", None))}` expected `InputPathType`')
505
+ if params.get("out_tracks", None) is None:
506
+ raise StyxValidationError("`out_tracks` must not be None")
507
+ if not isinstance(params["out_tracks"], str):
508
+ raise StyxValidationError(f'`out_tracks` has the wrong type: Received `{type(params.get("out_tracks", None))}` expected `str`')
509
+
510
+
511
+ def tckresample_cargs(
512
+ params: TckresampleParamsDict,
513
+ execution: Execution,
514
+ ) -> list[str]:
515
+ """
516
+ Build command-line arguments from parameters.
517
+
518
+ Args:
519
+ params: The parameters.
520
+ execution: The execution object for resolving input paths.
521
+ Returns:
522
+ Command-line arguments.
523
+ """
524
+ cargs = []
525
+ cargs.append("tckresample")
526
+ if params.get("upsample", None) is not None:
527
+ cargs.extend([
528
+ "-upsample",
529
+ str(params.get("upsample", None))
530
+ ])
531
+ if params.get("downsample", None) is not None:
532
+ cargs.extend([
533
+ "-downsample",
534
+ str(params.get("downsample", None))
535
+ ])
536
+ if params.get("step_size", None) is not None:
537
+ cargs.extend([
538
+ "-step_size",
539
+ str(params.get("step_size", None))
540
+ ])
541
+ if params.get("num_points", None) is not None:
542
+ cargs.extend([
543
+ "-num_points",
544
+ str(params.get("num_points", None))
545
+ ])
546
+ if params.get("endpoints", False):
547
+ cargs.append("-endpoints")
548
+ if params.get("line", None) is not None:
549
+ cargs.extend(tckresample_line_cargs(params.get("line", None), execution))
550
+ if params.get("arc", None) is not None:
551
+ cargs.extend(tckresample_arc_cargs(params.get("arc", None), execution))
552
+ if params.get("info", False):
553
+ cargs.append("-info")
554
+ if params.get("quiet", False):
555
+ cargs.append("-quiet")
556
+ if params.get("debug", False):
557
+ cargs.append("-debug")
558
+ if params.get("force", False):
559
+ cargs.append("-force")
560
+ if params.get("nthreads", None) is not None:
561
+ cargs.extend([
562
+ "-nthreads",
563
+ str(params.get("nthreads", None))
564
+ ])
565
+ if params.get("config", None) is not None:
566
+ cargs.extend([a for c in [tckresample_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
567
+ if params.get("help", False):
568
+ cargs.append("-help")
569
+ if params.get("version", False):
570
+ cargs.append("-version")
571
+ cargs.append(execution.input_file(params.get("in_tracks", None)))
572
+ cargs.append(params.get("out_tracks", None))
573
+ return cargs
574
+
575
+
576
+ def tckresample_outputs(
577
+ params: TckresampleParamsDict,
578
+ execution: Execution,
579
+ ) -> TckresampleOutputs:
580
+ """
581
+ Build outputs object containing output file paths and possibly stdout/stderr.
582
+
583
+ Args:
584
+ params: The parameters.
585
+ execution: The execution object for resolving input paths.
586
+ Returns:
587
+ Outputs object.
588
+ """
589
+ ret = TckresampleOutputs(
590
+ root=execution.output_file("."),
591
+ out_tracks=execution.output_file(params.get("out_tracks", None)),
592
+ )
593
+ return ret
594
+
595
+
596
+ def tckresample_execute(
597
+ params: TckresampleParamsDict,
598
+ runner: Runner | None = None,
599
+ ) -> TckresampleOutputs:
600
+ """
601
+ tckresample
602
+
603
+ Resample each streamline in a track file to a new set of vertices.
604
+
605
+ It is necessary to specify precisely ONE of the command-line options for
606
+ controlling how this resampling takes place; this may be either increasing
607
+ or decreasing the number of samples along each streamline, or may involve
608
+ changing the positions of the samples according to some specified
609
+ trajectory.
610
+
611
+ Note that because the length of a streamline is calculated based on the sums
612
+ of distances between adjacent vertices, resampling a streamline to a new set
613
+ of vertices will typically change the quantified length of that streamline;
614
+ the magnitude of the difference will typically depend on the discrepancy in
615
+ the number of vertices, with less vertices leading to a shorter length (due
616
+ to taking chordal lengths of curved trajectories).
617
+
618
+ References:
619
+
620
+ .
621
+
622
+ Author: MRTrix3 Developers
623
+
624
+ URL: https://www.mrtrix.org/
625
+
626
+ Args:
627
+ params: The parameters.
628
+ runner: Command runner.
629
+ Returns:
630
+ NamedTuple of outputs (described in `TckresampleOutputs`).
631
+ """
632
+ tckresample_validate(params)
633
+ runner = runner or get_global_runner()
634
+ execution = runner.start_execution(TCKRESAMPLE_METADATA)
635
+ params = execution.params(params)
636
+ cargs = tckresample_cargs(params, execution)
637
+ ret = tckresample_outputs(params, execution)
638
+ execution.run(cargs)
639
+ return ret
640
+
641
+
642
+ def tckresample(
643
+ in_tracks: InputPathType,
644
+ out_tracks: str,
645
+ upsample: int | None = None,
646
+ downsample: int | None = None,
647
+ step_size: float | None = None,
648
+ num_points: int | None = None,
649
+ endpoints: bool = False,
650
+ line: TckresampleLineParamsDict | None = None,
651
+ arc: TckresampleArcParamsDict | None = None,
652
+ info: bool = False,
653
+ quiet: bool = False,
654
+ debug: bool = False,
655
+ force: bool = False,
656
+ nthreads: int | None = None,
657
+ config: list[TckresampleConfigParamsDict] | None = None,
658
+ help_: bool = False,
659
+ version: bool = False,
660
+ runner: Runner | None = None,
661
+ ) -> TckresampleOutputs:
662
+ """
663
+ tckresample
664
+
665
+ Resample each streamline in a track file to a new set of vertices.
666
+
667
+ It is necessary to specify precisely ONE of the command-line options for
668
+ controlling how this resampling takes place; this may be either increasing
669
+ or decreasing the number of samples along each streamline, or may involve
670
+ changing the positions of the samples according to some specified
671
+ trajectory.
672
+
673
+ Note that because the length of a streamline is calculated based on the sums
674
+ of distances between adjacent vertices, resampling a streamline to a new set
675
+ of vertices will typically change the quantified length of that streamline;
676
+ the magnitude of the difference will typically depend on the discrepancy in
677
+ the number of vertices, with less vertices leading to a shorter length (due
678
+ to taking chordal lengths of curved trajectories).
679
+
680
+ References:
681
+
682
+ .
683
+
684
+ Author: MRTrix3 Developers
685
+
686
+ URL: https://www.mrtrix.org/
687
+
688
+ Args:
689
+ in_tracks: the input track file.
690
+ out_tracks: the output resampled tracks.
691
+ upsample: increase the density of points along the length of each\
692
+ streamline by some factor (may improve mapping streamlines to ROIs,\
693
+ and/or visualisation).
694
+ downsample: increase the density of points along the length of each\
695
+ streamline by some factor (decreases required storage space).
696
+ step_size: re-sample the streamlines to a desired step size (in mm).
697
+ num_points: re-sample each streamline to a fixed number of points.
698
+ endpoints: only output the two endpoints of each streamline.
699
+ line: resample tracks at 'num' equidistant locations along a line\
700
+ between 'start' and 'end' (specified as comma-separated 3-vectors in\
701
+ scanner coordinates).
702
+ arc: resample tracks at 'num' equidistant locations along a circular\
703
+ arc specified by points 'start', 'mid' and 'end' (specified as\
704
+ comma-separated 3-vectors in scanner coordinates).
705
+ info: display information messages.
706
+ quiet: do not display information messages or progress status;\
707
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
708
+ environment variable to a non-empty string.
709
+ debug: display debugging messages.
710
+ force: force overwrite of output files (caution: using the same file as\
711
+ input and output might cause unexpected behaviour).
712
+ nthreads: use this number of threads in multi-threaded applications\
713
+ (set to 0 to disable multi-threading).
714
+ config: temporarily set the value of an MRtrix config file entry.
715
+ help_: display this information page and exit.
716
+ version: display version information and exit.
717
+ runner: Command runner.
718
+ Returns:
719
+ NamedTuple of outputs (described in `TckresampleOutputs`).
720
+ """
721
+ params = tckresample_params(
722
+ upsample=upsample,
723
+ downsample=downsample,
724
+ step_size=step_size,
725
+ num_points=num_points,
726
+ endpoints=endpoints,
727
+ line=line,
728
+ arc=arc,
729
+ info=info,
730
+ quiet=quiet,
731
+ debug=debug,
732
+ force=force,
733
+ nthreads=nthreads,
734
+ config=config,
735
+ help_=help_,
736
+ version=version,
737
+ in_tracks=in_tracks,
738
+ out_tracks=out_tracks,
739
+ )
740
+ return tckresample_execute(params, runner)
741
+
742
+
743
+ __all__ = [
744
+ "TCKRESAMPLE_METADATA",
745
+ "TckresampleArcParamsDict",
746
+ "TckresampleArcParamsDictTagged",
747
+ "TckresampleConfigParamsDict",
748
+ "TckresampleConfigParamsDictTagged",
749
+ "TckresampleLineParamsDict",
750
+ "TckresampleLineParamsDictTagged",
751
+ "TckresampleOutputs",
752
+ "TckresampleParamsDict",
753
+ "TckresampleParamsDictTagged",
754
+ "tckresample",
755
+ "tckresample_arc",
756
+ "tckresample_config",
757
+ "tckresample_execute",
758
+ "tckresample_line",
759
+ "tckresample_params",
760
+ ]