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,1179 @@
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
+ FIXELCFESTATS_METADATA = Metadata(
9
+ id="977582ec85abc36abca54062935b4e3d34f0c9f9.boutiques",
10
+ name="fixelcfestats",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _FixelcfestatsColumnParamsDictNoTag = typing.TypedDict('_FixelcfestatsColumnParamsDictNoTag', {
17
+ "path": InputPathType,
18
+ })
19
+ FixelcfestatsColumnParamsDictTagged = typing.TypedDict('FixelcfestatsColumnParamsDictTagged', {
20
+ "@type": typing.Literal["column"],
21
+ "path": InputPathType,
22
+ })
23
+ FixelcfestatsColumnParamsDict = _FixelcfestatsColumnParamsDictNoTag | FixelcfestatsColumnParamsDictTagged
24
+
25
+
26
+ _FixelcfestatsConfigParamsDictNoTag = typing.TypedDict('_FixelcfestatsConfigParamsDictNoTag', {
27
+ "key": str,
28
+ "value": str,
29
+ })
30
+ FixelcfestatsConfigParamsDictTagged = typing.TypedDict('FixelcfestatsConfigParamsDictTagged', {
31
+ "@type": typing.Literal["config"],
32
+ "key": str,
33
+ "value": str,
34
+ })
35
+ FixelcfestatsConfigParamsDict = _FixelcfestatsConfigParamsDictNoTag | FixelcfestatsConfigParamsDictTagged
36
+
37
+
38
+ _FixelcfestatsVariousStringParamsDictNoTag = typing.TypedDict('_FixelcfestatsVariousStringParamsDictNoTag', {
39
+ "obj": str,
40
+ })
41
+ FixelcfestatsVariousStringParamsDictTagged = typing.TypedDict('FixelcfestatsVariousStringParamsDictTagged', {
42
+ "@type": typing.Literal["VariousString"],
43
+ "obj": str,
44
+ })
45
+ FixelcfestatsVariousStringParamsDict = _FixelcfestatsVariousStringParamsDictNoTag | FixelcfestatsVariousStringParamsDictTagged
46
+
47
+
48
+ _FixelcfestatsVariousFileParamsDictNoTag = typing.TypedDict('_FixelcfestatsVariousFileParamsDictNoTag', {
49
+ "obj": InputPathType,
50
+ })
51
+ FixelcfestatsVariousFileParamsDictTagged = typing.TypedDict('FixelcfestatsVariousFileParamsDictTagged', {
52
+ "@type": typing.Literal["VariousFile"],
53
+ "obj": InputPathType,
54
+ })
55
+ FixelcfestatsVariousFileParamsDict = _FixelcfestatsVariousFileParamsDictNoTag | FixelcfestatsVariousFileParamsDictTagged
56
+
57
+
58
+ _FixelcfestatsParamsDictNoTag = typing.TypedDict('_FixelcfestatsParamsDictNoTag', {
59
+ "mask": typing.NotRequired[InputPathType | None],
60
+ "notest": bool,
61
+ "errors": typing.NotRequired[str | None],
62
+ "exchange_within": typing.NotRequired[InputPathType | None],
63
+ "exchange_whole": typing.NotRequired[InputPathType | None],
64
+ "strong": bool,
65
+ "nshuffles": typing.NotRequired[int | None],
66
+ "permutations": typing.NotRequired[InputPathType | None],
67
+ "nonstationarity": bool,
68
+ "skew_nonstationarity": typing.NotRequired[float | None],
69
+ "nshuffles_nonstationarity": typing.NotRequired[int | None],
70
+ "permutations_nonstationarity": typing.NotRequired[InputPathType | None],
71
+ "cfe_dh": typing.NotRequired[float | None],
72
+ "cfe_e": typing.NotRequired[float | None],
73
+ "cfe_h": typing.NotRequired[float | None],
74
+ "cfe_c": typing.NotRequired[float | None],
75
+ "cfe_legacy": bool,
76
+ "variance": typing.NotRequired[InputPathType | None],
77
+ "ftests": typing.NotRequired[InputPathType | None],
78
+ "fonly": bool,
79
+ "column": typing.NotRequired[list[FixelcfestatsColumnParamsDict] | None],
80
+ "info": bool,
81
+ "quiet": bool,
82
+ "debug": bool,
83
+ "force": bool,
84
+ "nthreads": typing.NotRequired[int | None],
85
+ "config": typing.NotRequired[list[FixelcfestatsConfigParamsDict] | None],
86
+ "help": bool,
87
+ "version": bool,
88
+ "in_fixel_directory": InputPathType,
89
+ "subjects": InputPathType,
90
+ "design": InputPathType,
91
+ "contrast": InputPathType,
92
+ "connectivity": typing.Union[FixelcfestatsVariousStringParamsDictTagged, FixelcfestatsVariousFileParamsDictTagged],
93
+ "out_fixel_directory": str,
94
+ })
95
+ FixelcfestatsParamsDictTagged = typing.TypedDict('FixelcfestatsParamsDictTagged', {
96
+ "@type": typing.Literal["mrtrix/fixelcfestats"],
97
+ "mask": typing.NotRequired[InputPathType | None],
98
+ "notest": bool,
99
+ "errors": typing.NotRequired[str | None],
100
+ "exchange_within": typing.NotRequired[InputPathType | None],
101
+ "exchange_whole": typing.NotRequired[InputPathType | None],
102
+ "strong": bool,
103
+ "nshuffles": typing.NotRequired[int | None],
104
+ "permutations": typing.NotRequired[InputPathType | None],
105
+ "nonstationarity": bool,
106
+ "skew_nonstationarity": typing.NotRequired[float | None],
107
+ "nshuffles_nonstationarity": typing.NotRequired[int | None],
108
+ "permutations_nonstationarity": typing.NotRequired[InputPathType | None],
109
+ "cfe_dh": typing.NotRequired[float | None],
110
+ "cfe_e": typing.NotRequired[float | None],
111
+ "cfe_h": typing.NotRequired[float | None],
112
+ "cfe_c": typing.NotRequired[float | None],
113
+ "cfe_legacy": bool,
114
+ "variance": typing.NotRequired[InputPathType | None],
115
+ "ftests": typing.NotRequired[InputPathType | None],
116
+ "fonly": bool,
117
+ "column": typing.NotRequired[list[FixelcfestatsColumnParamsDict] | None],
118
+ "info": bool,
119
+ "quiet": bool,
120
+ "debug": bool,
121
+ "force": bool,
122
+ "nthreads": typing.NotRequired[int | None],
123
+ "config": typing.NotRequired[list[FixelcfestatsConfigParamsDict] | None],
124
+ "help": bool,
125
+ "version": bool,
126
+ "in_fixel_directory": InputPathType,
127
+ "subjects": InputPathType,
128
+ "design": InputPathType,
129
+ "contrast": InputPathType,
130
+ "connectivity": typing.Union[FixelcfestatsVariousStringParamsDictTagged, FixelcfestatsVariousFileParamsDictTagged],
131
+ "out_fixel_directory": str,
132
+ })
133
+ FixelcfestatsParamsDict = _FixelcfestatsParamsDictNoTag | FixelcfestatsParamsDictTagged
134
+
135
+
136
+ def fixelcfestats_connectivity_cargs_dyn_fn(
137
+ t: str,
138
+ ) -> typing.Any:
139
+ """
140
+ Get build cargs function by command type.
141
+
142
+ Args:
143
+ t: Command type.
144
+ Returns:
145
+ Build cargs function.
146
+ """
147
+ return {
148
+ "VariousString": fixelcfestats_various_string_cargs,
149
+ "VariousFile": fixelcfestats_various_file_cargs,
150
+ }.get(t)
151
+
152
+
153
+ def fixelcfestats_connectivity_validate_dyn_fn(
154
+ t: str,
155
+ ) -> typing.Any:
156
+ """
157
+ Get validate params function by command type.
158
+
159
+ Args:
160
+ t: Command type.
161
+ Returns:
162
+ Validate params function.
163
+ """
164
+ return {
165
+ "VariousString": fixelcfestats_various_string_validate,
166
+ "VariousFile": fixelcfestats_various_file_validate,
167
+ }.get(t)
168
+
169
+
170
+ def fixelcfestats_column(
171
+ path: InputPathType,
172
+ ) -> FixelcfestatsColumnParamsDictTagged:
173
+ """
174
+ Build parameters.
175
+
176
+ Args:
177
+ path: add a column to the design matrix corresponding to subject\
178
+ fixel-wise values (note that the contrast matrix must include an\
179
+ additional column for each use of this option); the text file provided\
180
+ via this option should contain a file name for each subject.
181
+ Returns:
182
+ Parameter dictionary
183
+ """
184
+ params = {
185
+ "@type": "column",
186
+ "path": path,
187
+ }
188
+ return params
189
+
190
+
191
+ def fixelcfestats_column_validate(
192
+ params: typing.Any,
193
+ ) -> None:
194
+ """
195
+ Validate parameters. Throws an error if `params` is not a valid
196
+ `FixelcfestatsColumnParamsDict` object.
197
+
198
+ Args:
199
+ params: The parameters object to validate.
200
+ """
201
+ if params is None or not isinstance(params, dict):
202
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
203
+ if params.get("path", None) is None:
204
+ raise StyxValidationError("`path` must not be None")
205
+ if not isinstance(params["path"], (pathlib.Path, str)):
206
+ raise StyxValidationError(f'`path` has the wrong type: Received `{type(params.get("path", None))}` expected `InputPathType`')
207
+
208
+
209
+ def fixelcfestats_column_cargs(
210
+ params: FixelcfestatsColumnParamsDict,
211
+ execution: Execution,
212
+ ) -> list[str]:
213
+ """
214
+ Build command-line arguments from parameters.
215
+
216
+ Args:
217
+ params: The parameters.
218
+ execution: The execution object for resolving input paths.
219
+ Returns:
220
+ Command-line arguments.
221
+ """
222
+ cargs = []
223
+ cargs.append("-column")
224
+ cargs.append(execution.input_file(params.get("path", None)))
225
+ return cargs
226
+
227
+
228
+ def fixelcfestats_config(
229
+ key: str,
230
+ value: str,
231
+ ) -> FixelcfestatsConfigParamsDictTagged:
232
+ """
233
+ Build parameters.
234
+
235
+ Args:
236
+ key: temporarily set the value of an MRtrix config file entry.
237
+ value: temporarily set the value of an MRtrix config file entry.
238
+ Returns:
239
+ Parameter dictionary
240
+ """
241
+ params = {
242
+ "@type": "config",
243
+ "key": key,
244
+ "value": value,
245
+ }
246
+ return params
247
+
248
+
249
+ def fixelcfestats_config_validate(
250
+ params: typing.Any,
251
+ ) -> None:
252
+ """
253
+ Validate parameters. Throws an error if `params` is not a valid
254
+ `FixelcfestatsConfigParamsDict` object.
255
+
256
+ Args:
257
+ params: The parameters object to validate.
258
+ """
259
+ if params is None or not isinstance(params, dict):
260
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
261
+ if params.get("key", None) is None:
262
+ raise StyxValidationError("`key` must not be None")
263
+ if not isinstance(params["key"], str):
264
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
265
+ if params.get("value", None) is None:
266
+ raise StyxValidationError("`value` must not be None")
267
+ if not isinstance(params["value"], str):
268
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
269
+
270
+
271
+ def fixelcfestats_config_cargs(
272
+ params: FixelcfestatsConfigParamsDict,
273
+ execution: Execution,
274
+ ) -> list[str]:
275
+ """
276
+ Build command-line arguments from parameters.
277
+
278
+ Args:
279
+ params: The parameters.
280
+ execution: The execution object for resolving input paths.
281
+ Returns:
282
+ Command-line arguments.
283
+ """
284
+ cargs = []
285
+ cargs.append("-config")
286
+ cargs.append(params.get("key", None))
287
+ cargs.append(params.get("value", None))
288
+ return cargs
289
+
290
+
291
+ def fixelcfestats_various_string(
292
+ obj: str,
293
+ ) -> FixelcfestatsVariousStringParamsDictTagged:
294
+ """
295
+ Build parameters.
296
+
297
+ Args:
298
+ obj: String object.
299
+ Returns:
300
+ Parameter dictionary
301
+ """
302
+ params = {
303
+ "@type": "VariousString",
304
+ "obj": obj,
305
+ }
306
+ return params
307
+
308
+
309
+ def fixelcfestats_various_string_validate(
310
+ params: typing.Any,
311
+ ) -> None:
312
+ """
313
+ Validate parameters. Throws an error if `params` is not a valid
314
+ `FixelcfestatsVariousStringParamsDict` object.
315
+
316
+ Args:
317
+ params: The parameters object to validate.
318
+ """
319
+ if params is None or not isinstance(params, dict):
320
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
321
+ if params.get("obj", None) is None:
322
+ raise StyxValidationError("`obj` must not be None")
323
+ if not isinstance(params["obj"], str):
324
+ raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `str`')
325
+
326
+
327
+ def fixelcfestats_various_string_cargs(
328
+ params: FixelcfestatsVariousStringParamsDict,
329
+ execution: Execution,
330
+ ) -> list[str]:
331
+ """
332
+ Build command-line arguments from parameters.
333
+
334
+ Args:
335
+ params: The parameters.
336
+ execution: The execution object for resolving input paths.
337
+ Returns:
338
+ Command-line arguments.
339
+ """
340
+ cargs = []
341
+ cargs.append(params.get("obj", None))
342
+ return cargs
343
+
344
+
345
+ def fixelcfestats_various_file(
346
+ obj: InputPathType,
347
+ ) -> FixelcfestatsVariousFileParamsDictTagged:
348
+ """
349
+ Build parameters.
350
+
351
+ Args:
352
+ obj: File object.
353
+ Returns:
354
+ Parameter dictionary
355
+ """
356
+ params = {
357
+ "@type": "VariousFile",
358
+ "obj": obj,
359
+ }
360
+ return params
361
+
362
+
363
+ def fixelcfestats_various_file_validate(
364
+ params: typing.Any,
365
+ ) -> None:
366
+ """
367
+ Validate parameters. Throws an error if `params` is not a valid
368
+ `FixelcfestatsVariousFileParamsDict` object.
369
+
370
+ Args:
371
+ params: The parameters object to validate.
372
+ """
373
+ if params is None or not isinstance(params, dict):
374
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
375
+ if params.get("obj", None) is None:
376
+ raise StyxValidationError("`obj` must not be None")
377
+ if not isinstance(params["obj"], (pathlib.Path, str)):
378
+ raise StyxValidationError(f'`obj` has the wrong type: Received `{type(params.get("obj", None))}` expected `InputPathType`')
379
+
380
+
381
+ def fixelcfestats_various_file_cargs(
382
+ params: FixelcfestatsVariousFileParamsDict,
383
+ execution: Execution,
384
+ ) -> list[str]:
385
+ """
386
+ Build command-line arguments from parameters.
387
+
388
+ Args:
389
+ params: The parameters.
390
+ execution: The execution object for resolving input paths.
391
+ Returns:
392
+ Command-line arguments.
393
+ """
394
+ cargs = []
395
+ cargs.append(execution.input_file(params.get("obj", None)))
396
+ return cargs
397
+
398
+
399
+ class FixelcfestatsOutputs(typing.NamedTuple):
400
+ """
401
+ Output object returned when calling `FixelcfestatsParamsDict(...)`.
402
+ """
403
+ root: OutputPathType
404
+ """Output root folder. This is the root folder for all outputs."""
405
+
406
+
407
+ def fixelcfestats_params(
408
+ in_fixel_directory: InputPathType,
409
+ subjects: InputPathType,
410
+ design: InputPathType,
411
+ contrast: InputPathType,
412
+ connectivity: typing.Union[FixelcfestatsVariousStringParamsDictTagged, FixelcfestatsVariousFileParamsDictTagged],
413
+ out_fixel_directory: str,
414
+ mask: InputPathType | None = None,
415
+ notest: bool = False,
416
+ errors: str | None = None,
417
+ exchange_within: InputPathType | None = None,
418
+ exchange_whole: InputPathType | None = None,
419
+ strong: bool = False,
420
+ nshuffles: int | None = None,
421
+ permutations: InputPathType | None = None,
422
+ nonstationarity: bool = False,
423
+ skew_nonstationarity: float | None = None,
424
+ nshuffles_nonstationarity: int | None = None,
425
+ permutations_nonstationarity: InputPathType | None = None,
426
+ cfe_dh: float | None = None,
427
+ cfe_e: float | None = None,
428
+ cfe_h: float | None = None,
429
+ cfe_c: float | None = None,
430
+ cfe_legacy: bool = False,
431
+ variance: InputPathType | None = None,
432
+ ftests: InputPathType | None = None,
433
+ fonly: bool = False,
434
+ column: list[FixelcfestatsColumnParamsDict] | None = None,
435
+ info: bool = False,
436
+ quiet: bool = False,
437
+ debug: bool = False,
438
+ force: bool = False,
439
+ nthreads: int | None = None,
440
+ config: list[FixelcfestatsConfigParamsDict] | None = None,
441
+ help_: bool = False,
442
+ version: bool = False,
443
+ ) -> FixelcfestatsParamsDictTagged:
444
+ """
445
+ Build parameters.
446
+
447
+ Args:
448
+ in_fixel_directory: the fixel directory containing the data files for\
449
+ each subject (after obtaining fixel correspondence.
450
+ subjects: a text file listing the subject identifiers (one per line).\
451
+ This should correspond with the filenames in the fixel directory\
452
+ (including the file extension), and be listed in the same order as the\
453
+ rows of the design matrix.
454
+ design: the design matrix.
455
+ contrast: the contrast matrix, specified as rows of weights.
456
+ connectivity: the fixel-fixel connectivity matrix.
457
+ out_fixel_directory: the output directory where results will be saved.\
458
+ Will be created if it does not exist.
459
+ mask: provide a fixel data file containing a mask of those fixels to be\
460
+ used during processing.
461
+ notest: don't perform statistical inference; only output population\
462
+ statistics (effect size, stdev etc).
463
+ errors: specify nature of errors for shuffling; options are:\
464
+ ee,ise,both (default: ee).
465
+ exchange_within: specify blocks of observations within each of which\
466
+ data may undergo restricted exchange.
467
+ exchange_whole: specify blocks of observations that may be exchanged\
468
+ with one another (for independent and symmetric errors, sign-flipping\
469
+ will occur block-wise).
470
+ strong: use strong familywise error control across multiple hypotheses.
471
+ nshuffles: the number of shuffles (default: 5000).
472
+ permutations: manually define the permutations (relabelling). The input\
473
+ should be a text file defining a m x n matrix, where each relabelling\
474
+ is defined as a column vector of size m, and the number of columns, n,\
475
+ defines the number of permutations. Can be generated with the\
476
+ palm_quickperms function in PALM\
477
+ (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles\
478
+ option.
479
+ nonstationarity: perform non-stationarity correction.
480
+ skew_nonstationarity: specify the skew parameter for empirical\
481
+ statistic calculation (default for this command is 1).
482
+ nshuffles_nonstationarity: the number of shuffles to use when\
483
+ precomputing the empirical statistic image for non-stationarity\
484
+ correction (default: 5000).
485
+ permutations_nonstationarity: manually define the permutations\
486
+ (relabelling) for computing the emprical statistics for\
487
+ non-stationarity correction. The input should be a text file defining a\
488
+ m x n matrix, where each relabelling is defined as a column vector of\
489
+ size m, and the number of columns, n, defines the number of\
490
+ permutations. Can be generated with the palm_quickperms function in\
491
+ PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM) Overrides the\
492
+ -nshuffles_nonstationarity option.
493
+ cfe_dh: the height increment used in the cfe integration (default: 0.1).
494
+ cfe_e: cfe extent exponent (default: 2).
495
+ cfe_h: cfe height exponent (default: 3).
496
+ cfe_c: cfe connectivity exponent (default: 0.5).
497
+ cfe_legacy: use the legacy (non-normalised) form of the cfe equation.
498
+ variance: define variance groups for the G-statistic; measurements for\
499
+ which the expected variance is equivalent should contain the same index.
500
+ ftests: perform F-tests; input text file should contain, for each\
501
+ F-test, a row containing ones and zeros, where ones indicate the rows\
502
+ of the contrast matrix to be included in the F-test.
503
+ fonly: only assess F-tests; do not perform statistical inference on\
504
+ entries in the contrast matrix.
505
+ column: add a column to the design matrix corresponding to subject\
506
+ fixel-wise values (note that the contrast matrix must include an\
507
+ additional column for each use of this option); the text file provided\
508
+ via this option should contain a file name for each subject.
509
+ info: display information messages.
510
+ quiet: do not display information messages or progress status;\
511
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
512
+ environment variable to a non-empty string.
513
+ debug: display debugging messages.
514
+ force: force overwrite of output files (caution: using the same file as\
515
+ input and output might cause unexpected behaviour).
516
+ nthreads: use this number of threads in multi-threaded applications\
517
+ (set to 0 to disable multi-threading).
518
+ config: temporarily set the value of an MRtrix config file entry.
519
+ help_: display this information page and exit.
520
+ version: display version information and exit.
521
+ Returns:
522
+ Parameter dictionary
523
+ """
524
+ params = {
525
+ "@type": "mrtrix/fixelcfestats",
526
+ "notest": notest,
527
+ "strong": strong,
528
+ "nonstationarity": nonstationarity,
529
+ "cfe_legacy": cfe_legacy,
530
+ "fonly": fonly,
531
+ "info": info,
532
+ "quiet": quiet,
533
+ "debug": debug,
534
+ "force": force,
535
+ "help": help_,
536
+ "version": version,
537
+ "in_fixel_directory": in_fixel_directory,
538
+ "subjects": subjects,
539
+ "design": design,
540
+ "contrast": contrast,
541
+ "connectivity": connectivity,
542
+ "out_fixel_directory": out_fixel_directory,
543
+ }
544
+ if mask is not None:
545
+ params["mask"] = mask
546
+ if errors is not None:
547
+ params["errors"] = errors
548
+ if exchange_within is not None:
549
+ params["exchange_within"] = exchange_within
550
+ if exchange_whole is not None:
551
+ params["exchange_whole"] = exchange_whole
552
+ if nshuffles is not None:
553
+ params["nshuffles"] = nshuffles
554
+ if permutations is not None:
555
+ params["permutations"] = permutations
556
+ if skew_nonstationarity is not None:
557
+ params["skew_nonstationarity"] = skew_nonstationarity
558
+ if nshuffles_nonstationarity is not None:
559
+ params["nshuffles_nonstationarity"] = nshuffles_nonstationarity
560
+ if permutations_nonstationarity is not None:
561
+ params["permutations_nonstationarity"] = permutations_nonstationarity
562
+ if cfe_dh is not None:
563
+ params["cfe_dh"] = cfe_dh
564
+ if cfe_e is not None:
565
+ params["cfe_e"] = cfe_e
566
+ if cfe_h is not None:
567
+ params["cfe_h"] = cfe_h
568
+ if cfe_c is not None:
569
+ params["cfe_c"] = cfe_c
570
+ if variance is not None:
571
+ params["variance"] = variance
572
+ if ftests is not None:
573
+ params["ftests"] = ftests
574
+ if column is not None:
575
+ params["column"] = column
576
+ if nthreads is not None:
577
+ params["nthreads"] = nthreads
578
+ if config is not None:
579
+ params["config"] = config
580
+ return params
581
+
582
+
583
+ def fixelcfestats_validate(
584
+ params: typing.Any,
585
+ ) -> None:
586
+ """
587
+ Validate parameters. Throws an error if `params` is not a valid
588
+ `FixelcfestatsParamsDict` object.
589
+
590
+ Args:
591
+ params: The parameters object to validate.
592
+ """
593
+ if params is None or not isinstance(params, dict):
594
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
595
+ if params.get("mask", None) is not None:
596
+ if not isinstance(params["mask"], (pathlib.Path, str)):
597
+ raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | None`')
598
+ if params.get("notest", False) is None:
599
+ raise StyxValidationError("`notest` must not be None")
600
+ if not isinstance(params["notest"], bool):
601
+ raise StyxValidationError(f'`notest` has the wrong type: Received `{type(params.get("notest", False))}` expected `bool`')
602
+ if params.get("errors", None) is not None:
603
+ if not isinstance(params["errors"], str):
604
+ raise StyxValidationError(f'`errors` has the wrong type: Received `{type(params.get("errors", None))}` expected `str | None`')
605
+ if params.get("exchange_within", None) is not None:
606
+ if not isinstance(params["exchange_within"], (pathlib.Path, str)):
607
+ raise StyxValidationError(f'`exchange_within` has the wrong type: Received `{type(params.get("exchange_within", None))}` expected `InputPathType | None`')
608
+ if params.get("exchange_whole", None) is not None:
609
+ if not isinstance(params["exchange_whole"], (pathlib.Path, str)):
610
+ raise StyxValidationError(f'`exchange_whole` has the wrong type: Received `{type(params.get("exchange_whole", None))}` expected `InputPathType | None`')
611
+ if params.get("strong", False) is None:
612
+ raise StyxValidationError("`strong` must not be None")
613
+ if not isinstance(params["strong"], bool):
614
+ raise StyxValidationError(f'`strong` has the wrong type: Received `{type(params.get("strong", False))}` expected `bool`')
615
+ if params.get("nshuffles", None) is not None:
616
+ if not isinstance(params["nshuffles"], int):
617
+ raise StyxValidationError(f'`nshuffles` has the wrong type: Received `{type(params.get("nshuffles", None))}` expected `int | None`')
618
+ if params.get("permutations", None) is not None:
619
+ if not isinstance(params["permutations"], (pathlib.Path, str)):
620
+ raise StyxValidationError(f'`permutations` has the wrong type: Received `{type(params.get("permutations", None))}` expected `InputPathType | None`')
621
+ if params.get("nonstationarity", False) is None:
622
+ raise StyxValidationError("`nonstationarity` must not be None")
623
+ if not isinstance(params["nonstationarity"], bool):
624
+ raise StyxValidationError(f'`nonstationarity` has the wrong type: Received `{type(params.get("nonstationarity", False))}` expected `bool`')
625
+ if params.get("skew_nonstationarity", None) is not None:
626
+ if not isinstance(params["skew_nonstationarity"], (float, int)):
627
+ raise StyxValidationError(f'`skew_nonstationarity` has the wrong type: Received `{type(params.get("skew_nonstationarity", None))}` expected `float | None`')
628
+ if params.get("nshuffles_nonstationarity", None) is not None:
629
+ if not isinstance(params["nshuffles_nonstationarity"], int):
630
+ raise StyxValidationError(f'`nshuffles_nonstationarity` has the wrong type: Received `{type(params.get("nshuffles_nonstationarity", None))}` expected `int | None`')
631
+ if params.get("permutations_nonstationarity", None) is not None:
632
+ if not isinstance(params["permutations_nonstationarity"], (pathlib.Path, str)):
633
+ raise StyxValidationError(f'`permutations_nonstationarity` has the wrong type: Received `{type(params.get("permutations_nonstationarity", None))}` expected `InputPathType | None`')
634
+ if params.get("cfe_dh", None) is not None:
635
+ if not isinstance(params["cfe_dh"], (float, int)):
636
+ raise StyxValidationError(f'`cfe_dh` has the wrong type: Received `{type(params.get("cfe_dh", None))}` expected `float | None`')
637
+ if params.get("cfe_e", None) is not None:
638
+ if not isinstance(params["cfe_e"], (float, int)):
639
+ raise StyxValidationError(f'`cfe_e` has the wrong type: Received `{type(params.get("cfe_e", None))}` expected `float | None`')
640
+ if params.get("cfe_h", None) is not None:
641
+ if not isinstance(params["cfe_h"], (float, int)):
642
+ raise StyxValidationError(f'`cfe_h` has the wrong type: Received `{type(params.get("cfe_h", None))}` expected `float | None`')
643
+ if params.get("cfe_c", None) is not None:
644
+ if not isinstance(params["cfe_c"], (float, int)):
645
+ raise StyxValidationError(f'`cfe_c` has the wrong type: Received `{type(params.get("cfe_c", None))}` expected `float | None`')
646
+ if params.get("cfe_legacy", False) is None:
647
+ raise StyxValidationError("`cfe_legacy` must not be None")
648
+ if not isinstance(params["cfe_legacy"], bool):
649
+ raise StyxValidationError(f'`cfe_legacy` has the wrong type: Received `{type(params.get("cfe_legacy", False))}` expected `bool`')
650
+ if params.get("variance", None) is not None:
651
+ if not isinstance(params["variance"], (pathlib.Path, str)):
652
+ raise StyxValidationError(f'`variance` has the wrong type: Received `{type(params.get("variance", None))}` expected `InputPathType | None`')
653
+ if params.get("ftests", None) is not None:
654
+ if not isinstance(params["ftests"], (pathlib.Path, str)):
655
+ raise StyxValidationError(f'`ftests` has the wrong type: Received `{type(params.get("ftests", None))}` expected `InputPathType | None`')
656
+ if params.get("fonly", False) is None:
657
+ raise StyxValidationError("`fonly` must not be None")
658
+ if not isinstance(params["fonly"], bool):
659
+ raise StyxValidationError(f'`fonly` has the wrong type: Received `{type(params.get("fonly", False))}` expected `bool`')
660
+ if params.get("column", None) is not None:
661
+ if not isinstance(params["column"], list):
662
+ raise StyxValidationError(f'`column` has the wrong type: Received `{type(params.get("column", None))}` expected `list[FixelcfestatsColumnParamsDict] | None`')
663
+ for e in params["column"]:
664
+ fixelcfestats_column_validate(e)
665
+ if params.get("info", False) is None:
666
+ raise StyxValidationError("`info` must not be None")
667
+ if not isinstance(params["info"], bool):
668
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
669
+ if params.get("quiet", False) is None:
670
+ raise StyxValidationError("`quiet` must not be None")
671
+ if not isinstance(params["quiet"], bool):
672
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
673
+ if params.get("debug", False) is None:
674
+ raise StyxValidationError("`debug` must not be None")
675
+ if not isinstance(params["debug"], bool):
676
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
677
+ if params.get("force", False) is None:
678
+ raise StyxValidationError("`force` must not be None")
679
+ if not isinstance(params["force"], bool):
680
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
681
+ if params.get("nthreads", None) is not None:
682
+ if not isinstance(params["nthreads"], int):
683
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
684
+ if params.get("config", None) is not None:
685
+ if not isinstance(params["config"], list):
686
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[FixelcfestatsConfigParamsDict] | None`')
687
+ for e in params["config"]:
688
+ fixelcfestats_config_validate(e)
689
+ if params.get("help", False) is None:
690
+ raise StyxValidationError("`help` must not be None")
691
+ if not isinstance(params["help"], bool):
692
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
693
+ if params.get("version", False) is None:
694
+ raise StyxValidationError("`version` must not be None")
695
+ if not isinstance(params["version"], bool):
696
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
697
+ if params.get("in_fixel_directory", None) is None:
698
+ raise StyxValidationError("`in_fixel_directory` must not be None")
699
+ if not isinstance(params["in_fixel_directory"], (pathlib.Path, str)):
700
+ raise StyxValidationError(f'`in_fixel_directory` has the wrong type: Received `{type(params.get("in_fixel_directory", None))}` expected `InputPathType`')
701
+ if params.get("subjects", None) is None:
702
+ raise StyxValidationError("`subjects` must not be None")
703
+ if not isinstance(params["subjects"], (pathlib.Path, str)):
704
+ raise StyxValidationError(f'`subjects` has the wrong type: Received `{type(params.get("subjects", None))}` expected `InputPathType`')
705
+ if params.get("design", None) is None:
706
+ raise StyxValidationError("`design` must not be None")
707
+ if not isinstance(params["design"], (pathlib.Path, str)):
708
+ raise StyxValidationError(f'`design` has the wrong type: Received `{type(params.get("design", None))}` expected `InputPathType`')
709
+ if params.get("contrast", None) is None:
710
+ raise StyxValidationError("`contrast` must not be None")
711
+ if not isinstance(params["contrast"], (pathlib.Path, str)):
712
+ raise StyxValidationError(f'`contrast` has the wrong type: Received `{type(params.get("contrast", None))}` expected `InputPathType`')
713
+ if params.get("connectivity", None) is None:
714
+ raise StyxValidationError("`connectivity` must not be None")
715
+ if not isinstance(params["connectivity"], dict):
716
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params["connectivity"])}\'')
717
+ if "@type" not in params["connectivity"]:
718
+ raise StyxValidationError("Params object is missing `@type`")
719
+ if params["connectivity"]["@type"] not in ["VariousString", "VariousFile"]:
720
+ raise StyxValidationError("Parameter `connectivity`s `@type` must be one of [\"VariousString\", \"VariousFile\"]")
721
+ fixelcfestats_connectivity_validate_dyn_fn(params["connectivity"]["@type"])(params["connectivity"])
722
+ if params.get("out_fixel_directory", None) is None:
723
+ raise StyxValidationError("`out_fixel_directory` must not be None")
724
+ if not isinstance(params["out_fixel_directory"], str):
725
+ raise StyxValidationError(f'`out_fixel_directory` has the wrong type: Received `{type(params.get("out_fixel_directory", None))}` expected `str`')
726
+
727
+
728
+ def fixelcfestats_cargs(
729
+ params: FixelcfestatsParamsDict,
730
+ execution: Execution,
731
+ ) -> list[str]:
732
+ """
733
+ Build command-line arguments from parameters.
734
+
735
+ Args:
736
+ params: The parameters.
737
+ execution: The execution object for resolving input paths.
738
+ Returns:
739
+ Command-line arguments.
740
+ """
741
+ cargs = []
742
+ cargs.append("fixelcfestats")
743
+ if params.get("mask", None) is not None:
744
+ cargs.extend([
745
+ "-mask",
746
+ execution.input_file(params.get("mask", None))
747
+ ])
748
+ if params.get("notest", False):
749
+ cargs.append("-notest")
750
+ if params.get("errors", None) is not None:
751
+ cargs.extend([
752
+ "-errors",
753
+ params.get("errors", None)
754
+ ])
755
+ if params.get("exchange_within", None) is not None:
756
+ cargs.extend([
757
+ "-exchange_within",
758
+ execution.input_file(params.get("exchange_within", None))
759
+ ])
760
+ if params.get("exchange_whole", None) is not None:
761
+ cargs.extend([
762
+ "-exchange_whole",
763
+ execution.input_file(params.get("exchange_whole", None))
764
+ ])
765
+ if params.get("strong", False):
766
+ cargs.append("-strong")
767
+ if params.get("nshuffles", None) is not None:
768
+ cargs.extend([
769
+ "-nshuffles",
770
+ str(params.get("nshuffles", None))
771
+ ])
772
+ if params.get("permutations", None) is not None:
773
+ cargs.extend([
774
+ "-permutations",
775
+ execution.input_file(params.get("permutations", None))
776
+ ])
777
+ if params.get("nonstationarity", False):
778
+ cargs.append("-nonstationarity")
779
+ if params.get("skew_nonstationarity", None) is not None:
780
+ cargs.extend([
781
+ "-skew_nonstationarity",
782
+ str(params.get("skew_nonstationarity", None))
783
+ ])
784
+ if params.get("nshuffles_nonstationarity", None) is not None:
785
+ cargs.extend([
786
+ "-nshuffles_nonstationarity",
787
+ str(params.get("nshuffles_nonstationarity", None))
788
+ ])
789
+ if params.get("permutations_nonstationarity", None) is not None:
790
+ cargs.extend([
791
+ "-permutations_nonstationarity",
792
+ execution.input_file(params.get("permutations_nonstationarity", None))
793
+ ])
794
+ if params.get("cfe_dh", None) is not None:
795
+ cargs.extend([
796
+ "-cfe_dh",
797
+ str(params.get("cfe_dh", None))
798
+ ])
799
+ if params.get("cfe_e", None) is not None:
800
+ cargs.extend([
801
+ "-cfe_e",
802
+ str(params.get("cfe_e", None))
803
+ ])
804
+ if params.get("cfe_h", None) is not None:
805
+ cargs.extend([
806
+ "-cfe_h",
807
+ str(params.get("cfe_h", None))
808
+ ])
809
+ if params.get("cfe_c", None) is not None:
810
+ cargs.extend([
811
+ "-cfe_c",
812
+ str(params.get("cfe_c", None))
813
+ ])
814
+ if params.get("cfe_legacy", False):
815
+ cargs.append("-cfe_legacy")
816
+ if params.get("variance", None) is not None:
817
+ cargs.extend([
818
+ "-variance",
819
+ execution.input_file(params.get("variance", None))
820
+ ])
821
+ if params.get("ftests", None) is not None:
822
+ cargs.extend([
823
+ "-ftests",
824
+ execution.input_file(params.get("ftests", None))
825
+ ])
826
+ if params.get("fonly", False):
827
+ cargs.append("-fonly")
828
+ if params.get("column", None) is not None:
829
+ cargs.extend([a for c in [fixelcfestats_column_cargs(s, execution) for s in params.get("column", None)] for a in c])
830
+ if params.get("info", False):
831
+ cargs.append("-info")
832
+ if params.get("quiet", False):
833
+ cargs.append("-quiet")
834
+ if params.get("debug", False):
835
+ cargs.append("-debug")
836
+ if params.get("force", False):
837
+ cargs.append("-force")
838
+ if params.get("nthreads", None) is not None:
839
+ cargs.extend([
840
+ "-nthreads",
841
+ str(params.get("nthreads", None))
842
+ ])
843
+ if params.get("config", None) is not None:
844
+ cargs.extend([a for c in [fixelcfestats_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
845
+ if params.get("help", False):
846
+ cargs.append("-help")
847
+ if params.get("version", False):
848
+ cargs.append("-version")
849
+ cargs.append(execution.input_file(params.get("in_fixel_directory", None)))
850
+ cargs.append(execution.input_file(params.get("subjects", None)))
851
+ cargs.append(execution.input_file(params.get("design", None)))
852
+ cargs.append(execution.input_file(params.get("contrast", None)))
853
+ cargs.extend(fixelcfestats_connectivity_cargs_dyn_fn(params.get("connectivity", None)["@type"])(params.get("connectivity", None), execution))
854
+ cargs.append(params.get("out_fixel_directory", None))
855
+ return cargs
856
+
857
+
858
+ def fixelcfestats_outputs(
859
+ params: FixelcfestatsParamsDict,
860
+ execution: Execution,
861
+ ) -> FixelcfestatsOutputs:
862
+ """
863
+ Build outputs object containing output file paths and possibly stdout/stderr.
864
+
865
+ Args:
866
+ params: The parameters.
867
+ execution: The execution object for resolving input paths.
868
+ Returns:
869
+ Outputs object.
870
+ """
871
+ ret = FixelcfestatsOutputs(
872
+ root=execution.output_file("."),
873
+ )
874
+ return ret
875
+
876
+
877
+ def fixelcfestats_execute(
878
+ params: FixelcfestatsParamsDict,
879
+ runner: Runner | None = None,
880
+ ) -> FixelcfestatsOutputs:
881
+ """
882
+ fixelcfestats
883
+
884
+ Fixel-based analysis using connectivity-based fixel enhancement and
885
+ non-parametric permutation testing.
886
+
887
+ Unlike previous versions of this command, where a whole-brain tractogram
888
+ file would be provided as input in order to generate the fixel-fixel
889
+ connectivity matrix and smooth fixel data, this version expects to be
890
+ provided with the directory path to a pre-calculated fixel-fixel
891
+ connectivity matrix (likely generated using the MRtrix3 command
892
+ fixelconnectivity), and for the input fixel data to have already been
893
+ smoothed (likely using the MRtrix3 command fixelfilter).
894
+
895
+ Note that if the -mask option is used, the output fixel directory will still
896
+ contain the same set of fixels as that present in the input fixel template,
897
+ in order to retain fixel correspondence. However a consequence of this is
898
+ that all fixels in the template will be initialy visible when the output
899
+ fixel directory is loaded in mrview. Those fixels outside the processing
900
+ mask will immediately disappear from view as soon as any data-file-based
901
+ fixel colouring or thresholding is applied.
902
+
903
+ In some software packages, a column of ones is automatically added to the
904
+ GLM design matrix; the purpose of this column is to estimate the "global
905
+ intercept", which is the predicted value of the observed variable if all
906
+ explanatory variables were to be zero. However there are rare situations
907
+ where including such a column would not be appropriate for a particular
908
+ experimental design. Hence, in MRtrix3 statistical inference commands, it is
909
+ up to the user to determine whether or not this column of ones should be
910
+ included in their design matrix, and add it explicitly if necessary. The
911
+ contrast matrix must also reflect the presence of this additional column.
912
+
913
+ References:
914
+
915
+ Raffelt, D.; Smith, RE.; Ridgway, GR.; Tournier, JD.; Vaughan, DN.; Rose,
916
+ S.; Henderson, R.; Connelly, A. Connectivity-based fixel enhancement:
917
+ Whole-brain statistical analysis of diffusion MRI measures in the presence
918
+ of crossing fibres.Neuroimage, 2015, 15(117):40-55
919
+
920
+ * If not using the -cfe_legacy option:
921
+ Smith, RE.; Dimond, D; Vaughan, D.; Parker, D.; Dhollander, T.; Jackson, G.;
922
+ Connelly, A. Intrinsic non-stationarity correction for Fixel-Based Analysis.
923
+ In Proc OHBM 2019 M789
924
+
925
+ * If using the -nonstationary option:
926
+ Salimi-Khorshidi, G. Smith, S.M. Nichols, T.E. Adjusting the effect of
927
+ nonstationarity in cluster-based and TFCE inference. NeuroImage, 2011,
928
+ 54(3), 2006-19.
929
+
930
+ Author: MRTrix3 Developers
931
+
932
+ URL: https://www.mrtrix.org/
933
+
934
+ Args:
935
+ params: The parameters.
936
+ runner: Command runner.
937
+ Returns:
938
+ NamedTuple of outputs (described in `FixelcfestatsOutputs`).
939
+ """
940
+ fixelcfestats_validate(params)
941
+ runner = runner or get_global_runner()
942
+ execution = runner.start_execution(FIXELCFESTATS_METADATA)
943
+ params = execution.params(params)
944
+ cargs = fixelcfestats_cargs(params, execution)
945
+ ret = fixelcfestats_outputs(params, execution)
946
+ execution.run(cargs)
947
+ return ret
948
+
949
+
950
+ def fixelcfestats(
951
+ in_fixel_directory: InputPathType,
952
+ subjects: InputPathType,
953
+ design: InputPathType,
954
+ contrast: InputPathType,
955
+ connectivity: typing.Union[FixelcfestatsVariousStringParamsDictTagged, FixelcfestatsVariousFileParamsDictTagged],
956
+ out_fixel_directory: str,
957
+ mask: InputPathType | None = None,
958
+ notest: bool = False,
959
+ errors: str | None = None,
960
+ exchange_within: InputPathType | None = None,
961
+ exchange_whole: InputPathType | None = None,
962
+ strong: bool = False,
963
+ nshuffles: int | None = None,
964
+ permutations: InputPathType | None = None,
965
+ nonstationarity: bool = False,
966
+ skew_nonstationarity: float | None = None,
967
+ nshuffles_nonstationarity: int | None = None,
968
+ permutations_nonstationarity: InputPathType | None = None,
969
+ cfe_dh: float | None = None,
970
+ cfe_e: float | None = None,
971
+ cfe_h: float | None = None,
972
+ cfe_c: float | None = None,
973
+ cfe_legacy: bool = False,
974
+ variance: InputPathType | None = None,
975
+ ftests: InputPathType | None = None,
976
+ fonly: bool = False,
977
+ column: list[FixelcfestatsColumnParamsDict] | None = None,
978
+ info: bool = False,
979
+ quiet: bool = False,
980
+ debug: bool = False,
981
+ force: bool = False,
982
+ nthreads: int | None = None,
983
+ config: list[FixelcfestatsConfigParamsDict] | None = None,
984
+ help_: bool = False,
985
+ version: bool = False,
986
+ runner: Runner | None = None,
987
+ ) -> FixelcfestatsOutputs:
988
+ """
989
+ fixelcfestats
990
+
991
+ Fixel-based analysis using connectivity-based fixel enhancement and
992
+ non-parametric permutation testing.
993
+
994
+ Unlike previous versions of this command, where a whole-brain tractogram
995
+ file would be provided as input in order to generate the fixel-fixel
996
+ connectivity matrix and smooth fixel data, this version expects to be
997
+ provided with the directory path to a pre-calculated fixel-fixel
998
+ connectivity matrix (likely generated using the MRtrix3 command
999
+ fixelconnectivity), and for the input fixel data to have already been
1000
+ smoothed (likely using the MRtrix3 command fixelfilter).
1001
+
1002
+ Note that if the -mask option is used, the output fixel directory will still
1003
+ contain the same set of fixels as that present in the input fixel template,
1004
+ in order to retain fixel correspondence. However a consequence of this is
1005
+ that all fixels in the template will be initialy visible when the output
1006
+ fixel directory is loaded in mrview. Those fixels outside the processing
1007
+ mask will immediately disappear from view as soon as any data-file-based
1008
+ fixel colouring or thresholding is applied.
1009
+
1010
+ In some software packages, a column of ones is automatically added to the
1011
+ GLM design matrix; the purpose of this column is to estimate the "global
1012
+ intercept", which is the predicted value of the observed variable if all
1013
+ explanatory variables were to be zero. However there are rare situations
1014
+ where including such a column would not be appropriate for a particular
1015
+ experimental design. Hence, in MRtrix3 statistical inference commands, it is
1016
+ up to the user to determine whether or not this column of ones should be
1017
+ included in their design matrix, and add it explicitly if necessary. The
1018
+ contrast matrix must also reflect the presence of this additional column.
1019
+
1020
+ References:
1021
+
1022
+ Raffelt, D.; Smith, RE.; Ridgway, GR.; Tournier, JD.; Vaughan, DN.; Rose,
1023
+ S.; Henderson, R.; Connelly, A. Connectivity-based fixel enhancement:
1024
+ Whole-brain statistical analysis of diffusion MRI measures in the presence
1025
+ of crossing fibres.Neuroimage, 2015, 15(117):40-55
1026
+
1027
+ * If not using the -cfe_legacy option:
1028
+ Smith, RE.; Dimond, D; Vaughan, D.; Parker, D.; Dhollander, T.; Jackson, G.;
1029
+ Connelly, A. Intrinsic non-stationarity correction for Fixel-Based Analysis.
1030
+ In Proc OHBM 2019 M789
1031
+
1032
+ * If using the -nonstationary option:
1033
+ Salimi-Khorshidi, G. Smith, S.M. Nichols, T.E. Adjusting the effect of
1034
+ nonstationarity in cluster-based and TFCE inference. NeuroImage, 2011,
1035
+ 54(3), 2006-19.
1036
+
1037
+ Author: MRTrix3 Developers
1038
+
1039
+ URL: https://www.mrtrix.org/
1040
+
1041
+ Args:
1042
+ in_fixel_directory: the fixel directory containing the data files for\
1043
+ each subject (after obtaining fixel correspondence.
1044
+ subjects: a text file listing the subject identifiers (one per line).\
1045
+ This should correspond with the filenames in the fixel directory\
1046
+ (including the file extension), and be listed in the same order as the\
1047
+ rows of the design matrix.
1048
+ design: the design matrix.
1049
+ contrast: the contrast matrix, specified as rows of weights.
1050
+ connectivity: the fixel-fixel connectivity matrix.
1051
+ out_fixel_directory: the output directory where results will be saved.\
1052
+ Will be created if it does not exist.
1053
+ mask: provide a fixel data file containing a mask of those fixels to be\
1054
+ used during processing.
1055
+ notest: don't perform statistical inference; only output population\
1056
+ statistics (effect size, stdev etc).
1057
+ errors: specify nature of errors for shuffling; options are:\
1058
+ ee,ise,both (default: ee).
1059
+ exchange_within: specify blocks of observations within each of which\
1060
+ data may undergo restricted exchange.
1061
+ exchange_whole: specify blocks of observations that may be exchanged\
1062
+ with one another (for independent and symmetric errors, sign-flipping\
1063
+ will occur block-wise).
1064
+ strong: use strong familywise error control across multiple hypotheses.
1065
+ nshuffles: the number of shuffles (default: 5000).
1066
+ permutations: manually define the permutations (relabelling). The input\
1067
+ should be a text file defining a m x n matrix, where each relabelling\
1068
+ is defined as a column vector of size m, and the number of columns, n,\
1069
+ defines the number of permutations. Can be generated with the\
1070
+ palm_quickperms function in PALM\
1071
+ (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM). Overrides the -nshuffles\
1072
+ option.
1073
+ nonstationarity: perform non-stationarity correction.
1074
+ skew_nonstationarity: specify the skew parameter for empirical\
1075
+ statistic calculation (default for this command is 1).
1076
+ nshuffles_nonstationarity: the number of shuffles to use when\
1077
+ precomputing the empirical statistic image for non-stationarity\
1078
+ correction (default: 5000).
1079
+ permutations_nonstationarity: manually define the permutations\
1080
+ (relabelling) for computing the emprical statistics for\
1081
+ non-stationarity correction. The input should be a text file defining a\
1082
+ m x n matrix, where each relabelling is defined as a column vector of\
1083
+ size m, and the number of columns, n, defines the number of\
1084
+ permutations. Can be generated with the palm_quickperms function in\
1085
+ PALM (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM) Overrides the\
1086
+ -nshuffles_nonstationarity option.
1087
+ cfe_dh: the height increment used in the cfe integration (default: 0.1).
1088
+ cfe_e: cfe extent exponent (default: 2).
1089
+ cfe_h: cfe height exponent (default: 3).
1090
+ cfe_c: cfe connectivity exponent (default: 0.5).
1091
+ cfe_legacy: use the legacy (non-normalised) form of the cfe equation.
1092
+ variance: define variance groups for the G-statistic; measurements for\
1093
+ which the expected variance is equivalent should contain the same index.
1094
+ ftests: perform F-tests; input text file should contain, for each\
1095
+ F-test, a row containing ones and zeros, where ones indicate the rows\
1096
+ of the contrast matrix to be included in the F-test.
1097
+ fonly: only assess F-tests; do not perform statistical inference on\
1098
+ entries in the contrast matrix.
1099
+ column: add a column to the design matrix corresponding to subject\
1100
+ fixel-wise values (note that the contrast matrix must include an\
1101
+ additional column for each use of this option); the text file provided\
1102
+ via this option should contain a file name for each subject.
1103
+ info: display information messages.
1104
+ quiet: do not display information messages or progress status;\
1105
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
1106
+ environment variable to a non-empty string.
1107
+ debug: display debugging messages.
1108
+ force: force overwrite of output files (caution: using the same file as\
1109
+ input and output might cause unexpected behaviour).
1110
+ nthreads: use this number of threads in multi-threaded applications\
1111
+ (set to 0 to disable multi-threading).
1112
+ config: temporarily set the value of an MRtrix config file entry.
1113
+ help_: display this information page and exit.
1114
+ version: display version information and exit.
1115
+ runner: Command runner.
1116
+ Returns:
1117
+ NamedTuple of outputs (described in `FixelcfestatsOutputs`).
1118
+ """
1119
+ params = fixelcfestats_params(
1120
+ mask=mask,
1121
+ notest=notest,
1122
+ errors=errors,
1123
+ exchange_within=exchange_within,
1124
+ exchange_whole=exchange_whole,
1125
+ strong=strong,
1126
+ nshuffles=nshuffles,
1127
+ permutations=permutations,
1128
+ nonstationarity=nonstationarity,
1129
+ skew_nonstationarity=skew_nonstationarity,
1130
+ nshuffles_nonstationarity=nshuffles_nonstationarity,
1131
+ permutations_nonstationarity=permutations_nonstationarity,
1132
+ cfe_dh=cfe_dh,
1133
+ cfe_e=cfe_e,
1134
+ cfe_h=cfe_h,
1135
+ cfe_c=cfe_c,
1136
+ cfe_legacy=cfe_legacy,
1137
+ variance=variance,
1138
+ ftests=ftests,
1139
+ fonly=fonly,
1140
+ column=column,
1141
+ info=info,
1142
+ quiet=quiet,
1143
+ debug=debug,
1144
+ force=force,
1145
+ nthreads=nthreads,
1146
+ config=config,
1147
+ help_=help_,
1148
+ version=version,
1149
+ in_fixel_directory=in_fixel_directory,
1150
+ subjects=subjects,
1151
+ design=design,
1152
+ contrast=contrast,
1153
+ connectivity=connectivity,
1154
+ out_fixel_directory=out_fixel_directory,
1155
+ )
1156
+ return fixelcfestats_execute(params, runner)
1157
+
1158
+
1159
+ __all__ = [
1160
+ "FIXELCFESTATS_METADATA",
1161
+ "FixelcfestatsColumnParamsDict",
1162
+ "FixelcfestatsColumnParamsDictTagged",
1163
+ "FixelcfestatsConfigParamsDict",
1164
+ "FixelcfestatsConfigParamsDictTagged",
1165
+ "FixelcfestatsOutputs",
1166
+ "FixelcfestatsParamsDict",
1167
+ "FixelcfestatsParamsDictTagged",
1168
+ "FixelcfestatsVariousFileParamsDict",
1169
+ "FixelcfestatsVariousFileParamsDictTagged",
1170
+ "FixelcfestatsVariousStringParamsDict",
1171
+ "FixelcfestatsVariousStringParamsDictTagged",
1172
+ "fixelcfestats",
1173
+ "fixelcfestats_column",
1174
+ "fixelcfestats_config",
1175
+ "fixelcfestats_execute",
1176
+ "fixelcfestats_params",
1177
+ "fixelcfestats_various_file",
1178
+ "fixelcfestats_various_string",
1179
+ ]