@ubercode/dcmtk 0.8.1 → 0.9.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/index.d.cts CHANGED
@@ -4,7 +4,8 @@ import { A as AETitle, D as DicomTag, a as DicomTagPath, P as Port, S as SOPClas
4
4
  export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, e as DicomOpenOptions, W as WalkTagEntry, f as WalkTagsOptions, g as createAETitle, h as createDicomFilePath, i as createDicomTag, j as createDicomTagPath, k as createPort, l as createSOPClassUID, m as createTransferSyntaxUID, t as tag, w as walkTags } from './DicomInstance-CxLKC-oM.cjs';
5
5
  import { z } from 'zod';
6
6
  export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-B13DmBRs.cjs';
7
- export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, T as TagModification, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-Cf-RPHF3.cjs';
7
+ import { T as TagModification } from './dcmodify-Cf-RPHF3.cjs';
8
+ export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-Cf-RPHF3.cjs';
8
9
  export { DictionaryEntry, SOPClassName, SOP_CLASSES, TagSegment, VR, VRCategoryName, VRMetadata, VRValue, VR_CATEGORY, VR_CATEGORY_NAME, VR_META, getVRCategory, isBinaryVR, isNumericVR, isStringVR, lookupTag, lookupTagByKeyword, lookupTagByName, segmentsToModifyPath, segmentsToString, sopClassNameFromUID, tagPathToSegments } from './dicom.cjs';
9
10
  import { ProposedTransferSyntaxValue } from './tools.cjs';
10
11
  export { Cda2dcmOptions, Cda2dcmResult, ColorConversion, ColorConversionValue, Dcm2cdaOptions, Dcm2cdaResult, Dcm2jsonOptions, Dcm2jsonResult, Dcm2jsonSource, Dcm2pdfOptions, Dcm2pdfResult, Dcm2pnmOptions, Dcm2pnmOutputFormat, Dcm2pnmOutputFormatValue, Dcm2pnmResult, Dcm2xmlCharset, Dcm2xmlCharsetValue, Dcm2xmlOptions, Dcm2xmlResult, DcmcjpegOptions, DcmcjpegResult, DcmcjplsOptions, DcmcjplsResult, DcmconvOptions, DcmconvResult, DcmcrleOptions, DcmcrleResult, DcmdecapOptions, DcmdecapResult, DcmdjpegOptions, DcmdjpegResult, DcmdjplsOptions, DcmdjplsResult, DcmdrleOptions, DcmdrleResult, DcmdspfnOptions, DcmdspfnResult, DcmdumpFormat, DcmdumpFormatValue, DcmdumpOptions, DcmdumpResult, DcmencapOptions, DcmencapResult, DcmftestOptions, DcmftestResult, DcmgpdirOptions, DcmgpdirResult, Dcmj2pnmOptions, Dcmj2pnmOutputFormat, Dcmj2pnmOutputFormatValue, Dcmj2pnmResult, DcmmkcrvOptions, DcmmkcrvResult, DcmmkdirOptions, DcmmkdirResult, DcmmklutOptions, DcmmklutResult, Dcmp2pgmOptions, Dcmp2pgmResult, DcmprscuOptions, DcmprscuResult, DcmpschkOptions, DcmpschkResult, DcmpsmkOptions, DcmpsmkResult, DcmpsprtOptions, DcmpsprtResult, DcmqridxOptions, DcmqridxResult, DcmquantOptions, DcmquantResult, DcmscaleOptions, DcmscaleResult, DcmsendOptions, DcmsendResult, Dcod2lumOptions, Dcod2lumResult, DconvlumOptions, DconvlumResult, DrtdumpOptions, DrtdumpResult, Dsr2xmlOptions, Dsr2xmlResult, DsrdumpOptions, DsrdumpResult, Dump2dcmOptions, Dump2dcmResult, EchoscuOptions, EchoscuResult, FindscuOptions, FindscuResult, GetQueryModel, GetQueryModelValue, GetscuOptions, GetscuResult, Img2dcmInputFormat, Img2dcmInputFormatValue, Img2dcmOptions, Img2dcmResult, JplsColorConversion, JplsColorConversionValue, Json2dcmOptions, Json2dcmResult, LutType, LutTypeValue, MoveQueryModel, MoveQueryModelValue, MovescuOptions, MovescuResult, Pdf2dcmOptions, Pdf2dcmResult, ProposedTransferSyntax, QueryModel, QueryModelValue, Stl2dcmOptions, Stl2dcmResult, StorescuOptions, StorescuResult, TermscuOptions, TermscuResult, TransferSyntax, TransferSyntaxValue, Xml2dcmOptions, Xml2dcmResult, Xml2dsrOptions, Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr } from './tools.cjs';
@@ -1014,4 +1015,230 @@ declare class PacsClient {
1014
1015
  private executeCMove;
1015
1016
  }
1016
1017
 
