@ubercode/dcmtk 0.7.1 → 0.7.3
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/index.cjs +94 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +94 -46
- package/dist/index.js.map +1 -1
- package/dist/tools.cjs +48 -16
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +17 -2
- package/dist/tools.d.ts +17 -2
- package/dist/tools.js +48 -16
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.d.cts
CHANGED
|
@@ -1433,6 +1433,17 @@ declare const ProposedTransferSyntax: {
|
|
|
1433
1433
|
readonly J2K_LOSSY: "j2kLossy";
|
|
1434
1434
|
readonly JLS_LOSSLESS: "jlsLossless";
|
|
1435
1435
|
readonly JLS_LOSSY: "jlsLossy";
|
|
1436
|
+
readonly MPEG2: "mpeg2";
|
|
1437
|
+
readonly MPEG2_HIGH: "mpeg2High";
|
|
1438
|
+
readonly MPEG4: "mpeg4";
|
|
1439
|
+
readonly MPEG4_BD: "mpeg4Bd";
|
|
1440
|
+
readonly MPEG4_2_2D: "mpeg4_2_2d";
|
|
1441
|
+
readonly MPEG4_2_3D: "mpeg4_2_3d";
|
|
1442
|
+
readonly MPEG4_2_ST: "mpeg4_2_st";
|
|
1443
|
+
readonly HEVC: "hevc";
|
|
1444
|
+
readonly HEVC10: "hevc10";
|
|
1445
|
+
readonly RLE: "rle";
|
|
1446
|
+
readonly DEFLATED: "deflated";
|
|
1436
1447
|
};
|
|
1437
1448
|
type ProposedTransferSyntaxValue = (typeof ProposedTransferSyntax)[keyof typeof ProposedTransferSyntax];
|
|
1438
1449
|
/** Options for {@link storescu}. */
|
|
@@ -1451,8 +1462,10 @@ interface StorescuOptions extends ToolBaseOptions {
|
|
|
1451
1462
|
readonly scanDirectories?: boolean | undefined;
|
|
1452
1463
|
/** Recurse into subdirectories (requires scanDirectories). */
|
|
1453
1464
|
readonly recurse?: boolean | undefined;
|
|
1454
|
-
/** Proposed transfer syntax for the association. */
|
|
1455
|
-
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
|
|
1465
|
+
/** Proposed transfer syntax(es) for the association. Pass an array to propose multiple. */
|
|
1466
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
1467
|
+
/** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
|
|
1468
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
1456
1469
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
1457
1470
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
1458
1471
|
/** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
|
|
@@ -1467,6 +1480,8 @@ interface StorescuOptions extends ToolBaseOptions {
|
|
|
1467
1480
|
readonly dimseTimeout?: number | undefined;
|
|
1468
1481
|
/** Disable hostname lookup for incoming associations. Maps to `-nh`. */
|
|
1469
1482
|
readonly noHostnameLookup?: boolean | undefined;
|
|
1483
|
+
/** Propose only the file's native transfer syntax. Maps to `-R`/`--required`. */
|
|
1484
|
+
readonly required?: boolean | undefined;
|
|
1470
1485
|
}
|
|
1471
1486
|
/** Result of a successful C-STORE send. */
|
|
1472
1487
|
interface StorescuResult {
|
package/dist/tools.d.ts
CHANGED
|
@@ -1433,6 +1433,17 @@ declare const ProposedTransferSyntax: {
|
|
|
1433
1433
|
readonly J2K_LOSSY: "j2kLossy";
|
|
1434
1434
|
readonly JLS_LOSSLESS: "jlsLossless";
|
|
1435
1435
|
readonly JLS_LOSSY: "jlsLossy";
|
|
1436
|
+
readonly MPEG2: "mpeg2";
|
|
1437
|
+
readonly MPEG2_HIGH: "mpeg2High";
|
|
1438
|
+
readonly MPEG4: "mpeg4";
|
|
1439
|
+
readonly MPEG4_BD: "mpeg4Bd";
|
|
1440
|
+
readonly MPEG4_2_2D: "mpeg4_2_2d";
|
|
1441
|
+
readonly MPEG4_2_3D: "mpeg4_2_3d";
|
|
1442
|
+
readonly MPEG4_2_ST: "mpeg4_2_st";
|
|
1443
|
+
readonly HEVC: "hevc";
|
|
1444
|
+
readonly HEVC10: "hevc10";
|
|
1445
|
+
readonly RLE: "rle";
|
|
1446
|
+
readonly DEFLATED: "deflated";
|
|
1436
1447
|
};
|
|
1437
1448
|
type ProposedTransferSyntaxValue = (typeof ProposedTransferSyntax)[keyof typeof ProposedTransferSyntax];
|
|
1438
1449
|
/** Options for {@link storescu}. */
|
|
@@ -1451,8 +1462,10 @@ interface StorescuOptions extends ToolBaseOptions {
|
|
|
1451
1462
|
readonly scanDirectories?: boolean | undefined;
|
|
1452
1463
|
/** Recurse into subdirectories (requires scanDirectories). */
|
|
1453
1464
|
readonly recurse?: boolean | undefined;
|
|
1454
|
-
/** Proposed transfer syntax for the association. */
|
|
1455
|
-
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
|
|
1465
|
+
/** Proposed transfer syntax(es) for the association. Pass an array to propose multiple. */
|
|
1466
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
1467
|
+
/** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
|
|
1468
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
1456
1469
|
/** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
|
|
1457
1470
|
readonly verbosity?: 'verbose' | 'debug' | undefined;
|
|
1458
1471
|
/** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
|
|
@@ -1467,6 +1480,8 @@ interface StorescuOptions extends ToolBaseOptions {
|
|
|
1467
1480
|
readonly dimseTimeout?: number | undefined;
|
|
1468
1481
|
/** Disable hostname lookup for incoming associations. Maps to `-nh`. */
|
|
1469
1482
|
readonly noHostnameLookup?: boolean | undefined;
|
|
1483
|
+
/** Propose only the file's native transfer syntax. Maps to `-R`/`--required`. */
|
|
1484
|
+
readonly required?: boolean | undefined;
|
|
1470
1485
|
}
|
|
1471
1486
|
/** Result of a successful C-STORE send. */
|
|
1472
1487
|
interface StorescuResult {
|
package/dist/tools.js
CHANGED
|
@@ -2292,7 +2292,18 @@ var ProposedTransferSyntax = {
|
|
|
2292
2292
|
J2K_LOSSLESS: "j2kLossless",
|
|
2293
2293
|
J2K_LOSSY: "j2kLossy",
|
|
2294
2294
|
JLS_LOSSLESS: "jlsLossless",
|
|
2295
|
-
JLS_LOSSY: "jlsLossy"
|
|
2295
|
+
JLS_LOSSY: "jlsLossy",
|
|
2296
|
+
MPEG2: "mpeg2",
|
|
2297
|
+
MPEG2_HIGH: "mpeg2High",
|
|
2298
|
+
MPEG4: "mpeg4",
|
|
2299
|
+
MPEG4_BD: "mpeg4Bd",
|
|
2300
|
+
MPEG4_2_2D: "mpeg4_2_2d",
|
|
2301
|
+
MPEG4_2_3D: "mpeg4_2_3d",
|
|
2302
|
+
MPEG4_2_ST: "mpeg4_2_st",
|
|
2303
|
+
HEVC: "hevc",
|
|
2304
|
+
HEVC10: "hevc10",
|
|
2305
|
+
RLE: "rle",
|
|
2306
|
+
DEFLATED: "deflated"
|
|
2296
2307
|
};
|
|
2297
2308
|
var PROPOSED_TS_FLAG_MAP = {
|
|
2298
2309
|
[ProposedTransferSyntax.UNCOMPRESSED]: "-x=",
|
|
@@ -2305,8 +2316,20 @@ var PROPOSED_TS_FLAG_MAP = {
|
|
|
2305
2316
|
[ProposedTransferSyntax.J2K_LOSSLESS]: "-xv",
|
|
2306
2317
|
[ProposedTransferSyntax.J2K_LOSSY]: "-xw",
|
|
2307
2318
|
[ProposedTransferSyntax.JLS_LOSSLESS]: "-xt",
|
|
2308
|
-
[ProposedTransferSyntax.JLS_LOSSY]: "-xu"
|
|
2319
|
+
[ProposedTransferSyntax.JLS_LOSSY]: "-xu",
|
|
2320
|
+
[ProposedTransferSyntax.MPEG2]: "-xm",
|
|
2321
|
+
[ProposedTransferSyntax.MPEG2_HIGH]: "-xh",
|
|
2322
|
+
[ProposedTransferSyntax.MPEG4]: "-xn",
|
|
2323
|
+
[ProposedTransferSyntax.MPEG4_BD]: "-xl",
|
|
2324
|
+
[ProposedTransferSyntax.MPEG4_2_2D]: "-x2",
|
|
2325
|
+
[ProposedTransferSyntax.MPEG4_2_3D]: "-x3",
|
|
2326
|
+
[ProposedTransferSyntax.MPEG4_2_ST]: "-xo",
|
|
2327
|
+
[ProposedTransferSyntax.HEVC]: "-x4",
|
|
2328
|
+
[ProposedTransferSyntax.HEVC10]: "-x5",
|
|
2329
|
+
[ProposedTransferSyntax.RLE]: "-xr",
|
|
2330
|
+
[ProposedTransferSyntax.DEFLATED]: "-xd"
|
|
2309
2331
|
};
|
|
2332
|
+
var PROPOSED_TS_VALUES = Object.values(ProposedTransferSyntax);
|
|
2310
2333
|
var StorescuOptionsSchema = z.object({
|
|
2311
2334
|
timeoutMs: z.number().int().positive().optional(),
|
|
2312
2335
|
signal: z.instanceof(AbortSignal).optional(),
|
|
@@ -2324,21 +2347,21 @@ var StorescuOptionsSchema = z.object({
|
|
|
2324
2347
|
acseTimeout: z.number().int().positive().optional(),
|
|
2325
2348
|
dimseTimeout: z.number().int().positive().optional(),
|
|
2326
2349
|
noHostnameLookup: z.boolean().optional(),
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
"bigEndian",
|
|
2331
|
-
"implicitVR",
|
|
2332
|
-
"jpegLossless",
|
|
2333
|
-
"jpeg8Bit",
|
|
2334
|
-
"jpeg12Bit",
|
|
2335
|
-
"j2kLossless",
|
|
2336
|
-
"j2kLossy",
|
|
2337
|
-
"jlsLossless",
|
|
2338
|
-
"jlsLossy"
|
|
2339
|
-
]).optional()
|
|
2350
|
+
required: z.boolean().optional(),
|
|
2351
|
+
proposedTransferSyntax: z.union([z.enum(PROPOSED_TS_VALUES), z.array(z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
|
|
2352
|
+
combineProposedTransferSyntaxes: z.boolean().optional()
|
|
2340
2353
|
}).strict();
|
|
2354
|
+
function pushProposedTsArgs(args, ts) {
|
|
2355
|
+
if (typeof ts === "string") {
|
|
2356
|
+
args.push(PROPOSED_TS_FLAG_MAP[ts]);
|
|
2357
|
+
} else {
|
|
2358
|
+
for (let i = 0; i < ts.length; i++) {
|
|
2359
|
+
args.push(PROPOSED_TS_FLAG_MAP[ts[i]]);
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2341
2363
|
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
2364
|
+
var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
|
|
2342
2365
|
function pushNetworkArgs3(args, options) {
|
|
2343
2366
|
if (options.verbosity !== void 0) {
|
|
2344
2367
|
args.push(VERBOSITY_FLAGS20[options.verbosity]);
|
|
@@ -2378,7 +2401,13 @@ function buildArgs34(options) {
|
|
|
2378
2401
|
args.push("+r");
|
|
2379
2402
|
}
|
|
2380
2403
|
if (options.proposedTransferSyntax !== void 0) {
|
|
2381
|
-
args
|
|
2404
|
+
pushProposedTsArgs(args, options.proposedTransferSyntax);
|
|
2405
|
+
}
|
|
2406
|
+
if (options.combineProposedTransferSyntaxes === true) {
|
|
2407
|
+
args.push("+C");
|
|
2408
|
+
}
|
|
2409
|
+
if (options.required === true) {
|
|
2410
|
+
args.push("-R");
|
|
2382
2411
|
}
|
|
2383
2412
|
args.push(options.host, String(options.port));
|
|
2384
2413
|
args.push(...options.files);
|
|
@@ -2405,6 +2434,9 @@ async function storescu(options) {
|
|
|
2405
2434
|
if (result.value.exitCode !== 0) {
|
|
2406
2435
|
return err(createToolError("storescu", args, result.value.exitCode, result.value.stderr));
|
|
2407
2436
|
}
|
|
2437
|
+
if (DIMSE_ERROR_PATTERN.test(result.value.stderr)) {
|
|
2438
|
+
return err(createToolError("storescu", args, 0, result.value.stderr));
|
|
2439
|
+
}
|
|
2408
2440
|
return ok({ success: true, stdout: result.value.stdout, stderr: result.value.stderr });
|
|
2409
2441
|
}
|
|
2410
2442
|
var QueryModel = {
|