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,525 @@
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
+ MRMETRIC_METADATA = Metadata(
9
+ id="900f502c877db64aba337cc23f205ccc871706a3.boutiques",
10
+ name="mrmetric",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _MrmetricConfigParamsDictNoTag = typing.TypedDict('_MrmetricConfigParamsDictNoTag', {
17
+ "key": str,
18
+ "value": str,
19
+ })
20
+ MrmetricConfigParamsDictTagged = typing.TypedDict('MrmetricConfigParamsDictTagged', {
21
+ "@type": typing.Literal["config"],
22
+ "key": str,
23
+ "value": str,
24
+ })
25
+ MrmetricConfigParamsDict = _MrmetricConfigParamsDictNoTag | MrmetricConfigParamsDictTagged
26
+
27
+
28
+ _MrmetricParamsDictNoTag = typing.TypedDict('_MrmetricParamsDictNoTag', {
29
+ "space": typing.NotRequired[str | None],
30
+ "interp": typing.NotRequired[str | None],
31
+ "metric": typing.NotRequired[str | None],
32
+ "mask1": typing.NotRequired[InputPathType | None],
33
+ "mask2": typing.NotRequired[InputPathType | None],
34
+ "nonormalisation": bool,
35
+ "overlap": bool,
36
+ "info": bool,
37
+ "quiet": bool,
38
+ "debug": bool,
39
+ "force": bool,
40
+ "nthreads": typing.NotRequired[int | None],
41
+ "config": typing.NotRequired[list[MrmetricConfigParamsDict] | None],
42
+ "help": bool,
43
+ "version": bool,
44
+ "image1": InputPathType,
45
+ "image2": InputPathType,
46
+ })
47
+ MrmetricParamsDictTagged = typing.TypedDict('MrmetricParamsDictTagged', {
48
+ "@type": typing.Literal["mrtrix/mrmetric"],
49
+ "space": typing.NotRequired[str | None],
50
+ "interp": typing.NotRequired[str | None],
51
+ "metric": typing.NotRequired[str | None],
52
+ "mask1": typing.NotRequired[InputPathType | None],
53
+ "mask2": typing.NotRequired[InputPathType | None],
54
+ "nonormalisation": bool,
55
+ "overlap": bool,
56
+ "info": bool,
57
+ "quiet": bool,
58
+ "debug": bool,
59
+ "force": bool,
60
+ "nthreads": typing.NotRequired[int | None],
61
+ "config": typing.NotRequired[list[MrmetricConfigParamsDict] | None],
62
+ "help": bool,
63
+ "version": bool,
64
+ "image1": InputPathType,
65
+ "image2": InputPathType,
66
+ })
67
+ MrmetricParamsDict = _MrmetricParamsDictNoTag | MrmetricParamsDictTagged
68
+
69
+
70
+ def mrmetric_config(
71
+ key: str,
72
+ value: str,
73
+ ) -> MrmetricConfigParamsDictTagged:
74
+ """
75
+ Build parameters.
76
+
77
+ Args:
78
+ key: temporarily set the value of an MRtrix config file entry.
79
+ value: temporarily set the value of an MRtrix config file entry.
80
+ Returns:
81
+ Parameter dictionary
82
+ """
83
+ params = {
84
+ "@type": "config",
85
+ "key": key,
86
+ "value": value,
87
+ }
88
+ return params
89
+
90
+
91
+ def mrmetric_config_validate(
92
+ params: typing.Any,
93
+ ) -> None:
94
+ """
95
+ Validate parameters. Throws an error if `params` is not a valid
96
+ `MrmetricConfigParamsDict` object.
97
+
98
+ Args:
99
+ params: The parameters object to validate.
100
+ """
101
+ if params is None or not isinstance(params, dict):
102
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
103
+ if params.get("key", None) is None:
104
+ raise StyxValidationError("`key` must not be None")
105
+ if not isinstance(params["key"], str):
106
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
107
+ if params.get("value", None) is None:
108
+ raise StyxValidationError("`value` must not be None")
109
+ if not isinstance(params["value"], str):
110
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
111
+
112
+
113
+ def mrmetric_config_cargs(
114
+ params: MrmetricConfigParamsDict,
115
+ execution: Execution,
116
+ ) -> list[str]:
117
+ """
118
+ Build command-line arguments from parameters.
119
+
120
+ Args:
121
+ params: The parameters.
122
+ execution: The execution object for resolving input paths.
123
+ Returns:
124
+ Command-line arguments.
125
+ """
126
+ cargs = []
127
+ cargs.append("-config")
128
+ cargs.append(params.get("key", None))
129
+ cargs.append(params.get("value", None))
130
+ return cargs
131
+
132
+
133
+ class MrmetricOutputs(typing.NamedTuple):
134
+ """
135
+ Output object returned when calling `MrmetricParamsDict(...)`.
136
+ """
137
+ root: OutputPathType
138
+ """Output root folder. This is the root folder for all outputs."""
139
+
140
+
141
+ def mrmetric_params(
142
+ image1: InputPathType,
143
+ image2: InputPathType,
144
+ space: str | None = None,
145
+ interp: str | None = None,
146
+ metric: str | None = None,
147
+ mask1: InputPathType | None = None,
148
+ mask2: InputPathType | None = None,
149
+ nonormalisation: bool = False,
150
+ overlap: bool = False,
151
+ info: bool = False,
152
+ quiet: bool = False,
153
+ debug: bool = False,
154
+ force: bool = False,
155
+ nthreads: int | None = None,
156
+ config: list[MrmetricConfigParamsDict] | None = None,
157
+ help_: bool = False,
158
+ version: bool = False,
159
+ ) -> MrmetricParamsDictTagged:
160
+ """
161
+ Build parameters.
162
+
163
+ Args:
164
+ image1: the first input image.
165
+ image2: the second input image.
166
+ space: voxel (default): per voxel image1: scanner space of image 1\
167
+ image2: scanner space of image 2 average: scanner space of the average\
168
+ affine transformation of image 1 and 2.
169
+ interp: set the interpolation method to use when reslicing (choices:\
170
+ nearest, linear, cubic, sinc. Default: linear).
171
+ metric: define the dissimilarity metric used to calculate the cost.\
172
+ Choices: diff (squared differences), cc (non-normalised negative cross\
173
+ correlation aka negative cross covariance). Default: diff). cc is only\
174
+ implemented for -space average and -interp linear and cubic.
175
+ mask1: mask for image 1.
176
+ mask2: mask for image 2.
177
+ nonormalisation: do not normalise the dissimilarity metric to the\
178
+ number of voxels.
179
+ overlap: output number of voxels that were used.
180
+ info: display information messages.
181
+ quiet: do not display information messages or progress status;\
182
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
183
+ environment variable to a non-empty string.
184
+ debug: display debugging messages.
185
+ force: force overwrite of output files (caution: using the same file as\
186
+ input and output might cause unexpected behaviour).
187
+ nthreads: use this number of threads in multi-threaded applications\
188
+ (set to 0 to disable multi-threading).
189
+ config: temporarily set the value of an MRtrix config file entry.
190
+ help_: display this information page and exit.
191
+ version: display version information and exit.
192
+ Returns:
193
+ Parameter dictionary
194
+ """
195
+ params = {
196
+ "@type": "mrtrix/mrmetric",
197
+ "nonormalisation": nonormalisation,
198
+ "overlap": overlap,
199
+ "info": info,
200
+ "quiet": quiet,
201
+ "debug": debug,
202
+ "force": force,
203
+ "help": help_,
204
+ "version": version,
205
+ "image1": image1,
206
+ "image2": image2,
207
+ }
208
+ if space is not None:
209
+ params["space"] = space
210
+ if interp is not None:
211
+ params["interp"] = interp
212
+ if metric is not None:
213
+ params["metric"] = metric
214
+ if mask1 is not None:
215
+ params["mask1"] = mask1
216
+ if mask2 is not None:
217
+ params["mask2"] = mask2
218
+ if nthreads is not None:
219
+ params["nthreads"] = nthreads
220
+ if config is not None:
221
+ params["config"] = config
222
+ return params
223
+
224
+
225
+ def mrmetric_validate(
226
+ params: typing.Any,
227
+ ) -> None:
228
+ """
229
+ Validate parameters. Throws an error if `params` is not a valid
230
+ `MrmetricParamsDict` object.
231
+
232
+ Args:
233
+ params: The parameters object to validate.
234
+ """
235
+ if params is None or not isinstance(params, dict):
236
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
237
+ if params.get("space", None) is not None:
238
+ if not isinstance(params["space"], str):
239
+ raise StyxValidationError(f'`space` has the wrong type: Received `{type(params.get("space", None))}` expected `str | None`')
240
+ if params.get("interp", None) is not None:
241
+ if not isinstance(params["interp"], str):
242
+ raise StyxValidationError(f'`interp` has the wrong type: Received `{type(params.get("interp", None))}` expected `str | None`')
243
+ if params.get("metric", None) is not None:
244
+ if not isinstance(params["metric"], str):
245
+ raise StyxValidationError(f'`metric` has the wrong type: Received `{type(params.get("metric", None))}` expected `str | None`')
246
+ if params.get("mask1", None) is not None:
247
+ if not isinstance(params["mask1"], (pathlib.Path, str)):
248
+ raise StyxValidationError(f'`mask1` has the wrong type: Received `{type(params.get("mask1", None))}` expected `InputPathType | None`')
249
+ if params.get("mask2", None) is not None:
250
+ if not isinstance(params["mask2"], (pathlib.Path, str)):
251
+ raise StyxValidationError(f'`mask2` has the wrong type: Received `{type(params.get("mask2", None))}` expected `InputPathType | None`')
252
+ if params.get("nonormalisation", False) is None:
253
+ raise StyxValidationError("`nonormalisation` must not be None")
254
+ if not isinstance(params["nonormalisation"], bool):
255
+ raise StyxValidationError(f'`nonormalisation` has the wrong type: Received `{type(params.get("nonormalisation", False))}` expected `bool`')
256
+ if params.get("overlap", False) is None:
257
+ raise StyxValidationError("`overlap` must not be None")
258
+ if not isinstance(params["overlap"], bool):
259
+ raise StyxValidationError(f'`overlap` has the wrong type: Received `{type(params.get("overlap", False))}` expected `bool`')
260
+ if params.get("info", False) is None:
261
+ raise StyxValidationError("`info` must not be None")
262
+ if not isinstance(params["info"], bool):
263
+ raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
264
+ if params.get("quiet", False) is None:
265
+ raise StyxValidationError("`quiet` must not be None")
266
+ if not isinstance(params["quiet"], bool):
267
+ raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
268
+ if params.get("debug", False) is None:
269
+ raise StyxValidationError("`debug` must not be None")
270
+ if not isinstance(params["debug"], bool):
271
+ raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
272
+ if params.get("force", False) is None:
273
+ raise StyxValidationError("`force` must not be None")
274
+ if not isinstance(params["force"], bool):
275
+ raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
276
+ if params.get("nthreads", None) is not None:
277
+ if not isinstance(params["nthreads"], int):
278
+ raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
279
+ if params.get("config", None) is not None:
280
+ if not isinstance(params["config"], list):
281
+ raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[MrmetricConfigParamsDict] | None`')
282
+ for e in params["config"]:
283
+ mrmetric_config_validate(e)
284
+ if params.get("help", False) is None:
285
+ raise StyxValidationError("`help` must not be None")
286
+ if not isinstance(params["help"], bool):
287
+ raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
288
+ if params.get("version", False) is None:
289
+ raise StyxValidationError("`version` must not be None")
290
+ if not isinstance(params["version"], bool):
291
+ raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
292
+ if params.get("image1", None) is None:
293
+ raise StyxValidationError("`image1` must not be None")
294
+ if not isinstance(params["image1"], (pathlib.Path, str)):
295
+ raise StyxValidationError(f'`image1` has the wrong type: Received `{type(params.get("image1", None))}` expected `InputPathType`')
296
+ if params.get("image2", None) is None:
297
+ raise StyxValidationError("`image2` must not be None")
298
+ if not isinstance(params["image2"], (pathlib.Path, str)):
299
+ raise StyxValidationError(f'`image2` has the wrong type: Received `{type(params.get("image2", None))}` expected `InputPathType`')
300
+
301
+
302
+ def mrmetric_cargs(
303
+ params: MrmetricParamsDict,
304
+ execution: Execution,
305
+ ) -> list[str]:
306
+ """
307
+ Build command-line arguments from parameters.
308
+
309
+ Args:
310
+ params: The parameters.
311
+ execution: The execution object for resolving input paths.
312
+ Returns:
313
+ Command-line arguments.
314
+ """
315
+ cargs = []
316
+ cargs.append("mrmetric")
317
+ if params.get("space", None) is not None:
318
+ cargs.extend([
319
+ "-space",
320
+ params.get("space", None)
321
+ ])
322
+ if params.get("interp", None) is not None:
323
+ cargs.extend([
324
+ "-interp",
325
+ params.get("interp", None)
326
+ ])
327
+ if params.get("metric", None) is not None:
328
+ cargs.extend([
329
+ "-metric",
330
+ params.get("metric", None)
331
+ ])
332
+ if params.get("mask1", None) is not None:
333
+ cargs.extend([
334
+ "-mask1",
335
+ execution.input_file(params.get("mask1", None))
336
+ ])
337
+ if params.get("mask2", None) is not None:
338
+ cargs.extend([
339
+ "-mask2",
340
+ execution.input_file(params.get("mask2", None))
341
+ ])
342
+ if params.get("nonormalisation", False):
343
+ cargs.append("-nonormalisation")
344
+ if params.get("overlap", False):
345
+ cargs.append("-overlap")
346
+ if params.get("info", False):
347
+ cargs.append("-info")
348
+ if params.get("quiet", False):
349
+ cargs.append("-quiet")
350
+ if params.get("debug", False):
351
+ cargs.append("-debug")
352
+ if params.get("force", False):
353
+ cargs.append("-force")
354
+ if params.get("nthreads", None) is not None:
355
+ cargs.extend([
356
+ "-nthreads",
357
+ str(params.get("nthreads", None))
358
+ ])
359
+ if params.get("config", None) is not None:
360
+ cargs.extend([a for c in [mrmetric_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
361
+ if params.get("help", False):
362
+ cargs.append("-help")
363
+ if params.get("version", False):
364
+ cargs.append("-version")
365
+ cargs.append(execution.input_file(params.get("image1", None)))
366
+ cargs.append(execution.input_file(params.get("image2", None)))
367
+ return cargs
368
+
369
+
370
+ def mrmetric_outputs(
371
+ params: MrmetricParamsDict,
372
+ execution: Execution,
373
+ ) -> MrmetricOutputs:
374
+ """
375
+ Build outputs object containing output file paths and possibly stdout/stderr.
376
+
377
+ Args:
378
+ params: The parameters.
379
+ execution: The execution object for resolving input paths.
380
+ Returns:
381
+ Outputs object.
382
+ """
383
+ ret = MrmetricOutputs(
384
+ root=execution.output_file("."),
385
+ )
386
+ return ret
387
+
388
+
389
+ def mrmetric_execute(
390
+ params: MrmetricParamsDict,
391
+ runner: Runner | None = None,
392
+ ) -> MrmetricOutputs:
393
+ """
394
+ mrmetric
395
+
396
+ Computes a dissimilarity metric between two images.
397
+
398
+ Currently only the mean squared difference is fully implemented.
399
+
400
+ References:
401
+
402
+ .
403
+
404
+ Author: MRTrix3 Developers
405
+
406
+ URL: https://www.mrtrix.org/
407
+
408
+ Args:
409
+ params: The parameters.
410
+ runner: Command runner.
411
+ Returns:
412
+ NamedTuple of outputs (described in `MrmetricOutputs`).
413
+ """
414
+ mrmetric_validate(params)
415
+ runner = runner or get_global_runner()
416
+ execution = runner.start_execution(MRMETRIC_METADATA)
417
+ params = execution.params(params)
418
+ cargs = mrmetric_cargs(params, execution)
419
+ ret = mrmetric_outputs(params, execution)
420
+ execution.run(cargs)
421
+ return ret
422
+
423
+
424
+ def mrmetric(
425
+ image1: InputPathType,
426
+ image2: InputPathType,
427
+ space: str | None = None,
428
+ interp: str | None = None,
429
+ metric: str | None = None,
430
+ mask1: InputPathType | None = None,
431
+ mask2: InputPathType | None = None,
432
+ nonormalisation: bool = False,
433
+ overlap: bool = False,
434
+ info: bool = False,
435
+ quiet: bool = False,
436
+ debug: bool = False,
437
+ force: bool = False,
438
+ nthreads: int | None = None,
439
+ config: list[MrmetricConfigParamsDict] | None = None,
440
+ help_: bool = False,
441
+ version: bool = False,
442
+ runner: Runner | None = None,
443
+ ) -> MrmetricOutputs:
444
+ """
445
+ mrmetric
446
+
447
+ Computes a dissimilarity metric between two images.
448
+
449
+ Currently only the mean squared difference is fully implemented.
450
+
451
+ References:
452
+
453
+ .
454
+
455
+ Author: MRTrix3 Developers
456
+
457
+ URL: https://www.mrtrix.org/
458
+
459
+ Args:
460
+ image1: the first input image.
461
+ image2: the second input image.
462
+ space: voxel (default): per voxel image1: scanner space of image 1\
463
+ image2: scanner space of image 2 average: scanner space of the average\
464
+ affine transformation of image 1 and 2.
465
+ interp: set the interpolation method to use when reslicing (choices:\
466
+ nearest, linear, cubic, sinc. Default: linear).
467
+ metric: define the dissimilarity metric used to calculate the cost.\
468
+ Choices: diff (squared differences), cc (non-normalised negative cross\
469
+ correlation aka negative cross covariance). Default: diff). cc is only\
470
+ implemented for -space average and -interp linear and cubic.
471
+ mask1: mask for image 1.
472
+ mask2: mask for image 2.
473
+ nonormalisation: do not normalise the dissimilarity metric to the\
474
+ number of voxels.
475
+ overlap: output number of voxels that were used.
476
+ info: display information messages.
477
+ quiet: do not display information messages or progress status;\
478
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
479
+ environment variable to a non-empty string.
480
+ debug: display debugging messages.
481
+ force: force overwrite of output files (caution: using the same file as\
482
+ input and output might cause unexpected behaviour).
483
+ nthreads: use this number of threads in multi-threaded applications\
484
+ (set to 0 to disable multi-threading).
485
+ config: temporarily set the value of an MRtrix config file entry.
486
+ help_: display this information page and exit.
487
+ version: display version information and exit.
488
+ runner: Command runner.
489
+ Returns:
490
+ NamedTuple of outputs (described in `MrmetricOutputs`).
491
+ """
492
+ params = mrmetric_params(
493
+ space=space,
494
+ interp=interp,
495
+ metric=metric,
496
+ mask1=mask1,
497
+ mask2=mask2,
498
+ nonormalisation=nonormalisation,
499
+ overlap=overlap,
500
+ info=info,
501
+ quiet=quiet,
502
+ debug=debug,
503
+ force=force,
504
+ nthreads=nthreads,
505
+ config=config,
506
+ help_=help_,
507
+ version=version,
508
+ image1=image1,
509
+ image2=image2,
510
+ )
511
+ return mrmetric_execute(params, runner)
512
+
513
+
514
+ __all__ = [
515
+ "MRMETRIC_METADATA",
516
+ "MrmetricConfigParamsDict",
517
+ "MrmetricConfigParamsDictTagged",
518
+ "MrmetricOutputs",
519
+ "MrmetricParamsDict",
520
+ "MrmetricParamsDictTagged",
521
+ "mrmetric",
522
+ "mrmetric_config",
523
+ "mrmetric_execute",
524
+ "mrmetric_params",
525
+ ]