@ubercode/dcmtk 0.14.0 → 0.15.1

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.
package/dist/tools.d.cts CHANGED
@@ -2,6 +2,23 @@ import { R as Result } from './types-Cgumy1N4.cjs';
2
2
  import { d as ToolBaseOptions, a as DicomJsonModel } from './dcmodify-Cf-RPHF3.cjs';
3
3
  export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, T as TagModification, e as dcmodify } from './dcmodify-Cf-RPHF3.cjs';
4
4
 
5
+ /**
6
+ * Error thrown by tool wrappers when the underlying binary exits non-zero
7
+ * (or otherwise reports failure). Carries the full captured stdout/stderr
8
+ * and exit code so callers can surface diagnostic output without parsing
9
+ * the message string.
10
+ */
11
+ declare class ToolExecutionError extends Error {
12
+ readonly stdout: string;
13
+ readonly stderr: string;
14
+ readonly exitCode: number;
15
+ constructor(message: string, details: {
16
+ readonly stdout: string;
17
+ readonly stderr: string;
18
+ readonly exitCode: number;
19
+ });
20
+ }
21
+
5
22
  /**
6
23
  * DICOM to XML conversion using the dcm2xml binary.
7
24
  *
@@ -2269,4 +2286,4 @@ interface DcmmklutResult {
2269
2286
  */
2270
2287
  declare function dcmmklut(outputPath: string, options?: DcmmklutOptions): Promise<Result<DcmmklutResult>>;
2271
2288
 
2272
- export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
2289
+ export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, ToolExecutionError, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
package/dist/tools.d.ts CHANGED
@@ -2,6 +2,23 @@ import { R as Result } from './types-Cgumy1N4.js';
2
2
  import { d as ToolBaseOptions, a as DicomJsonModel } from './dcmodify-CHvwChFu.js';
3
3
  export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, T as TagModification, e as dcmodify } from './dcmodify-CHvwChFu.js';
4
4
 
5
+ /**
6
+ * Error thrown by tool wrappers when the underlying binary exits non-zero
7
+ * (or otherwise reports failure). Carries the full captured stdout/stderr
8
+ * and exit code so callers can surface diagnostic output without parsing
9
+ * the message string.
10
+ */
11
+ declare class ToolExecutionError extends Error {
12
+ readonly stdout: string;
13
+ readonly stderr: string;
14
+ readonly exitCode: number;
15
+ constructor(message: string, details: {
16
+ readonly stdout: string;
17
+ readonly stderr: string;
18
+ readonly exitCode: number;
19
+ });
20
+ }
21
+
5
22
  /**
6
23
  * DICOM to XML conversion using the dcm2xml binary.
7
24
  *
@@ -2269,4 +2286,4 @@ interface DcmmklutResult {
2269
2286
  */
2270
2287
  declare function dcmmklut(outputPath: string, options?: DcmmklutOptions): Promise<Result<DcmmklutResult>>;
2271
2288
 