1017
- export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, type DcmsendSendOptions, DcmtkProcessResult, DicomDataset, DicomSend, type DicomSendEventMap, type DicomSendOptions, DicomSender, type DicomSenderEventMap, type DicomSenderOptions, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, ProposedTransferSyntaxValue, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SendOptions, type SendResult, type SenderBucketFlushedData, type SenderErrorData, SenderHealth, type SenderHealthChangedData, type SenderHealthValue, SenderMode, type SenderModeValue, type SenderSendCompleteData, type SenderSendFailedData, type SenderStatus, type SeriesFilter, SpawnOptions, type StudyFilter, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };
1018
+ /**
1019
+ * Types for the DicomHammer load testing tool.
1020
+ *
1021
+ * @module testing/types
1022
+ */
1023
+
1024
+ /** Phases of a DicomHammer run. */
1025
+ declare const HammerPhase: {
1026
+ /** File generation phase (copy + modify). */
1027
+ readonly GENERATE: "generate";
1028
+ /** File sending phase (dcmsend). */
1029
+ readonly SEND: "send";
1030
+ };
1031
+ type HammerPhaseValue = (typeof HammerPhase)[keyof typeof HammerPhase];
1032
+ /** Options for {@link DicomHammer.create}. */
1033
+ interface DicomHammerOptions {
1034
+ /** Path to the template DICOM file to copy and modify. */
1035
+ readonly sourceFile: string;
1036
+ /** Target SCP hostname or IP. */
1037
+ readonly host: string;
1038
+ /** Target SCP port (1-65535). */
1039
+ readonly port: number;
1040
+ /** Calling AE title. Defaults to `'HAMMER'`. */
1041
+ readonly callingAETitle?: string | undefined;
1042
+ /** Called AE title. Defaults to `'ANY-SCP'`. */
1043
+ readonly calledAETitle?: string | undefined;
1044
+ /** Number of DICOM file copies to generate. Range 1-100000. Defaults to 100. */
1045
+ readonly fileCount?: number | undefined;
1046
+ /** Max parallel operations for both generate and send phases. Range 1-64. Defaults to 4. */
1047
+ readonly concurrency?: number | undefined;
1048
+ /** Delay in milliseconds between each send. 0 means flood. Defaults to 0. */
1049
+ readonly delayMs?: number | undefined;
1050
+ /** Institution Name tag value to stamp on each copy. */
1051
+ readonly institution?: string | undefined;
1052
+ /** Erase all private tags from generated copies. Defaults to false. */
1053
+ readonly erasePrivateTags?: boolean | undefined;
1054
+ /** Additional tag modifications to apply to each copy. */
1055
+ readonly modifications?: readonly TagModification[] | undefined;
1056
+ /** Per-send timeout in milliseconds. */
1057
+ readonly timeoutMs?: number | undefined;
1058
+ /** AbortSignal for cancellation. */
1059
+ readonly signal?: AbortSignal | undefined;
1060
+ /** Directory for generated files. Defaults to `os.tmpdir()`. */
1061
+ readonly outputDir?: string | undefined;
1062
+ /** Pass `--no-halt` to dcmsend (continue on errors). Defaults to true. */
1063
+ readonly noHalt?: boolean | undefined;
1064
+ }
1065
+ /** Result of the file generation phase. */
1066
+ interface GenerateResult {
1067
+ /** Paths to all generated DICOM files. */
1068
+ readonly files: readonly string[];
1069
+ /** Duration of file generation in milliseconds. */
1070
+ readonly durationMs: number;
1071
+ /** Directory containing generated files. */
1072
+ readonly outputDir: string;
1073
+ }
1074
+ /** A single send failure. */
1075
+ interface HammerError {
1076
+ /** Path to the file that failed to send. */
1077
+ readonly file: string;
1078
+ /** The error that occurred. */
1079
+ readonly error: Error;
1080
+ }
1081
+ /** Result of the send phase. */
1082
+ interface HammerSendResult {
1083
+ /** Number of successfully sent files. */
1084
+ readonly succeeded: number;
1085
+ /** Number of failed sends. */
1086
+ readonly failed: number;
1087
+ /** Total files attempted. */
1088
+ readonly totalFiles: number;
1089
+ /** Duration of send phase in milliseconds. */
1090
+ readonly durationMs: number;
1091
+ /** Throughput in files per second. */
1092
+ readonly filesPerSec: number;
1093
+ /** Throughput in bytes per second. */
1094
+ readonly bytesPerSec: number;
1095
+ /** Total bytes sent (succeeded files only). */
1096
+ readonly totalBytes: number;
1097
+ /** Details of each failed send. */
1098
+ readonly errors: readonly HammerError[];
1099
+ }
1100
+ /** Combined result of generate + send phases. */
1101
+ interface HammerResult {
1102
+ /** Number of successfully sent files. */
1103
+ readonly succeeded: number;
1104
+ /** Number of failed sends. */
1105
+ readonly failed: number;
1106
+ /** Total files attempted. */
1107
+ readonly totalFiles: number;
1108
+ /** Total duration (generate + send) in milliseconds. */
1109
+ readonly durationMs: number;
1110
+ /** Duration of the generate phase in milliseconds. */
1111
+ readonly generateDurationMs: number;
1112
+ /** Duration of the send phase in milliseconds. */
1113
+ readonly sendDurationMs: number;
1114
+ /** Throughput in files per second (send phase only). */
1115
+ readonly filesPerSec: number;
1116
+ /** Throughput in bytes per second (send phase only). */
1117
+ readonly bytesPerSec: number;
1118
+ /** Total bytes sent (succeeded files only). */
1119
+ readonly totalBytes: number;
1120
+ /** Details of each failed send. */
1121
+ readonly errors: readonly HammerError[];
1122
+ }
1123
+ /** Event map for DicomHammer typed events. */
1124
+ interface DicomHammerEventMap {
1125
+ FILE_GENERATED: [{
1126
+ readonly index: number;
1127
+ readonly total: number;
1128
+ readonly filePath: string;
1129
+ }];
1130
+ SEND_COMPLETE: [{
1131
+ readonly index: number;
1132
+ readonly total: number;
1133
+ readonly file: string;
1134
+ readonly durationMs: number;
1135
+ }];
1136
+ SEND_FAILED: [{
1137
+ readonly index: number;
1138
+ readonly total: number;
1139
+ readonly file: string;
1140
+ readonly error: Error;
1141
+ }];
1142
+ PROGRESS: [{
1143
+ readonly phase: HammerPhaseValue;
1144
+ readonly completed: number;
1145
+ readonly total: number;
1146
+ readonly percent: number;
1147
+ }];
1148
+ RUN_COMPLETE: [HammerResult];
1149
+ error: [{
1150
+ readonly error: Error;
1151
+ }];
1152
+ }
1153
+
1154
+ /**
1155
+ * DICOM load testing tool.
1156
+ *
1157
+ * Generates N copies of a template DICOM file with unique UIDs, sends them
1158
+ * to a target SCP with configurable concurrency, and reports throughput.
1159
+ *
1160
+ * @module testing/DicomHammer
1161
+ */
1162
+
1163
+ /**
1164
+ * DICOM load testing tool.
1165
+ *
1166
+ * Generates modified copies of a template DICOM file and sends them to a
1167
+ * target SCP to stress test its capacity.
1168
+ *
1169
+ * @example
1170
+ * ```ts
1171
+ * const result = DicomHammer.create({
1172
+ * sourceFile: '/path/to/template.dcm',
1173
+ * host: '127.0.0.1',
1174
+ * port: 8104,
1175
+ * fileCount: 1000,
1176
+ * concurrency: 8,
1177
+ * });
1178
+ * if (!result.ok) { console.error(result.error.message); return; }
1179
+ * const hammer = result.value;
1180
+ *
1181
+ * hammer.onProgress(data => console.log(`${data.phase}: ${data.completed}/${data.total}`));
1182
+ * const runResult = await hammer.run();
1183
+ * if (runResult.ok) console.log(`${runResult.value.filesPerSec} files/sec`);
1184
+ * await hammer.cleanup();
1185
+ * ```
1186
+ */
1187
+ declare class DicomHammer extends EventEmitter<DicomHammerEventMap> {
1188
+ private readonly opts;
1189
+ private generatedDir;
1190
+ private generatedFiles;
1191
+ private constructor();
1192
+ /**
1193
+ * Creates a DicomHammer instance.
1194
+ *
1195
+ * @param options - Configuration for file generation and sending
1196
+ * @returns A Result containing the DicomHammer or a validation error
1197
+ */
1198
+ static create(options: DicomHammerOptions): Result<DicomHammer>;
1199
+ /**
1200
+ * Generates modified copies of the source DICOM file.
1201
+ *
1202
+ * Each copy receives unique Study/Series/SOP Instance UIDs, a unique
1203
+ * accession number, and any custom modifications.
1204
+ */
1205
+ generate(): Promise<Result<GenerateResult>>;
1206
+ /** Generates a single modified copy. Extracted for function size compliance. */
1207
+ private generateOneFile;
1208
+ /**
1209
+ * Sends files to the target SCP.
1210
+ *
1211
+ * @param files - Files to send. Defaults to previously generated files.
1212
+ */
1213
+ send(files?: readonly string[]): Promise<Result<HammerSendResult>>;
1214
+ /** Tracks a single send result for progress reporting. */
1215
+ private trackSendProgress;
1216
+ /** Assembles the final HammerSendResult. */
1217
+ private buildSendResult;
1218
+ /** Sends a single file, with optional delay. */
1219
+ private sendOneFile;
1220
+ /** Gets the file size in bytes, returning 0 on error. */
1221
+ private getFileSize;
1222
+ /**
1223
+ * Generates files and sends them in one call.
1224
+ *
1225
+ * @returns Combined result with timing for both phases
1226
+ */
1227
+ run(): Promise<Result<HammerResult>>;
1228
+ /** Removes all generated files and the output directory. */
1229
+ cleanup(): Promise<Result<void>>;
1230
+ /** Emits a PROGRESS event. */
1231
+ private emitProgress;
1232
+ /** Registers a listener for FILE_GENERATED events. */
1233
+ onFileGenerated(listener: (data: DicomHammerEventMap['FILE_GENERATED'][0]) => void): this;
1234
+ /** Registers a listener for SEND_COMPLETE events. */
1235
+ onSendComplete(listener: (data: DicomHammerEventMap['SEND_COMPLETE'][0]) => void): this;
1236
+ /** Registers a listener for SEND_FAILED events. */
1237
+ onSendFailed(listener: (data: DicomHammerEventMap['SEND_FAILED'][0]) => void): this;
1238
+ /** Registers a listener for PROGRESS events. */
1239
+ onProgress(listener: (data: DicomHammerEventMap['PROGRESS'][0]) => void): this;
1240
+ /** Registers a listener for RUN_COMPLETE events. */
1241
+ onRunComplete(listener: (data: DicomHammerEventMap['RUN_COMPLETE'][0]) => void): this;
1242
+ }
1243
+
1244
+ export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, type DcmsendSendOptions, DcmtkProcessResult, DicomDataset, DicomHammer, type DicomHammerEventMap, type DicomHammerOptions, DicomSend, type DicomSendEventMap, type DicomSendOptions, DicomSender, type DicomSenderEventMap, type DicomSenderOptions, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type GenerateResult, type HammerError, HammerPhase, type HammerPhaseValue, type HammerResult, type HammerSendResult, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, ProposedTransferSyntaxValue, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SendOptions, type SendResult, type SenderBucketFlushedData, type SenderErrorData, SenderHealth, type SenderHealthChangedData, type SenderHealthValue, SenderMode, type SenderModeValue, type SenderSendCompleteData, type SenderSendFailedData, type SenderStatus, type SeriesFilter, SpawnOptions, type StudyFilter, TagModification, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ import { A as AETitle, D as DicomTag, a as DicomTagPath, P as Port, S as SOPClas
4
4
  export { B as Brand, C as ChangeSet, c as DicomFilePath, d as DicomInstance, e as DicomOpenOptions, W as WalkTagEntry, f as WalkTagsOptions, g as createAETitle, h as createDicomFilePath, i as createDicomTag, j as createDicomTagPath, k as createPort, l as createSOPClassUID, m as createTransferSyntaxUID, t as tag, w as walkTags } from './DicomInstance-BKUiir0G.js';
5
5
  import { z } from 'zod';
6
6
  export { A as AssociationAcknowledgedData, a as AssociationCompleteData, b as AssociationContext, c as AssociationReceivedData, d as AssociationSummary, e as AssociationTracker, C as CStoreRequestData, f as CannotStartListenerData, g as ConfigErrorData, D as DCMPRSCP_FATAL_EVENTS, h as DCMPRSCP_PATTERNS, i as DCMPSRCV_FATAL_EVENTS, j as DCMPSRCV_PATTERNS, k as DCMQRSCP_FATAL_EVENTS, l as DCMQRSCP_PATTERNS, m as DCMRECV_FATAL_EVENTS, n as DCMRECV_PATTERNS, o as DatabaseReadyData, p as DcmQRSCP, q as DcmQRSCPEventMap, r as DcmQRSCPOptions, s as DcmprsCP, t as DcmprsCPEventMap, u as DcmprsCPOptions, v as DcmprscpEvent, w as DcmprscpEventValue, x as Dcmpsrcv, y as DcmpsrcvEvent, z as DcmpsrcvEventMap, B as DcmpsrcvEventValue, E as DcmpsrcvOptions, F as DcmqrscpEvent, G as DcmqrscpEventValue, H as Dcmrecv, I as DcmrecvEvent, J as DcmrecvEventMap, K as DcmrecvEventValue, L as DcmrecvOptions, M as DcmtkProcess, N as DcmtkProcessConfig, O as DcmtkProcessEventMap, P as DicomReceiver, Q as DicomReceiverEventMap, R as DicomReceiverOptions, S as EventPattern, T as FileDeletedData, U as FileReceivedData, V as FilenameMode, W as FilenameModeValue, X as LineParser, Y as LineParserEventMap, Z as MultiLineConfig, _ as PoolAssociationReceivedData, $ as PoolCStoreRequestData, a0 as PoolEchoRequestData, a1 as PoolRefusingAssociationData, a2 as PoolStatus, a3 as PreferredTransferSyntax, a4 as PreferredTransferSyntaxValue, a5 as PrintAssociationAcknowledgedData, a6 as PrintAssociationReceivedData, a7 as PrintCannotStartListenerData, a8 as ProcessState, a9 as ProcessStateValue, aa as QRAssociationAcknowledgedData, ab as QRAssociationReceivedData, ac as QRCFindRequestData, ad as QRCGetRequestData, ae as QRCMoveRequestData, af as QRCStoreRequestData, ag as QRCannotStartListenerData, ah as QRListeningData, ai as ReceiverAssociationAcknowledgedData, aj as ReceiverAssociationData, ak as ReceiverAssociationReceivedData, al as ReceiverCStoreRequestData, am as ReceiverCannotStartListenerData, an as ReceiverConfigErrorData, ao as ReceiverDatabaseReadyData, ap as ReceiverEchoRequestData, aq as ReceiverErrorData, ar as ReceiverFileData, as as ReceiverListeningData, at as RefusingAssociationData, au as STORESCP_FATAL_EVENTS, av as STORESCP_PATTERNS, aw as StorageMode, ax as StorageModeValue, ay as StoreSCP, az as StoreSCPEventMap, aA as StoreSCPOptions, aB as StoreSCPPreset, aC as StoreSCPPresetName, aD as StoredFileData, aE as StorescpEvent, aF as StorescpEventValue, aG as StoringFileData, aH as SubdirectoryCreatedData, aI as SubdirectoryMode, aJ as SubdirectoryModeValue, aK as TrackedFile, aL as WLMSCPFS_FATAL_EVENTS, aM as WLMSCPFS_PATTERNS, aN as WlmAssociationAcknowledgedData, aO as WlmAssociationReceivedData, aP as WlmCFindRequestData, aQ as WlmCannotStartListenerData, aR as WlmListeningData, aS as Wlmscpfs, aT as WlmscpfsEvent, aU as WlmscpfsEventMap, aV as WlmscpfsEventValue, aW as WlmscpfsOptions } from './index-CCgNgve7.js';
7
- export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, T as TagModification, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-CHvwChFu.js';
7
+ import { T as TagModification } from './dcmodify-CHvwChFu.js';
8
+ export { b as DcmodifyOptions, c as DcmodifyResult, D as DicomJsonElement, a as DicomJsonModel, d as ToolBaseOptions, e as dcmodify, x as xmlToJson } from './dcmodify-CHvwChFu.js';
8
9
  export { DictionaryEntry, SOPClassName, SOP_CLASSES, TagSegment, VR, VRCategoryName, VRMetadata, VRValue, VR_CATEGORY, VR_CATEGORY_NAME, VR_META, getVRCategory, isBinaryVR, isNumericVR, isStringVR, lookupTag, lookupTagByKeyword, lookupTagByName, segmentsToModifyPath, segmentsToString, sopClassNameFromUID, tagPathToSegments } from './dicom.js';
9
10
  import { ProposedTransferSyntaxValue } from './tools.js';
10
11
  export { Cda2dcmOptions, Cda2dcmResult, ColorConversion, ColorConversionValue, Dcm2cdaOptions, Dcm2cdaResult, Dcm2jsonOptions, Dcm2jsonResult, Dcm2jsonSource, Dcm2pdfOptions, Dcm2pdfResult, Dcm2pnmOptions, Dcm2pnmOutputFormat, Dcm2pnmOutputFormatValue, Dcm2pnmResult, Dcm2xmlCharset, Dcm2xmlCharsetValue, Dcm2xmlOptions, Dcm2xmlResult, DcmcjpegOptions, DcmcjpegResult, DcmcjplsOptions, DcmcjplsResult, DcmconvOptions, DcmconvResult, DcmcrleOptions, DcmcrleResult, DcmdecapOptions, DcmdecapResult, DcmdjpegOptions, DcmdjpegResult, DcmdjplsOptions, DcmdjplsResult, DcmdrleOptions, DcmdrleResult, DcmdspfnOptions, DcmdspfnResult, DcmdumpFormat, DcmdumpFormatValue, DcmdumpOptions, DcmdumpResult, DcmencapOptions, DcmencapResult, DcmftestOptions, DcmftestResult, DcmgpdirOptions, DcmgpdirResult, Dcmj2pnmOptions, Dcmj2pnmOutputFormat, Dcmj2pnmOutputFormatValue, Dcmj2pnmResult, DcmmkcrvOptions, DcmmkcrvResult, DcmmkdirOptions, DcmmkdirResult, DcmmklutOptions, DcmmklutResult, Dcmp2pgmOptions, Dcmp2pgmResult, DcmprscuOptions, DcmprscuResult, DcmpschkOptions, DcmpschkResult, DcmpsmkOptions, DcmpsmkResult, DcmpsprtOptions, DcmpsprtResult, DcmqridxOptions, DcmqridxResult, DcmquantOptions, DcmquantResult, DcmscaleOptions, DcmscaleResult, DcmsendOptions, DcmsendResult, Dcod2lumOptions, Dcod2lumResult, DconvlumOptions, DconvlumResult, DrtdumpOptions, DrtdumpResult, Dsr2xmlOptions, Dsr2xmlResult, DsrdumpOptions, DsrdumpResult, Dump2dcmOptions, Dump2dcmResult, EchoscuOptions, EchoscuResult, FindscuOptions, FindscuResult, GetQueryModel, GetQueryModelValue, GetscuOptions, GetscuResult, Img2dcmInputFormat, Img2dcmInputFormatValue, Img2dcmOptions, Img2dcmResult, JplsColorConversion, JplsColorConversionValue, Json2dcmOptions, Json2dcmResult, LutType, LutTypeValue, MoveQueryModel, MoveQueryModelValue, MovescuOptions, MovescuResult, Pdf2dcmOptions, Pdf2dcmResult, ProposedTransferSyntax, QueryModel, QueryModelValue, Stl2dcmOptions, Stl2dcmResult, StorescuOptions, StorescuResult, TermscuOptions, TermscuResult, TransferSyntax, TransferSyntaxValue, Xml2dcmOptions, Xml2dcmResult, Xml2dsrOptions, Xml2dsrResult, cda2dcm, dcm2cda, dcm2json, dcm2pdf, dcm2pnm, dcm2xml, dcmcjpeg, dcmcjpls, dcmconv, dcmcrle, dcmdecap, dcmdjpeg, dcmdjpls, dcmdrle, dcmdspfn, dcmdump, dcmencap, dcmftest, dcmgpdir, dcmj2pnm, dcmmkcrv, dcmmkdir, dcmmklut, dcmp2pgm, dcmprscu, dcmpschk, dcmpsmk, dcmpsprt, dcmqridx, dcmquant, dcmscale, dcmsend, dcod2lum, dconvlum, drtdump, dsr2xml, dsrdump, dump2dcm, echoscu, findscu, getscu, img2dcm, json2dcm, movescu, pdf2dcm, stl2dcm, storescu, termscu, xml2dcm, xml2dsr } from './tools.js';
@@ -1014,4 +1015,230 @@ declare class PacsClient {
1014
1015
  private executeCMove;
1015
1016
  }
1016
1017
 
1017
- export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, type DcmsendSendOptions, DcmtkProcessResult, DicomDataset, DicomSend, type DicomSendEventMap, type DicomSendOptions, DicomSender, type DicomSenderEventMap, type DicomSenderOptions, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, ProposedTransferSyntaxValue, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SendOptions, type SendResult, type SenderBucketFlushedData, type SenderErrorData, SenderHealth, type SenderHealthChangedData, type SenderHealthValue, SenderMode, type SenderModeValue, type SenderSendCompleteData, type SenderSendFailedData, type SenderStatus, type SeriesFilter, SpawnOptions, type StudyFilter, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };
1018
+ /**
1019
+ * Types for the DicomHammer load testing tool.
1020
+ *
1021
+ * @module testing/types
1022
+ */
1023
+
1024
+ /** Phases of a DicomHammer run. */
1025
+ declare const HammerPhase: {
1026
+ /** File generation phase (copy + modify). */
1027
+ readonly GENERATE: "generate";
1028
+ /** File sending phase (dcmsend). */
1029
+ readonly SEND: "send";
1030
+ };
1031
+ type HammerPhaseValue = (typeof HammerPhase)[keyof typeof HammerPhase];
1032
+ /** Options for {@link DicomHammer.create}. */
1033
+ interface DicomHammerOptions {
1034
+ /** Path to the template DICOM file to copy and modify. */
1035
+ readonly sourceFile: string;
1036
+ /** Target SCP hostname or IP. */
1037
+ readonly host: string;
1038
+ /** Target SCP port (1-65535). */
1039
+ readonly port: number;
1040
+ /** Calling AE title. Defaults to `'HAMMER'`. */
1041
+ readonly callingAETitle?: string | undefined;
1042
+ /** Called AE title. Defaults to `'ANY-SCP'`. */
1043
+ readonly calledAETitle?: string | undefined;
1044
+ /** Number of DICOM file copies to generate. Range 1-100000. Defaults to 100. */
1045
+ readonly fileCount?: number | undefined;
1046
+ /** Max parallel operations for both generate and send phases. Range 1-64. Defaults to 4. */
1047
+ readonly concurrency?: number | undefined;
1048
+ /** Delay in milliseconds between each send. 0 means flood. Defaults to 0. */
1049
+ readonly delayMs?: number | undefined;
1050
+ /** Institution Name tag value to stamp on each copy. */
1051
+ readonly institution?: string | undefined;
1052
+ /** Erase all private tags from generated copies. Defaults to false. */
1053
+ readonly erasePrivateTags?: boolean | undefined;
1054
+ /** Additional tag modifications to apply to each copy. */
1055
+ readonly modifications?: readonly TagModification[] | undefined;
1056
+ /** Per-send timeout in milliseconds. */
1057
+ readonly timeoutMs?: number | undefined;
1058
+ /** AbortSignal for cancellation. */
1059
+ readonly signal?: AbortSignal | undefined;
1060
+ /** Directory for generated files. Defaults to `os.tmpdir()`. */
1061
+ readonly outputDir?: string | undefined;
1062
+ /** Pass `--no-halt` to dcmsend (continue on errors). Defaults to true. */
1063
+ readonly noHalt?: boolean | undefined;
1064
+ }
1065
+ /** Result of the file generation phase. */
1066
+ interface GenerateResult {
1067
+ /** Paths to all generated DICOM files. */
1068
+ readonly files: readonly string[];
1069
+ /** Duration of file generation in milliseconds. */
1070
+ readonly durationMs: number;
1071
+ /** Directory containing generated files. */
1072
+ readonly outputDir: string;
1073
+ }
1074
+ /** A single send failure. */
1075
+ interface HammerError {
1076
+ /** Path to the file that failed to send. */
1077
+ readonly file: string;
1078
+ /** The error that occurred. */
1079
+ readonly error: Error;
1080
+ }
1081
+ /** Result of the send phase. */
1082
+ interface HammerSendResult {
1083
+ /** Number of successfully sent files. */
1084
+ readonly succeeded: number;
1085
+ /** Number of failed sends. */
1086
+ readonly failed: number;
1087
+ /** Total files attempted. */
1088
+ readonly totalFiles: number;
1089
+ /** Duration of send phase in milliseconds. */
1090
+ readonly durationMs: number;
1091
+ /** Throughput in files per second. */
1092
+ readonly filesPerSec: number;
1093
+ /** Throughput in bytes per second. */
1094
+ readonly bytesPerSec: number;
1095
+ /** Total bytes sent (succeeded files only). */
1096
+ readonly totalBytes: number;
1097
+ /** Details of each failed send. */
1098
+ readonly errors: readonly HammerError[];
1099
+ }
1100
+ /** Combined result of generate + send phases. */
1101
+ interface HammerResult {
1102
+ /** Number of successfully sent files. */
1103
+ readonly succeeded: number;
1104
+ /** Number of failed sends. */
1105
+ readonly failed: number;
1106
+ /** Total files attempted. */
1107
+ readonly totalFiles: number;
1108
+ /** Total duration (generate + send) in milliseconds. */
1109
+ readonly durationMs: number;
1110
+ /** Duration of the generate phase in milliseconds. */
1111
+ readonly generateDurationMs: number;
1112
+ /** Duration of the send phase in milliseconds. */
1113
+ readonly sendDurationMs: number;
1114
+ /** Throughput in files per second (send phase only). */
1115
+ readonly filesPerSec: number;
1116
+ /** Throughput in bytes per second (send phase only). */
1117
+ readonly bytesPerSec: number;
1118
+ /** Total bytes sent (succeeded files only). */
1119
+ readonly totalBytes: number;
1120
+ /** Details of each failed send. */
1121
+ readonly errors: readonly HammerError[];
1122
+ }
1123
+ /** Event map for DicomHammer typed events. */
1124
+ interface DicomHammerEventMap {
1125
+ FILE_GENERATED: [{
1126
+ readonly index: number;
1127
+ readonly total: number;
1128
+ readonly filePath: string;
1129
+ }];
1130
+ SEND_COMPLETE: [{
1131
+ readonly index: number;
1132
+ readonly total: number;
1133
+ readonly file: string;
1134
+ readonly durationMs: number;
1135
+ }];
1136
+ SEND_FAILED: [{
1137
+ readonly index: number;
1138
+ readonly total: number;
1139
+ readonly file: string;
1140
+ readonly error: Error;
1141
+ }];
1142
+ PROGRESS: [{
1143
+ readonly phase: HammerPhaseValue;
1144
+ readonly completed: number;
1145
+ readonly total: number;
1146
+ readonly percent: number;
1147
+ }];
1148
+ RUN_COMPLETE: [HammerResult];
1149
+ error: [{
1150
+ readonly error: Error;
1151
+ }];
1152
+ }
1153
+
1154
+ /**
1155
+ * DICOM load testing tool.
1156
+ *
1157
+ * Generates N copies of a template DICOM file with unique UIDs, sends them
1158
+ * to a target SCP with configurable concurrency, and reports throughput.
1159
+ *
1160
+ * @module testing/DicomHammer
1161
+ */
1162
+
1163
+ /**
1164
+ * DICOM load testing tool.
1165
+ *
1166
+ * Generates modified copies of a template DICOM file and sends them to a
1167
+ * target SCP to stress test its capacity.
1168
+ *
1169
+ * @example
1170
+ * ```ts
1171
+ * const result = DicomHammer.create({
1172
+ * sourceFile: '/path/to/template.dcm',
1173
+ * host: '127.0.0.1',
1174
+ * port: 8104,
1175
+ * fileCount: 1000,
1176
+ * concurrency: 8,
1177
+ * });
1178
+ * if (!result.ok) { console.error(result.error.message); return; }
1179
+ * const hammer = result.value;
1180
+ *
1181
+ * hammer.onProgress(data => console.log(`${data.phase}: ${data.completed}/${data.total}`));
1182
+ * const runResult = await hammer.run();
1183
+ * if (runResult.ok) console.log(`${runResult.value.filesPerSec} files/sec`);
1184
+ * await hammer.cleanup();
1185
+ * ```
1186
+ */
1187
+ declare class DicomHammer extends EventEmitter<DicomHammerEventMap> {
1188
+ private readonly opts;
1189
+ private generatedDir;
1190
+ private generatedFiles;
1191
+ private constructor();
1192
+ /**
1193
+ * Creates a DicomHammer instance.
1194
+ *
1195
+ * @param options - Configuration for file generation and sending
1196
+ * @returns A Result containing the DicomHammer or a validation error
1197
+ */
1198
+ static create(options: DicomHammerOptions): Result<DicomHammer>;
1199
+ /**
1200
+ * Generates modified copies of the source DICOM file.
1201
+ *
1202
+ * Each copy receives unique Study/Series/SOP Instance UIDs, a unique
1203
+ * accession number, and any custom modifications.
1204
+ */
1205
+ generate(): Promise<Result<GenerateResult>>;
1206
+ /** Generates a single modified copy. Extracted for function size compliance. */
1207
+ private generateOneFile;
1208
+ /**
1209
+ * Sends files to the target SCP.
1210
+ *
1211
+ * @param files - Files to send. Defaults to previously generated files.
1212
+ */
1213
+ send(files?: readonly string[]): Promise<Result<HammerSendResult>>;
1214
+ /** Tracks a single send result for progress reporting. */
1215
+ private trackSendProgress;
1216
+ /** Assembles the final HammerSendResult. */
1217
+ private buildSendResult;
1218
+ /** Sends a single file, with optional delay. */
1219
+ private sendOneFile;
1220
+ /** Gets the file size in bytes, returning 0 on error. */
1221
+ private getFileSize;
1222
+ /**
1223
+ * Generates files and sends them in one call.
1224
+ *
1225
+ * @returns Combined result with timing for both phases
1226
+ */
1227
+ run(): Promise<Result<HammerResult>>;
1228
+ /** Removes all generated files and the output directory. */
1229
+ cleanup(): Promise<Result<void>>;
1230
+ /** Emits a PROGRESS event. */
1231
+ private emitProgress;
1232
+ /** Registers a listener for FILE_GENERATED events. */
1233
+ onFileGenerated(listener: (data: DicomHammerEventMap['FILE_GENERATED'][0]) => void): this;
1234
+ /** Registers a listener for SEND_COMPLETE events. */
1235
+ onSendComplete(listener: (data: DicomHammerEventMap['SEND_COMPLETE'][0]) => void): this;
1236
+ /** Registers a listener for SEND_FAILED events. */
1237
+ onSendFailed(listener: (data: DicomHammerEventMap['SEND_FAILED'][0]) => void): this;
1238
+ /** Registers a listener for PROGRESS events. */
1239
+ onProgress(listener: (data: DicomHammerEventMap['PROGRESS'][0]) => void): this;
1240
+ /** Registers a listener for RUN_COMPLETE events. */
1241
+ onRunComplete(listener: (data: DicomHammerEventMap['RUN_COMPLETE'][0]) => void): this;
1242
+ }
1243
+
1244
+ export { AETitle, AETitleSchema, DEFAULT_BLOCK_TIMEOUT_MS, DEFAULT_DICOM_PORT, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_PARSE_CONCURRENCY, DEFAULT_START_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, type DcmsendSendOptions, DcmtkProcessResult, DicomDataset, DicomHammer, type DicomHammerEventMap, type DicomHammerOptions, DicomSend, type DicomSendEventMap, type DicomSendOptions, DicomSender, type DicomSenderEventMap, type DicomSenderOptions, DicomTag, DicomTagPath, DicomTagPathSchema, DicomTagSchema, ExecOptions, type FindDcmtkPathOptions, type GenerateResult, type HammerError, HammerPhase, type HammerPhaseValue, type HammerResult, type HammerSendResult, type ImageFilter, MAX_BLOCK_LINES, MAX_CHANGESET_OPERATIONS, MAX_EVENT_PATTERNS, MAX_TRAVERSAL_DEPTH, PDU_SIZE, PacsClient, type PacsClientConfig, type PacsEchoOptions, type PacsEchoResult, type PacsMethodOptions, type PacsQueryOptions, type PacsQueryResult, type PacsRetrieveOptions, type PacsRetrieveResult, type PacsStoreOptions, type PacsStoreResult, Port, PortSchema, ProposedTransferSyntaxValue, QueryLevel, type QueryLevelValue, REQUIRED_BINARIES, Result, RetrieveMode, type RetrieveModeValue, SOPClassUID, type SendOptions, type SendResult, type SenderBucketFlushedData, type SenderErrorData, SenderHealth, type SenderHealthChangedData, type SenderHealthValue, SenderMode, type SenderModeValue, type SenderSendCompleteData, type SenderSendFailedData, type SenderStatus, type SeriesFilter, SpawnOptions, type StudyFilter, TagModification, TransferSyntaxUID, UIDSchema, UNIX_SEARCH_PATHS, WINDOWS_SEARCH_PATHS, type WorklistFilter, clearDcmtkPathCache, execCommand, findDcmtkPath, parseAETitle, parseDicomTag, parseDicomTagPath, parsePort, parseSOPClassUID, parseTransferSyntaxUID, spawnCommand };