@ubercode/dcmtk 0.7.3 → 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 +614 -295
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -60
- package/dist/index.d.ts +201 -60
- package/dist/index.js +614 -296
- 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 +53 -3
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +18 -0
- package/dist/tools.d.ts +18 -0
- package/dist/tools.js +53 -3
- package/dist/tools.js.map +1 -1
- package/package.json +2 -2
package/dist/tools.cjs
CHANGED
|
@@ -257,6 +257,7 @@ var Dcm2xmlOptionsSchema = zod.z.object({
|
|
|
257
257
|
charset: zod.z.enum(["utf8", "latin1", "ascii"]).optional(),
|
|
258
258
|
writeBinaryData: zod.z.boolean().optional(),
|
|
259
259
|
encodeBinaryBase64: zod.z.boolean().optional(),
|
|
260
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
260
261
|
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
261
262
|
}).strict().optional();
|
|
262
263
|
function pushEncodingArgs(args, options) {
|
|
@@ -280,6 +281,9 @@ function buildArgs(inputPath, options) {
|
|
|
280
281
|
if (options?.namespace === true) {
|
|
281
282
|
args.push("+Xn");
|
|
282
283
|
}
|
|
284
|
+
if (options?.charsetAssume !== void 0) {
|
|
285
|
+
args.push("+Ca", options.charsetAssume);
|
|
286
|
+
}
|
|
283
287
|
pushEncodingArgs(args, options);
|
|
284
288
|
args.push(inputPath);
|
|
285
289
|
return args;
|
|
@@ -529,6 +533,7 @@ var Dcm2jsonOptionsSchema = zod.z.object({
|
|
|
529
533
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
530
534
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
531
535
|
directOnly: zod.z.boolean().optional(),
|
|
536
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
532
537
|
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
533
538
|
}).strict().optional();
|
|
534
539
|
var VERBOSITY_FLAGS2 = { verbose: "-v", debug: "-d" };
|
|
@@ -538,12 +543,19 @@ function buildVerbosityArgs(verbosity) {
|
|
|
538
543
|
}
|
|
539
544
|
return [];
|
|
540
545
|
}
|
|
541
|
-
|
|
546
|
+
function buildXmlOpts(options) {
|
|
547
|
+
const result = {};
|
|
548
|
+
if (options?.verbosity !== void 0) result["verbosity"] = options.verbosity;
|
|
549
|
+
if (options?.charsetAssume !== void 0) result["charsetAssume"] = options.charsetAssume;
|
|
550
|
+
return result;
|
|
551
|
+
}
|
|
552
|
+
async function tryXmlPath(inputPath, timeoutMs, signal, opts) {
|
|
542
553
|
const xmlBinary = resolveBinary("dcm2xml");
|
|
543
554
|
if (!xmlBinary.ok) {
|
|
544
555
|
return err(xmlBinary.error);
|
|
545
556
|
}
|
|
546
|
-
const
|
|
557
|
+
const charsetArgs = opts?.charsetAssume !== void 0 ? ["+Ca", opts.charsetAssume] : [];
|
|
558
|
+
const xmlArgs = [...buildVerbosityArgs(opts?.verbosity), ...charsetArgs, "-nat", inputPath];
|
|
547
559
|
const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
|
|
548
560
|
if (!xmlResult.ok) {
|
|
549
561
|
return err(xmlResult.error);
|
|
@@ -589,7 +601,7 @@ async function dcm2json(inputPath, options) {
|
|
|
589
601
|
if (options?.directOnly === true) {
|
|
590
602
|
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
591
603
|
}
|
|
592
|
-
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal,
|
|
604
|
+
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
|
|
593
605
|
if (xmlResult.ok) {
|
|
594
606
|
return xmlResult;
|
|
595
607
|
}
|
|
@@ -2204,6 +2216,30 @@ async function echoscu(options) {
|
|
|
2204
2216
|
return ok({ success: true, stderr: result.value.stderr });
|
|
2205
2217
|
}
|
|
2206
2218
|
var VERBOSITY_FLAGS19 = { verbose: "-v", debug: "-d" };
|
|
2219
|
+
var DECOMPRESS_FLAGS = {
|
|
2220
|
+
never: "--decompress-never",
|
|
2221
|
+
lossless: "--decompress-lossless",
|
|
2222
|
+
lossy: "--decompress-lossy"
|
|
2223
|
+
};
|
|
2224
|
+
function pushSendModeArgs(args, options) {
|
|
2225
|
+
if (options.noHalt === true) {
|
|
2226
|
+
args.push("--no-halt");
|
|
2227
|
+
}
|
|
2228
|
+
if (options.noIllegalProposal === true) {
|
|
2229
|
+
args.push("--no-illegal-proposal");
|
|
2230
|
+
}
|
|
2231
|
+
if (options.decompress !== void 0) {
|
|
2232
|
+
args.push(DECOMPRESS_FLAGS[options.decompress]);
|
|
2233
|
+
}
|
|
2234
|
+
if (options.multiAssociations === true) {
|
|
2235
|
+
args.push("+ma");
|
|
2236
|
+
} else if (options.multiAssociations === false) {
|
|
2237
|
+
args.push("-ma");
|
|
2238
|
+
}
|
|
2239
|
+
if (options.createReportFile !== void 0) {
|
|
2240
|
+
args.push("--create-report-file", options.createReportFile);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2207
2243
|
var DcmsendOptionsSchema = zod.z.object({
|
|
2208
2244
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
2209
2245
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
@@ -2213,8 +2249,15 @@ var DcmsendOptionsSchema = zod.z.object({
|
|
|
2213
2249
|
callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2214
2250
|
calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
2215
2251
|
scanDirectory: zod.z.boolean().optional(),
|
|
2252
|
+
recurse: zod.z.boolean().optional(),
|
|
2253
|
+
scanPattern: zod.z.string().min(1).optional(),
|
|
2216
2254
|
verbosity: zod.z.enum(["verbose", "debug"]).optional(),
|
|
2217
2255
|
noUidChecks: zod.z.boolean().optional(),
|
|
2256
|
+
noHalt: zod.z.boolean().optional(),
|
|
2257
|
+
noIllegalProposal: zod.z.boolean().optional(),
|
|
2258
|
+
decompress: zod.z.enum(["never", "lossless", "lossy"]).optional(),
|
|
2259
|
+
multiAssociations: zod.z.boolean().optional(),
|
|
2260
|
+
createReportFile: zod.z.string().min(1).optional(),
|
|
2218
2261
|
maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2219
2262
|
maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
|
|
2220
2263
|
noHostnameLookup: zod.z.boolean().optional(),
|
|
@@ -2260,6 +2303,13 @@ function buildArgs33(options) {
|
|
|
2260
2303
|
if (options.scanDirectory === true) {
|
|
2261
2304
|
args.push("--scan-directories");
|
|
2262
2305
|
}
|
|
2306
|
+
if (options.recurse === true) {
|
|
2307
|
+
args.push("+r");
|
|
2308
|
+
}
|
|
2309
|
+
if (options.scanPattern !== void 0) {
|
|
2310
|
+
args.push("--scan-pattern", options.scanPattern);
|
|
2311
|
+
}
|
|
2312
|
+
pushSendModeArgs(args, options);
|
|
2263
2313
|
args.push(options.host, String(options.port));
|
|
2264
2314
|
args.push(...options.files);
|
|
2265
2315
|
return args;
|