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,552 @@
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
+ DCMEDIT_METADATA = Metadata(
9
+ id="8755d3035d88c63d3618eea7e9e40463fa8a47ee.boutiques",
10
+ name="dcmedit",
11
+ package="mrtrix",
12
+ container_image_tag="mrtrix3/mrtrix3:3.0.4",
13
+ )
14
+
15
+
16
+ _DcmeditTagParamsDictNoTag = typing.TypedDict('_DcmeditTagParamsDictNoTag', {
17
+ "group": str,
18
+ "element": str,
19
+ "newvalue": str,
20
+ })
21
+ DcmeditTagParamsDictTagged = typing.TypedDict('DcmeditTagParamsDictTagged', {
22
+ "@type": typing.Literal["tag"],
23
+ "group": str,
24
+ "element": str,
25
+ "newvalue": str,
26
+ })
27
+ DcmeditTagParamsDict = _DcmeditTagParamsDictNoTag | DcmeditTagParamsDictTagged
28
+
29
+
30
+ _DcmeditConfigParamsDictNoTag = typing.TypedDict('_DcmeditConfigParamsDictNoTag', {
31
+ "key": str,
32
+ "value": str,
33
+ })
34
+ DcmeditConfigParamsDictTagged = typing.TypedDict('DcmeditConfigParamsDictTagged', {
35
+ "@type": typing.Literal["config"],
36
+ "key": str,
37
+ "value": str,
38
+ })
39
+ DcmeditConfigParamsDict = _DcmeditConfigParamsDictNoTag | DcmeditConfigParamsDictTagged
40
+
41
+
42
+ _DcmeditParamsDictNoTag = typing.TypedDict('_DcmeditParamsDictNoTag', {
43
+ "anonymise": bool,
44
+ "id": typing.NotRequired[str | None],
45
+ "tag": typing.NotRequired[list[DcmeditTagParamsDict] | None],
46
+ "info": bool,
47
+ "quiet": bool,
48
+ "debug": bool,
49
+ "force": bool,
50
+ "nthreads": typing.NotRequired[int | None],
51
+ "config": typing.NotRequired[list[DcmeditConfigParamsDict] | None],
52
+ "help": bool,
53
+ "version": bool,
54
+ "file": InputPathType,
55
+ })
56
+ DcmeditParamsDictTagged = typing.TypedDict('DcmeditParamsDictTagged', {
57
+ "@type": typing.Literal["mrtrix/dcmedit"],
58
+ "anonymise": bool,
59
+ "id": typing.NotRequired[str | None],
60
+ "tag": typing.NotRequired[list[DcmeditTagParamsDict] | None],
61
+ "info": bool,
62
+ "quiet": bool,
63
+ "debug": bool,
64
+ "force": bool,
65
+ "nthreads": typing.NotRequired[int | None],
66
+ "config": typing.NotRequired[list[DcmeditConfigParamsDict] | None],
67
+ "help": bool,
68
+ "version": bool,
69
+ "file": InputPathType,
70
+ })
71
+ DcmeditParamsDict = _DcmeditParamsDictNoTag | DcmeditParamsDictTagged
72
+
73
+
74
+ def dcmedit_tag(
75
+ group: str,
76
+ element: str,
77
+ newvalue: str,
78
+ ) -> DcmeditTagParamsDictTagged:
79
+ """
80
+ Build parameters.
81
+
82
+ Args:
83
+ group: replace specific tag.
84
+ element: replace specific tag.
85
+ newvalue: replace specific tag.
86
+ Returns:
87
+ Parameter dictionary
88
+ """
89
+ params = {
90
+ "@type": "tag",
91
+ "group": group,
92
+ "element": element,
93
+ "newvalue": newvalue,
94
+ }
95
+ return params
96
+
97
+
98
+ def dcmedit_tag_validate(
99
+ params: typing.Any,
100
+ ) -> None:
101
+ """
102
+ Validate parameters. Throws an error if `params` is not a valid
103
+ `DcmeditTagParamsDict` object.
104
+
105
+ Args:
106
+ params: The parameters object to validate.
107
+ """
108
+ if params is None or not isinstance(params, dict):
109
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
110
+ if params.get("group", None) is None:
111
+ raise StyxValidationError("`group` must not be None")
112
+ if not isinstance(params["group"], str):
113
+ raise StyxValidationError(f'`group` has the wrong type: Received `{type(params.get("group", None))}` expected `str`')
114
+ if params.get("element", None) is None:
115
+ raise StyxValidationError("`element` must not be None")
116
+ if not isinstance(params["element"], str):
117
+ raise StyxValidationError(f'`element` has the wrong type: Received `{type(params.get("element", None))}` expected `str`')
118
+ if params.get("newvalue", None) is None:
119
+ raise StyxValidationError("`newvalue` must not be None")
120
+ if not isinstance(params["newvalue"], str):
121
+ raise StyxValidationError(f'`newvalue` has the wrong type: Received `{type(params.get("newvalue", None))}` expected `str`')
122
+
123
+
124
+ def dcmedit_tag_cargs(
125
+ params: DcmeditTagParamsDict,
126
+ execution: Execution,
127
+ ) -> list[str]:
128
+ """
129
+ Build command-line arguments from parameters.
130
+
131
+ Args:
132
+ params: The parameters.
133
+ execution: The execution object for resolving input paths.
134
+ Returns:
135
+ Command-line arguments.
136
+ """
137
+ cargs = []
138
+ cargs.append("-tag")
139
+ cargs.append(params.get("group", None))
140
+ cargs.append(params.get("element", None))
141
+ cargs.append(params.get("newvalue", None))
142
+ return cargs
143
+
144
+
145
+ def dcmedit_config(
146
+ key: str,
147
+ value: str,
148
+ ) -> DcmeditConfigParamsDictTagged:
149
+ """
150
+ Build parameters.
151
+
152
+ Args:
153
+ key: temporarily set the value of an MRtrix config file entry.
154
+ value: temporarily set the value of an MRtrix config file entry.
155
+ Returns:
156
+ Parameter dictionary
157
+ """
158
+ params = {
159
+ "@type": "config",
160
+ "key": key,
161
+ "value": value,
162
+ }
163
+ return params
164
+
165
+
166
+ def dcmedit_config_validate(
167
+ params: typing.Any,
168
+ ) -> None:
169
+ """
170
+ Validate parameters. Throws an error if `params` is not a valid
171
+ `DcmeditConfigParamsDict` object.
172
+
173
+ Args:
174
+ params: The parameters object to validate.
175
+ """
176
+ if params is None or not isinstance(params, dict):
177
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
178
+ if params.get("key", None) is None:
179
+ raise StyxValidationError("`key` must not be None")
180
+ if not isinstance(params["key"], str):
181
+ raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
182
+ if params.get("value", None) is None:
183
+ raise StyxValidationError("`value` must not be None")
184
+ if not isinstance(params["value"], str):
185
+ raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')
186
+
187
+
188
+ def dcmedit_config_cargs(
189
+ params: DcmeditConfigParamsDict,
190
+ execution: Execution,
191
+ ) -> list[str]:
192
+ """
193
+ Build command-line arguments from parameters.
194
+
195
+ Args:
196
+ params: The parameters.
197
+ execution: The execution object for resolving input paths.
198
+ Returns:
199
+ Command-line arguments.
200
+ """
201
+ cargs = []
202
+ cargs.append("-config")
203
+ cargs.append(params.get("key", None))
204
+ cargs.append(params.get("value", None))
205
+ return cargs
206
+
207
+
208
+ class DcmeditOutputs(typing.NamedTuple):
209
+ """
210
+ Output object returned when calling `DcmeditParamsDict(...)`.
211
+ """
212
+ root: OutputPathType
213
+ """Output root folder. This is the root folder for all outputs."""
214
+
215
+
216
+ def dcmedit_params(
217
+ file: InputPathType,
218
+ anonymise: bool = False,
219
+ id_: str | None = None,
220
+ tag: list[DcmeditTagParamsDict] | None = None,
221
+ info: bool = False,
222
+ quiet: bool = False,
223
+ debug: bool = False,
224
+ force: bool = False,
225
+ nthreads: int | None = None,
226
+ config: list[DcmeditConfigParamsDict] | None = None,
227
+ help_: bool = False,
228
+ version: bool = False,
229
+ ) -> DcmeditParamsDictTagged:
230
+ """
231
+ Build parameters.
232
+
233
+ Args:
234
+ file: the DICOM file to be edited.
235
+ anonymise: remove any identifiable information, by replacing the\
236
+ following tags:\
237
+ - any tag with Value Representation PN will be replaced with\
238
+ 'anonymous'\
239
+ - tag (0010,0030) PatientBirthDate will be replaced with an empty\
240
+ string\
241
+ WARNING: there is no guarantee that this command will remove all\
242
+ identiable information, since such information may be contained in\
243
+ any number of private vendor-specific tags. You will need to\
244
+ double-check the results independently if you need to ensure\
245
+ anonymity.
246
+ id_: replace all ID tags with string supplied. This consists of tags\
247
+ (0010, 0020) PatientID and (0010, 1000) OtherPatientIDs.
248
+ tag: replace specific tag.
249
+ info: display information messages.
250
+ quiet: do not display information messages or progress status;\
251
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
252
+ environment variable to a non-empty string.
253
+ debug: display debugging messages.
254
+ force: force overwrite of output files (caution: using the same file as\
255
+ input and output might cause unexpected behaviour).
256
+ nthreads: use this number of threads in multi-threaded applications\
257
+ (set to 0 to disable multi-threading).
258
+ config: temporarily set the value of an MRtrix config file entry.
259
+ help_: display this information page and exit.
260
+ version: display version information and exit.
261
+ Returns:
262
+ Parameter dictionary
263
+ """
264
+ params = {
265
+ "@type": "mrtrix/dcmedit",
266
+ "anonymise": anonymise,
267
+ "info": info,
268
+ "quiet": quiet,
269
+ "debug": debug,
270
+ "force": force,
271
+ "help": help_,
272
+ "version": version,
273
+ "file": file,
274
+ }
275
+ if id_ is not None:
276
+ params["id"] = id_
277
+ if tag is not None:
278
+ params["tag"] = tag
279
+ if nthreads is not None:
280
+ params["nthreads"] = nthreads
281
+ if config is not None:
282
+ params["config"] = config
283
+ return params
284
+
285
+
286
+ def dcmedit_validate(
287
+ params: typing.Any,
288
+ ) -> None:
289
+ """
290
+ Validate parameters. Throws an error if `params` is not a valid
291
+ `DcmeditParamsDict` object.
292
+
293
+ Args:
294
+ params: The parameters object to validate.
295
+ """
296
+ if params is None or not isinstance(params, dict):
297
+ raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
298
+ if params.get("anonymise", False) is None:
299
+ raise StyxValidationError("`anonymise` must not be None")
300
+ if not isinstance(params["anonymise"], bool):
301
+ raise StyxValidationError(f'`anonymise` has the wrong type: Received `{type(params.get("anonymise", False))}` expected `bool`')
302
+ if params.get("id", None) is not None:
303
+ if not isinstance(params["id"], str):
304
+ raise StyxValidationError(f'`id` has the wrong type: Received `{type(params.get("id", None))}` expected `str | None`')
305
+ if params.get("tag", None) is not None:
306
+ if not isinstance(params["tag"], list):
307
+ raise StyxValidationError(f'`tag` has the wrong type: Received `{type(params.get("tag", None))}` expected `list[DcmeditTagParamsDict] | None`')
308
+ for e in params["tag"]:
309
+ dcmedit_tag_validate(e)
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[DcmeditConfigParamsDict] | None`')
332
+ for e in params["config"]:
333
+ dcmedit_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("file", None) is None:
343
+ raise StyxValidationError("`file` must not be None")
344
+ if not isinstance(params["file"], (pathlib.Path, str)):
345
+ raise StyxValidationError(f'`file` has the wrong type: Received `{type(params.get("file", None))}` expected `InputPathType`')
346
+
347
+
348
+ def dcmedit_cargs(
349
+ params: DcmeditParamsDict,
350
+ execution: Execution,
351
+ ) -> list[str]:
352
+ """
353
+ Build command-line arguments from parameters.
354
+
355
+ Args:
356
+ params: The parameters.
357
+ execution: The execution object for resolving input paths.
358
+ Returns:
359
+ Command-line arguments.
360
+ """
361
+ cargs = []
362
+ cargs.append("dcmedit")
363
+ if params.get("anonymise", False):
364
+ cargs.append("-anonymise")
365
+ if params.get("id", None) is not None:
366
+ cargs.extend([
367
+ "-id",
368
+ params.get("id", None)
369
+ ])
370
+ if params.get("tag", None) is not None:
371
+ cargs.extend([a for c in [dcmedit_tag_cargs(s, execution) for s in params.get("tag", None)] for a in c])
372
+ if params.get("info", False):
373
+ cargs.append("-info")
374
+ if params.get("quiet", False):
375
+ cargs.append("-quiet")
376
+ if params.get("debug", False):
377
+ cargs.append("-debug")
378
+ if params.get("force", False):
379
+ cargs.append("-force")
380
+ if params.get("nthreads", None) is not None:
381
+ cargs.extend([
382
+ "-nthreads",
383
+ str(params.get("nthreads", None))
384
+ ])
385
+ if params.get("config", None) is not None:
386
+ cargs.extend([a for c in [dcmedit_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
387
+ if params.get("help", False):
388
+ cargs.append("-help")
389
+ if params.get("version", False):
390
+ cargs.append("-version")
391
+ cargs.append(execution.input_file(params.get("file", None)))
392
+ return cargs
393
+
394
+
395
+ def dcmedit_outputs(
396
+ params: DcmeditParamsDict,
397
+ execution: Execution,
398
+ ) -> DcmeditOutputs:
399
+ """
400
+ Build outputs object containing output file paths and possibly stdout/stderr.
401
+
402
+ Args:
403
+ params: The parameters.
404
+ execution: The execution object for resolving input paths.
405
+ Returns:
406
+ Outputs object.
407
+ """
408
+ ret = DcmeditOutputs(
409
+ root=execution.output_file("."),
410
+ )
411
+ return ret
412
+
413
+
414
+ def dcmedit_execute(
415
+ params: DcmeditParamsDict,
416
+ runner: Runner | None = None,
417
+ ) -> DcmeditOutputs:
418
+ """
419
+ dcmedit
420
+
421
+ Edit DICOM file in-place.
422
+
423
+ Note that this command simply replaces the existing values without modifying
424
+ the DICOM structure in any way. Replacement text will be truncated if it is
425
+ too long to fit inside the existing tag.
426
+
427
+ WARNING: this command will modify existing data! It is recommended to run
428
+ this command on a copy of the original data set to avoid loss of data.
429
+
430
+ References:
431
+
432
+ .
433
+
434
+ Author: MRTrix3 Developers
435
+
436
+ URL: https://www.mrtrix.org/
437
+
438
+ Args:
439
+ params: The parameters.
440
+ runner: Command runner.
441
+ Returns:
442
+ NamedTuple of outputs (described in `DcmeditOutputs`).
443
+ """
444
+ dcmedit_validate(params)
445
+ runner = runner or get_global_runner()
446
+ execution = runner.start_execution(DCMEDIT_METADATA)
447
+ params = execution.params(params)
448
+ cargs = dcmedit_cargs(params, execution)
449
+ ret = dcmedit_outputs(params, execution)
450
+ execution.run(cargs)
451
+ return ret
452
+
453
+
454
+ def dcmedit(
455
+ file: InputPathType,
456
+ anonymise: bool = False,
457
+ id_: str | None = None,
458
+ tag: list[DcmeditTagParamsDict] | None = None,
459
+ info: bool = False,
460
+ quiet: bool = False,
461
+ debug: bool = False,
462
+ force: bool = False,
463
+ nthreads: int | None = None,
464
+ config: list[DcmeditConfigParamsDict] | None = None,
465
+ help_: bool = False,
466
+ version: bool = False,
467
+ runner: Runner | None = None,
468
+ ) -> DcmeditOutputs:
469
+ """
470
+ dcmedit
471
+
472
+ Edit DICOM file in-place.
473
+
474
+ Note that this command simply replaces the existing values without modifying
475
+ the DICOM structure in any way. Replacement text will be truncated if it is
476
+ too long to fit inside the existing tag.
477
+
478
+ WARNING: this command will modify existing data! It is recommended to run
479
+ this command on a copy of the original data set to avoid loss of data.
480
+
481
+ References:
482
+
483
+ .
484
+
485
+ Author: MRTrix3 Developers
486
+
487
+ URL: https://www.mrtrix.org/
488
+
489
+ Args:
490
+ file: the DICOM file to be edited.
491
+ anonymise: remove any identifiable information, by replacing the\
492
+ following tags:\
493
+ - any tag with Value Representation PN will be replaced with\
494
+ 'anonymous'\
495
+ - tag (0010,0030) PatientBirthDate will be replaced with an empty\
496
+ string\
497
+ WARNING: there is no guarantee that this command will remove all\
498
+ identiable information, since such information may be contained in\
499
+ any number of private vendor-specific tags. You will need to\
500
+ double-check the results independently if you need to ensure\
501
+ anonymity.
502
+ id_: replace all ID tags with string supplied. This consists of tags\
503
+ (0010, 0020) PatientID and (0010, 1000) OtherPatientIDs.
504
+ tag: replace specific tag.
505
+ info: display information messages.
506
+ quiet: do not display information messages or progress status;\
507
+ alternatively, this can be achieved by setting the MRTRIX_QUIET\
508
+ environment variable to a non-empty string.
509
+ debug: display debugging messages.
510
+ force: force overwrite of output files (caution: using the same file as\
511
+ input and output might cause unexpected behaviour).
512
+ nthreads: use this number of threads in multi-threaded applications\
513
+ (set to 0 to disable multi-threading).
514
+ config: temporarily set the value of an MRtrix config file entry.
515
+ help_: display this information page and exit.
516
+ version: display version information and exit.
517
+ runner: Command runner.
518
+ Returns:
519
+ NamedTuple of outputs (described in `DcmeditOutputs`).
520
+ """
521
+ params = dcmedit_params(
522
+ anonymise=anonymise,
523
+ id_=id_,
524
+ tag=tag,
525
+ info=info,
526
+ quiet=quiet,
527
+ debug=debug,
528
+ force=force,
529
+ nthreads=nthreads,
530
+ config=config,
531
+ help_=help_,
532
+ version=version,
533
+ file=file,
534
+ )
535
+ return dcmedit_execute(params, runner)
536
+
537
+
538
+ __all__ = [
539
+ "DCMEDIT_METADATA",
540
+ "DcmeditConfigParamsDict",
541
+ "DcmeditConfigParamsDictTagged",
542
+ "DcmeditOutputs",
543
+ "DcmeditParamsDict",
544
+ "DcmeditParamsDictTagged",
545
+ "DcmeditTagParamsDict",
546
+ "DcmeditTagParamsDictTagged",
547
+ "dcmedit",
548
+ "dcmedit_config",
549
+ "dcmedit_execute",
550
+ "dcmedit_params",
551
+ "dcmedit_tag",
552
+ ]