@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LineSource, R as Result } from './types-Cgumy1N4.cjs';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import * as net from 'node:net';
|
|
4
|
-
import { d as DicomInstance } from './DicomInstance-
|
|
4
|
+
import { d as DicomInstance } from './DicomInstance-CxLKC-oM.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Base class for long-lived DCMTK processes (servers).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LineSource, R as Result } from './types-Cgumy1N4.js';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import * as net from 'node:net';
|
|
4
|
-
import { d as DicomInstance } from './DicomInstance-
|
|
4
|
+
import { d as DicomInstance } from './DicomInstance-BKUiir0G.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Base class for long-lived DCMTK processes (servers).
|
package/dist/index.cjs
CHANGED
|
@@ -31184,6 +31184,7 @@ var Dcm2xmlOptionsSchema = zod.z.object({
|
|
|
31184
31184
|
charset: zod.z.enum(["utf8", "latin1", "ascii"]).optional(),
|
|
31185
31185
|
writeBinaryData: zod.z.boolean().optional(),
|
|
31186
31186
|
encodeBinaryBase64: zod.z.boolean().optional(),
|
|
31187
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
31187
31188
|
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
31188
31189
|
}).strict().optional();
|
|
31189
31190
|
function pushEncodingArgs(args, options) {
|
|
@@ -31207,6 +31208,9 @@ function buildArgs(inputPath, options) {
|
|
|
31207
31208
|
if (options?.namespace === true) {
|
|
31208
31209
|
args.push("+Xn");
|
|
31209
31210
|
}
|
|
31211
|
+
if (options?.charsetAssume !== void 0) {
|
|
31212
|
+
args.push("+Ca", options.charsetAssume);
|
|
31213
|
+
}
|
|
31210
31214
|
pushEncodingArgs(args, options);
|
|
31211
31215
|
args.push(inputPath);
|
|
31212
31216
|
return args;
|
|
@@ -31456,6 +31460,7 @@ var Dcm2jsonOptionsSchema = zod.z.object({
|
|
|
31456
31460
|
timeoutMs: zod.z.number().int().positive().optional(),
|
|
31457
31461
|
signal: zod.z.instanceof(AbortSignal).optional(),
|
|
31458
31462
|
directOnly: zod.z.boolean().optional(),
|
|
31463
|
+
charsetAssume: zod.z.string().min(1).optional(),
|
|
31459
31464
|
verbosity: zod.z.enum(["verbose", "debug"]).optional()
|
|
31460
31465
|
}).strict().optional();
|
|
31461
31466
|
var VERBOSITY_FLAGS2 = { verbose: "-v", debug: "-d" };
|
|
@@ -31465,12 +31470,19 @@ function buildVerbosityArgs(verbosity) {
|
|
|
31465
31470
|
}
|
|
31466
31471
|
return [];
|
|
31467
31472
|
}
|
|
31468
|
-
|
|
31473
|
+
function buildXmlOpts(options) {
|
|
31474
|
+
const result = {};
|
|
31475
|
+
if (options?.verbosity !== void 0) result["verbosity"] = options.verbosity;
|
|
31476
|
+
if (options?.charsetAssume !== void 0) result["charsetAssume"] = options.charsetAssume;
|
|
31477
|
+
return result;
|
|
31478
|
+
}
|
|
31479
|
+
async function tryXmlPath(inputPath, timeoutMs, signal, opts) {
|
|
31469
31480
|
const xmlBinary = resolveBinary("dcm2xml");
|
|
31470
31481
|
if (!xmlBinary.ok) {
|
|
31471
31482
|
return err(xmlBinary.error);
|
|
31472
31483
|
}
|
|
31473
|
-
const
|
|
31484
|
+
const charsetArgs = opts?.charsetAssume !== void 0 ? ["+Ca", opts.charsetAssume] : [];
|
|
31485
|
+
const xmlArgs = [...buildVerbosityArgs(opts?.verbosity), ...charsetArgs, "-nat", inputPath];
|
|
31474
31486
|
const xmlResult = await execCommand(xmlBinary.value, xmlArgs, { timeoutMs, signal });
|
|
31475
31487
|
if (!xmlResult.ok) {
|
|
31476
31488
|
return err(xmlResult.error);
|
|
@@ -31516,7 +31528,7 @@ async function dcm2json(inputPath, options) {
|
|
|
31516
31528
|
if (options?.directOnly === true) {
|
|
31517
31529
|
return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
|
|
31518
31530
|
}
|
|
31519
|
-
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal,
|
|
31531
|
+
const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
|
|
31520
31532
|
if (xmlResult.ok) {
|
|
31521
31533
|
return xmlResult;
|
|
31522
31534
|
}
|
|
@@ -34351,7 +34363,7 @@ var DicomInstance = class _DicomInstance {
|
|
|
34351
34363
|
* Opens a DICOM file and creates a DicomInstance.
|
|
34352
34364
|
*
|
|
34353
34365
|
* @param path - Filesystem path to the DICOM file
|
|
34354
|
-
* @param options - Timeout and
|
|
34366
|
+
* @param options - Timeout, abort, and charset options
|
|
34355
34367
|
* @returns A Result containing the DicomInstance or an error
|
|
34356
34368
|
*/
|
|
34357
34369
|
static async open(path2, options) {
|
|
@@ -34359,7 +34371,8 @@ var DicomInstance = class _DicomInstance {
|
|
|
34359
34371
|
if (!filePathResult.ok) return err(filePathResult.error);
|
|
34360
34372
|
const jsonResult = await dcm2json(path2, {
|
|
34361
34373
|
timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
34362
|
-
signal: options?.signal
|
|
34374
|
+
signal: options?.signal,
|
|
34375
|
+
charsetAssume: options?.charsetAssume
|
|
34363
34376
|
});
|
|
34364
34377
|
if (!jsonResult.ok) return err(jsonResult.error);
|
|
34365
34378
|
const datasetResult = DicomDataset.fromJson(jsonResult.value.data);
|