2272
- export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
2289
+ export { type Cda2dcmOptions, type Cda2dcmResult, ColorConversion, type ColorConversionValue, type Dcm2cdaOptions, type Dcm2cdaResult, type Dcm2jsonOptions, type Dcm2jsonResult, type Dcm2jsonSource, type Dcm2pdfOptions, type Dcm2pdfResult, type Dcm2pnmOptions, Dcm2pnmOutputFormat, type Dcm2pnmOutputFormatValue, type Dcm2pnmResult, Dcm2xmlCharset, type Dcm2xmlCharsetValue, type Dcm2xmlOptions, type Dcm2xmlResult, type DcmcjpegOptions, type DcmcjpegResult, type DcmcjplsOptions, type DcmcjplsResult, type DcmconvOptions, type DcmconvResult, type DcmcrleOptions, type DcmcrleResult, type DcmdecapOptions, type DcmdecapResult, type DcmdjpegOptions, type DcmdjpegResult, type DcmdjplsOptions, type DcmdjplsResult, type DcmdrleOptions, type DcmdrleResult, type DcmdspfnOptions, type DcmdspfnResult, DcmdumpFormat, type DcmdumpFormatValue, type DcmdumpOptions, type DcmdumpResult, type DcmencapOptions, type DcmencapResult, type DcmftestOptions, type DcmftestResult, type DcmgpdirOptions, type DcmgpdirResult, type Dcmj2pnmOptions, Dcmj2pnmOutputFormat, type Dcmj2pnmOutputFormatValue, type Dcmj2pnmResult, type DcmmkcrvOptions, type DcmmkcrvResult, type DcmmkdirOptions, type DcmmkdirResult, type DcmmklutOptions, type DcmmklutResult, type Dcmp2pgmOptions, type Dcmp2pgmResult, type DcmprscuOptions, type DcmprscuResult, type DcmpschkOptions, type DcmpschkResult, type DcmpsmkOptions, type DcmpsmkResult, type DcmpsprtOptions, type DcmpsprtResult, type DcmqridxOptions, type DcmqridxResult, type DcmquantOptions, type DcmquantResult, type DcmscaleOptions, type DcmscaleResult, type DcmsendOptions, type DcmsendResult, type Dcod2lumOptions, type Dcod2lumResult, type DconvlumOptions, type DconvlumResult, DicomJsonModel, type DrtdumpOptions, type DrtdumpResult, type Dsr2xmlOptions, type Dsr2xmlResult, type DsrdumpOptions, type DsrdumpResult, type Dump2dcmOptions, type Dump2dcmResult, type EchoscuOptions, type EchoscuResult, type FindscuOptions, type FindscuResult, GetQueryModel, type GetQueryModelValue, type GetscuOptions, type GetscuResult, Img2dcmInputFormat, type Img2dcmInputFormatValue, type Img2dcmOptions, type Img2dcmResult, JplsColorConversion, type JplsColorConversionValue, type Json2dcmOptions, type Json2dcmResult, LutType, type LutTypeValue, MoveQueryModel, type MoveQueryModelValue, type MovescuOptions, type MovescuResult, type Pdf2dcmOptions, type Pdf2dcmResult, ProposedTransferSyntax, type ProposedTransferSyntaxValue, QueryModel, type QueryModelValue, type Stl2dcmOptions, type Stl2dcmResult, type StorescuOptions, type StorescuResult, type TermscuOptions, type TermscuResult, ToolBaseOptions, ToolExecutionError, TransferSyntax, type TransferSyntaxValue, type Xml2dcmOptions, type Xml2dcmResult, type Xml2dsrOptions, type Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
package/dist/tools.js CHANGED
@@ -8,7 +8,54 @@ import { tmpdir } from 'os';
8
8
  import { stderr } from 'stderr-lib';
9
9
  import { XMLParser } from 'fast-xml-parser';
10
10
 
11
- // src/tools/dcm2xml.ts
11
+ var __defProp = Object.defineProperty;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
14
+
15
+ // src/tools/_toolError.ts
16
+ var MAX_ARGS_LENGTH = 200;
17
+ var MAX_STDERR_LENGTH = 500;
18
+ function truncate(value, maxLength) {
19
+ if (value.length <= maxLength) {
20
+ return value;
21
+ }
22
+ return `${value.substring(0, maxLength)}...`;
23
+ }
24
+ var ToolExecutionError = class extends Error {
25
+ constructor(message, details) {
26
+ super(message);
27
+ __publicField(this, "stdout");
28
+ __publicField(this, "stderr");
29
+ __publicField(this, "exitCode");
30
+ this.name = "ToolExecutionError";
31
+ this.stdout = details.stdout;
32
+ this.stderr = details.stderr;
33
+ this.exitCode = details.exitCode;
34
+ }
35
+ };
36
+ function createToolError(toolName, args, exitCode, stderr3, stdout = "") {
37
+ const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
38
+ const stderrStr = truncate(stderr3.trim(), MAX_STDERR_LENGTH);
39
+ const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
40
+ if (argsStr.length > 0) {
41
+ parts.push(`args: ${argsStr}`);
42
+ }
43
+ if (stderrStr.length > 0) {
44
+ parts.push(`stderr: ${stderrStr}`);
45
+ }
46
+ return new ToolExecutionError(parts.join(" | "), { stdout, stderr: stderr3, exitCode });
47
+ }
48
+ function createValidationError(toolName, zodError) {
49
+ const parts = [];
50
+ for (let i = 0; i < zodError.issues.length; i++) {
51
+ const issue = zodError.issues[i];
52
+ if (issue === void 0) continue;
53
+ const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
54
+ parts.push(`${path}: ${issue.message}`);
55
+ }
56
+ const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
57
+ return new Error(`${toolName}: invalid options \u2014 ${detail}`);
58
+ }
12
59
 
13
60
  // src/types.ts
14
61
  function ok(value) {
@@ -204,39 +251,6 @@ function resolveBinary(toolName) {
204
251
  return ok(join(pathResult.value, binaryName2));
205
252
  }
206
253
 
207
- // src/tools/_toolError.ts
208
- var MAX_ARGS_LENGTH = 200;
209
- var MAX_STDERR_LENGTH = 500;
210
- function truncate(value, maxLength) {
211
- if (value.length <= maxLength) {
212
- return value;
213
- }
214
- return `${value.substring(0, maxLength)}...`;
215
- }
216
- function createToolError(toolName, args, exitCode, stderr3) {
217
- const argsStr = truncate(args.join(" "), MAX_ARGS_LENGTH);
218
- const stderrStr = truncate(stderr3.trim(), MAX_STDERR_LENGTH);
219
- const parts = [`${toolName} failed (exit code ${String(exitCode)})`];
220
- if (argsStr.length > 0) {
221
- parts.push(`args: ${argsStr}`);
222
- }
223
- if (stderrStr.length > 0) {
224
- parts.push(`stderr: ${stderrStr}`);
225
- }
226
- return new Error(parts.join(" | "));
227
- }
228
- function createValidationError(toolName, zodError) {
229
- const parts = [];
230
- for (let i = 0; i < zodError.issues.length; i++) {
231
- const issue = zodError.issues[i];
232
- if (issue === void 0) continue;
233
- const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)";
234
- parts.push(`${path}: ${issue.message}`);
235
- }
236
- const detail = parts.length > 0 ? parts.join("; ") : "unknown validation error";
237
- return new Error(`${toolName}: invalid options \u2014 ${detail}`);
238
- }
239
-
240
254
  // src/tools/dcm2xml.ts
241
255
  var Dcm2xmlCharset = {
242
256
  /** Use UTF-8 encoding (default). */
@@ -346,8 +360,14 @@ var KNOWN_VR_CODES = /* @__PURE__ */ new Set([
346
360
  "UT",
347
361
  "UV"
348
362
  ]);
363
+ function decodeXmlEntities(value) {
364
+ return value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
365
+ }
366
+ function decodeIfString(value) {
367
+ return typeof value === "string" ? decodeXmlEntities(value) : value;
368
+ }
349
369
  function buildPnString(comp) {
350
- const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""];
370
+ const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""].map(decodeXmlEntities);
351
371
  let last = parts.length - 1;
352
372
  for (; last >= 0; last--) {
353
373
  if (parts[last] !== "") break;
@@ -386,9 +406,9 @@ function convertBulkDataURI(attr, element) {
386
406
  const bulkArray = toArray(attr.BulkDataURI);
387
407
  const firstBulk = bulkArray[0];
388
408
  if (typeof firstBulk === "object" && firstBulk !== null && "@_uri" in firstBulk) {
389
- element.BulkDataURI = safeString(firstBulk["@_uri"]);
409
+ element.BulkDataURI = decodeXmlEntities(safeString(firstBulk["@_uri"]));
390
410
  } else {
391
- element.BulkDataURI = safeString(firstBulk);
411
+ element.BulkDataURI = decodeXmlEntities(safeString(firstBulk));
392
412
  }
393
413
  }
394
414
  function convertPNValue(attr, element) {
@@ -432,7 +452,7 @@ function convertRegularValue(attr, element, vr) {
432
452
  const values = [];
433
453
  const isNumeric = NUMERIC_JSON_VRS.has(vr);
434
454
  for (const v of valArray) {
435
- const unwrapped = unwrapValue(v);
455
+ const unwrapped = decodeIfString(unwrapValue(v));
436
456
  values.push(isNumeric ? coerceNumeric(unwrapped) : unwrapped);
437
457
  }
438
458
  if (values.length > 0) element.Value = values;
@@ -2358,7 +2378,7 @@ async function dcmsend(options) {
2358
2378
  return err(result.error);
2359
2379
  }
2360
2380
  if (result.value.exitCode !== 0) {
2361
- return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr));
2381
+ return err(createToolError("dcmsend", args, result.value.exitCode, result.value.stderr, result.value.stdout));
2362
2382
  }
2363
2383
  return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
2364
2384
  }
@@ -2513,10 +2533,10 @@ async function storescu(options) {
2513
2533
  return err(result.error);
2514
2534
  }
2515
2535
  if (result.value.exitCode !== 0) {
2516
- return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
2536
+ return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr, result.value.stdout));
2517
2537
  }
