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,368 @@
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
+ WARPCORRECT_METADATA = Metadata(
9
+ id="ac61099f3060923f7f158e31279303a1a92afb02.boutiques",
10
+ name="warpcorrect",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ WarpcorrectConfigParameters = typing.TypedDict('WarpcorrectConfigParameters', {
17
+ "__STYX_TYPE__": typing.Literal["config"],
18
+ "key": str,
19
+ "value": str,
20
+ })
21
+
22
+
23
+ WarpcorrectParameters = typing.TypedDict('WarpcorrectParameters', {
24
+ "__STYX_TYPE__": typing.Literal["warpcorrect"],
25
+ "marker": typing.NotRequired[list[float] | None],
26
+ "tolerance": typing.NotRequired[float | None],
27
+ "info": bool,
28
+ "quiet": bool,
29
+ "debug": bool,
30
+ "force": bool,
31
+ "nthreads": typing.NotRequired[int | None],
32
+ "config": typing.NotRequired[list[WarpcorrectConfigParameters] | None],
33
+ "help": bool,
34
+ "version": bool,
35
+ "in": InputPathType,
36
+ "out": str,
37
+ })
38
+
39
+
40
+ def dyn_cargs(
41
+ t: str,
42
+ ) -> typing.Any:
43
+ """
44
+ Get build cargs function by command type.
45
+
46
+ Args:
47
+ t: Command type.
48
+ Returns:
49
+ Build cargs function.
50
+ """
51
+ return {
52
+ "warpcorrect": warpcorrect_cargs,
53
+ "config": warpcorrect_config_cargs,
54
+ }.get(t)
55
+
56
+
57
+ def dyn_outputs(
58
+ t: str,
59
+ ) -> typing.Any:
60
+ """
61
+ Get build outputs function by command type.
62
+
63
+ Args:
64
+ t: Command type.
65
+ Returns:
66
+ Build outputs function.
67
+ """
68
+ return {
69
+ "warpcorrect": warpcorrect_outputs,
70
+ }.get(t)
71
+
72
+
73
+ def warpcorrect_config_params(
74
+ key: str,
75
+ value: str,
76
+ ) -> WarpcorrectConfigParameters:
77
+ """
78
+ Build parameters.
79
+
80
+ Args:
81
+ key: temporarily set the value of an MRtrix config file entry.
82
+ value: temporarily set the value of an MRtrix config file entry.
83
+ Returns:
84
+ Parameter dictionary
85
+ """
86
+ params = {
87
+ "__STYXTYPE__": "config",
88
+ "key": key,
89
+ "value": value,
90
+ }
91
+ return params
92
+
93
+
94
+ def warpcorrect_config_cargs(
95
+ params: WarpcorrectConfigParameters,
96
+ execution: Execution,
97
+ ) -> list[str]:
98
+ """
99
+ Build command-line arguments from parameters.
100
+
101
+ Args:
102
+ params: The parameters.
103
+ execution: The execution object for resolving input paths.
104
+ Returns:
105
+ Command-line arguments.
106
+ """
107
+ cargs = []
108
+ cargs.append("-config")
109
+ cargs.append(params.get("key"))
110
+ cargs.append(params.get("value"))
111
+ return cargs
112
+
113
+
114
+ class WarpcorrectOutputs(typing.NamedTuple):
115
+ """
116
+ Output object returned when calling `warpcorrect(...)`.
117
+ """
118
+ root: OutputPathType
119
+ """Output root folder. This is the root folder for all outputs."""
120
+ out: OutputPathType
121
+ """the output warp image."""
122
+
123
+
124
+ def warpcorrect_params(
125
+ in_: InputPathType,
126
+ out: str,
127
+ marker: list[float] | None = None,
128
+ tolerance: float | None = None,
129
+ info: bool = False,
130
+ quiet: bool = False,
131
+ debug: bool = False,
132
+ force: bool = False,
133
+ nthreads: int | None = None,
134
+ config: list[WarpcorrectConfigParameters] | None = None,
135
+ help_: bool = False,
136
+ version: bool = False,
137
+ ) -> WarpcorrectParameters:
138
+ """
139
+ Build parameters.
140
+
141
+ Args:
142
+ in_: the input warp image.
143
+ out: the output warp image.
144
+ marker: single value or a comma separated list of values that define\
145
+ out of bounds voxels in the input warp image. Default: (0,0,0).
146
+ tolerance: numerical precision used for L2 matrix norm comparison.\
147
+ Default: 9.99999975e-06.
148
+ info: display information messages.
149
+ quiet: do not display information messages or progress status;\
150
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
151
+ environment variable to a non-empty string.
152
+ debug: display debugging messages.
153
+ force: force overwrite of output files (caution: using the same file as\
154
+ input and output might cause unexpected behaviour).
155
+ nthreads: use this number of threads in multi-threaded applications\
156
+ (set to 0 to disable multi-threading).
157
+ config: temporarily set the value of an MRtrix config file entry.
158
+ help_: display this information page and exit.
159
+ version: display version information and exit.
160
+ Returns:
161
+ Parameter dictionary
162
+ """
163
+ params = {
164
+ "__STYXTYPE__": "warpcorrect",
165
+ "info": info,
166
+ "quiet": quiet,
167
+ "debug": debug,
168
+ "force": force,
169
+ "help": help_,
170
+ "version": version,
171
+ "in": in_,
172
+ "out": out,
173
+ }
174
+ if marker is not None:
175
+ params["marker"] = marker
176
+ if tolerance is not None:
177
+ params["tolerance"] = tolerance
178
+ if nthreads is not None:
179
+ params["nthreads"] = nthreads
180
+ if config is not None:
181
+ params["config"] = config
182
+ return params
183
+
184
+
185
+ def warpcorrect_cargs(
186
+ params: WarpcorrectParameters,
187
+ execution: Execution,
188
+ ) -> list[str]:
189
+ """
190
+ Build command-line arguments from parameters.
191
+
192
+ Args:
193
+ params: The parameters.
194
+ execution: The execution object for resolving input paths.
195
+ Returns:
196
+ Command-line arguments.
197
+ """
198
+ cargs = []
199
+ cargs.append("warpcorrect")
200
+ if params.get("marker") is not None:
201
+ cargs.extend([
202
+ "-marker",
203
+ *map(str, params.get("marker"))
204
+ ])
205
+ if params.get("tolerance") is not None:
206
+ cargs.extend([
207
+ "-tolerance",
208
+ str(params.get("tolerance"))
209
+ ])
210
+ if params.get("info"):
211
+ cargs.append("-info")
212
+ if params.get("quiet"):
213
+ cargs.append("-quiet")
214
+ if params.get("debug"):
215
+ cargs.append("-debug")
216
+ if params.get("force"):
217
+ cargs.append("-force")
218
+ if params.get("nthreads") is not None:
219
+ cargs.extend([
220
+ "-nthreads",
221
+ str(params.get("nthreads"))
222
+ ])
223
+ if params.get("config") is not None:
224
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
225
+ if params.get("help"):
226
+ cargs.append("-help")
227
+ if params.get("version"):
228
+ cargs.append("-version")
229
+ cargs.append(execution.input_file(params.get("in")))
230
+ cargs.append(params.get("out"))
231
+ return cargs
232
+
233
+
234
+ def warpcorrect_outputs(
235
+ params: WarpcorrectParameters,
236
+ execution: Execution,
237
+ ) -> WarpcorrectOutputs:
238
+ """
239
+ Build outputs object containing output file paths and possibly stdout/stderr.
240
+
241
+ Args:
242
+ params: The parameters.
243
+ execution: The execution object for resolving input paths.
244
+ Returns:
245
+ Outputs object.
246
+ """
247
+ ret = WarpcorrectOutputs(
248
+ root=execution.output_file("."),
249
+ out=execution.output_file(params.get("out")),
250
+ )
251
+ return ret
252
+
253
+
254
+ def warpcorrect_execute(
255
+ params: WarpcorrectParameters,
256
+ execution: Execution,
257
+ ) -> WarpcorrectOutputs:
258
+ """
259
+ Replaces voxels in a deformation field that point to a specific out of bounds
260
+ location with nan,nan,nan.
261
+
262
+ This can be used in conjunction with the warpinit command to compute a
263
+ MRtrix compatible deformation field from non-linear transformations
264
+ generated by any other registration package.
265
+
266
+ References:
267
+
268
+ .
269
+
270
+ Author: MRTrix3 Developers
271
+
272
+ URL: https://www.mrtrix.org/
273
+
274
+ Args:
275
+ params: The parameters.
276
+ execution: The execution object.
277
+ Returns:
278
+ NamedTuple of outputs (described in `WarpcorrectOutputs`).
279
+ """
280
+ params = execution.params(params)
281
+ cargs = warpcorrect_cargs(params, execution)
282
+ ret = warpcorrect_outputs(params, execution)
283
+ execution.run(cargs)
284
+ return ret
285
+
286
+
287
+ def warpcorrect(
288
+ in_: InputPathType,
289
+ out: str,
290
+ marker: list[float] | None = None,
291
+ tolerance: float | None = None,
292
+ info: bool = False,
293
+ quiet: bool = False,
294
+ debug: bool = False,
295
+ force: bool = False,
296
+ nthreads: int | None = None,
297
+ config: list[WarpcorrectConfigParameters] | None = None,
298
+ help_: bool = False,
299
+ version: bool = False,
300
+ runner: Runner | None = None,
301
+ ) -> WarpcorrectOutputs:
302
+ """
303
+ Replaces voxels in a deformation field that point to a specific out of bounds
304
+ location with nan,nan,nan.
305
+
306
+ This can be used in conjunction with the warpinit command to compute a
307
+ MRtrix compatible deformation field from non-linear transformations
308
+ generated by any other registration package.
309
+
310
+ References:
311
+
312
+ .
313
+
314
+ Author: MRTrix3 Developers
315
+
316
+ URL: https://www.mrtrix.org/
317
+
318
+ Args:
319
+ in_: the input warp image.
320
+ out: the output warp image.
321
+ marker: single value or a comma separated list of values that define\
322
+ out of bounds voxels in the input warp image. Default: (0,0,0).
323
+ tolerance: numerical precision used for L2 matrix norm comparison.\
324
+ Default: 9.99999975e-06.
325
+ info: display information messages.
326
+ quiet: do not display information messages or progress status;\
327
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
328
+ environment variable to a non-empty string.
329
+ debug: display debugging messages.
330
+ force: force overwrite of output files (caution: using the same file as\
331
+ input and output might cause unexpected behaviour).
332
+ nthreads: use this number of threads in multi-threaded applications\
333
+ (set to 0 to disable multi-threading).
334
+ config: temporarily set the value of an MRtrix config file entry.
335
+ help_: display this information page and exit.
336
+ version: display version information and exit.
337
+ runner: Command runner.
338
+ Returns:
339
+ NamedTuple of outputs (described in `WarpcorrectOutputs`).
340
+ """
341
+ runner = runner or get_global_runner()
342
+ execution = runner.start_execution(WARPCORRECT_METADATA)
343
+ params = warpcorrect_params(
344
+ marker=marker,
345
+ tolerance=tolerance,
346
+ info=info,
347
+ quiet=quiet,
348
+ debug=debug,
349
+ force=force,
350
+ nthreads=nthreads,
351
+ config=config,
352
+ help_=help_,
353
+ version=version,
354
+ in_=in_,
355
+ out=out,
356
+ )
357
+ return warpcorrect_execute(params, execution)
358
+
359
+
360
+ __all__ = [
361
+ "WARPCORRECT_METADATA",
362
+ "WarpcorrectConfigParameters",
363
+ "WarpcorrectOutputs",
364
+ "WarpcorrectParameters",
365
+ "warpcorrect",
366
+ "warpcorrect_config_params",
367
+ "warpcorrect_params",
368
+ ]
@@ -0,0 +1,356 @@
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
+ WARPINIT_METADATA = Metadata(
9
+ id="4b6c806f701cb5bc6b23937491e0dab59feb77ec.boutiques",
10
+ name="warpinit",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ WarpinitConfigParameters = typing.TypedDict('WarpinitConfigParameters', {
17
+ "__STYX_TYPE__": typing.Literal["config"],
18
+ "key": str,
19
+ "value": str,
20
+ })
21
+
22
+
23
+ WarpinitParameters = typing.TypedDict('WarpinitParameters', {
24
+ "__STYX_TYPE__": typing.Literal["warpinit"],
25
+ "info": bool,
26
+ "quiet": bool,
27
+ "debug": bool,
28
+ "force": bool,
29
+ "nthreads": typing.NotRequired[int | None],
30
+ "config": typing.NotRequired[list[WarpinitConfigParameters] | None],
31
+ "help": bool,
32
+ "version": bool,
33
+ "template": InputPathType,
34
+ "warp": str,
35
+ })
36
+
37
+
38
+ def dyn_cargs(
39
+ t: str,
40
+ ) -> typing.Any:
41
+ """
42
+ Get build cargs function by command type.
43
+
44
+ Args:
45
+ t: Command type.
46
+ Returns:
47
+ Build cargs function.
48
+ """
49
+ return {
50
+ "warpinit": warpinit_cargs,
51
+ "config": warpinit_config_cargs,
52
+ }.get(t)
53
+
54
+
55
+ def dyn_outputs(
56
+ t: str,
57
+ ) -> typing.Any:
58
+ """
59
+ Get build outputs function by command type.
60
+
61
+ Args:
62
+ t: Command type.
63
+ Returns:
64
+ Build outputs function.
65
+ """
66
+ return {
67
+ "warpinit": warpinit_outputs,
68
+ }.get(t)
69
+
70
+
71
+ def warpinit_config_params(
72
+ key: str,
73
+ value: str,
74
+ ) -> WarpinitConfigParameters:
75
+ """
76
+ Build parameters.
77
+
78
+ Args:
79
+ key: temporarily set the value of an MRtrix config file entry.
80
+ value: temporarily set the value of an MRtrix config file entry.
81
+ Returns:
82
+ Parameter dictionary
83
+ """
84
+ params = {
85
+ "__STYXTYPE__": "config",
86
+ "key": key,
87
+ "value": value,
88
+ }
89
+ return params
90
+
91
+
92
+ def warpinit_config_cargs(
93
+ params: WarpinitConfigParameters,
94
+ execution: Execution,
95
+ ) -> list[str]:
96
+ """
97
+ Build command-line arguments from parameters.
98
+
99
+ Args:
100
+ params: The parameters.
101
+ execution: The execution object for resolving input paths.
102
+ Returns:
103
+ Command-line arguments.
104
+ """
105
+ cargs = []
106
+ cargs.append("-config")
107
+ cargs.append(params.get("key"))
108
+ cargs.append(params.get("value"))
109
+ return cargs
110
+
111
+
112
+ class WarpinitOutputs(typing.NamedTuple):
113
+ """
114
+ Output object returned when calling `warpinit(...)`.
115
+ """
116
+ root: OutputPathType
117
+ """Output root folder. This is the root folder for all outputs."""
118
+ warp: OutputPathType
119
+ """the output warp image."""
120
+
121
+
122
+ def warpinit_params(
123
+ template: InputPathType,
124
+ warp: str,
125
+ info: bool = False,
126
+ quiet: bool = False,
127
+ debug: bool = False,
128
+ force: bool = False,
129
+ nthreads: int | None = None,
130
+ config: list[WarpinitConfigParameters] | None = None,
131
+ help_: bool = False,
132
+ version: bool = False,
133
+ ) -> WarpinitParameters:
134
+ """
135
+ Build parameters.
136
+
137
+ Args:
138
+ template: the input template image.
139
+ warp: the output warp image.
140
+ info: display information messages.
141
+ quiet: do not display information messages or progress status;\
142
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
143
+ environment variable to a non-empty string.
144
+ debug: display debugging messages.
145
+ force: force overwrite of output files (caution: using the same file as\
146
+ input and output might cause unexpected behaviour).
147
+ nthreads: use this number of threads in multi-threaded applications\
148
+ (set to 0 to disable multi-threading).
149
+ config: temporarily set the value of an MRtrix config file entry.
150
+ help_: display this information page and exit.
151
+ version: display version information and exit.
152
+ Returns:
153
+ Parameter dictionary
154
+ """
155
+ params = {
156
+ "__STYXTYPE__": "warpinit",
157
+ "info": info,
158
+ "quiet": quiet,
159
+ "debug": debug,
160
+ "force": force,
161
+ "help": help_,
162
+ "version": version,
163
+ "template": template,
164
+ "warp": warp,
165
+ }
166
+ if nthreads is not None:
167
+ params["nthreads"] = nthreads
168
+ if config is not None:
169
+ params["config"] = config
170
+ return params
171
+
172
+
173
+ def warpinit_cargs(
174
+ params: WarpinitParameters,
175
+ execution: Execution,
176
+ ) -> list[str]:
177
+ """
178
+ Build command-line arguments from parameters.
179
+
180
+ Args:
181
+ params: The parameters.
182
+ execution: The execution object for resolving input paths.
183
+ Returns:
184
+ Command-line arguments.
185
+ """
186
+ cargs = []
187
+ cargs.append("warpinit")
188
+ if params.get("info"):
189
+ cargs.append("-info")
190
+ if params.get("quiet"):
191
+ cargs.append("-quiet")
192
+ if params.get("debug"):
193
+ cargs.append("-debug")
194
+ if params.get("force"):
195
+ cargs.append("-force")
196
+ if params.get("nthreads") is not None:
197
+ cargs.extend([
198
+ "-nthreads",
199
+ str(params.get("nthreads"))
200
+ ])
201
+ if params.get("config") is not None:
202
+ cargs.extend([a for c in [dyn_cargs(s["__STYXTYPE__"])(s, execution) for s in params.get("config")] for a in c])
203
+ if params.get("help"):
204
+ cargs.append("-help")
205
+ if params.get("version"):
206
+ cargs.append("-version")
207
+ cargs.append(execution.input_file(params.get("template")))
208
+ cargs.append(params.get("warp"))
209
+ return cargs
210
+
211
+
212
+ def warpinit_outputs(
213
+ params: WarpinitParameters,
214
+ execution: Execution,
215
+ ) -> WarpinitOutputs:
216
+ """
217
+ Build outputs object containing output file paths and possibly stdout/stderr.
218
+
219
+ Args:
220
+ params: The parameters.
221
+ execution: The execution object for resolving input paths.
222
+ Returns:
223
+ Outputs object.
224
+ """
225
+ ret = WarpinitOutputs(
226
+ root=execution.output_file("."),
227
+ warp=execution.output_file(params.get("warp")),
228
+ )
229
+ return ret
230
+
231
+
232
+ def warpinit_execute(
233
+ params: WarpinitParameters,
234
+ execution: Execution,
235
+ ) -> WarpinitOutputs:
236
+ """
237
+ Create an initial warp image, representing an identity transformation.
238
+
239
+ This is useful to obtain the warp fields from other normalisation
240
+ applications, by applying the transformation of interest to the warp field
241
+ generated by this program.
242
+
243
+ The image generated is a 4D image with the same spatial characteristics as
244
+ the input template image. It contains 3 volumes, with each voxel containing
245
+ its own x,y,z coordinates.
246
+
247
+ Note that this command can be used to create 3 separate X,Y,Z images
248
+ directly (which may be useful to create images suitable for use in the
249
+ registration program) using the following syntax:
250
+
251
+ $ warpinit template.mif warp-'[]'.nii
252
+
253
+ References:
254
+
255
+ .
256
+
257
+ Author: MRTrix3 Developers
258
+
259
+ URL: https://www.mrtrix.org/
260
+
261
+ Args:
262
+ params: The parameters.
263
+ execution: The execution object.
264
+ Returns:
265
+ NamedTuple of outputs (described in `WarpinitOutputs`).
266
+ """
267
+ params = execution.params(params)
268
+ cargs = warpinit_cargs(params, execution)
269
+ ret = warpinit_outputs(params, execution)
270
+ execution.run(cargs)
271
+ return ret
272
+
273
+
274
+ def warpinit(
275
+ template: InputPathType,
276
+ warp: str,
277
+ info: bool = False,
278
+ quiet: bool = False,
279
+ debug: bool = False,
280
+ force: bool = False,
281
+ nthreads: int | None = None,
282
+ config: list[WarpinitConfigParameters] | None = None,
283
+ help_: bool = False,
284
+ version: bool = False,
285
+ runner: Runner | None = None,
286
+ ) -> WarpinitOutputs:
287
+ """
288
+ Create an initial warp image, representing an identity transformation.
289
+
290
+ This is useful to obtain the warp fields from other normalisation
291
+ applications, by applying the transformation of interest to the warp field
292
+ generated by this program.
293
+
294
+ The image generated is a 4D image with the same spatial characteristics as
295
+ the input template image. It contains 3 volumes, with each voxel containing
296
+ its own x,y,z coordinates.
297
+
298
+ Note that this command can be used to create 3 separate X,Y,Z images
299
+ directly (which may be useful to create images suitable for use in the
300
+ registration program) using the following syntax:
301
+
302
+ $ warpinit template.mif warp-'[]'.nii
303
+
304
+ References:
305
+
306
+ .
307
+
308
+ Author: MRTrix3 Developers
309
+
310
+ URL: https://www.mrtrix.org/
311
+
312
+ Args:
313
+ template: the input template image.
314
+ warp: the output warp image.
315
+ info: display information messages.
316
+ quiet: do not display information messages or progress status;\
317
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
318
+ environment variable to a non-empty string.
319
+ debug: display debugging messages.
320
+ force: force overwrite of output files (caution: using the same file as\
321
+ input and output might cause unexpected behaviour).
322
+ nthreads: use this number of threads in multi-threaded applications\
323
+ (set to 0 to disable multi-threading).
324
+ config: temporarily set the value of an MRtrix config file entry.
325
+ help_: display this information page and exit.
326
+ version: display version information and exit.
327
+ runner: Command runner.
328
+ Returns:
329
+ NamedTuple of outputs (described in `WarpinitOutputs`).
330
+ """
331
+ runner = runner or get_global_runner()
332
+ execution = runner.start_execution(WARPINIT_METADATA)
333
+ params = warpinit_params(
334
+ info=info,
335
+ quiet=quiet,
336
+ debug=debug,
337
+ force=force,
338
+ nthreads=nthreads,
339
+ config=config,
340
+ help_=help_,
341
+ version=version,
342
+ template=template,
343
+ warp=warp,
344
+ )
345
+ return warpinit_execute(params, execution)
346
+
347
+
348
+ __all__ = [
349
+ "WARPINIT_METADATA",
350
+ "WarpinitConfigParameters",
351
+ "WarpinitOutputs",
352
+ "WarpinitParameters",
353
+ "warpinit",
354
+ "warpinit_config_params",
355
+ "warpinit_params",
356
+ ]