@dcmjs-org/dcmjs 1.0.0-beta.19 → 1.0.0-beta.20
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/build/dcmjs.cjs +1 -1
- package/build/dcmjs.es.js +1 -1
- package/build/dcmjs.js +65 -37
- package/build/dcmjs.js.map +1 -1
- package/build/dcmjs.min.js +1 -1
- package/build/dcmjs.min.js.map +1 -1
- package/build/{dcmjs.shared-L4OH_Ab_.cjs → dcmjs.shared-Cmkm67T1.cjs} +66 -38
- package/build/dcmjs.shared-Cmkm67T1.cjs.map +1 -0
- package/build/{dcmjs.shared-DnjtTwFB.js → dcmjs.shared-RH-AbhO5.js} +66 -38
- package/build/dcmjs.shared-RH-AbhO5.js.map +1 -0
- package/build/eventStream.cjs +1 -1
- package/build/eventStream.es.js +1 -1
- package/package.json +7 -7
- package/build/dcmjs.shared-DnjtTwFB.js.map +0 -1
- package/build/dcmjs.shared-L4OH_Ab_.cjs.map +0 -1
|
@@ -1608,6 +1608,8 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
1608
1608
|
_classCallCheck(this, AsyncDicomReader);
|
|
1609
1609
|
_defineProperty(this, "syntax", core.EXPLICIT_LITTLE_ENDIAN);
|
|
1610
1610
|
this.isLittleEndian = options === null || options === void 0 ? void 0 : options.isLittleEndian;
|
|
1611
|
+
// Number of sequence items being read, 0 at the top level
|
|
1612
|
+
this.sequenceDepth = 0;
|
|
1611
1613
|
// Default maxFragmentSize is 128 MB (128 * 1024 * 1024 bytes)
|
|
1612
1614
|
this.maxFragmentSize = (_options$maxFragmentS = options === null || options === void 0 ? void 0 : options.maxFragmentSize) !== null && _options$maxFragmentS !== void 0 ? _options$maxFragmentS : 128 * 1024 * 1024;
|
|
1613
1615
|
this.stream = new core.ReadBufferStream(null, _objectSpread2(_objectSpread2({
|
|
@@ -2069,16 +2071,24 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2069
2071
|
* item boundary and returns control here for the next item. Without that
|
|
2070
2072
|
* offset, read() skips the later Item tags as instructions, and all items
|
|
2071
2073
|
* of a defined-length sequence merge into the first item.
|
|
2074
|
+
*
|
|
2075
|
+
* untilTag and includeUntilTagValue apply to the top-level data set only,
|
|
2076
|
+
* so the items are read without them: an Icon Image Sequence item has its
|
|
2077
|
+
* own Pixel Data, which must not stop a read with untilTag 7FE00010.
|
|
2072
2078
|
*/
|
|
2073
2079
|
}, {
|
|
2074
2080
|
key: "readSequence",
|
|
2075
2081
|
value: (function () {
|
|
2076
2082
|
var _readSequence = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(listener, sqTagInfo, options) {
|
|
2077
2083
|
var _ref, _sqTagInfo$sequenceRe;
|
|
2078
|
-
var length, stream, readSyntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, decoder, _t;
|
|
2084
|
+
var itemOptions, length, stream, readSyntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, decoder, _t;
|
|
2079
2085
|
return _regeneratorRuntime().wrap(function (_context6) {
|
|
2080
2086
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2081
2087
|
case 0:
|
|
2088
|
+
itemOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2089
|
+
untilTag: null,
|
|
2090
|
+
includeUntilTagValue: false
|
|
2091
|
+
});
|
|
2082
2092
|
length = sqTagInfo.length;
|
|
2083
2093
|
stream = this.stream;
|
|
2084
2094
|
readSyntax = (_ref = (_sqTagInfo$sequenceRe = sqTagInfo.sequenceReadSyntax) !== null && _sqTagInfo$sequenceRe !== void 0 ? _sqTagInfo$sequenceRe : options === null || options === void 0 ? void 0 : options.readSyntax) !== null && _ref !== void 0 ? _ref : this.syntax;
|
|
@@ -2095,16 +2105,16 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2095
2105
|
_t = _context6.sent;
|
|
2096
2106
|
case 3:
|
|
2097
2107
|
if (!_t) {
|
|
2098
|
-
_context6.next =
|
|
2108
|
+
_context6.next = 10;
|
|
2099
2109
|
break;
|
|
2100
2110
|
}
|
|
2101
2111
|
readLog.debug("readSequence loop", stream.offset, endOffset);
|
|
2102
|
-
tagInfo = this.readTagHeader(_objectSpread2(_objectSpread2({},
|
|
2112
|
+
tagInfo = this.readTagHeader(_objectSpread2(_objectSpread2({}, itemOptions), {}, {
|
|
2103
2113
|
readSyntax: readSyntax
|
|
2104
2114
|
}));
|
|
2105
2115
|
tag = tagInfo.tag;
|
|
2106
2116
|
if (!(tag === core.TagHex.Item)) {
|
|
2107
|
-
_context6.next =
|
|
2117
|
+
_context6.next = 7;
|
|
2108
2118
|
break;
|
|
2109
2119
|
}
|
|
2110
2120
|
listener.startObject();
|
|
@@ -2114,38 +2124,59 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2114
2124
|
// item (PS3.5 7.5.3), but the item is read on this stream:
|
|
2115
2125
|
// put back the decoder the item started with.
|
|
2116
2126
|
decoder = stream.decoder;
|
|
2117
|
-
|
|
2118
|
-
|
|
2127
|
+
this.sequenceDepth++;
|
|
2128
|
+
_context6.prev = 4;
|
|
2129
|
+
_context6.next = 5;
|
|
2130
|
+
return this.read(listener, _objectSpread2(_objectSpread2({}, itemOptions), {}, {
|
|
2119
2131
|
untilOffset: itemUntilOffset,
|
|
2120
2132
|
readSyntax: readSyntax
|
|
2121
2133
|
}));
|
|
2122
|
-
case
|
|
2134
|
+
case 5:
|
|
2135
|
+
_context6.prev = 5;
|
|
2136
|
+
this.sequenceDepth--;
|
|
2137
|
+
return _context6.finish(5);
|
|
2138
|
+
case 6:
|
|
2123
2139
|
stream.setDecoder(decoder);
|
|
2124
|
-
_context6.next =
|
|
2140
|
+
_context6.next = 9;
|
|
2125
2141
|
break;
|
|
2126
|
-
case
|
|
2142
|
+
case 7:
|
|
2127
2143
|
if (!(tag === core.TagHex.SequenceDelimitationEnd)) {
|
|
2128
|
-
_context6.next =
|
|
2144
|
+
_context6.next = 8;
|
|
2129
2145
|
break;
|
|
2130
2146
|
}
|
|
2131
2147
|
return _context6.abrupt("return");
|
|
2132
|
-
case
|
|
2148
|
+
case 8:
|
|
2133
2149
|
console.warn("Unknown tag info", length, tagInfo);
|
|
2134
|
-
throw new Error();
|
|
2135
|
-
case
|
|
2150
|
+
throw new Error("Expected an item or a sequence delimitation item in a sequence, found tag ".concat(tag));
|
|
2151
|
+
case 9:
|
|
2136
2152
|
_context6.next = 1;
|
|
2137
2153
|
break;
|
|
2138
|
-
case
|
|
2154
|
+
case 10:
|
|
2139
2155
|
case "end":
|
|
2140
2156
|
return _context6.stop();
|
|
2141
2157
|
}
|
|
2142
|
-
}, _callee6, this);
|
|
2158
|
+
}, _callee6, this, [[4,, 5, 6]]);
|
|
2143
2159
|
}));
|
|
2144
2160
|
function readSequence(_x3, _x4, _x5) {
|
|
2145
2161
|
return _readSequence.apply(this, arguments);
|
|
2146
2162
|
}
|
|
2147
2163
|
return readSequence;
|
|
2148
|
-
}()
|
|
2164
|
+
}()
|
|
2165
|
+
/**
|
|
2166
|
+
* The number of frames of the Pixel Data being read. NumberOfFrames is
|
|
2167
|
+
* tracked for the top-level data set only, so Pixel Data inside a sequence
|
|
2168
|
+
* item (an Icon Image Sequence item, for example) is a single frame.
|
|
2169
|
+
*/
|
|
2170
|
+
)
|
|
2171
|
+
}, {
|
|
2172
|
+
key: "getNumberOfFrames",
|
|
2173
|
+
value: function getNumberOfFrames() {
|
|
2174
|
+
var _this$listener;
|
|
2175
|
+
if (this.sequenceDepth > 0) {
|
|
2176
|
+
return 1;
|
|
2177
|
+
}
|
|
2178
|
+
return parseInt(((_this$listener = this.listener) === null || _this$listener === void 0 || (_this$listener = _this$listener.information) === null || _this$listener === void 0 ? void 0 : _this$listener.numberOfFrames) || 1);
|
|
2179
|
+
}
|
|
2149
2180
|
}, {
|
|
2150
2181
|
key: "readPixelData",
|
|
2151
2182
|
value: function readPixelData(tagInfo) {
|
|
@@ -2215,8 +2246,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2215
2246
|
key: "readCompressed",
|
|
2216
2247
|
value: (function () {
|
|
2217
2248
|
var _readCompressed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_tagInfo) {
|
|
2218
|
-
var
|
|
2219
|
-
var stream, listener, transferSyntaxUid, isVideo, numberOfFrames, isSingleFrame, offsets, singleArray, startOffset, frameNumber, lastFrame, frameTag, length;
|
|
2249
|
+
var stream, listener, transferSyntaxUid, isVideo, isSingleFrame, offsets, singleArray, startOffset, frameNumber, lastFrame, frameTag, length;
|
|
2220
2250
|
return _regeneratorRuntime().wrap(function (_context8) {
|
|
2221
2251
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2222
2252
|
case 0:
|
|
@@ -2227,8 +2257,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2227
2257
|
case 1:
|
|
2228
2258
|
// Check if this is a video transfer syntax
|
|
2229
2259
|
isVideo = core.isVideoTransferSyntax(transferSyntaxUid); // Check number of frames - only use video logic for single frame (or undefined)
|
|
2230
|
-
|
|
2231
|
-
isSingleFrame = !numberOfFrames || parseInt(numberOfFrames) <= 1;
|
|
2260
|
+
isSingleFrame = this.getNumberOfFrames() <= 1;
|
|
2232
2261
|
_context8.next = 2;
|
|
2233
2262
|
return this.readOffsets();
|
|
2234
2263
|
case 2:
|
|
@@ -2342,23 +2371,22 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2342
2371
|
key: "readUncompressed",
|
|
2343
2372
|
value: (function () {
|
|
2344
2373
|
var _readUncompressed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(tagInfo) {
|
|
2345
|
-
var _listener$information2;
|
|
2346
|
-
var length, listener, numberOfFrames, frameLength, _listener$information3, _listener$information4, _listener$information5, _listener$information6, rows, cols, samplesPerPixel, bitsAllocated, bitsPerFrame, frameNumber;
|
|
2374
|
+
var length, listener, numberOfFrames, frameLength, _listener$information, _listener$information2, _listener$information3, _listener$information4, rows, cols, samplesPerPixel, bitsAllocated, bitsPerFrame, frameNumber;
|
|
2347
2375
|
return _regeneratorRuntime().wrap(function (_context0) {
|
|
2348
2376
|
while (1) switch (_context0.prev = _context0.next) {
|
|
2349
2377
|
case 0:
|
|
2350
2378
|
length = tagInfo.length;
|
|
2351
2379
|
listener = this.listener;
|
|
2352
|
-
numberOfFrames =
|
|
2380
|
+
numberOfFrames = this.getNumberOfFrames();
|
|
2353
2381
|
frameLength = Math.floor(length / numberOfFrames);
|
|
2354
2382
|
if (!(numberOfFrames > 1)) {
|
|
2355
2383
|
_context0.next = 4;
|
|
2356
2384
|
break;
|
|
2357
2385
|
}
|
|
2358
|
-
rows = (_listener$
|
|
2359
|
-
cols = (_listener$
|
|
2360
|
-
samplesPerPixel = (_listener$
|
|
2361
|
-
bitsAllocated = (_listener$
|
|
2386
|
+
rows = (_listener$information = listener.information) === null || _listener$information === void 0 ? void 0 : _listener$information.rows;
|
|
2387
|
+
cols = (_listener$information2 = listener.information) === null || _listener$information2 === void 0 ? void 0 : _listener$information2.columns;
|
|
2388
|
+
samplesPerPixel = (_listener$information3 = listener.information) === null || _listener$information3 === void 0 ? void 0 : _listener$information3.samplesPerPixel;
|
|
2389
|
+
bitsAllocated = (_listener$information4 = listener.information) === null || _listener$information4 === void 0 ? void 0 : _listener$information4.bitsAllocated;
|
|
2362
2390
|
bitsPerFrame = rows * cols * samplesPerPixel * bitsAllocated;
|
|
2363
2391
|
if (!(bitsPerFrame % 8 !== 0)) {
|
|
2364
2392
|
_context0.next = 3;
|
|
@@ -2427,18 +2455,18 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2427
2455
|
key: "readUncompressedBitFrame",
|
|
2428
2456
|
value: (function () {
|
|
2429
2457
|
var _readUncompressedBitFrame = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(tagInfo) {
|
|
2430
|
-
var _listener$
|
|
2458
|
+
var _listener$information5, _listener$information6, _listener$information7, _listener$information8;
|
|
2431
2459
|
var length, listener, stream, numberOfFrames, rows, cols, samplesPerPixel, bitsAllocated, bitsPerFrame, bytesPerFrame, totalBits, totalBytes, allPixelData, frameNumber, bitOffset, frameBuffer, frameView, sourceView, bitIndex, globalBitIndex, sourceByteIndex, sourceBitIndex, targetByteIndex, targetBitIndex, sourceByte, bitValue;
|
|
2432
2460
|
return _regeneratorRuntime().wrap(function (_context1) {
|
|
2433
2461
|
while (1) switch (_context1.prev = _context1.next) {
|
|
2434
2462
|
case 0:
|
|
2435
2463
|
length = tagInfo.length;
|
|
2436
2464
|
listener = this.listener, stream = this.stream;
|
|
2437
|
-
numberOfFrames =
|
|
2438
|
-
rows = (_listener$
|
|
2439
|
-
cols = (_listener$
|
|
2440
|
-
samplesPerPixel = ((_listener$
|
|
2441
|
-
bitsAllocated = (_listener$
|
|
2465
|
+
numberOfFrames = this.getNumberOfFrames();
|
|
2466
|
+
rows = (_listener$information5 = listener.information) === null || _listener$information5 === void 0 ? void 0 : _listener$information5.rows;
|
|
2467
|
+
cols = (_listener$information6 = listener.information) === null || _listener$information6 === void 0 ? void 0 : _listener$information6.columns;
|
|
2468
|
+
samplesPerPixel = ((_listener$information7 = listener.information) === null || _listener$information7 === void 0 ? void 0 : _listener$information7.samplesPerPixel) || 1;
|
|
2469
|
+
bitsAllocated = (_listener$information8 = listener.information) === null || _listener$information8 === void 0 ? void 0 : _listener$information8.bitsAllocated;
|
|
2442
2470
|
if (!(!rows || !cols || !bitsAllocated)) {
|
|
2443
2471
|
_context1.next = 1;
|
|
2444
2472
|
break;
|
|
@@ -2585,13 +2613,13 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2585
2613
|
if (elementData) {
|
|
2586
2614
|
vrType = elementData.vr;
|
|
2587
2615
|
if (vrType === "xs") {
|
|
2588
|
-
var _this$
|
|
2616
|
+
var _this$listener2;
|
|
2589
2617
|
// The dictionary meta-VR "xs" ("US or SS") resolves via
|
|
2590
2618
|
// PixelRepresentation (PS3.5), exactly like the sync
|
|
2591
2619
|
// reader (DicomMessage._readTag). The listener's
|
|
2592
2620
|
// information filter tracks (0028,0103), which precedes
|
|
2593
2621
|
// every xs tag in tag order.
|
|
2594
|
-
vrType = DicomMessage.resolveXsVrType((_this$
|
|
2622
|
+
vrType = DicomMessage.resolveXsVrType((_this$listener2 = this.listener) === null || _this$listener2 === void 0 || (_this$listener2 = _this$listener2.information) === null || _this$listener2 === void 0 ? void 0 : _this$listener2.pixelRepresentation);
|
|
2595
2623
|
}
|
|
2596
2624
|
} else {
|
|
2597
2625
|
//unknown tag
|
|
@@ -2613,10 +2641,10 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
2613
2641
|
if (vrType === "UN" && (_DicomMessage$lookupT = DicomMessage.lookupTag(tagObj)) !== null && _DicomMessage$lookupT !== void 0 && _DicomMessage$lookupT.vr) {
|
|
2614
2642
|
vrType = DicomMessage.lookupTag(tagObj).vr;
|
|
2615
2643
|
if (vrType === "xs") {
|
|
2616
|
-
var _this$
|
|
2644
|
+
var _this$listener3;
|
|
2617
2645
|
// Same PixelRepresentation-driven US/SS resolution for
|
|
2618
2646
|
// explicit-VR UN elements whose dictionary VR is "xs".
|
|
2619
|
-
vrType = DicomMessage.resolveXsVrType((_this$
|
|
2647
|
+
vrType = DicomMessage.resolveXsVrType((_this$listener3 = this.listener) === null || _this$listener3 === void 0 || (_this$listener3 = _this$listener3.information) === null || _this$listener3 === void 0 ? void 0 : _this$listener3.pixelRepresentation);
|
|
2620
2648
|
}
|
|
2621
2649
|
vr = core.ValueRepresentation.parseUnknownVr(vrType);
|
|
2622
2650
|
} else {
|
|
@@ -15993,4 +16021,4 @@ exports.derivations = derivations;
|
|
|
15993
16021
|
exports.normalizers = normalizers;
|
|
15994
16022
|
exports.sr = sr;
|
|
15995
16023
|
exports.utilities = utilities;
|
|
15996
|
-
//# sourceMappingURL=dcmjs.shared-
|
|
16024
|
+
//# sourceMappingURL=dcmjs.shared-Cmkm67T1.cjs.map
|