@ubercode/dcmtk 0.7.2 → 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 +68 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +68 -35
- package/dist/index.js.map +1 -1
- package/dist/tools.cjs +40 -16
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.d.cts +15 -2
- package/dist/tools.d.ts +15 -2
- package/dist/tools.js +40 -16
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -263,8 +263,10 @@ interface DicomSenderOptions {
|
|
|
263
263
|
readonly mode?: SenderModeValue | undefined;
|
|
264
264
|
/** Maximum concurrent storescu associations. Defaults to 4 (forced to 1 in single mode). */
|
|
265
265
|
readonly maxAssociations?: number | undefined;
|
|
266
|
-
/** Proposed transfer syntax for associations. */
|
|
267
|
-
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
|
|
266
|
+
/** Proposed transfer syntax(es) for associations. Pass an array to propose multiple. */
|
|
267
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
268
|
+
/** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
|
|
269
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
268
270
|
/** Maximum queued send requests before rejecting. Defaults to 1000. */
|
|
269
271
|
readonly maxQueueLength?: number | undefined;
|
|
270
272
|
/** Per-storescu timeout in milliseconds. Defaults to 30000. */
|
|
@@ -308,6 +310,10 @@ interface SendOptions {
|
|
|
308
310
|
readonly callingAETitle?: string | undefined;
|
|
309
311
|
/** Override required flag for this send. */
|
|
310
312
|
readonly required?: boolean | undefined;
|
|
313
|
+
/** Override proposed transfer syntax(es) for this send. */
|
|
314
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
315
|
+
/** Override combine proposed transfer syntaxes for this send. */
|
|
316
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
311
317
|
}
|
|
312
318
|
/** Result of a successful send operation. */
|
|
313
319
|
interface SendResult {
|
|
@@ -480,6 +486,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
|
|
|
480
486
|
* @returns A Result containing the send result or an error
|
|
481
487
|
*/
|
|
482
488
|
send(files: readonly string[], options?: SendOptions): Promise<Result<SendResult>>;
|
|
489
|
+
/** Builds SendParams from per-send options, applying instance defaults. */
|
|
490
|
+
private buildSendParams;
|
|
483
491
|
/** Dispatches a send to the appropriate mode handler. */
|
|
484
492
|
private dispatchSend;
|
|
485
493
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -263,8 +263,10 @@ interface DicomSenderOptions {
|
|
|
263
263
|
readonly mode?: SenderModeValue | undefined;
|
|
264
264
|
/** Maximum concurrent storescu associations. Defaults to 4 (forced to 1 in single mode). */
|
|
265
265
|
readonly maxAssociations?: number | undefined;
|
|
266
|
-
/** Proposed transfer syntax for associations. */
|
|
267
|
-
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | undefined;
|
|
266
|
+
/** Proposed transfer syntax(es) for associations. Pass an array to propose multiple. */
|
|
267
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
268
|
+
/** Combine proposed transfer syntaxes into fewer presentation contexts. Maps to `+C`/`--combine`. */
|
|
269
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
268
270
|
/** Maximum queued send requests before rejecting. Defaults to 1000. */
|
|
269
271
|
readonly maxQueueLength?: number | undefined;
|
|
270
272
|
/** Per-storescu timeout in milliseconds. Defaults to 30000. */
|
|
@@ -308,6 +310,10 @@ interface SendOptions {
|
|
|
308
310
|
readonly callingAETitle?: string | undefined;
|
|
309
311
|
/** Override required flag for this send. */
|
|
310
312
|
readonly required?: boolean | undefined;
|
|
313
|
+
/** Override proposed transfer syntax(es) for this send. */
|
|
314
|
+
readonly proposedTransferSyntax?: ProposedTransferSyntaxValue | readonly ProposedTransferSyntaxValue[] | undefined;
|
|
315
|
+
/** Override combine proposed transfer syntaxes for this send. */
|
|
316
|
+
readonly combineProposedTransferSyntaxes?: boolean | undefined;
|
|
311
317
|
}
|
|
312
318
|
/** Result of a successful send operation. */
|
|
313
319
|
interface SendResult {
|
|
@@ -480,6 +486,8 @@ declare class DicomSender extends EventEmitter<DicomSenderEventMap> {
|
|
|
480
486
|
* @returns A Result containing the send result or an error
|
|
481
487
|
*/
|
|
482
488
|
send(files: readonly string[], options?: SendOptions): Promise<Result<SendResult>>;
|
|
489
|
+
/** Builds SendParams from per-send options, applying instance defaults. */
|
|
490
|
+
private buildSendParams;
|
|
483
491
|
/** Dispatches a send to the appropriate mode handler. */
|
|
484
492
|
private dispatchSend;
|
|
485
493
|
/**
|
package/dist/index.js
CHANGED
|
@@ -33200,7 +33200,18 @@ var ProposedTransferSyntax = {
|
|
|
33200
33200
|
J2K_LOSSLESS: "j2kLossless",
|
|
33201
33201
|
J2K_LOSSY: "j2kLossy",
|
|
33202
33202
|
JLS_LOSSLESS: "jlsLossless",
|
|
33203
|
-
JLS_LOSSY: "jlsLossy"
|
|
33203
|
+
JLS_LOSSY: "jlsLossy",
|
|
33204
|
+
MPEG2: "mpeg2",
|
|
33205
|
+
MPEG2_HIGH: "mpeg2High",
|
|
33206
|
+
MPEG4: "mpeg4",
|
|
33207
|
+
MPEG4_BD: "mpeg4Bd",
|
|
33208
|
+
MPEG4_2_2D: "mpeg4_2_2d",
|
|
33209
|
+
MPEG4_2_3D: "mpeg4_2_3d",
|
|
33210
|
+
MPEG4_2_ST: "mpeg4_2_st",
|
|
33211
|
+
HEVC: "hevc",
|
|
33212
|
+
HEVC10: "hevc10",
|
|
33213
|
+
RLE: "rle",
|
|
33214
|
+
DEFLATED: "deflated"
|
|
33204
33215
|
};
|
|
33205
33216
|
var PROPOSED_TS_FLAG_MAP = {
|
|
33206
33217
|
[ProposedTransferSyntax.UNCOMPRESSED]: "-x=",
|
|
@@ -33213,8 +33224,20 @@ var PROPOSED_TS_FLAG_MAP = {
|
|
|
33213
33224
|
[ProposedTransferSyntax.J2K_LOSSLESS]: "-xv",
|
|
33214
33225
|
[ProposedTransferSyntax.J2K_LOSSY]: "-xw",
|
|
33215
33226
|
[ProposedTransferSyntax.JLS_LOSSLESS]: "-xt",
|
|
33216
|
-
[ProposedTransferSyntax.JLS_LOSSY]: "-xu"
|
|
33227
|
+
[ProposedTransferSyntax.JLS_LOSSY]: "-xu",
|
|
33228
|
+
[ProposedTransferSyntax.MPEG2]: "-xm",
|
|
33229
|
+
[ProposedTransferSyntax.MPEG2_HIGH]: "-xh",
|
|
33230
|
+
[ProposedTransferSyntax.MPEG4]: "-xn",
|
|
33231
|
+
[ProposedTransferSyntax.MPEG4_BD]: "-xl",
|
|
33232
|
+
[ProposedTransferSyntax.MPEG4_2_2D]: "-x2",
|
|
33233
|
+
[ProposedTransferSyntax.MPEG4_2_3D]: "-x3",
|
|
33234
|
+
[ProposedTransferSyntax.MPEG4_2_ST]: "-xo",
|
|
33235
|
+
[ProposedTransferSyntax.HEVC]: "-x4",
|
|
33236
|
+
[ProposedTransferSyntax.HEVC10]: "-x5",
|
|
33237
|
+
[ProposedTransferSyntax.RLE]: "-xr",
|
|
33238
|
+
[ProposedTransferSyntax.DEFLATED]: "-xd"
|
|
33217
33239
|
};
|
|
33240
|
+
var PROPOSED_TS_VALUES = Object.values(ProposedTransferSyntax);
|
|
33218
33241
|
var StorescuOptionsSchema = z.object({
|
|
33219
33242
|
timeoutMs: z.number().int().positive().optional(),
|
|
33220
33243
|
signal: z.instanceof(AbortSignal).optional(),
|
|
@@ -33233,20 +33256,18 @@ var StorescuOptionsSchema = z.object({
|
|
|
33233
33256
|
dimseTimeout: z.number().int().positive().optional(),
|
|
33234
33257
|
noHostnameLookup: z.boolean().optional(),
|
|
33235
33258
|
required: z.boolean().optional(),
|
|
33236
|
-
proposedTransferSyntax: z.enum(
|
|
33237
|
-
|
|
33238
|
-
"littleEndian",
|
|
33239
|
-
"bigEndian",
|
|
33240
|
-
"implicitVR",
|
|
33241
|
-
"jpegLossless",
|
|
33242
|
-
"jpeg8Bit",
|
|
33243
|
-
"jpeg12Bit",
|
|
33244
|
-
"j2kLossless",
|
|
33245
|
-
"j2kLossy",
|
|
33246
|
-
"jlsLossless",
|
|
33247
|
-
"jlsLossy"
|
|
33248
|
-
]).optional()
|
|
33259
|
+
proposedTransferSyntax: z.union([z.enum(PROPOSED_TS_VALUES), z.array(z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
|
|
33260
|
+
combineProposedTransferSyntaxes: z.boolean().optional()
|
|
33249
33261
|
}).strict();
|
|
33262
|
+
function pushProposedTsArgs(args, ts) {
|
|
33263
|
+
if (typeof ts === "string") {
|
|
33264
|
+
args.push(PROPOSED_TS_FLAG_MAP[ts]);
|
|
33265
|
+
} else {
|
|
33266
|
+
for (let i = 0; i < ts.length; i++) {
|
|
33267
|
+
args.push(PROPOSED_TS_FLAG_MAP[ts[i]]);
|
|
33268
|
+
}
|
|
33269
|
+
}
|
|
33270
|
+
}
|
|
33250
33271
|
var VERBOSITY_FLAGS20 = { verbose: "-v", debug: "-d" };
|
|
33251
33272
|
var DIMSE_ERROR_PATTERN = /^E:.*(?:DIMSE Failed|Store Failed)/m;
|
|
33252
33273
|
function pushNetworkArgs3(args, options) {
|
|
@@ -33288,7 +33309,10 @@ function buildArgs34(options) {
|
|
|
33288
33309
|
args.push("+r");
|
|
33289
33310
|
}
|
|
33290
33311
|
if (options.proposedTransferSyntax !== void 0) {
|
|
33291
|
-
args
|
|
33312
|
+
pushProposedTsArgs(args, options.proposedTransferSyntax);
|
|
33313
|
+
}
|
|
33314
|
+
if (options.combineProposedTransferSyntaxes === true) {
|
|
33315
|
+
args.push("+C");
|
|
33292
33316
|
}
|
|
33293
33317
|
if (options.required === true) {
|
|
33294
33318
|
args.push("-R");
|
|
@@ -36846,19 +36870,8 @@ var DicomSenderOptionsSchema = z.object({
|
|
|
36846
36870
|
callingAETitle: z.string().min(1).max(16).refine(isValidAETitle, { message: "AE Title contains invalid characters" }).optional(),
|
|
36847
36871
|
mode: z.enum(["single", "multiple", "bucket"]).optional(),
|
|
36848
36872
|
maxAssociations: z.number().int().min(1).max(MAX_ASSOCIATIONS_LIMIT).optional(),
|
|
36849
|
-
proposedTransferSyntax: z.enum(
|
|
36850
|
-
|
|
36851
|
-
"littleEndian",
|
|
36852
|
-
"bigEndian",
|
|
36853
|
-
"implicitVR",
|
|
36854
|
-
"jpegLossless",
|
|
36855
|
-
"jpeg8Bit",
|
|
36856
|
-
"jpeg12Bit",
|
|
36857
|
-
"j2kLossless",
|
|
36858
|
-
"j2kLossy",
|
|
36859
|
-
"jlsLossless",
|
|
36860
|
-
"jlsLossy"
|
|
36861
|
-
]).optional(),
|
|
36873
|
+
proposedTransferSyntax: z.union([z.enum(PROPOSED_TS_VALUES), z.array(z.enum(PROPOSED_TS_VALUES)).min(1)]).optional(),
|
|
36874
|
+
combineProposedTransferSyntaxes: z.boolean().optional(),
|
|
36862
36875
|
maxQueueLength: z.number().int().min(1).optional(),
|
|
36863
36876
|
timeoutMs: z.number().int().positive().optional(),
|
|
36864
36877
|
maxRetries: z.number().int().min(0).optional(),
|
|
@@ -36971,14 +36984,19 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
36971
36984
|
if (files.length === 0) {
|
|
36972
36985
|
return Promise.resolve(err(new Error("DicomSender: no files provided")));
|
|
36973
36986
|
}
|
|
36974
|
-
|
|
36987
|
+
return this.dispatchSend(files, this.buildSendParams(options));
|
|
36988
|
+
}
|
|
36989
|
+
/** Builds SendParams from per-send options, applying instance defaults. */
|
|
36990
|
+
buildSendParams(options) {
|
|
36991
|
+
return {
|
|
36975
36992
|
timeoutMs: options?.timeoutMs ?? this.defaultTimeoutMs,
|
|
36976
36993
|
maxRetries: options?.maxRetries ?? this.defaultMaxRetries,
|
|
36977
36994
|
calledAETitle: options?.calledAETitle,
|
|
36978
36995
|
callingAETitle: options?.callingAETitle,
|
|
36979
|
-
required: options?.required
|
|
36996
|
+
required: options?.required,
|
|
36997
|
+
proposedTransferSyntax: options?.proposedTransferSyntax,
|
|
36998
|
+
combineProposedTransferSyntaxes: options?.combineProposedTransferSyntaxes
|
|
36980
36999
|
};
|
|
36981
|
-
return this.dispatchSend(files, params);
|
|
36982
37000
|
}
|
|
36983
37001
|
/** Dispatches a send to the appropriate mode handler. */
|
|
36984
37002
|
dispatchSend(files, params) {
|
|
@@ -37096,6 +37114,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37096
37114
|
calledAETitle: params.calledAETitle,
|
|
37097
37115
|
callingAETitle: params.callingAETitle,
|
|
37098
37116
|
required: params.required,
|
|
37117
|
+
proposedTransferSyntax: params.proposedTransferSyntax,
|
|
37118
|
+
combineProposedTransferSyntaxes: params.combineProposedTransferSyntaxes,
|
|
37099
37119
|
resolve
|
|
37100
37120
|
};
|
|
37101
37121
|
if (this.activeAssociations < this.effectiveMaxAssociations) {
|
|
@@ -37124,8 +37144,18 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37124
37144
|
resolve(err(new Error("DicomSender: queue full")));
|
|
37125
37145
|
return;
|
|
37126
37146
|
}
|
|
37127
|
-
const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required } = params;
|
|
37128
|
-
this.currentBucket.push({
|
|
37147
|
+
const { timeoutMs, maxRetries, calledAETitle, callingAETitle, required, proposedTransferSyntax, combineProposedTransferSyntaxes } = params;
|
|
37148
|
+
this.currentBucket.push({
|
|
37149
|
+
files,
|
|
37150
|
+
resolve,
|
|
37151
|
+
timeoutMs,
|
|
37152
|
+
maxRetries,
|
|
37153
|
+
calledAETitle,
|
|
37154
|
+
callingAETitle,
|
|
37155
|
+
required,
|
|
37156
|
+
proposedTransferSyntax,
|
|
37157
|
+
combineProposedTransferSyntaxes
|
|
37158
|
+
});
|
|
37129
37159
|
const totalFiles = this.countBucketFiles();
|
|
37130
37160
|
if (totalFiles >= this.maxBucketSize) {
|
|
37131
37161
|
this.clearBucketTimer();
|
|
@@ -37162,6 +37192,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37162
37192
|
calledAETitle: entries[0]?.calledAETitle,
|
|
37163
37193
|
callingAETitle: entries[0]?.callingAETitle,
|
|
37164
37194
|
required: entries[0]?.required,
|
|
37195
|
+
proposedTransferSyntax: entries[0]?.proposedTransferSyntax,
|
|
37196
|
+
combineProposedTransferSyntaxes: entries[0]?.combineProposedTransferSyntaxes,
|
|
37165
37197
|
resolve: (result) => {
|
|
37166
37198
|
for (let i = 0; i < entries.length; i++) {
|
|
37167
37199
|
entries[i].resolve(result);
|
|
@@ -37249,7 +37281,8 @@ var DicomSender = class _DicomSender extends EventEmitter {
|
|
|
37249
37281
|
files: [...entry.files],
|
|
37250
37282
|
calledAETitle: entry.calledAETitle ?? this.options.calledAETitle,
|
|
37251
37283
|
callingAETitle: entry.callingAETitle ?? this.options.callingAETitle,
|
|
37252
|
-
proposedTransferSyntax: this.options.proposedTransferSyntax,
|
|
37284
|
+
proposedTransferSyntax: entry.proposedTransferSyntax ?? this.options.proposedTransferSyntax,
|
|
37285
|
+
combineProposedTransferSyntaxes: entry.combineProposedTransferSyntaxes ?? this.options.combineProposedTransferSyntaxes,
|
|
37253
37286
|
maxPduReceive: this.options.maxPduReceive,
|
|
37254
37287
|
maxPduSend: this.options.maxPduSend,
|
|
37255
37288
|
associationTimeout: this.options.associationTimeout,
|