@ubercode/dcmtk 0.8.0 → 0.8.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/{DicomInstance-BjrSIEGN.d.ts → DicomInstance-BKUiir0G.d.ts} +8 -3
- package/dist/{DicomInstance-zsmyd7fs.d.cts → DicomInstance-CxLKC-oM.d.cts} +8 -3
- package/dist/dicom.cjs +14 -5
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.d.cts +2 -2
- package/dist/dicom.d.ts +2 -2
- package/dist/dicom.js +14 -5
- package/dist/dicom.js.map +1 -1
- package/dist/{index-AYvUunlI.d.cts → index-B13DmBRs.d.cts} +1 -1
- package/dist/{index-C20fLU5U.d.ts → index-CCgNgve7.d.ts} +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +14 -5
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +2 -2
- package/dist/servers.d.ts +2 -2
- package/dist/servers.js +14 -5
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +15 -3
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +4 -0
- package/dist/tools.d.ts +4 -0
- package/dist/tools.js +15 -3
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
package/dist/tools.d.cts
CHANGED
|
@@ -32,6 +32,8 @@ interface Dcm2xmlOptions extends ToolBaseOptions {
|
|
|
32
32
|
readonly writeBinaryData?: boolean | undefined;
|
|
33
33
|
/** Encode binary data inline instead of referencing external files. Defaults to true when writeBinaryData is true. */
|
|
34
34
|
readonly encodeBinaryBase64?: boolean | undefined;
|
|
35
|
+
/** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Maps to `+Ca`. */
|
|
36
|
+
readonly charsetAssume?: string | undefined;
|
|
35
37
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
36
38
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
37
39
|
}
|
|
@@ -74,6 +76,8 @@ type Dcm2jsonSource = 'xml' | 'direct';
|
|
|
74
76
|
interface Dcm2jsonOptions extends ToolBaseOptions {
|
|
75
77
|
/** Skip the XML primary path and use direct dcm2json only. Defaults to false. */
|
|
76
78
|
readonly directOnly?: boolean | undefined;
|
|
79
|
+
/** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Passed to dcm2xml as `+Ca`. Only effective on the XML path (dcm2json binary does not support this flag). */
|
|
80
|
+
readonly charsetAssume?: string | undefined;
|
|
77
81
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
78
82
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
79
83
|
}
|
package/dist/tools.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ interface Dcm2xmlOptions extends ToolBaseOptions {
|
|
|
32
32
|
readonly writeBinaryData?: boolean | undefined;
|
|
33
33
|
/** Encode binary data inline instead of referencing external files. Defaults to true when writeBinaryData is true. */
|
|
34
34
|
readonly encodeBinaryBase64?: boolean | undefined;
|
|
35
|
+
/** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Maps to `+Ca`. */
|
|
36
|
+
readonly charsetAssume?: string | undefined;
|
|
35
37
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
36
38
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
37
39
|
}
|
|
@@ -74,6 +76,8 @@ type Dcm2jsonSource = 'xml' | 'direct';
|
|
|
74
76
|
interface Dcm2jsonOptions extends ToolBaseOptions {
|
|
75
77
|
/** Skip the XML primary path and use direct dcm2json only. Defaults to false. */
|
|
76
78
|
readonly directOnly?: boolean | undefined;
|
|
79
|
+
/** Assume the specified character set when SpecificCharacterSet (0008,0005) is absent. Passed to dcm2xml as `+Ca`. Only effective on the XML path (dcm2json binary does not support this flag). */
|
|
80
|
+
readonly charsetAssume?: string | undefined;
|
|
77
81
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
78
82
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
79
83
|
}
|
package/dist/tools.js
CHANGED
|
@@ -251,6 +251,7 @@ var Dcm2xmlOptionsSchema = z.object({
|
|
|
251
251
|
charset: z.enum(["utf8", "latin1", "ascii"]).optional(),
|
|
252
252
|
writeBinaryData: z.boolean().optional(),
|
|
253
253
|
encodeBinaryBase64: z.boolean().optional(),
|
|
254
|
+
charsetAssume: z.string().min(1).optional(),
|
|
254
255
|
verbosity: z.enum(["verbose", "debug"]).optional()
|
|
255
256
|
}).strict().optional();
|
|
256
257
|
function pushEncodingArgs(args, options) {
|
|
@@ -274,6 +275,9 @@ function buildArgs(inputPath, options) {
|
|
|
274
275
|
if (options?.namespace === true) {
|
|
275
276
|
args.push("+Xn");
|
|
276
277
|
}
|
|
278
|
+
if (options?.charsetAssume !== void 0) {
|
|
279
|
+
args.push("+Ca", options.charsetAssume);
|
|
280
|
+
}
|
|
277
281
|
pushEncodingArgs(args, options);
|
|
278
282
|
args.push(inputPath);
|
|
279
283
|
return args;
|
|
@@ -523,6 +527,7 @@ var Dcm2jsonOptionsSchema = z.object({
|
|
|
523
527
|
timeoutMs: z.number().int().positive().optional(),
|
|
524
528
|
signal: z.instanceof(AbortSignal).optional(),
|
|
525
529
|
directOnly: z.boolean().optional(),
|
|
530
|
+
charsetAssume: z.string().min(1).optional(),
|
|
526
531
|
verbosity: z.enum(["verbose", "debug"]).optional()
|
|
527
532
|
}).strict().optional();
|
|
528
533
|
var VERBOSITY_FLAGS2 = { verbose: "-v", debug: "-d" };
|
|
@@ -532,12 +537,19 @@ function buildVerbosityArgs(verbosity) {
|
|
|
532
537
|
}
|
|
533
538
|
return [];
|
|
534
539
|
}
|
|
535
|
-
|
|
540
|
+
function buildXmlOpts(options) {
|
|
541
|
+
const result = {};
|
|
542
|
+
if (options?.verbosity !== void 0) result["verbosity"] = options.verbosity;
|
|
543
|
+
if (options?.charsetAssume !== void 0) result["charsetAssume"] = options.charsetAssume;
|
|
544
|
+
return result;
|
|
545
|
+
}
|
|
546
|
+
async function tryXmlPath(inputPath, timeoutMs, signal, opts) {
|
|
536
547
|
const xmlBinary = resolveBinary("dcm2xml");
|
|
537
548
|
if (!xmlBinary.ok) {
|
|
538
549
|
return err(xmlBinary.error);
|
|
539
550
|
}
|
|
540
|
-
const
|
|
551
|
+
const charsetArgs = opts?.charsetAssume !== void 0 ? ["+Ca", opts.charsetAssume] : [];
|
|
552
|
+
const xmlArgs = [...buildVerbosityArgs(opts?.verbosity), ...charsetArgs, "-nat", inputPath];
|
|
541
553
|
const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
|
|
542
554
|
if (!xmlResult.ok) {
|
|
543
555
|
return err(xmlResult.error);
|
|
@@ -583,7 +595,7 @@ async function dcm2json(inputPath, options) {
|
|
|
583
595
|
if (options?.directOnly === true) {
|
|
584
596
|
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
585
597
|
}
|
|
586
|
-
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal,
|
|
598
|
+
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
|
|
587
599
|
if (xmlResult.ok) {
|
|
588
600
|
return xmlResult;
|
|
589
601
|
}
|