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,570 @@
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
+ DWI2MASK_METADATA = Metadata(
9
+ id="5345247ad41518ec6a872de4d754e7c58b01dff1.boutiques",
10
+ name="dwi2mask",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _Dwi2maskFslgradParamsDictNoTag = typing.TypedDict('_Dwi2maskFslgradParamsDictNoTag', {
17
+ "bvecs": InputPathType,
18
+ "bvals": InputPathType,
19
+ })
20
+ Dwi2maskFslgradParamsDictTagged = typing.TypedDict('Dwi2maskFslgradParamsDictTagged', {
21
+ "@type": typing.Literal["fslgrad"],
22
+ "bvecs": InputPathType,
23
+ "bvals": InputPathType,
24
+ })
25
+ Dwi2maskFslgradParamsDict = _Dwi2maskFslgradParamsDictNoTag | Dwi2maskFslgradParamsDictTagged
26
+
27
+
28
+ _Dwi2maskConfigParamsDictNoTag = typing.TypedDict('_Dwi2maskConfigParamsDictNoTag', {
29
+ "key": str,
30
+ "value": str,
31
+ })
32
+ Dwi2maskConfigParamsDictTagged = typing.TypedDict('Dwi2maskConfigParamsDictTagged', {
33
+ "@type": typing.Literal["config"],
34
+ "key": str,
35
+ "value": str,
36
+ })
37
+ Dwi2maskConfigParamsDict = _Dwi2maskConfigParamsDictNoTag | Dwi2maskConfigParamsDictTagged
38
+
39
+
40
+ _Dwi2maskParamsDictNoTag = typing.TypedDict('_Dwi2maskParamsDictNoTag', {
41
+ "clean_scale": typing.NotRequired[int | None],
42
+ "grad": typing.NotRequired[InputPathType | None],
43
+ "fslgrad": typing.NotRequired[Dwi2maskFslgradParamsDict | None],
44
+ "info": bool,
45
+ "quiet": bool,
46
+ "debug": bool,
47
+ "force": bool,
48
+ "nthreads": typing.NotRequired[int | None],
49
+ "config": typing.NotRequired[list[Dwi2maskConfigParamsDict] | None],
50
+ "help": bool,
51
+ "version": bool,
52
+ "input": InputPathType,
53
+ "output": str,
54
+ })
55
+ Dwi2maskParamsDictTagged = typing.TypedDict('Dwi2maskParamsDictTagged', {
56
+ "@type": typing.Literal["mrtrix/dwi2mask"],
57
+ "clean_scale": typing.NotRequired[int | None],
58
+ "grad": typing.NotRequired[InputPathType | None],
59
+ "fslgrad": typing.NotRequired[Dwi2maskFslgradParamsDict | None],
60
+ "info": bool,
61
+ "quiet": bool,
62
+ "debug": bool,
63
+ "force": bool,
64
+ "nthreads": typing.NotRequired[int | None],
65
+ "config": typing.NotRequired[list[Dwi2maskConfigParamsDict] | None],
66
+ "help": bool,
67
+ "version": bool,
68
+ "input": InputPathType,
69
+ "output": str,
70
+ })
71
+ Dwi2maskParamsDict = _Dwi2maskParamsDictNoTag | Dwi2maskParamsDictTagged
72
+
73
+
74
+ def dwi2mask_fslgrad(
75
+ bvecs: InputPathType,
76
+ bvals: InputPathType,
77
+ ) -> Dwi2maskFslgradParamsDictTagged:
78
+ """
79
+ Build parameters.
80
+
81
+ Args:
82
+ bvecs: Provide the diffusion-weighted gradient scheme used in the\
83
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
84
+ scheme is present in the input image header, the data provided with\
85
+ this option will be instead used.
86
+ bvals: Provide the diffusion-weighted gradient scheme used in the\
87
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
88
+ scheme is present in the input image header, the data provided with\
89
+ this option will be instead used.
90
+ Returns:
91
+ Parameter dictionary
92
+ """
93
+ params = {
94
+ "@type": "fslgrad",
95
+ "bvecs": bvecs,
96
+ "bvals": bvals,
97
+ }
98
+ return params
99
+
100
+
101
+ def dwi2mask_fslgrad_validate(
102
+ params: typing.Any,
103
+ ) -> None:
104
+ """
105
+ Validate parameters. Throws an error if `params` is not a valid
106
+ `Dwi2maskFslgradParamsDict` object.
107
+
108
+ Args:
109
+ params: The parameters object to validate.
110
+ """
111
+ if params is None or not isinstance(params, dict):
112
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
113
+ if params.get("bvecs", None) is None:
114
+ raise StyxValidationError("`bvecs` must not be None")
115
+ if not isinstance(params["bvecs"], (pathlib.Path, str)):
116
+ raise StyxValidationError(f'`bvecs` has the wrong type: Received `{type(params.get("bvecs", None))}` expected `InputPathType`')
117
+ if params.get("bvals", None) is None:
118
+ raise StyxValidationError("`bvals` must not be None")
119
+ if not isinstance(params["bvals"], (pathlib.Path, str)):
120
+ raise StyxValidationError(f'`bvals` has the wrong type: Received `{type(params.get("bvals", None))}` expected `InputPathType`')
121
+
122
+
123
+ def dwi2mask_fslgrad_cargs(
124
+ params: Dwi2maskFslgradParamsDict,
125
+ execution: Execution,
126
+ ) -> list[str]:
127
+ """
128
+ Build command-line arguments from parameters.
129
+
130
+ Args:
131
+ params: The parameters.
132
+ execution: The execution object for resolving input paths.
133
+ Returns:
134
+ Command-line arguments.
135
+ """
136
+ cargs = []
137
+ cargs.append("-fslgrad")
138
+ cargs.append(execution.input_file(params.get("bvecs", None)))
139
+ cargs.append(execution.input_file(params.get("bvals", None)))
140
+ return cargs
141
+
142
+
143
+ def dwi2mask_config(
144
+ key: str,
145
+ value: str,
146
+ ) -> Dwi2maskConfigParamsDictTagged:
147
+ """
148
+ Build parameters.
149
+
150
+ Args:
151
+ key: temporarily set the value of an MRtrix config file entry.
152
+ value: temporarily set the value of an MRtrix config file entry.
153
+ Returns:
154
+ Parameter dictionary
155
+ """
156
+ params = {
157
+ "@type": "config",
158
+ "key": key,
159
+ "value": value,
160
+ }
161
+ return params
162
+
163
+
164
+ def dwi2mask_config_validate(
165
+ params: typing.Any,
166
+ ) -> None:
167
+ """
168
+ Validate parameters. Throws an error if `params` is not a valid
169
+ `Dwi2maskConfigParamsDict` object.
170
+
171
+ Args:
172
+ params: The parameters object to validate.
173
+ """
174
+ if params is None or not isinstance(params, dict):
175
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
176
+ if params.get("key", None) is None:
177
+ raise StyxValidationError("`key` must not be None")
178
+ if not isinstance(params["key"], str):
179
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
180
+ if params.get("value", None) is None:
181
+ raise StyxValidationError("`value` must not be None")
182
+ if not isinstance(params["value"], str):
183
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
184
+
185
+
186
+ def dwi2mask_config_cargs(
187
+ params: Dwi2maskConfigParamsDict,
188
+ execution: Execution,
189
+ ) -> list[str]:
190
+ """
191
+ Build command-line arguments from parameters.
192
+
193
+ Args:
194
+ params: The parameters.
195
+ execution: The execution object for resolving input paths.
196
+ Returns:
197
+ Command-line arguments.
198
+ """
199
+ cargs = []
200
+ cargs.append("-config")
201
+ cargs.append(params.get("key", None))
202
+ cargs.append(params.get("value", None))
203
+ return cargs
204
+
205
+
206
+ class Dwi2maskOutputs(typing.NamedTuple):
207
+ """
208
+ Output object returned when calling `Dwi2maskParamsDict(...)`.
209
+ """
210
+ root: OutputPathType
211
+ """Output root folder. This is the root folder for all outputs."""
212
+ output: OutputPathType
213
+ """the output whole-brain mask image"""
214
+
215
+
216
+ def dwi2mask_params(
217
+ input_: InputPathType,
218
+ output: str,
219
+ clean_scale: int | None = None,
220
+ grad: InputPathType | None = None,
221
+ fslgrad: Dwi2maskFslgradParamsDict | None = None,
222
+ info: bool = False,
223
+ quiet: bool = False,
224
+ debug: bool = False,
225
+ force: bool = False,
226
+ nthreads: int | None = None,
227
+ config: list[Dwi2maskConfigParamsDict] | None = None,
228
+ help_: bool = False,
229
+ version: bool = False,
230
+ ) -> Dwi2maskParamsDictTagged:
231
+ """
232
+ Build parameters.
233
+
234
+ Args:
235
+ input_: the input DWI image containing volumes that are both diffusion\
236
+ weighted and b=0.
237
+ output: the output whole-brain mask image.
238
+ clean_scale: the maximum scale used to cut bridges. A certain maximum\
239
+ scale cuts bridges up to a width (in voxels) of 2x the provided scale.\
240
+ Setting this to 0 disables the mask cleaning step. (Default: 2).
241
+ grad: Provide the diffusion-weighted gradient scheme used in the\
242
+ acquisition in a text file. This should be supplied as a 4xN text file\
243
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
244
+ the direction of the applied gradient, and b gives the b-value in units\
245
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
246
+ header, the data provided with this option will be instead used.
247
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
248
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
249
+ scheme is present in the input image header, the data provided with\
250
+ this option will be instead used.
251
+ info: display information messages.
252
+ quiet: do not display information messages or progress status;\
253
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
254
+ environment variable to a non-empty string.
255
+ debug: display debugging messages.
256
+ force: force overwrite of output files (caution: using the same file as\
257
+ input and output might cause unexpected behaviour).
258
+ nthreads: use this number of threads in multi-threaded applications\
259
+ (set to 0 to disable multi-threading).
260
+ config: temporarily set the value of an MRtrix config file entry.
261
+ help_: display this information page and exit.
262
+ version: display version information and exit.
263
+ Returns:
264
+ Parameter dictionary
265
+ """
266
+ params = {
267
+ "@type": "mrtrix/dwi2mask",
268
+ "info": info,
269
+ "quiet": quiet,
270
+ "debug": debug,
271
+ "force": force,
272
+ "help": help_,
273
+ "version": version,
274
+ "input": input_,
275
+ "output": output,
276
+ }
277
+ if clean_scale is not None:
278
+ params["clean_scale"] = clean_scale
279
+ if grad is not None:
280
+ params["grad"] = grad
281
+ if fslgrad is not None:
282
+ params["fslgrad"] = fslgrad
283
+ if nthreads is not None:
284
+ params["nthreads"] = nthreads
285
+ if config is not None:
286
+ params["config"] = config
287
+ return params
288
+
289
+
290
+ def dwi2mask_validate(
291
+ params: typing.Any,
292
+ ) -> None:
293
+ """
294
+ Validate parameters. Throws an error if `params` is not a valid
295
+ `Dwi2maskParamsDict` object.
296
+
297
+ Args:
298
+ params: The parameters object to validate.
299
+ """
300
+ if params is None or not isinstance(params, dict):
301
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
302
+ if params.get("clean_scale", None) is not None:
303
+ if not isinstance(params["clean_scale"], int):
304
+ raise StyxValidationError(f'`clean_scale` has the wrong type: Received `{type(params.get("clean_scale", None))}` expected `int | None`')
305
+ if params.get("grad", None) is not None:
306
+ if not isinstance(params["grad"], (pathlib.Path, str)):
307
+ raise StyxValidationError(f'`grad` has the wrong type: Received `{type(params.get("grad", None))}` expected `InputPathType | None`')
308
+ if params.get("fslgrad", None) is not None:
309
+ dwi2mask_fslgrad_validate(params["fslgrad"])
310
+ if params.get("info", False) is None:
311
+ raise StyxValidationError("`info` must not be None")
312
+ if not isinstance(params["info"], bool):
313
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
314
+ if params.get("quiet", False) is None:
315
+ raise StyxValidationError("`quiet` must not be None")
316
+ if not isinstance(params["quiet"], bool):
317
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
318
+ if params.get("debug", False) is None:
319
+ raise StyxValidationError("`debug` must not be None")
320
+ if not isinstance(params["debug"], bool):
321
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
322
+ if params.get("force", False) is None:
323
+ raise StyxValidationError("`force` must not be None")
324
+ if not isinstance(params["force"], bool):
325
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
326
+ if params.get("nthreads", None) is not None:
327
+ if not isinstance(params["nthreads"], int):
328
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
329
+ if params.get("config", None) is not None:
330
+ if not isinstance(params["config"], list):
331
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Dwi2maskConfigParamsDict] | None`')
332
+ for e in params["config"]:
333
+ dwi2mask_config_validate(e)
334
+ if params.get("help", False) is None:
335
+ raise StyxValidationError("`help` must not be None")
336
+ if not isinstance(params["help"], bool):
337
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
338
+ if params.get("version", False) is None:
339
+ raise StyxValidationError("`version` must not be None")
340
+ if not isinstance(params["version"], bool):
341
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
342
+ if params.get("input", None) is None:
343
+ raise StyxValidationError("`input` must not be None")
344
+ if not isinstance(params["input"], (pathlib.Path, str)):
345
+ raise StyxValidationError(f'`input` has the wrong type: Received `{type(params.get("input", None))}` expected `InputPathType`')
346
+ if params.get("output", None) is None:
347
+ raise StyxValidationError("`output` must not be None")
348
+ if not isinstance(params["output"], str):
349
+ raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
350
+
351
+
352
+ def dwi2mask_cargs(
353
+ params: Dwi2maskParamsDict,
354
+ execution: Execution,
355
+ ) -> list[str]:
356
+ """
357
+ Build command-line arguments from parameters.
358
+
359
+ Args:
360
+ params: The parameters.
361
+ execution: The execution object for resolving input paths.
362
+ Returns:
363
+ Command-line arguments.
364
+ """
365
+ cargs = []
366
+ cargs.append("dwi2mask")
367
+ if params.get("clean_scale", None) is not None:
368
+ cargs.extend([
369
+ "-clean_scale",
370
+ str(params.get("clean_scale", None))
371
+ ])
372
+ if params.get("grad", None) is not None:
373
+ cargs.extend([
374
+ "-grad",
375
+ execution.input_file(params.get("grad", None))
376
+ ])
377
+ if params.get("fslgrad", None) is not None:
378
+ cargs.extend(dwi2mask_fslgrad_cargs(params.get("fslgrad", None), execution))
379
+ if params.get("info", False):
380
+ cargs.append("-info")
381
+ if params.get("quiet", False):
382
+ cargs.append("-quiet")
383
+ if params.get("debug", False):
384
+ cargs.append("-debug")
385
+ if params.get("force", False):
386
+ cargs.append("-force")
387
+ if params.get("nthreads", None) is not None:
388
+ cargs.extend([
389
+ "-nthreads",
390
+ str(params.get("nthreads", None))
391
+ ])
392
+ if params.get("config", None) is not None:
393
+ cargs.extend([a for c in [dwi2mask_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
394
+ if params.get("help", False):
395
+ cargs.append("-help")
396
+ if params.get("version", False):
397
+ cargs.append("-version")
398
+ cargs.append(execution.input_file(params.get("input", None)))
399
+ cargs.append(params.get("output", None))
400
+ return cargs
401
+
402
+
403
+ def dwi2mask_outputs(
404
+ params: Dwi2maskParamsDict,
405
+ execution: Execution,
406
+ ) -> Dwi2maskOutputs:
407
+ """
408
+ Build outputs object containing output file paths and possibly stdout/stderr.
409
+
410
+ Args:
411
+ params: The parameters.
412
+ execution: The execution object for resolving input paths.
413
+ Returns:
414
+ Outputs object.
415
+ """
416
+ ret = Dwi2maskOutputs(
417
+ root=execution.output_file("."),
418
+ output=execution.output_file(params.get("output", None)),
419
+ )
420
+ return ret
421
+
422
+
423
+ def dwi2mask_execute(
424
+ params: Dwi2maskParamsDict,
425
+ runner: Runner | None = None,
426
+ ) -> Dwi2maskOutputs:
427
+ """
428
+ dwi2mask
429
+
430
+ Generates a whole brain mask from a DWI image.
431
+
432
+ All diffusion weighted and b=0 volumes are used to obtain a mask that
433
+ includes both brain tissue and CSF.
434
+
435
+ In a second step peninsula-like extensions, where the peninsula itself is
436
+ wider than the bridge connecting it to the mask, are removed. This may help
437
+ removing artefacts and non-brain parts, e.g. eyes, from the mask.
438
+
439
+ References:
440
+
441
+ Dhollander T, Raffelt D, Connelly A. Unsupervised 3-tissue response function
442
+ estimation from single-shell or multi-shell diffusion MR data without a
443
+ co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion
444
+ MRI, 2016, 5.
445
+
446
+ Author: MRTrix3 Developers
447
+
448
+ URL: https://www.mrtrix.org/
449
+
450
+ Args:
451
+ params: The parameters.
452
+ runner: Command runner.
453
+ Returns:
454
+ NamedTuple of outputs (described in `Dwi2maskOutputs`).
455
+ """
456
+ dwi2mask_validate(params)
457
+ runner = runner or get_global_runner()
458
+ execution = runner.start_execution(DWI2MASK_METADATA)
459
+ params = execution.params(params)
460
+ cargs = dwi2mask_cargs(params, execution)
461
+ ret = dwi2mask_outputs(params, execution)
462
+ execution.run(cargs)
463
+ return ret
464
+
465
+
466
+ def dwi2mask(
467
+ input_: InputPathType,
468
+ output: str,
469
+ clean_scale: int | None = None,
470
+ grad: InputPathType | None = None,
471
+ fslgrad: Dwi2maskFslgradParamsDict | None = None,
472
+ info: bool = False,
473
+ quiet: bool = False,
474
+ debug: bool = False,
475
+ force: bool = False,
476
+ nthreads: int | None = None,
477
+ config: list[Dwi2maskConfigParamsDict] | None = None,
478
+ help_: bool = False,
479
+ version: bool = False,
480
+ runner: Runner | None = None,
481
+ ) -> Dwi2maskOutputs:
482
+ """
483
+ dwi2mask
484
+
485
+ Generates a whole brain mask from a DWI image.
486
+
487
+ All diffusion weighted and b=0 volumes are used to obtain a mask that
488
+ includes both brain tissue and CSF.
489
+
490
+ In a second step peninsula-like extensions, where the peninsula itself is
491
+ wider than the bridge connecting it to the mask, are removed. This may help
492
+ removing artefacts and non-brain parts, e.g. eyes, from the mask.
493
+
494
+ References:
495
+
496
+ Dhollander T, Raffelt D, Connelly A. Unsupervised 3-tissue response function
497
+ estimation from single-shell or multi-shell diffusion MR data without a
498
+ co-registered T1 image. ISMRM Workshop on Breaking the Barriers of Diffusion
499
+ MRI, 2016, 5.
500
+
501
+ Author: MRTrix3 Developers
502
+
503
+ URL: https://www.mrtrix.org/
504
+
505
+ Args:
506
+ input_: the input DWI image containing volumes that are both diffusion\
507
+ weighted and b=0.
508
+ output: the output whole-brain mask image.
509
+ clean_scale: the maximum scale used to cut bridges. A certain maximum\
510
+ scale cuts bridges up to a width (in voxels) of 2x the provided scale.\
511
+ Setting this to 0 disables the mask cleaning step. (Default: 2).
512
+ grad: Provide the diffusion-weighted gradient scheme used in the\
513
+ acquisition in a text file. This should be supplied as a 4xN text file\
514
+ with each line is in the format [ X Y Z b ], where [ X Y Z ] describe\
515
+ the direction of the applied gradient, and b gives the b-value in units\
516
+ of s/mm^2. If a diffusion gradient scheme is present in the input image\
517
+ header, the data provided with this option will be instead used.
518
+ fslgrad: Provide the diffusion-weighted gradient scheme used in the\
519
+ acquisition in FSL bvecs/bvals format files. If a diffusion gradient\
520
+ scheme is present in the input image header, the data provided with\
521
+ this option will be instead used.
522
+ info: display information messages.
523
+ quiet: do not display information messages or progress status;\
524
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
525
+ environment variable to a non-empty string.
526
+ debug: display debugging messages.
527
+ force: force overwrite of output files (caution: using the same file as\
528
+ input and output might cause unexpected behaviour).
529
+ nthreads: use this number of threads in multi-threaded applications\
530
+ (set to 0 to disable multi-threading).
531
+ config: temporarily set the value of an MRtrix config file entry.
532
+ help_: display this information page and exit.
533
+ version: display version information and exit.
534
+ runner: Command runner.
535
+ Returns:
536
+ NamedTuple of outputs (described in `Dwi2maskOutputs`).
537
+ """
538
+ params = dwi2mask_params(
539
+ clean_scale=clean_scale,
540
+ grad=grad,
541
+ fslgrad=fslgrad,
542
+ info=info,
543
+ quiet=quiet,
544
+ debug=debug,
545
+ force=force,
546
+ nthreads=nthreads,
547
+ config=config,
548
+ help_=help_,
549
+ version=version,
550
+ input_=input_,
551
+ output=output,
552
+ )
553
+ return dwi2mask_execute(params, runner)
554
+
555
+
556
+ __all__ = [
557
+ "DWI2MASK_METADATA",
558
+ "Dwi2maskConfigParamsDict",
559
+ "Dwi2maskConfigParamsDictTagged",
560
+ "Dwi2maskFslgradParamsDict",
561
+ "Dwi2maskFslgradParamsDictTagged",
562
+ "Dwi2maskOutputs",
563
+ "Dwi2maskParamsDict",
564
+ "Dwi2maskParamsDictTagged",
565
+ "dwi2mask",
566
+ "dwi2mask_config",
567
+ "dwi2mask_execute",
568
+ "dwi2mask_fslgrad",
569
+ "dwi2mask_params",
570
+ ]