@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.d.cts CHANGED
@@ -1364,10 +1364,24 @@ interface DcmsendOptions extends ToolBaseOptions {
1364
1364
  readonly calledAETitle?: string | undefined;
1365
1365
  /** Scan input directory recursively for DICOM files. Defaults to false. */
1366
1366
  readonly scanDirectory?: boolean | undefined;
1367
+ /** Recurse into subdirectories (requires scanDirectory). Maps to `+r`. */
1368
+ readonly recurse?: boolean | undefined;
1369
+ /** Scan pattern for filename filtering (only with scanDirectory). Maps to `--scan-pattern`. */
1370
+ readonly scanPattern?: string | undefined;
1367
1371
  /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
1368
1372
  readonly verbosity?: 'verbose' | 'debug' | undefined;
1369
1373
  /** Disable UID validity checking. Maps to `--no-uid-checks`. */
1370
1374
  readonly noUidChecks?: boolean | undefined;
1375
+ /** Do not halt on first invalid input file. Maps to `--no-halt`. */
1376
+ readonly noHalt?: boolean | undefined;
1377
+ /** Do not propose illegal presentation contexts. Maps to `--no-illegal-proposal`. */
1378
+ readonly noIllegalProposal?: boolean | undefined;
1379
+ /** Decompression mode. Maps to `--decompress-never` / `--decompress-lossless` / `--decompress-lossy`. */
1380
+ readonly decompress?: 'never' | 'lossless' | 'lossy' | undefined;
1381
+ /** Use multiple associations (one after the other). Maps to `+ma`. False maps to `-ma`. */
1382
+ readonly multiAssociations?: boolean | undefined;
1383
+ /** Create a detailed report file on the transfer. Maps to `--create-report-file`. */
1384
+ readonly createReportFile?: string | undefined;
1371
1385
  /** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
1372
1386
  readonly maxPduReceive?: number | undefined;
1373
1387
  /** Maximum send PDU size in bytes (4096–131072). Maps to `--max-send-pdu`. */
@@ -1433,6 +1447,17 @@ declare const ProposedTransferSyntax: {
1433
1447
  readonly J2K_LOSSY: "j2kLossy";
1434
1448
  readonly JLS_LOSSLESS: "jlsLossless";
1435
1449
  readonly JLS_LOSSY: "jlsLossy";
1450
+ readonly MPEG2: "mpeg2";
1451
+ readonly MPEG2_HIGH: "mpeg2High";
1452
+ readonly MPEG4: "mpeg4";
1453
+ readonly MPEG4_BD: "mpeg4Bd";
1454
+ readonly MPEG4_2_2D: "mpeg4_2_2d";
1455
+ readonly MPEG4_2_3D: "mpeg4_2_3d";
1456
+ readonly MPEG4_2_ST: "mpeg4_2_st";
1457
+ readonly HEVC: "hevc";
1458
+ readonly HEVC10: "hevc10";
1459
+ readonly RLE: "rle";
1460
+ readonly DEFLATED: "deflated";
1436
1461
  };
1437
1462
  type ProposedTransferSyntaxValue = (typeof ProposedTransferSyntax)[keyof typeof ProposedTransferSyntax];
1438
1463
  /** Options for {@link storescu}. */
@@ -1451,8 +1476,10 @@ interface StorescuOptions extends ToolBaseOptions {
1451
1476
  readonly scanDirectories?: boolean | undefined;
1452
1477
  /** Recurse into subdirectories (requires scanDirectories). */
1453
1478
  readonly recurse?: boolean | undefined;
1454
- /** Proposed transfer syntax for the association. */
1455
- readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
1479
+ /** Proposed transfer syntax(es) for the association. Pass an array to propose multiple. */
1480
+ readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
1481
+ /** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
1482
+ readonly combineProposedTransferSyntaxes?: boolean | undefined;
1456
1483
  /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
1457
1484
  readonly verbosity?: 'verbose' | 'debug' | undefined;
1458
1485
  /** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
package/dist/tools.d.ts CHANGED
@@ -1364,10 +1364,24 @@ interface DcmsendOptions extends ToolBaseOptions {
1364
1364
  readonly calledAETitle?: string | undefined;
1365
1365
  /** Scan input directory recursively for DICOM files. Defaults to false. */
1366
1366
  readonly scanDirectory?: boolean | undefined;
1367
+ /** Recurse into subdirectories (requires scanDirectory). Maps to `+r`. */
1368
+ readonly recurse?: boolean | undefined;
1369
+ /** Scan pattern for filename filtering (only with scanDirectory). Maps to `--scan-pattern`. */
1370
+ readonly scanPattern?: string | undefined;
1367
1371
  /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
1368
1372
  readonly verbosity?: 'verbose' | 'debug' | undefined;
1369
1373
  /** Disable UID validity checking. Maps to `--no-uid-checks`. */
1370
1374
  readonly noUidChecks?: boolean | undefined;
1375
+ /** Do not halt on first invalid input file. Maps to `--no-halt`. */
1376
+ readonly noHalt?: boolean | undefined;
1377
+ /** Do not propose illegal presentation contexts. Maps to `--no-illegal-proposal`. */
1378
+ readonly noIllegalProposal?: boolean | undefined;
1379
+ /** Decompression mode. Maps to `--decompress-never` / `--decompress-lossless` / `--decompress-lossy`. */
1380
+ readonly decompress?: 'never' | 'lossless' | 'lossy' | undefined;
1381
+ /** Use multiple associations (one after the other). Maps to `+ma`. False maps to `-ma`. */
1382
+ readonly multiAssociations?: boolean | undefined;
1383
+ /** Create a detailed report file on the transfer. Maps to `--create-report-file`. */
1384
+ readonly createReportFile?: string | undefined;
1371
1385
  /** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
1372
1386
  readonly maxPduReceive?: number | undefined;
1373
1387
  /** Maximum send PDU size in bytes (4096–131072). Maps to `--max-send-pdu`. */
@@ -1433,6 +1447,17 @@ declare const ProposedTransferSyntax: {
1433
1447
  readonly J2K_LOSSY: "j2kLossy";
1434
1448
  readonly JLS_LOSSLESS: "jlsLossless";
1435
1449
  readonly JLS_LOSSY: "jlsLossy";
1450
+ readonly MPEG2: "mpeg2";
1451
+ readonly MPEG2_HIGH: "mpeg2High";
1452
+ readonly MPEG4: "mpeg4";
1453
+ readonly MPEG4_BD: "mpeg4Bd";
1454
+ readonly MPEG4_2_2D: "mpeg4_2_2d";
1455
+ readonly MPEG4_2_3D: "mpeg4_2_3d";
1456
+ readonly MPEG4_2_ST: "mpeg4_2_st";
1457
+ readonly HEVC: "hevc";
1458
+ readonly HEVC10: "hevc10";
1459
+ readonly RLE: "rle";
1460
+ readonly DEFLATED: "deflated";
1436
1461
  };
1437
1462
  type ProposedTransferSyntaxValue = (typeof ProposedTransferSyntax)[keyof typeof ProposedTransferSyntax];
1438
1463
  /** Options for {@link storescu}. */
@@ -1451,8 +1476,10 @@ interface StorescuOptions extends ToolBaseOptions {
1451
1476
  readonly scanDirectories?: boolean | undefined;
1452
1477
  /** Recurse into subdirectories (requires scanDirectories). */
1453
1478
  readonly recurse?: boolean | undefined;
1454
- /** Proposed transfer syntax for the association. */
1455
- readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
1479
+ /** Proposed transfer syntax(es) for the association. Pass an array to propose multiple. */
1480
+ readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
1481
+ /** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
1482
+ readonly combineProposedTransferSyntaxes?: boolean | undefined;
1456
1483
  /** Verbosity level for diagnostic output. `'verbose'` maps to `-v`, `'debug'` maps to `-d`. */
1457
1484
  readonly verbosity?: 'verbose' | 'debug' | undefined;
1458
1485
  /** Maximum receive PDU size in bytes (4096–131072). Maps to `--max-pdu`. */
package/dist/tools.js CHANGED
@@ -2198,6 +2198,30 @@ async function echoscu(options) {
2198
2198
  return ok({ success: true, stderr: result.value.stderr });
2199
2199
  }
2200
2200
  var VERBOSITY_FLAGS19 = { verbose: "-v", debug: "-d" };
2201
+ var DECOMPRESS_FLAGS = {
2202
+ never: "--decompress-never",
2203
+ lossless: "--decompress-lossless",
2204
+ lossy: "--decompress-lossy"
2205
+ };
2206
+ function pushSendModeArgs(args, options) {
2207
+ if (options.noHalt === true) {
2208
+ args.push("--no-halt");
2209
+ }
2210
+ if (options.noIllegalProposal === true) {
2211
+ args.push("--no-illegal-proposal");
2212
+ }
2213
+ if (options.decompress !== void 0) {
2214
+ args.push(DECOMPRESS_FLAGS[options.decompress]);
2215
+ }
2216
+ if (options.multiAssociations === true) {
2217
+ args.push("+ma");
2218
+ } else if (options.multiAssociations === false) {
2219
+ args.push("-ma");
2220
+ }
2221
+ if (options.createReportFile !== void 0) {
2222
+ args.push("--create-report-file", options.createReportFile);
2223
+ }
2224
+ }
2201
2225
  var DcmsendOptionsSchema = z.object({
2202
2226
  timeoutMs: z.number().int().positive().optional(),
2203
2227
  signal: z.instanceof(AbortSignal).optional(),
@@ -2207,8 +2231,15 @@ var DcmsendOptionsSchema = z.object({
2207
2231
  callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2208
2232
  calledAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
2209
2233
  scanDirectory: z.boolean().optional(),
2234
+ recurse: z.boolean().optional(),
2235
+ scanPattern: z.string().min(1).optional(),
2210
2236
  verbosity: z.enum(["verbose", "debug"]).optional(),
2211
2237
  noUidChecks: z.boolean().optional(),
2238
+ noHalt: z.boolean().optional(),
2239
+ noIllegalProposal: z.boolean().optional(),
2240
+ decompress: z.enum(["never", "lossless", "lossy"]).optional(),
2241
+ multiAssociations: z.boolean().optional(),
2242
+ createReportFile: z.string().min(1).optional(),
2212
2243
  maxPduReceive: z.number().int().min(4096).max(131072).optional(),
2213
2244
  maxPduSend: z.number().int().min(4096).max(131072).optional(),
2214
2245
  noHostnameLookup: z.boolean().optional(),
@@ -2254,6 +2285,13 @@ function buildArgs33(options) {
2254
2285
  if (options.scanDirectory === true) {
2255
2286
  args.push("--scan-directories");
2256
2287
  }
2288
+ if (options.recurse === true) {
2289
+ args.push("+r");
2290
+ }
2291
+ if (options.scanPattern !== void 0) {
2292
+ args.push("--scan-pattern", options.scanPattern);
2293
+ }
2294
+ pushSendModeArgs(args, options);
2257
2295
  args.push(options.host, String(options.port));
2258
2296
  args.push(...options.files);
2259
2297
  return args;
@@ -2292,7 +2330,18 @@ var ProposedTransferSyntax = {
2292
2330
  J2K_LOSSLESS: "j2kLossless",
2293
2331
  J2K_LOSSY: "j2kLossy",
2294
2332
  JLS_LOSSLESS: "jlsLossless",
2295
- JLS_LOSSY: "jlsLossy"
2333
+ JLS_LOSSY: "jlsLossy",
2334
+ MPEG2: "mpeg2",
2335
+ MPEG2_HIGH: "mpeg2High",
2336
+ MPEG4: "mpeg4",
2337
+ MPEG4_BD: "mpeg4Bd",
2338
+ MPEG4_2_2D: "mpeg4_2_2d",
2339
+ MPEG4_2_3D: "mpeg4_2_3d",
2340
+ MPEG4_2_ST: "mpeg4_2_st",
2341
+ HEVC: "hevc",
2342
+ HEVC10: "hevc10",
2343
+ RLE: "rle",
2344
+ DEFLATED: "deflated"
2296
2345
  };
2297
2346
  var PROPOSED_TS_FLAG_MAP = {
2298
2347
  [ProposedTransferSyntax.UNCOMPRESSED]: "-x=",
@@ -2305,8 +2354,20 @@ var PROPOSED_TS_FLAG_MAP = {
2305
2354
  [ProposedTransferSyntax.J2K_LOSSLESS]: "-xv",
2306
2355
  [ProposedTransferSyntax.J2K_LOSSY]: "-xw",
2307
2356
  [ProposedTransferSyntax.JLS_LOSSLESS]: "-xt",
2308
- [ProposedTransferSyntax.JLS_LOSSY]: "-xu"
2357
+ [ProposedTransferSyntax.JLS_LOSSY]: "-xu",
2358
+ [ProposedTransferSyntax.MPEG2]: "-xm",
2359
+ [ProposedTransferSyntax.MPEG2_HIGH]: "-xh",
2360
+ [ProposedTransferSyntax.MPEG4]: "-xn",
2361
+ [ProposedTransferSyntax.MPEG4_BD]: "-xl",
2362
+ [ProposedTransferSyntax.MPEG4_2_2D]: "-x2",
2363
+ [ProposedTransferSyntax.MPEG4_2_3D]: "-x3",
2364
+ [ProposedTransferSyntax.MPEG4_2_ST]: "-xo",
2365
+ [ProposedTransferSyntax.HEVC]: "-x4",
2366
+ [ProposedTransferSyntax.HEVC10]: "-x5",
2367
+ [ProposedTransferSyntax.RLE]: "-xr",
2368
+ [ProposedTransferSyntax.DEFLATED]: "-xd"
2309
2369
  };
2370
+ var PROPOSED_TS_VALUES = Object.values(ProposedTransferSyntax);
2310
2371
  var StorescuOptionsSchema = z.object({
2311
2372
  timeoutMs: z.number().int().positive().optional(),
2312
2373
  signal: z.instanceof(AbortSignal).optional(),
@@ -2325,20 +2386,18 @@ var StorescuOptionsSchema = z.object({
2325
2386
  dimseTimeout: z.number().int().positive().optional(),
2326
2387
  noHostnameLookup: z.boolean().optional(),
2327
2388
  required: z.boolean().optional(),
2328
- proposedTransferSyntax: z.enum([
2329
- "uncompressed",
2330
- "littleEndian",
2331
- "bigEndian",
2332
- "implicitVR",
2333
- "jpegLossless",
2334
- "jpeg8Bit",
2335
- "jpeg12Bit",
2336
- "j2kLossless",
2337
- "j2kLossy",
2338
- "jlsLossless",
2339
- "jlsLossy"
2340
- ]).optional()
2389
+ proposedTransferSyntax: z.union([z.enum(PROPOSED_TS_VALUES), z.array(z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
2390
+ combineProposedTransferSyntaxes: z.boolean().optional()
2341
2391
  }).strict();
2392
+ function pushProposedTsArgs(args, ts) {
2393
+ if (typeof ts === "string") {
2394
+ args.push(PROPOSED_TS_FLAG_MAP[ts]);
2395
+ } else {
2396
+ for (let i = 0; i < ts.length; i++) {
2397
+ args.push(PROPOSED_TS_FLAG_MAP[ts[i]]);
2398
+ }
2399
+ }
2400
+ }
2342
2401
  var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
2343
2402
  var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
2344
2403
  function pushNetworkArgs3(args, options) {
@@ -2380,7 +2439,10 @@ function buildArgs34(options) {
2380
2439
  args.push("+r");
2381
2440
  }
2382
2441
  if (options.proposedTransferSyntax !== void 0) {
2383
- args.push(PROPOSED_TS_FLAG_MAP[options.proposedTransferSyntax]);
2442
+ pushProposedTsArgs(args, options.proposedTransferSyntax);
2443
+ }
2444
+ if (options.combineProposedTransferSyntaxes === true) {
2445
+ args.push("+C");
2384
2446
  }
2385
2447
  if (options.required === true) {
2386
2448
  args.push("-R");