2518
2538
  if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
2519
- return err(createToolError("storescu", args, 0, result.value.stderr));
2539
+ return err(createToolError("storescu", args, 0, result.value.stderr, result.value.stdout));
2520
2540
  }
2521
2541
  return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
2522
2542
  }
@@ -3408,6 +3428,6 @@ async function dcmmklut(outputPath, options) {
3408
3428
  return ok({ outputPath });
3409
3429
  }
3410
3430
 
3411
- export { ColorConversion, Dcm2pnmOutputFormat, Dcm2xmlCharset, DcmdumpFormat, Dcmj2pnmOutputFormat, GetQueryModel, Img2dcmInputFormat, JplsColorConversion, LutType, MoveQueryModel, ProposedTransferSyntax, QueryModel, TransferSyntax, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmodify, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
3431
+ export { ColorConversion, Dcm2pnmOutputFormat, Dcm2xmlCharset, DcmdumpFormat, Dcmj2pnmOutputFormat, GetQueryModel, Img2dcmInputFormat, JplsColorConversion, LutType, MoveQueryModel, ProposedTransferSyntax, QueryModel, ToolExecutionError, TransferSyntax, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmodify, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr };
3412
3432
  //# sourceMappingURL=tools.js.map
3413
3433
  //# sourceMappingURL=tools.js.map