@dcmjs-org/dcmjs 0.0.0-bootstrap.0 → 1.0.0-beta.10

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.
@@ -0,0 +1,1128 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dcmjs = require('./dcmjs.shared-CvR7StGL.cjs');
6
+ var parser = require('@dcmjs-org/parser');
7
+ var core = require('@dcmjs-org/core');
8
+ var encapsulated = require('@dcmjs-org/encapsulated');
9
+ var imaging = require('@dcmjs-org/imaging');
10
+ var video = require('@dcmjs-org/video');
11
+
12
+ /**
13
+ * Part10Writer — slice E2: an event-stream sink that produces DICOM Part 10
14
+ * bytes.
15
+ *
16
+ * Architecture: this is a thin LAYER over the canonical encoder, not a second
17
+ * encoder. It collects the event stream into a tag-keyed `{ meta, dict }` tree
18
+ * (reusing CollectorListener) and delegates serialization to core's
19
+ * `writePart10` (the proven Part 10 envelope, relocated from legacy
20
+ * `DicomDict.write()`), which handles every VR, undefined-length sequences,
21
+ * deflate, padding, Big16, and FileMetaInformationGroupLength recomputation.
22
+ * This closed the one temporary `@dcmjs-org/legacy` edge this package had.
23
+ *
24
+ * Byte-IDENTICAL Part 10 round-tripping (incl. re-emitting compressed pixel data
25
+ * verbatim) is intentionally NOT this path's job — that is a non-goal of the
26
+ * naturalized/event layer (spec §4.5) and remains served by the lazy-read +
27
+ * R4 passthrough-write path. This writer produces correct, semantically faithful
28
+ * Part 10 output from any event source.
29
+ */
30
+ var Part10Writer = /*#__PURE__*/function (_CollectorListener) {
31
+ function Part10Writer() {
32
+ dcmjs._classCallCheck(this, Part10Writer);
33
+ return dcmjs._callSuper(this, Part10Writer, arguments);
34
+ }
35
+ dcmjs._inherits(Part10Writer, _CollectorListener);
36
+ return dcmjs._createClass(Part10Writer, [{
37
+ key: "write",
38
+ value:
39
+ /**
40
+ * Serialize the collected dataset to a Part 10 ArrayBuffer.
41
+ * @param {Object} [writeOptions] forwarded to writePart10
42
+ * @returns {ArrayBuffer}
43
+ */
44
+ function write(writeOptions) {
45
+ var meta = dcmjs._objectSpread2({}, this.result.meta);
46
+ // writePart10 recomputes the group length; drop any collected one so
47
+ // it is not double-counted.
48
+ delete meta["00020000"];
49
+ var dataSet = {
50
+ meta: meta,
51
+ dict: this.result.dict
52
+ };
53
+ return writeOptions ? core.writePart10(dataSet, writeOptions) : core.writePart10(dataSet);
54
+ }
55
+ }]);
56
+ }(parser.CollectorListener);
57
+
58
+ /**
59
+ * DicomWebJsonWriter — slice E1: an event-stream consumer that writes the
60
+ * DICOM JSON model (DICOMweb metadata representation).
61
+ *
62
+ * The faithful inverse of `fromDicomWebJson`: it makes the contract a SINK as
63
+ * well as a source, so the architecture round-trips
64
+ * (DICOMweb JSON -> events -> DICOMweb JSON is identity) and any source can be
65
+ * serialized to DICOMweb JSON (Part 10 -> events -> JSON).
66
+ *
67
+ * Output shape per tag: `{ vr, Value: [...] }`, or `{ vr, BulkDataURI }`, or
68
+ * `{ vr, InlineBinary: base64 }`. Person Names pass through as the DICOMweb
69
+ * `{ Alphabetic }` objects the contract carries. Binary source form is preserved
70
+ * (§25): a `bulkDataReference` stays a `BulkDataURI`; assembled binary fragments
71
+ * become base64 `InlineBinary`. Meta (group 0002) elements, when present, are
72
+ * written flat alongside the dataset.
73
+ */
74
+ var DicomWebJsonWriter = /*#__PURE__*/function (_EventStreamListener) {
75
+ function DicomWebJsonWriter() {
76
+ var _this;
77
+ dcmjs._classCallCheck(this, DicomWebJsonWriter);
78
+ for (var _len = arguments.length, filters = new Array(_len), _key = 0; _key < _len; _key++) {
79
+ filters[_key] = arguments[_key];
80
+ }
81
+ _this = dcmjs._callSuper(this, DicomWebJsonWriter, [].concat(filters));
82
+ _this.result = {};
83
+ // Stack of containers (the root object or a sequence item object) plus
84
+ // the element/sequence currently being built.
85
+ _this._containers = [_this.result];
86
+ _this._pending = null; // { tag, attr, fragments? }
87
+ return _this;
88
+ }
89
+ dcmjs._inherits(DicomWebJsonWriter, _EventStreamListener);
90
+ return dcmjs._createClass(DicomWebJsonWriter, [{
91
+ key: "_container",
92
+ value: function _container() {
93
+ return this._containers[this._containers.length - 1];
94
+ }
95
+ }, {
96
+ key: "_baseStartDataSet",
97
+ value: function _baseStartDataSet() {
98
+ this.result = {};
99
+ this._containers = [this.result];
100
+ this._pending = null;
101
+ }
102
+ }, {
103
+ key: "_baseStartElement",
104
+ value: function _baseStartElement(tag) {
105
+ var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
106
+ this._pending = {
107
+ tag: tag,
108
+ attr: {
109
+ vr: info.vr
110
+ },
111
+ values: []
112
+ };
113
+ }
114
+ }, {
115
+ key: "_baseValue",
116
+ value: function _baseValue(v, info) {
117
+ this._pending.values.push(this._jsonModelValue(v, info));
118
+ }
119
+
120
+ /**
121
+ * PS3.18 F.2.3.1: DS/IS may be encoded as JSON numbers OR strings.
122
+ * Emit a number when the conversion is lossless (dcm4chee parity, #53);
123
+ * fall back to the raw source string when Number() would silently lose
124
+ * integer precision — e.g. DS/IS integers beyond 2^53 (#398). The raw
125
+ * string is the standard's escape hatch; `_rawValue` itself never
126
+ * appears in the JSON model (#404).
127
+ */
128
+ }, {
129
+ key: "_jsonModelValue",
130
+ value: function _jsonModelValue(v, info) {
131
+ var vr = this._pending.attr.vr;
132
+ if ((vr === "DS" || vr === "IS") && info && typeof info.rawValue === "string") {
133
+ var raw = info.rawValue.trim();
134
+ var parsed = Number(raw);
135
+ if (/^[+-]?\d+$/.test(raw) && !Number.isSafeInteger(parsed) && String(parsed) !== raw) {
136
+ return raw;
137
+ }
138
+ }
139
+ return v;
140
+ }
141
+ }, {
142
+ key: "_baseBulkDataReference",
143
+ value: function _baseBulkDataReference() {
144
+ var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
145
+ this._pending.attr.BulkDataURI = ref.uri;
146
+ this._pending.values = null; // bulk reference carries no Value
147
+ }
148
+ }, {
149
+ key: "_baseStartBinary",
150
+ value: function _baseStartBinary() {
151
+ this._pending.fragments = [];
152
+ this._pending.values = null;
153
+ }
154
+ }, {
155
+ key: "_baseBinaryFragment",
156
+ value: function _baseBinaryFragment(chunk) {
157
+ this._pending.fragments.push(chunk);
158
+ }
159
+ }, {
160
+ key: "_baseEndBinary",
161
+ value: function _baseEndBinary() {
162
+ this._pending.attr.InlineBinary = core.encodeBase64(concatFragments(this._pending.fragments));
163
+ }
164
+ }, {
165
+ key: "_baseEndElement",
166
+ value: function _baseEndElement() {
167
+ var _this$_pending = this._pending,
168
+ tag = _this$_pending.tag,
169
+ attr = _this$_pending.attr,
170
+ values = _this$_pending.values;
171
+ if (values && values.length) {
172
+ attr.Value = values;
173
+ }
174
+ this._container()[tag] = attr;
175
+ this._pending = null;
176
+ }
177
+ }, {
178
+ key: "_baseStartSequence",
179
+ value: function _baseStartSequence(tag) {
180
+ var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
181
+ var attr = {
182
+ vr: info.vr,
183
+ Value: []
184
+ };
185
+ this._container()[tag] = attr;
186
+ this._pending = null;
187
+ // Items are pushed into attr.Value via a sequence marker on the stack.
188
+ this._containers.push({
189
+ __seqValue: attr.Value
190
+ });
191
+ }
192
+ }, {
193
+ key: "_baseStartItem",
194
+ value: function _baseStartItem() {
195
+ var item = {};
196
+ this._container().__seqValue.push(item);
197
+ this._containers.push(item);
198
+ }
199
+ }, {
200
+ key: "_baseEndItem",
201
+ value: function _baseEndItem() {
202
+ this._containers.pop();
203
+ }
204
+ }, {
205
+ key: "_baseEndSequence",
206
+ value: function _baseEndSequence() {
207
+ this._containers.pop();
208
+ }
209
+ }]);
210
+ }(parser.EventStreamListener);
211
+ function concatFragments(fragments) {
212
+ // a view, or a buffer (ArrayBuffer or SharedArrayBuffer)
213
+ var parts = fragments.map(function (f) {
214
+ return ArrayBuffer.isView(f) ? new Uint8Array(f.buffer, f.byteOffset, f.byteLength) : new Uint8Array(f);
215
+ });
216
+ var total = parts.reduce(function (n, p) {
217
+ return n + p.length;
218
+ }, 0);
219
+ var out = new Uint8Array(total);
220
+ var off = 0;
221
+ var _iterator = dcmjs._createForOfIteratorHelper(parts),
222
+ _step;
223
+ try {
224
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
225
+ var p = _step.value;
226
+ out.set(p, off);
227
+ off += p.length;
228
+ }
229
+ } catch (err) {
230
+ _iterator.e(err);
231
+ } finally {
232
+ _iterator.f();
233
+ }
234
+ return out;
235
+ }
236
+
237
+ var FMI_GROUP_LENGTH = "00020000";
238
+ var TRANSFER_SYNTAX_UID = "00020010";
239
+ var UNDEFINED_LENGTH = 0xffffffff;
240
+
241
+ /**
242
+ * StreamingPart10Writer — plan-R2: an event-stream sink that emits DICOM
243
+ * Part 10 bytes incrementally, as events arrive, instead of collecting the
244
+ * whole dataset first like {@link Part10Writer}.
245
+ *
246
+ * Purpose: writing datasets whose Pixel Data does not fit in memory (the
247
+ * R2 trigger — e.g. a Supplement 225 fragmentable video instance measured in
248
+ * tens of GB). Peak memory is bounded by the largest single non-encapsulated
249
+ * element plus the file meta group; encapsulated pixel-data fragments are
250
+ * forwarded chunk-for-chunk and never accumulated.
251
+ *
252
+ * Output contract: `options.onChunk(Uint8Array)` is called zero or more times
253
+ * per event, in file order. Absent `onChunk`, chunks accumulate on
254
+ * `this.chunks` (testing convenience; that mode is NOT streaming). The caller
255
+ * owns backpressure: wire the generator's `setDrain` to the sink that
256
+ * consumes the chunks (e.g. a Node fs write stream's own drain).
257
+ *
258
+ * Encoding decisions (all legal Part 10, all chosen to avoid backpatching):
259
+ * - the file meta group is buffered — it is small and its group length
260
+ * (0002,0000) must be computed over the encoded elements, exactly as
261
+ * DicomDict.write does;
262
+ * - sequences and their items are written with undefined length and closed
263
+ * with item/sequence delimitation items;
264
+ * - encapsulated pixel data is written with undefined length, an empty
265
+ * Basic Offset Table, one item per incoming fragment (odd fragments are
266
+ * padded), and a sequence delimiter.
267
+ *
268
+ * Byte-identical round-tripping remains a non-goal (spec §4.5 / D15): output
269
+ * is correct, semantically faithful Part 10, not a byte-for-byte copy of any
270
+ * source.
271
+ *
272
+ * Not supported (throws): deflated transfer syntax, bulkDataReference events
273
+ * (the bytes are elsewhere — materialize them first), sequences inside the
274
+ * file meta group.
275
+ */
276
+ var StreamingPart10Writer = /*#__PURE__*/function (_EventStreamListener) {
277
+ /**
278
+ * @param {Object} [options]
279
+ * @param {(chunk: Uint8Array) => void} [options.onChunk] - Byte sink;
280
+ * defaults to accumulating on `this.chunks`.
281
+ * @param {Object} [options.writeOptions] - Forwarded to the element
282
+ * encoders (e.g. { allowInvalidVRLength }).
283
+ * @param {...Object} filters - Event-stream filters, as for any listener.
284
+ */
285
+ function StreamingPart10Writer() {
286
+ var _options$onChunk, _options$writeOptions;
287
+ var _this;
288
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
289
+ dcmjs._classCallCheck(this, StreamingPart10Writer);
290
+ for (var _len = arguments.length, filters = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
291
+ filters[_key - 1] = arguments[_key];
292
+ }
293
+ _this = dcmjs._callSuper(this, StreamingPart10Writer, [].concat(filters));
294
+ _this.chunks = [];
295
+ _this._onChunk = (_options$onChunk = options.onChunk) !== null && _options$onChunk !== void 0 ? _options$onChunk : function (chunk) {
296
+ return _this.chunks.push(chunk);
297
+ };
298
+ _this._writeOptions = (_options$writeOptions = options.writeOptions) !== null && _options$writeOptions !== void 0 ? _options$writeOptions : {
299
+ allowInvalidVRLength: false
300
+ };
301
+ _this.bytesWritten = 0;
302
+ _this._inMeta = false;
303
+ _this._meta = {};
304
+ _this._bodySyntax = core.EXPLICIT_LITTLE_ENDIAN;
305
+ _this._current = null;
306
+ _this._encapsulated = false;
307
+ _this.done = false;
308
+ return _this;
309
+ }
310
+
311
+ /**
312
+ * Endianness for every header the writer builds itself (sequence, item,
313
+ * delimiter and encapsulated pixel-data headers). Review finding 5: these
314
+ * were hardcoded little-endian while plain elements followed the body
315
+ * syntax, so an Explicit VR Big Endian file disagreed with itself. File
316
+ * Meta streams do NOT use this — the meta group is always explicit
317
+ * little endian (PS3.10 §7.1).
318
+ * @private
319
+ */
320
+ dcmjs._inherits(StreamingPart10Writer, _EventStreamListener);
321
+ return dcmjs._createClass(StreamingPart10Writer, [{
322
+ key: "_bodyLittleEndian",
323
+ get: function get() {
324
+ return this._bodySyntax !== core.EXPLICIT_BIG_ENDIAN;
325
+ }
326
+
327
+ /** @param {ArrayBuffer|Uint8Array} bytes @private */
328
+ }, {
329
+ key: "_emit",
330
+ value: function _emit(bytes) {
331
+ var chunk = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
332
+ this.bytesWritten += chunk.byteLength;
333
+ this._onChunk(chunk);
334
+ }
335
+
336
+ /** @private */
337
+ }, {
338
+ key: "_emitStream",
339
+ value: function _emitStream(stream) {
340
+ this._emit(stream.getBuffer(0, stream.size));
341
+ }
342
+
343
+ /**
344
+ * Writes a bare tag + 32-bit length, the form shared by item and
345
+ * delimitation items (never a VR).
346
+ * @private
347
+ */
348
+ }, {
349
+ key: "_writeRawTag",
350
+ value: function _writeRawTag(stream, group, element, length) {
351
+ stream.writeUint16(group);
352
+ stream.writeUint16(element);
353
+ stream.writeUint32(length);
354
+ }
355
+
356
+ /**
357
+ * Writes an element header in the long (reserved + 32-bit length) form —
358
+ * the only form needed for the headers this writer emits itself (SQ and
359
+ * encapsulated OB/OW/UN); everything else goes through
360
+ * core's writeTagObject.
361
+ * @private
362
+ */
363
+ }, {
364
+ key: "_writeLongHeader",
365
+ value: function _writeLongHeader(stream, tag, vr, length) {
366
+ stream.writeUint16(parseInt(tag.substring(0, 4), 16));
367
+ stream.writeUint16(parseInt(tag.substring(4, 8), 16));
368
+ if (this._bodySyntax !== core.IMPLICIT_LITTLE_ENDIAN) {
369
+ stream.writeAsciiString(vr);
370
+ stream.writeUint16(0);
371
+ }
372
+ stream.writeUint32(length);
373
+ }
374
+ }, {
375
+ key: "_baseStartDataSet",
376
+ value: function _baseStartDataSet() {}
377
+ }, {
378
+ key: "_baseEndDataSet",
379
+ value: function _baseEndDataSet() {
380
+ this.done = true;
381
+ }
382
+ }, {
383
+ key: "_baseStartFileMetaInformation",
384
+ value: function _baseStartFileMetaInformation() {
385
+ this._inMeta = true;
386
+ var stream = new core.WriteBufferStream(160, true);
387
+ stream.writeUint8Repeat(0, 128);
388
+ stream.writeAsciiString("DICM");
389
+ this._emitStream(stream);
390
+ }
391
+ }, {
392
+ key: "_baseEndFileMetaInformation",
393
+ value: function _baseEndFileMetaInformation() {
394
+ this._inMeta = false;
395
+ if (!this._meta[TRANSFER_SYNTAX_UID]) {
396
+ this._meta[TRANSFER_SYNTAX_UID] = {
397
+ vr: "UI",
398
+ Value: [core.EXPLICIT_LITTLE_ENDIAN]
399
+ };
400
+ }
401
+ this._bodySyntax = this._meta[TRANSFER_SYNTAX_UID].Value[0];
402
+ if (this._bodySyntax === core.DEFLATED_EXPLICIT_LITTLE_ENDIAN) {
403
+ throw new Error("StreamingPart10Writer does not support the deflated " + "transfer syntax; inflate the source or use Part10Writer");
404
+ }
405
+ // Group length must cover the encoded meta elements, so the group is
406
+ // the one part of the file that cannot stream element-by-element.
407
+ delete this._meta[FMI_GROUP_LENGTH];
408
+ var metaStream = new core.WriteBufferStream(1024, true);
409
+ core.writeDataSet(this._meta, metaStream, core.EXPLICIT_LITTLE_ENDIAN, this._writeOptions);
410
+ var out = new core.WriteBufferStream(1024 + 16, true);
411
+ core.writeTagObject(out, FMI_GROUP_LENGTH, "UL", metaStream.size, core.EXPLICIT_LITTLE_ENDIAN, this._writeOptions);
412
+ out.concat(metaStream);
413
+ this._emitStream(out);
414
+ this._meta = {};
415
+ }
416
+ }, {
417
+ key: "_baseStartElement",
418
+ value: function _baseStartElement(tag) {
419
+ var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
420
+ this._current = {
421
+ tag: tag,
422
+ vr: info.vr,
423
+ values: [],
424
+ emitted: false
425
+ };
426
+ }
427
+ }, {
428
+ key: "_baseValue",
429
+ value: function _baseValue(v) {
430
+ this._current.values.push(v);
431
+ }
432
+ }, {
433
+ key: "_baseEndElement",
434
+ value: function _baseEndElement() {
435
+ var el = this._current;
436
+ this._current = null;
437
+ if (el.emitted) {
438
+ return; // encapsulated path already streamed it
439
+ }
440
+ if (this._inMeta) {
441
+ if (el.tag !== FMI_GROUP_LENGTH) {
442
+ this._meta[el.tag] = {
443
+ vr: el.vr,
444
+ Value: el.values
445
+ };
446
+ }
447
+ return;
448
+ }
449
+ var stream = new core.WriteBufferStream(256, this._bodyLittleEndian);
450
+ core.writeTagObject(stream, el.tag, el.vr, el.values, this._bodySyntax, this._writeOptions);
451
+ this._emitStream(stream);
452
+ }
453
+ }, {
454
+ key: "_baseStartBinary",
455
+ value: function _baseStartBinary() {
456
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
457
+ if (opts.encapsulated && this._inMeta) {
458
+ throw new Error("encapsulated binary is not legal in the file meta group");
459
+ }
460
+ if (!opts.encapsulated) {
461
+ // Defined-length binary: fragments accumulate on the element and
462
+ // endElement serializes it whole (bounded by that one element).
463
+ this._encapsulated = false;
464
+ return;
465
+ }
466
+ this._encapsulated = true;
467
+ this._current.emitted = true;
468
+ var stream = new core.WriteBufferStream(24, this._bodyLittleEndian);
469
+ this._writeLongHeader(stream, this._current.tag, this._current.vr || "OB", UNDEFINED_LENGTH);
470
+ // Empty Basic Offset Table: generators emit data fragments only (the
471
+ // source table, if any, indexes source offsets that no longer hold).
472
+ this._writeRawTag(stream, 0xfffe, 0xe000, 0);
473
+ this._emitStream(stream);
474
+ }
475
+ }, {
476
+ key: "_baseBinaryFragment",
477
+ value: function _baseBinaryFragment(chunk) {
478
+ var bytes = chunk instanceof Uint8Array ? chunk : chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
479
+ if (!this._encapsulated) {
480
+ // Review finding 11: bytes.buffer is the WHOLE backing store, so
481
+ // a subarray view would write (and retain) every byte of it.
482
+ // Slice out the view's own window when they differ.
483
+ this._current.values.push(bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength ? bytes.buffer : bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
484
+ return;
485
+ }
486
+ var pad = bytes.byteLength % 2;
487
+ var header = new core.WriteBufferStream(8, this._bodyLittleEndian);
488
+ this._writeRawTag(header, 0xfffe, 0xe000, bytes.byteLength + pad);
489
+ this._emitStream(header);
490
+ this._emit(bytes);
491
+ if (pad) {
492
+ this._emit(new Uint8Array(1));
493
+ }
494
+ }
495
+ }, {
496
+ key: "_baseEndBinary",
497
+ value: function _baseEndBinary() {
498
+ if (this._encapsulated) {
499
+ var stream = new core.WriteBufferStream(8, this._bodyLittleEndian);
500
+ this._writeRawTag(stream, 0xfffe, 0xe0dd, 0);
501
+ this._emitStream(stream);
502
+ this._encapsulated = false;
503
+ }
504
+ }
505
+ }, {
506
+ key: "_baseStartSequence",
507
+ value: function _baseStartSequence(tag) {
508
+ var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
509
+ if (this._inMeta) {
510
+ throw new Error("sequences are not legal in the file meta group");
511
+ }
512
+ // Undefined length streams without backpatching; items and the
513
+ // delimiters below close it out (PS3.5 §7.5).
514
+ var stream = new core.WriteBufferStream(16, this._bodyLittleEndian);
515
+ this._writeLongHeader(stream, tag, info.vr || "SQ", UNDEFINED_LENGTH);
516
+ this._emitStream(stream);
517
+ }
518
+ }, {
519
+ key: "_baseStartItem",
520
+ value: function _baseStartItem() {
521
+ var stream = new core.WriteBufferStream(8, this._bodyLittleEndian);
522
+ this._writeRawTag(stream, 0xfffe, 0xe000, UNDEFINED_LENGTH);
523
+ this._emitStream(stream);
524
+ }
525
+ }, {
526
+ key: "_baseEndItem",
527
+ value: function _baseEndItem() {
528
+ var stream = new core.WriteBufferStream(8, this._bodyLittleEndian);
529
+ this._writeRawTag(stream, 0xfffe, 0xe00d, 0);
530
+ this._emitStream(stream);
531
+ }
532
+ }, {
533
+ key: "_baseEndSequence",
534
+ value: function _baseEndSequence() {
535
+ var stream = new core.WriteBufferStream(8, this._bodyLittleEndian);
536
+ this._writeRawTag(stream, 0xfffe, 0xe0dd, 0);
537
+ this._emitStream(stream);
538
+ }
539
+ }, {
540
+ key: "_baseBulkDataReference",
541
+ value: function _baseBulkDataReference() {
542
+ var _ref$uri;
543
+ var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
544
+ throw new Error("StreamingPart10Writer cannot serialize a bulkDataReference " + "(".concat((_ref$uri = ref.uri) !== null && _ref$uri !== void 0 ? _ref$uri : "no uri", "); materialize bulk data before writing"));
545
+ }
546
+
547
+ /**
548
+ * Testing convenience for the accumulate mode: the collected chunks as
549
+ * one ArrayBuffer. Meaningless when onChunk was provided.
550
+ * @returns {ArrayBuffer}
551
+ */
552
+ }, {
553
+ key: "toArrayBuffer",
554
+ value: function toArrayBuffer() {
555
+ var total = this.chunks.reduce(function (n, c) {
556
+ return n + c.byteLength;
557
+ }, 0);
558
+ var out = new Uint8Array(total);
559
+ var offset = 0;
560
+ var _iterator = dcmjs._createForOfIteratorHelper(this.chunks),
561
+ _step;
562
+ try {
563
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
564
+ var chunk = _step.value;
565
+ out.set(chunk, offset);
566
+ offset += chunk.byteLength;
567
+ }
568
+ } catch (err) {
569
+ _iterator.e(err);
570
+ } finally {
571
+ _iterator.f();
572
+ }
573
+ return out.buffer;
574
+ }
575
+ }]);
576
+ }(parser.EventStreamListener);
577
+
578
+ /**
579
+ * The recommended public source/sink API (spec §32) — thin, ergonomic wrappers
580
+ * over the event-stream generators and listeners.
581
+ *
582
+ * const events = DicomEventStream.fromPart10(bytes);
583
+ * const metadata = await Naturalized.from(events); // or events.toNaturalized()
584
+ * const json = await DicomWebJson.from(events); // or events.toDicomWebJson()
585
+ *
586
+ * A DicomEventStream wraps a re-runnable `run(listener)` thunk, so the same
587
+ * source can drive multiple sinks. Explicit listener usage remains available via
588
+ * `events.process(listener)`.
589
+ *
590
+ * Scope: the byte, dataset, and DICOMweb JSON sources and sinks, and the
591
+ * media factories (fromImage, fromPdf, fromVideo, fromVideoStream, toPdf,
592
+ * toVideo). The FHIR mapping is the separate, preliminary
593
+ * `@dcmjs-org/fhir` package: `toFhir(await events.toNaturalized())`.
594
+ *
595
+ * The media source factories pass `options` unchanged to their builder,
596
+ * which takes the `createInstance` options of `@dcmjs-org/core` (`instance`,
597
+ * `dataLevel`, `levels`, `predecessor`, `postProcess`, `baseDicom`,
598
+ * `overrides`). The DICOM attributes go in `overrides`, for example
599
+ * `fromPdf(bytes, { instance, overrides: { DocumentTitle: "Report" } })`.
600
+ */
601
+ var DicomEventStream = /*#__PURE__*/function () {
602
+ /**
603
+ * @param {(listener: import("./EventStreamListener").EventStreamListener) => Promise<void>} run
604
+ */
605
+ function DicomEventStream(run) {
606
+ dcmjs._classCallCheck(this, DicomEventStream);
607
+ this._run = run;
608
+ }
609
+
610
+ /** A Part 10 byte buffer source. */
611
+ return dcmjs._createClass(DicomEventStream, [{
612
+ key: "process",
613
+ value: /** Drive an arbitrary listener; resolves when the stream completes. */
614
+ function process(listener) {
615
+ return Promise.resolve(this._run(listener)).then(function () {
616
+ return listener;
617
+ });
618
+ }
619
+
620
+ /** Materialize the naturalized object (slice D1). */
621
+ }, {
622
+ key: "toNaturalized",
623
+ value: (function () {
624
+ var _toNaturalized = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee() {
625
+ var options,
626
+ listener,
627
+ _args = arguments;
628
+ return dcmjs._regeneratorRuntime().wrap(function (_context) {
629
+ while (1) switch (_context.prev = _context.next) {
630
+ case 0:
631
+ options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
632
+ listener = new parser.NaturalizedListener(options);
633
+ _context.next = 1;
634
+ return this._run(listener);
635
+ case 1:
636
+ return _context.abrupt("return", listener.result);
637
+ case 2:
638
+ case "end":
639
+ return _context.stop();
640
+ }
641
+ }, _callee, this);
642
+ }));
643
+ function toNaturalized() {
644
+ return _toNaturalized.apply(this, arguments);
645
+ }
646
+ return toNaturalized;
647
+ }() /** Serialize to the DICOM JSON model (slice E1). */)
648
+ }, {
649
+ key: "toDicomWebJson",
650
+ value: (function () {
651
+ var _toDicomWebJson = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee2() {
652
+ var writer;
653
+ return dcmjs._regeneratorRuntime().wrap(function (_context2) {
654
+ while (1) switch (_context2.prev = _context2.next) {
655
+ case 0:
656
+ writer = new DicomWebJsonWriter();
657
+ _context2.next = 1;
658
+ return this._run(writer);
659
+ case 1:
660
+ return _context2.abrupt("return", writer.result);
661
+ case 2:
662
+ case "end":
663
+ return _context2.stop();
664
+ }
665
+ }, _callee2, this);
666
+ }));
667
+ function toDicomWebJson() {
668
+ return _toDicomWebJson.apply(this, arguments);
669
+ }
670
+ return toDicomWebJson;
671
+ }() /** Serialize to a Part 10 ArrayBuffer (slice E2). */)
672
+ }, {
673
+ key: "toPart10",
674
+ value: (function () {
675
+ var _toPart = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee3(writeOptions) {
676
+ var writer;
677
+ return dcmjs._regeneratorRuntime().wrap(function (_context3) {
678
+ while (1) switch (_context3.prev = _context3.next) {
679
+ case 0:
680
+ writer = new Part10Writer();
681
+ _context3.next = 1;
682
+ return this._run(writer);
683
+ case 1:
684
+ return _context3.abrupt("return", writer.write(writeOptions));
685
+ case 2:
686
+ case "end":
687
+ return _context3.stop();
688
+ }
689
+ }, _callee3, this);
690
+ }));
691
+ function toPart10(_x) {
692
+ return _toPart.apply(this, arguments);
693
+ }
694
+ return toPart10;
695
+ }() /** Rebuild a tag-keyed { meta, dict } tree (the reference collector). */)
696
+ }, {
697
+ key: "toDataSet",
698
+ value: (function () {
699
+ var _toDataSet = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee4() {
700
+ var collector;
701
+ return dcmjs._regeneratorRuntime().wrap(function (_context4) {
702
+ while (1) switch (_context4.prev = _context4.next) {
703
+ case 0:
704
+ collector = new parser.CollectorListener();
705
+ _context4.next = 1;
706
+ return this._run(collector);
707
+ case 1:
708
+ return _context4.abrupt("return", collector.result);
709
+ case 2:
710
+ case "end":
711
+ return _context4.stop();
712
+ }
713
+ }, _callee4, this);
714
+ }));
715
+ function toDataSet() {
716
+ return _toDataSet.apply(this, arguments);
717
+ }
718
+ return toDataSet;
719
+ }()
720
+ /**
721
+ * Extract the embedded PDF from an Encapsulated PDF instance:
722
+ * { bytes, mimeType, title }. Throws (naming the expected SOP class)
723
+ * when the stream is not an Encapsulated PDF instance.
724
+ */
725
+ )
726
+ }, {
727
+ key: "toPdf",
728
+ value: (function () {
729
+ var _toPdf = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee5() {
730
+ var _t;
731
+ return dcmjs._regeneratorRuntime().wrap(function (_context5) {
732
+ while (1) switch (_context5.prev = _context5.next) {
733
+ case 0:
734
+ _t = encapsulated.extractEncapsulatedPdf;
735
+ _context5.next = 1;
736
+ return this.toNaturalized();
737
+ case 1:
738
+ return _context5.abrupt("return", _t(_context5.sent));
739
+ case 2:
740
+ case "end":
741
+ return _context5.stop();
742
+ }
743
+ }, _callee5, this);
744
+ }));
745
+ function toPdf() {
746
+ return _toPdf.apply(this, arguments);
747
+ }
748
+ return toPdf;
749
+ }()
750
+ /**
751
+ * Recover the verbatim video stream from an encapsulated video
752
+ * instance: { bytes, transferSyntaxUID, declaredLength }. Fragments
753
+ * are concatenated and truncated to the declared (7FE0,0003) total
754
+ * length, so the result is byte-identical to the originally
755
+ * encapsulated MP4. Buffered — for multi-GB instances stream the
756
+ * fragments instead. Throws a corrective error when the stream is
757
+ * not a video instance.
758
+ */
759
+ )
760
+ }, {
761
+ key: "toVideo",
762
+ value: (function () {
763
+ var _toVideo = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee6() {
764
+ var _t2;
765
+ return dcmjs._regeneratorRuntime().wrap(function (_context6) {
766
+ while (1) switch (_context6.prev = _context6.next) {
767
+ case 0:
768
+ _t2 = video.extractEncapsulatedVideo;
769
+ _context6.next = 1;
770
+ return this.toNaturalized();
771
+ case 1:
772
+ return _context6.abrupt("return", _t2(_context6.sent));
773
+ case 2:
774
+ case "end":
775
+ return _context6.stop();
776
+ }
777
+ }, _callee6, this);
778
+ }));
779
+ function toVideo() {
780
+ return _toVideo.apply(this, arguments);
781
+ }
782
+ return toVideo;
783
+ }() /** Consume the stream as an async-iterable of `{ type, args }` events. */)
784
+ }, {
785
+ key: "asyncIterable",
786
+ value: function asyncIterable(options) {
787
+ var _this = this;
788
+ return parser.createEventAsyncIterable(function (listener) {
789
+ return _this._run(listener);
790
+ }, options);
791
+ }
792
+ }], [{
793
+ key: "fromPart10",
794
+ value: function fromPart10(buffer) {
795
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
796
+ return new DicomEventStream(function (listener) {
797
+ return parser.fromPart10(buffer, listener, options);
798
+ });
799
+ }
800
+
801
+ /**
802
+ * A chunked bytes→events source (slice K).
803
+ *
804
+ * Accepted `input` forms — see `fromPart10Stream` for the full contract:
805
+ * - `ArrayBuffer | Uint8Array` → re-runnable (each `.process()` starts fresh)
806
+ * - `AsyncIterable | ReadableStream` → single-use; second `.process()` rejects
807
+ * with a clear "already been consumed" error.
808
+ *
809
+ * `noCopy` is not accepted; the streaming source forces noCopy off because
810
+ * zero-copy views alias chunk memory that `consume()` releases (decision D-E).
811
+ *
812
+ * @param {ArrayBuffer|Uint8Array|AsyncIterable|ReadableStream} input
813
+ * @param {Object} [options]
814
+ * @param {boolean} [options.forceStoreRaw]
815
+ * @param {boolean} [options.ignoreErrors]
816
+ * @returns {DicomEventStream}
817
+ */
818
+ }, {
819
+ key: "fromPart10Stream",
820
+ value: function fromPart10Stream(input) {
821
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
822
+ var isBuffer = input instanceof ArrayBuffer || ArrayBuffer.isView(input);
823
+ if (isBuffer) {
824
+ // Buffer inputs are re-runnable: every _run() creates a fresh parse.
825
+ return new DicomEventStream(function (listener) {
826
+ return parser.fromPart10Stream(input, listener, options);
827
+ });
828
+ }
829
+
830
+ // Iterable / ReadableStream inputs are single-use: the iterator is
831
+ // consumed on the first .process() call. A second call rejects with
832
+ // a clear error so callers are not silently handed an empty stream.
833
+ var consumed = false;
834
+ return new DicomEventStream(function (listener) {
835
+ if (consumed) {
836
+ return Promise.reject(new Error("DicomEventStream.fromPart10Stream: this stream source " + "has already been consumed and cannot be re-run. " + "Only ArrayBuffer/Uint8Array inputs are re-runnable. " + "To drive multiple sinks, convert the bytes to an " + "ArrayBuffer first and pass that instead."));
837
+ }
838
+ consumed = true;
839
+ return parser.fromPart10Stream(input, listener, options);
840
+ });
841
+ }
842
+
843
+ /** A DICOMweb JSON (DICOM JSON model) source. */
844
+ }, {
845
+ key: "fromDicomWebJson",
846
+ value: function fromDicomWebJson(json) {
847
+ return new DicomEventStream(function (listener) {
848
+ return parser.fromDicomWebJson(json, listener);
849
+ });
850
+ }
851
+
852
+ /** A parsed dcmjs dataset ({ meta, dict }) source. */
853
+ }, {
854
+ key: "fromDataSet",
855
+ value: function fromDataSet(dataset) {
856
+ return new DicomEventStream(function (listener) {
857
+ return parser.fromDataSet(dataset, listener);
858
+ });
859
+ }
860
+
861
+ /**
862
+ * A naturalized dataset source; a `_meta` member becomes the file meta
863
+ * information. toNaturalized() gives no `_meta`, so set
864
+ * `dataset._meta` to keep the transfer syntax of the source. Set it on
865
+ * the dataset itself: a copy loses the deletes of private aliases.
866
+ */
867
+ }, {
868
+ key: "fromNaturalized",
869
+ value: function fromNaturalized(dataset) {
870
+ return new DicomEventStream(function (listener) {
871
+ return parser.fromNaturalized(dataset, listener);
872
+ });
873
+ }
874
+
875
+ /**
876
+ * An already-decoded image source: builds a full instance dataset via
877
+ * buildImageDataset of @dcmjs-org/imaging (geometry from the pixels,
878
+ * context from `instance` and `overrides`, `derivedFrom` for a derived
879
+ * instance), then streams it. The dataset is built eagerly so minted
880
+ * UIDs are stable across re-runs of the same stream.
881
+ *
882
+ * @param {Object} decodedImage - { pixels, rows, columns, ... }
883
+ * @param {Object} [options] - buildImageDataset options (the
884
+ * createInstance options plus `derivedFrom`, `lossy`, `encapsulated`)
885
+ * @returns {DicomEventStream}
886
+ */
887
+ }, {
888
+ key: "fromImage",
889
+ value: function fromImage(decodedImage) {
890
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
891
+ var dataset = imaging.buildImageDataset(decodedImage, options);
892
+ var dicomDict = dcmjs.datasetToDict(dataset);
893
+ if (options.encapsulated && dicomDict.dict["7FE00010"]) {
894
+ // fromDataSet reads this flag to emit startBinary({encapsulated:true})
895
+ dicomDict.dict["7FE00010"].encapsulatedPixelData = true;
896
+ }
897
+ return new DicomEventStream(function (listener) {
898
+ return parser.fromDataSet(dicomDict, listener);
899
+ });
900
+ }
901
+
902
+ /**
903
+ * A PDF source: wraps the bytes into an Encapsulated PDF instance
904
+ * (encapsulatePdf of @dcmjs-org/encapsulated) and streams it.
905
+ *
906
+ * @param {ArrayBuffer|Uint8Array} pdfBytes
907
+ * @param {Object} [options] - encapsulatePdf options (the
908
+ * createInstance options plus `mimeType`); the attributes
909
+ * (PatientName, DocumentTitle, ...) go in `overrides`
910
+ * @returns {DicomEventStream}
911
+ */
912
+ }, {
913
+ key: "fromPdf",
914
+ value: function fromPdf(pdfBytes) {
915
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
916
+ var dicomDict = dcmjs.datasetToDict(encapsulated.encapsulatePdf(pdfBytes, options));
917
+ return new DicomEventStream(function (listener) {
918
+ return parser.fromDataSet(dicomDict, listener);
919
+ });
920
+ }
921
+
922
+ /**
923
+ * An MP4 video source, buffered (mirrors fromPdf): the H.264 stream is
924
+ * carried verbatim as encapsulated PixelData in a Video Photographic
925
+ * Image instance (Supplement 225) — geometry, frame count, and frame
926
+ * rate are read from the MP4's moov metadata; no pixels are decoded.
927
+ * The source is created lazily on the first consumption and cached,
928
+ * so minted UIDs stay stable across re-runs AND a bad input cannot
929
+ * raise an unhandled rejection before the caller drives the stream
930
+ * (review finding 14) — the parse error surfaces from .process() or
931
+ * whichever sink runs first. Unsupported codecs (anything but H.264
932
+ * Baseline/Main/High up to Level 4.2) throw a corrective error naming
933
+ * the transcode.
934
+ *
935
+ * @param {ArrayBuffer|Uint8Array} mp4Bytes
936
+ * @param {Object} [options] - buildVideoDataset options (the
937
+ * createInstance options; the attributes go in `overrides`) plus
938
+ * `fragmentBytes`
939
+ * @returns {DicomEventStream}
940
+ */
941
+ }, {
942
+ key: "fromVideo",
943
+ value: function fromVideo(mp4Bytes) {
944
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
945
+ var sourcePromise = null;
946
+ return new DicomEventStream(/*#__PURE__*/function () {
947
+ var _ref = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee7(listener) {
948
+ return dcmjs._regeneratorRuntime().wrap(function (_context7) {
949
+ while (1) switch (_context7.prev = _context7.next) {
950
+ case 0:
951
+ if (!sourcePromise) {
952
+ sourcePromise = video.createVideoEventSource(mp4Bytes, options);
953
+ }
954
+ _context7.next = 1;
955
+ return sourcePromise;
956
+ case 1:
957
+ return _context7.abrupt("return", _context7.sent.run(listener));
958
+ case 2:
959
+ case "end":
960
+ return _context7.stop();
961
+ }
962
+ }, _callee7);
963
+ }));
964
+ return function (_x2) {
965
+ return _ref.apply(this, arguments);
966
+ };
967
+ }());
968
+ }
969
+
970
+ /**
971
+ * The streaming form of fromVideo, for MP4s too large to buffer: the
972
+ * caller supplies a random-access reader and fragments are read one at
973
+ * a time, so peak memory is one fragment regardless of file size. Pair
974
+ * with StreamingPart10Writer for a bounded-memory MP4 → Part 10 write.
975
+ * Lazy like fromVideo: the reader is not touched until the first
976
+ * consumption (finding 14).
977
+ *
978
+ * @param {{size: number, read: (offset: number, length: number) =>
979
+ * Promise<Uint8Array>}} reader
980
+ * @param {Object} [options] - as fromVideo
981
+ * @returns {DicomEventStream}
982
+ */
983
+ }, {
984
+ key: "fromVideoStream",
985
+ value: function fromVideoStream(reader) {
986
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
987
+ var sourcePromise = null;
988
+ return new DicomEventStream(/*#__PURE__*/function () {
989
+ var _ref2 = dcmjs._asyncToGenerator(/*#__PURE__*/dcmjs._regeneratorRuntime().mark(function _callee8(listener) {
990
+ return dcmjs._regeneratorRuntime().wrap(function (_context8) {
991
+ while (1) switch (_context8.prev = _context8.next) {
992
+ case 0:
993
+ if (!sourcePromise) {
994
+ sourcePromise = video.createVideoEventSource(reader, options);
995
+ }
996
+ _context8.next = 1;
997
+ return sourcePromise;
998
+ case 1:
999
+ return _context8.abrupt("return", _context8.sent.run(listener));
1000
+ case 2:
1001
+ case "end":
1002
+ return _context8.stop();
1003
+ }
1004
+ }, _callee8);
1005
+ }));
1006
+ return function (_x3) {
1007
+ return _ref2.apply(this, arguments);
1008
+ };
1009
+ }());
1010
+ }
1011
+
1012
+ /**
1013
+ * Auto-detecting source factory: an ArrayBuffer/typed array is treated as
1014
+ * Part 10 bytes; an object with a `dict` (or `meta`) is a parsed dataset;
1015
+ * any other object is the DICOM JSON model.
1016
+ */
1017
+ }, {
1018
+ key: "from",
1019
+ value: function from(source) {
1020
+ if (source instanceof ArrayBuffer || ArrayBuffer.isView(source)) {
1021
+ return DicomEventStream.fromPart10(source);
1022
+ }
1023
+ if (source && dcmjs._typeof(source) === "object") {
1024
+ if (source.dict || source.meta) {
1025
+ return DicomEventStream.fromDataSet(source);
1026
+ }
1027
+ return DicomEventStream.fromDicomWebJson(source);
1028
+ }
1029
+ throw new TypeError("DicomEventStream.from: unrecognized source (expected Part 10 bytes, a { meta, dict } dataset, or a DICOM JSON object)");
1030
+ }
1031
+ }]);
1032
+ }();
1033
+
1034
+ /** §32 sink helpers — `Naturalized.from(events)` / `DicomWebJson.from(events)`. */
1035
+ var Naturalized = {
1036
+ from: function from(source, options) {
1037
+ return source.toNaturalized(options);
1038
+ }
1039
+ };
1040
+ var DicomWebJson = {
1041
+ from: function from(source) {
1042
+ return source.toDicomWebJson();
1043
+ }
1044
+ };
1045
+
1046
+ /**
1047
+ * The dcmjs event-stream contract.
1048
+ *
1049
+ * The canonical, source-agnostic interchange layer: readers produce event
1050
+ * streams, listeners and writers consume them. This module grows as the
1051
+ * engine slices land; it currently exports the contract, the reference
1052
+ * collector, the byte / dataset / DICOMweb JSON sources, the async pull
1053
+ * adapter, the naturalized-model listener, and the collector-backed writer
1054
+ * sinks (Part 10 and DICOMweb JSON), plus the DicomEventStream facade over
1055
+ * all of them.
1056
+ */
1057
+ var index = {
1058
+ EventStreamListener: parser.EventStreamListener,
1059
+ EVENT_STREAM_VOCABULARY: parser.EVENT_STREAM_VOCABULARY,
1060
+ CONTRACT_VERSION: parser.CONTRACT_VERSION,
1061
+ CollectorListener: parser.CollectorListener,
1062
+ NaturalizedListener: parser.NaturalizedListener,
1063
+ fromDataSet: parser.fromDataSet,
1064
+ fromNaturalized: parser.fromNaturalized,
1065
+ fromDicomWebJson: parser.fromDicomWebJson,
1066
+ createEventAsyncIterable: parser.createEventAsyncIterable,
1067
+ fromPart10: parser.fromPart10,
1068
+ fromPart10Stream: parser.fromPart10Stream,
1069
+ Part10Writer: Part10Writer,
1070
+ DicomWebJsonWriter: DicomWebJsonWriter,
1071
+ StreamingPart10Writer: StreamingPart10Writer,
1072
+ DicomEventStream: DicomEventStream,
1073
+ Naturalized: Naturalized,
1074
+ DicomWebJson: DicomWebJson
1075
+ };
1076
+
1077
+ Object.defineProperty(exports, "CONTRACT_VERSION", {
1078
+ enumerable: true,
1079
+ get: function () { return parser.CONTRACT_VERSION; }
1080
+ });
1081
+ Object.defineProperty(exports, "CollectorListener", {
1082
+ enumerable: true,
1083
+ get: function () { return parser.CollectorListener; }
1084
+ });
1085
+ Object.defineProperty(exports, "EVENT_STREAM_VOCABULARY", {
1086
+ enumerable: true,
1087
+ get: function () { return parser.EVENT_STREAM_VOCABULARY; }
1088
+ });
1089
+ Object.defineProperty(exports, "EventStreamListener", {
1090
+ enumerable: true,
1091
+ get: function () { return parser.EventStreamListener; }
1092
+ });
1093
+ Object.defineProperty(exports, "NaturalizedListener", {
1094
+ enumerable: true,
1095
+ get: function () { return parser.NaturalizedListener; }
1096
+ });
1097
+ Object.defineProperty(exports, "createEventAsyncIterable", {
1098
+ enumerable: true,
1099
+ get: function () { return parser.createEventAsyncIterable; }
1100
+ });
1101
+ Object.defineProperty(exports, "fromDataSet", {
1102
+ enumerable: true,
1103
+ get: function () { return parser.fromDataSet; }
1104
+ });
1105
+ Object.defineProperty(exports, "fromDicomWebJson", {
1106
+ enumerable: true,
1107
+ get: function () { return parser.fromDicomWebJson; }
1108
+ });
1109
+ Object.defineProperty(exports, "fromNaturalized", {
1110
+ enumerable: true,
1111
+ get: function () { return parser.fromNaturalized; }
1112
+ });
1113
+ Object.defineProperty(exports, "fromPart10", {
1114
+ enumerable: true,
1115
+ get: function () { return parser.fromPart10; }
1116
+ });
1117
+ Object.defineProperty(exports, "fromPart10Stream", {
1118
+ enumerable: true,
1119
+ get: function () { return parser.fromPart10Stream; }
1120
+ });
1121
+ exports.DicomEventStream = DicomEventStream;
1122
+ exports.DicomWebJson = DicomWebJson;
1123
+ exports.DicomWebJsonWriter = DicomWebJsonWriter;
1124
+ exports.Naturalized = Naturalized;
1125
+ exports.Part10Writer = Part10Writer;
1126
+ exports.StreamingPart10Writer = StreamingPart10Writer;
1127
+ exports.default = index;
1128
+ //# sourceMappingURL=eventStream.cjs.map