@ubercode/dcmtk 0.7.2 → 0.8.0

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.cjs CHANGED
@@ -2204,6 +2204,30 @@ async function echoscu(options) {
2204
2204
  return ok({ success: true, stderr: result.value.stderr });
2205
2205
  }
2206
2206
  var VERBOSITY_FLAGS19 = { verbose: "-v", debug: "-d" };
2207
+ var DECOMPRESS_FLAGS = {
2208
+ never: "--decompress-never",
2209
+ lossless: "--decompress-lossless",
2210
+ lossy: "--decompress-lossy"
2211
+ };
2212
+ function pushSendModeArgs(args, options) {
2213
+ if (options.noHalt === true) {
2214
+ args.push("--no-halt");
2215
+ }
2216
+ if (options.noIllegalProposal === true) {
2217
+ args.push("--no-illegal-proposal");
2218
+ }
2219
+ if (options.decompress !== void 0) {
2220
+ args.push(DECOMPRESS_FLAGS[options.decompress]);
2221
+ }
2222
+ if (options.multiAssociations === true) {
2223
+ args.push("+ma");
2224
+ } else if (options.multiAssociations === false) {
2225
+ args.push("-ma");
2226
+ }
2227
+ if (options.createReportFile !== void 0) {
2228
+ args.push("--create-report-file", options.createReportFile);
2229
+ }
2230
+ }
2207
2231
  var DcmsendOptionsSchema = zod.z.object({
2208
2232
  timeoutMs: zod.z.number().int().positive().optional(),
2209
2233
  signal: zod.z.instanceof(AbortSignal).optional(),
@@ -2213,8 +2237,15 @@ var DcmsendOptionsSchema = zod.z.object({
2213
2237
  callingAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2214
2238
  calledAETitle: zod.z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2215
2239
  scanDirectory: zod.z.boolean().optional(),
2240
+ recurse: zod.z.boolean().optional(),
2241
+ scanPattern: zod.z.string().min(1).optional(),
2216
2242
  verbosity: zod.z.enum(["verbose", "debug"]).optional(),
2217
2243
  noUidChecks: zod.z.boolean().optional(),
2244
+ noHalt: zod.z.boolean().optional(),
2245
+ noIllegalProposal: zod.z.boolean().optional(),
2246
+ decompress: zod.z.enum(["never", "lossless", "lossy"]).optional(),
2247
+ multiAssociations: zod.z.boolean().optional(),
2248
+ createReportFile: zod.z.string().min(1).optional(),
2218
2249
  maxPduReceive: zod.z.number().int().min(4096).max(131072).optional(),
2219
2250
  maxPduSend: zod.z.number().int().min(4096).max(131072).optional(),
2220
2251
  noHostnameLookup: zod.z.boolean().optional(),
@@ -2260,6 +2291,13 @@ function buildArgs33(options) {
2260
2291
  if (options.scanDirectory === true) {
2261
2292
  args.push("--scan-directories");
2262
2293
  }
2294
+ if (options.recurse === true) {
2295
+ args.push("+r");
2296
+ }
2297
+ if (options.scanPattern !== void 0) {
2298
+ args.push("--scan-pattern", options.scanPattern);
2299
+ }
2300
+ pushSendModeArgs(args, options);
2263
2301
  args.push(options.host, String(options.port));
2264
2302
  args.push(...options.files);
2265
2303
  return args;
@@ -2298,7 +2336,18 @@ var ProposedTransferSyntax = {
2298
2336
  J2K_LOSSLESS: "j2kLossless",
2299
2337
  J2K_LOSSY: "j2kLossy",
2300
2338
  JLS_LOSSLESS: "jlsLossless",
2301
- JLS_LOSSY: "jlsLossy"
2339
+ JLS_LOSSY: "jlsLossy",
2340
+ MPEG2: "mpeg2",
2341
+ MPEG2_HIGH: "mpeg2High",
2342
+ MPEG4: "mpeg4",
2343
+ MPEG4_BD: "mpeg4Bd",
2344
+ MPEG4_2_2D: "mpeg4_2_2d",
2345
+ MPEG4_2_3D: "mpeg4_2_3d",
2346
+ MPEG4_2_ST: "mpeg4_2_st",
2347
+ HEVC: "hevc",
2348
+ HEVC10: "hevc10",
2349
+ RLE: "rle",
2350
+ DEFLATED: "deflated"
2302
2351
  };
2303
2352
  var PROPOSED_TS_FLAG_MAP = {
2304
2353
  [ProposedTransferSyntax.UNCOMPRESSED]: "-x=",
@@ -2311,8 +2360,20 @@ var PROPOSED_TS_FLAG_MAP = {
2311
2360
  [ProposedTransferSyntax.J2K_LOSSLESS]: "-xv",
2312
2361
  [ProposedTransferSyntax.J2K_LOSSY]: "-xw",
2313
2362
  [ProposedTransferSyntax.JLS_LOSSLESS]: "-xt",
2314
- [ProposedTransferSyntax.JLS_LOSSY]: "-xu"
2363
+ [ProposedTransferSyntax.JLS_LOSSY]: "-xu",
2364
+ [ProposedTransferSyntax.MPEG2]: "-xm",
2365
+ [ProposedTransferSyntax.MPEG2_HIGH]: "-xh",
2366
+ [ProposedTransferSyntax.MPEG4]: "-xn",
2367
+ [ProposedTransferSyntax.MPEG4_BD]: "-xl",
2368
+ [ProposedTransferSyntax.MPEG4_2_2D]: "-x2",
2369
+ [ProposedTransferSyntax.MPEG4_2_3D]: "-x3",
2370
+ [ProposedTransferSyntax.MPEG4_2_ST]: "-xo",
2371
+ [ProposedTransferSyntax.HEVC]: "-x4",
2372
+ [ProposedTransferSyntax.HEVC10]: "-x5",
2373
+ [ProposedTransferSyntax.RLE]: "-xr",
2374
+ [ProposedTransferSyntax.DEFLATED]: "-xd"
2315
2375
  };
2376
+ var PROPOSED_TS_VALUES = Object.values(ProposedTransferSyntax);
2316
2377
  var StorescuOptionsSchema = zod.z.object({
2317
2378
  timeoutMs: zod.z.number().int().positive().optional(),
2318
2379
  signal: zod.z.instanceof(AbortSignal).optional(),
@@ -2331,20 +2392,18 @@ var StorescuOptionsSchema = zod.z.object({
2331
2392
  dimseTimeout: zod.z.number().int().positive().optional(),
2332
2393
  noHostnameLookup: zod.z.boolean().optional(),
2333
2394
  required: zod.z.boolean().optional(),
2334
- proposedTransferSyntax: zod.z.enum([
2335
- "uncompressed",
2336
- "littleEndian",
2337
- "bigEndian",
2338
- "implicitVR",
2339
- "jpegLossless",
2340
- "jpeg8Bit",
2341
- "jpeg12Bit",
2342
- "j2kLossless",
2343
- "j2kLossy",
2344
- "jlsLossless",
2345
- "jlsLossy"
2346
- ]).optional()
2395
+ proposedTransferSyntax: zod.z.union([zod.z.enum(PROPOSED_TS_VALUES), zod.z.array(zod.z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
2396
+ combineProposedTransferSyntaxes: zod.z.boolean().optional()
2347
2397
  }).strict();
2398
+ function pushProposedTsArgs(args, ts) {
2399
+ if (typeof ts === "string") {
2400
+ args.push(PROPOSED_TS_FLAG_MAP[ts]);
2401
+ } else {
2402
+ for (let i = 0; i < ts.length; i++) {
2403
+ args.push(PROPOSED_TS_FLAG_MAP[ts[i]]);
2404
+ }
2405
+ }
2406
+ }
2348
2407
  var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
2349
2408
  var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
2350
2409
  function pushNetworkArgs3(args, options) {
@@ -2386,7 +2445,10 @@ function buildArgs34(options) {
2386
2445
  args.push("+r");
2387
2446
  }
2388
2447
  if (options.proposedTransferSyntax !== void 0) {
2389
- args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
2448
+ pushProposedTsArgs(args, options.proposedTransferSyntax);
2449
+ }
2450
+ if (options.combineProposedTransferSyntaxes === true) {
2451
+ args.push("+C");
2390
2452
  }
2391
2453
  if (options.required === true) {
2392
2454
  args.push("-R");