@dcmjs-org/dcmjs 1.0.0-beta.8 → 1.0.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.
@@ -720,6 +720,34 @@ var DicomDict = /*#__PURE__*/function () {
720
720
  this.dict[tag].Value = core.ValueRepresentation.addValueAccessorsFor(this.dict[tag].vr, values);
721
721
  }
722
722
 
723
+ /**
724
+ * Reserves a private block for a creator, and writes its creator element
725
+ * when the creator has no block yet; pass `{ create: false }` to only look
726
+ * it up. The block is found by creator, never assumed (NAT-U-PRIV-11).
727
+ *
728
+ * dicomDict.privateBlock("4D43:ACME 1.0").set("x01", "CS", ["HYBRID"]);
729
+ *
730
+ * @param {number|string} groupOrKey odd group number, or block key "gggg:creator"
731
+ * @param {string} [creator] creator string, with a group number
732
+ * @param {{create?: boolean}} [options] create defaults to true; false
733
+ * returns null when the creator is absent
734
+ * @returns {Object|null} accessor with key, group, creator, reservedBlock,
735
+ * tag, has, get and set
736
+ */
737
+ }, {
738
+ key: "privateBlock",
739
+ value: function privateBlock(groupOrKey, creator) {
740
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
741
+ if (typeof groupOrKey === "string" && _typeof(creator) === "object") {
742
+ options = creator;
743
+ creator = undefined;
744
+ }
745
+ var _ref = options || {},
746
+ _ref$create = _ref.create,
747
+ create = _ref$create === void 0 ? true : _ref$create;
748
+ return create ? core.reservePrivateBlock(this.dict, groupOrKey, creator) : core.findPrivateBlock(this.dict, groupOrKey, creator);
749
+ }
750
+
723
751
  // The Part 10 envelope (preamble/DICM, computed meta group length,
724
752
  // deflate branch, default transfer syntax) moved verbatim to
725
753
  // @dcmjs-org/core as writePart10 (core/writeCore.js); this delegation
@@ -908,7 +936,7 @@ var DicomMessage = /*#__PURE__*/function () {
908
936
  // issue #93 opt-in: accept preamble-less / meta-less inputs
909
937
  allowMissingHeader: false
910
938
  };
911
- var stream = new core.ReadBufferStream(buffer, null, {
939
+ var stream = new core.ReadBufferStream(buffer, {
912
940
  noCopy: options.noCopy
913
941
  }),
914
942
  useSyntax = core.EXPLICIT_LITTLE_ENDIAN;
@@ -1049,7 +1077,8 @@ var DicomMessage = /*#__PURE__*/function () {
1049
1077
  }
1050
1078
  var length = null,
1051
1079
  vr = null,
1052
- vrType;
1080
+ vrType,
1081
+ wireVrType = null;
1053
1082
  if (implicit) {
1054
1083
  length = stream.readUint32();
1055
1084
  var elementData = DicomMessage.lookupTag(tag);
@@ -1077,6 +1106,7 @@ var DicomMessage = /*#__PURE__*/function () {
1077
1106
  vr = core.ValueRepresentation.createByTypeString(vrType);
1078
1107
  } else {
1079
1108
  vrType = stream.readVR();
1109
+ wireVrType = vrType;
1080
1110
  if (vrType === "UN" && DicomMessage.lookupTag(tag) && DicomMessage.lookupTag(tag).vr) {
1081
1111
  vrType = DicomMessage.lookupTag(tag).vr;
1082
1112
  if (vrType === "xs") {
@@ -1095,13 +1125,19 @@ var DicomMessage = /*#__PURE__*/function () {
1095
1125
  length = stream.readUint16();
1096
1126
  }
1097
1127
  }
1128
+ var readSyntax = syntax;
1129
+ if (!implicit && wireVrType === "UN" && core.isUnSequenceValue(stream.view, stream.offset, length, vr.type)) {
1130
+ vr = core.ValueRepresentation.createByTypeString("SQ");
1131
+ readSyntax = core.IMPLICIT_LITTLE_ENDIAN;
1132
+ stream.setEndian(true); // the items are LE in a BE body too
1133
+ }
1098
1134
  var values = [];
1099
1135
  var rawValues = [];
1100
1136
  if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
1101
1137
  var times = length / vr.maxLength,
1102
1138
  i = 0;
1103
1139
  while (i++ < times) {
1104
- var _vr$read = vr.read(stream, vr.maxLength, syntax, options),
1140
+ var _vr$read = vr.read(stream, vr.maxLength, readSyntax, options),
1105
1141
  rawValue = _vr$read.rawValue,
1106
1142
  value = _vr$read.value;
1107
1143
  rawValues.push(rawValue);
@@ -1112,7 +1148,7 @@ var DicomMessage = /*#__PURE__*/function () {
1112
1148
  var readOptions = vr.type === "SQ" ? _objectSpread2(_objectSpread2({}, options), {}, {
1113
1149
  readItem: readItem
1114
1150
  }) : options;
1115
- var _ref = vr.read(stream, length, syntax, readOptions) || {},
1151
+ var _ref = vr.read(stream, length, readSyntax, readOptions) || {},
1116
1152
  _rawValue = _ref.rawValue,
1117
1153
  _value = _ref.value;
1118
1154
  if (!vr.isBinary() && core.singleVRs.indexOf(vr.type) == -1) {
@@ -1327,25 +1363,65 @@ var ValueRepresentation = /*#__PURE__*/function (_CoreValueRepresentat) {
1327
1363
  //
1328
1364
  // Handle DICOM and CIELAB colors
1329
1365
  // based on:
1330
- // https://github.com/michaelonken/dcmtk/blob/3c68f0e882e22e6d9e2a42f836332c0ca21b3e7f/dcmiod/libsrc/cielabutil.cc
1366
+ // https://github.com/DCMTK/dcmtk/blob/88105877c3b610e23fc9422ba6a84af85552f5dd/dcmiod/libsrc/cielabutil.cc
1331
1367
  //
1332
1368
  // RGB here refers to sRGB 0-1 per component.
1333
1369
  // dicomlab is CIELAB values as defined in the dicom standard
1334
- // XYZ is CIEXYZ convention
1335
- //
1336
- // TODO: needs a test suite
1337
- // TODO: only dicomlab2RGB tested on real data
1370
+ // XYZ is CIEXYZ convention, relative to the D50 white point (ICC PCS)
1338
1371
  //
1372
+ // DICOM encodes CIELab values in the same way as the ICC Profile Connection
1373
+ // Space (PCS, see PS3.3 C.10.7.1.1), i.e. relative to the D50 illuminant,
1374
+ // whereas the native white point of sRGB is D65. The conversions below
1375
+ // therefore chromatically adapt between the two using the linear Bradford
1376
+ // transform. Matrices and constants are those of the CSS Color Module Level 4
1377
+ // sample code (https://www.w3.org/TR/css-color-4/#color-conversion-code).
1339
1378
  //
1379
+
1380
+ // White points, defined by their 4-figure CIE x,y chromaticities.
1381
+ // D50 is intentionally [0.96430, 1, 0.82510] and not the ICC.1 PCS illuminant
1382
+ // [0.9642, 1, 0.8249]: this matches DCMTK, highdicom and CSS Color 4, and
1383
+ // encodes sRGB white as exactly 0x8080 in a* and b*.
1384
+ var D50_WHITEPOINT_XYZ = [0.3457 / 0.3585, 1.0, (1.0 - 0.3457 - 0.3585) / 0.3585];
1385
+ var D65_WHITEPOINT_XYZ = [0.3127 / 0.329, 1.0, (1.0 - 0.3127 - 0.329) / 0.329];
1386
+ function clamp01(n) {
1387
+ return Math.min(1.0, Math.max(0.0, n));
1388
+ }
1389
+
1390
+ // Rounds to the nearest integer in [0, max]; NaN (invalid input) gives 0
1391
+ function roundClamp(n, max) {
1392
+ if (!(n >= 0.0)) {
1393
+ return 0;
1394
+ }
1395
+ if (n > max) {
1396
+ return max;
1397
+ }
1398
+ return Math.floor(n + 0.5);
1399
+ }
1340
1400
  var Colors = /*#__PURE__*/function () {
1341
1401
  function Colors() {
1342
1402
  _classCallCheck(this, Colors);
1343
1403
  }
1344
1404
  return _createClass(Colors, null, [{
1405
+ key: "d50WhitePointXYZ",
1406
+ value:
1407
+ /**
1408
+ * White point of the D50 illuminant (ICC PCS), the reference white of
1409
+ * DICOM CIELab. Use this white with the XYZ values of rgb2XYZ, xyz2RGB,
1410
+ * lab2XYZ and xyz2LAB.
1411
+ */
1412
+ function d50WhitePointXYZ() {
1413
+ return [].concat(D50_WHITEPOINT_XYZ);
1414
+ }
1415
+
1416
+ /**
1417
+ * White point of the D65 illuminant, the native white of sRGB. No
1418
+ * conversion in this class uses it. Do not combine it with the XYZ
1419
+ * values of this class, which are relative to D50.
1420
+ */
1421
+ }, {
1345
1422
  key: "d65WhitePointXYZ",
1346
1423
  value: function d65WhitePointXYZ() {
1347
- // white points of D65 light point (CIELAB standard white point)
1348
- return [0.950456, 1.0, 1.088754];
1424
+ return [].concat(D65_WHITEPOINT_XYZ);
1349
1425
  }
1350
1426
  }, {
1351
1427
  key: "dicomlab2RGB",
@@ -1357,6 +1433,26 @@ var Colors = /*#__PURE__*/function () {
1357
1433
  value: function rgb2DICOMLAB(rgb) {
1358
1434
  return Colors.lab2DICOMLAB(Colors.rgb2LAB(rgb));
1359
1435
  }
1436
+
1437
+ // 16 bit DICOM CIELab -> 8 bit sRGB, rounded and clamped
1438
+ }, {
1439
+ key: "dicomlab2RGB8",
1440
+ value: function dicomlab2RGB8(dicomlab) {
1441
+ return Colors.dicomlab2RGB(dicomlab).map(function (n) {
1442
+ return roundClamp(n * 255.0, 255);
1443
+ });
1444
+ }
1445
+
1446
+ // 8 bit sRGB (array or typed array) -> 16 bit DICOM CIELab, rounded and clamped
1447
+ }, {
1448
+ key: "rgb82DICOMLAB",
1449
+ value: function rgb82DICOMLAB(rgb) {
1450
+ return Colors.rgb2DICOMLAB(Array.from(rgb, function (n) {
1451
+ return n / 255.0;
1452
+ })).map(function (n) {
1453
+ return roundClamp(n, 65535);
1454
+ });
1455
+ }
1360
1456
  }, {
1361
1457
  key: "dicomlab2LAB",
1362
1458
  value: function dicomlab2LAB(dicomlab) {
@@ -1385,7 +1481,8 @@ var Colors = /*#__PURE__*/function () {
1385
1481
  }, {
1386
1482
  key: "gammaCorrection",
1387
1483
  value: function gammaCorrection(n) {
1388
- if (n <= 0.0031306684425005883) {
1484
+ // sRGB transfer function (IEC 61966-2-1), linear to gamma-encoded
1485
+ if (n <= 0.0031308) {
1389
1486
  return 12.92 * n;
1390
1487
  } else {
1391
1488
  return 1.055 * Math.pow(n, 1 / 2.4) - 0.055;
@@ -1394,27 +1491,39 @@ var Colors = /*#__PURE__*/function () {
1394
1491
  }, {
1395
1492
  key: "invGammaCorrection",
1396
1493
  value: function invGammaCorrection(n) {
1397
- if (n <= 0.0404482362771076) {
1494
+ // sRGB transfer function (IEC 61966-2-1), gamma-encoded to linear
1495
+ if (n <= 0.04045) {
1398
1496
  return n / 12.92;
1399
1497
  } else {
1400
1498
  return Math.pow((n + 0.055) / 1.055, 2.4);
1401
1499
  }
1402
1500
  }
1501
+
1502
+ // sRGB -> CIE XYZ relative to D50, as DICOM CIELab requires (not D65)
1403
1503
  }, {
1404
1504
  key: "rgb2XYZ",
1405
1505
  value: function rgb2XYZ(rgb) {
1506
+ // sRGB to linear RGB
1406
1507
  var R = Colors.invGammaCorrection(rgb[0]);
1407
1508
  var G = Colors.invGammaCorrection(rgb[1]);
1408
1509
  var B = Colors.invGammaCorrection(rgb[2]);
1409
- return [0.4123955889674142161 * R + 0.3575834307637148171 * G + 0.1804926473817015735 * B, 0.2125862307855955516 * R + 0.7151703037034108499 * G + 0.07220049864333622685 * B, 0.01929721549174694484 * R + 0.1191838645808485318 * G + 0.950497125131579766 * B];
1510
+
1511
+ // linear RGB to CIE XYZ (D65)
1512
+ var X65 = 506752.0 / 1228815.0 * R + 87881.0 / 245763.0 * G + 12673.0 / 70218.0 * B;
1513
+ var Y65 = 87098.0 / 409605.0 * R + 175762.0 / 245763.0 * G + 12673.0 / 175545.0 * B;
1514
+ var Z65 = 7918.0 / 409605.0 * R + 87881.0 / 737289.0 * G + 1001167.0 / 1053270.0 * B;
1515
+
1516
+ // chromatic adaptation D65 to D50 (linear Bradford)
1517
+ return [1.0479297925449969 * X65 + 0.022946870601609652 * Y65 - 0.05019226628920524 * Z65, 0.02962780877005599 * X65 + 0.9904344267538799 * Y65 - 0.017073799063418826 * Z65, -0.009243040646204504 * X65 + 0.015055191490298152 * Y65 + 0.7518742814281371 * Z65];
1410
1518
  }
1519
+
1520
+ // CIE XYZ relative to D50 -> CIELab
1411
1521
  }, {
1412
1522
  key: "xyz2LAB",
1413
1523
  value: function xyz2LAB(xyz) {
1414
- var whitePoint = Colors.d65WhitePointXYZ();
1415
- var X = xyz[0] / whitePoint[0];
1416
- var Y = xyz[1] / whitePoint[1];
1417
- var Z = xyz[2] / whitePoint[2];
1524
+ var X = xyz[0] / D50_WHITEPOINT_XYZ[0];
1525
+ var Y = xyz[1] / D50_WHITEPOINT_XYZ[1];
1526
+ var Z = xyz[2] / D50_WHITEPOINT_XYZ[2];
1418
1527
  X = Colors.labf(X);
1419
1528
  Y = Colors.labf(Y);
1420
1529
  Z = Colors.labf(Z);
@@ -1425,50 +1534,58 @@ var Colors = /*#__PURE__*/function () {
1425
1534
  value: function lab2RGB(lab) {
1426
1535
  return Colors.xyz2RGB(Colors.lab2XYZ(lab));
1427
1536
  }
1537
+
1538
+ // CIELab -> CIE XYZ relative to D50
1428
1539
  }, {
1429
1540
  key: "lab2XYZ",
1430
1541
  value: function lab2XYZ(lab) {
1431
1542
  var L = (lab[0] + 16) / 116;
1432
1543
  var a = L + lab[1] / 500;
1433
1544
  var b = L - lab[2] / 200;
1434
- var whitePoint = Colors.d65WhitePointXYZ();
1435
- return [whitePoint[0] * Colors.labfInv(a), whitePoint[1] * Colors.labfInv(L), whitePoint[2] * Colors.labfInv(b)];
1545
+ return [D50_WHITEPOINT_XYZ[0] * Colors.labfInv(a), D50_WHITEPOINT_XYZ[1] * Colors.labfInv(L), D50_WHITEPOINT_XYZ[2] * Colors.labfInv(b)];
1436
1546
  }
1547
+
1548
+ // CIE XYZ relative to D50 -> sRGB, clipped per channel to [0, 1]
1437
1549
  }, {
1438
1550
  key: "xyz2RGB",
1439
1551
  value: function xyz2RGB(xyz) {
1440
- var R1 = 3.2406 * xyz[0] - 1.5372 * xyz[1] - 0.4986 * xyz[2];
1441
- var G1 = -0.9689 * xyz[0] + 1.8758 * xyz[1] + 0.0415 * xyz[2];
1442
- var B1 = 0.0557 * xyz[0] - 0.204 * xyz[1] + 1.057 * xyz[2];
1552
+ var _xyz = _slicedToArray(xyz, 3),
1553
+ X = _xyz[0],
1554
+ Y = _xyz[1],
1555
+ Z = _xyz[2];
1443
1556
 
1444
- /* Force nonnegative values so that gamma correction is well-defined. */
1445
- var minimumComponent = Math.min(R1, G1);
1446
- minimumComponent = Math.min(minimumComponent, B1);
1447
- if (minimumComponent < 0) {
1448
- R1 -= minimumComponent;
1449
- G1 -= minimumComponent;
1450
- B1 -= minimumComponent;
1451
- }
1557
+ // chromatic adaptation D50 to D65 (linear Bradford)
1558
+ var X65 = 0.955473421488075 * X - 0.02309845494876471 * Y + 0.06325924320057072 * Z;
1559
+ var Y65 = -0.0283697093338637 * X + 1.0099953980813041 * Y + 0.021041441191917323 * Z;
1560
+ var Z65 = 0.012314014864481998 * X - 0.020507649298898964 * Y + 1.330365926242124 * Z;
1561
+
1562
+ // CIE XYZ (D65) to linear RGB
1563
+ var R1 = 12831.0 / 3959.0 * X65 - 329.0 / 214.0 * Y65 - 1974.0 / 3959.0 * Z65;
1564
+ var G1 = -851781 / 878810.0 * X65 + 1648619.0 / 878810.0 * Y65 + 36519.0 / 878810.0 * Z65;
1565
+ var B1 = 705.0 / 12673.0 * X65 - 2585.0 / 12673.0 * Y65 + 705.0 / 667.0 * Z65;
1452
1566
 
1453
- /* Transform from RGB to R'G'B' */
1454
- return [Colors.gammaCorrection(R1), Colors.gammaCorrection(G1), Colors.gammaCorrection(B1)];
1567
+ // Clip to the sRGB gamut (also makes sure that gamma encoding is
1568
+ // well-defined), then transform from linear RGB to sRGB
1569
+ return [Colors.gammaCorrection(clamp01(R1)), Colors.gammaCorrection(clamp01(G1)), Colors.gammaCorrection(clamp01(B1))];
1455
1570
  }
1456
1571
  }, {
1457
1572
  key: "labf",
1458
1573
  value: function labf(n) {
1459
- if (n >= 8.85645167903563082e-3) {
1460
- return Math.pow(n, 0.333333333333333);
1574
+ // epsilon = (6/29)^3 = 216/24389, kappa = (29/3)^3 = 24389/27
1575
+ if (n > 216.0 / 24389.0) {
1576
+ return Math.cbrt(n);
1461
1577
  } else {
1462
- return 841.0 / 108.0 * n + 4.0 / 29.0;
1578
+ return (24389.0 / 27.0 * n + 16.0) / 116.0;
1463
1579
  }
1464
1580
  }
1465
1581
  }, {
1466
1582
  key: "labfInv",
1467
1583
  value: function labfInv(n) {
1468
- if (n >= 0.206896551724137931) {
1584
+ // n > 6/29 <=> n^3 > epsilon
1585
+ if (n > 6.0 / 29.0) {
1469
1586
  return n * n * n;
1470
1587
  } else {
1471
- return 108.0 / 841.0 * (n - 4.0 / 29.0);
1588
+ return (116.0 * n - 16.0) / (24389.0 / 27.0);
1472
1589
  }
1473
1590
  }
1474
1591
  }]);
@@ -1491,11 +1608,15 @@ var AsyncDicomReader = /*#__PURE__*/function () {
1491
1608
  _classCallCheck(this, AsyncDicomReader);
1492
1609
  _defineProperty(this, "syntax", core.EXPLICIT_LITTLE_ENDIAN);
1493
1610
  this.isLittleEndian = options === null || options === void 0 ? void 0 : options.isLittleEndian;
1494
- // Default maxFragmentSize is 128 MB (128 * 1024 * 1024 bytes)
1611
+ // Number of sequence items being read, 0 at the top level
1612
+ this.sequenceDepth = 0;
1613
+ // Default maxFragmentSize is 128 MB; a Big Endian fragment is at least one word, so it can be larger
1495
1614
  this.maxFragmentSize = (_options$maxFragmentS = options === null || options === void 0 ? void 0 : options.maxFragmentSize) !== null && _options$maxFragmentS !== void 0 ? _options$maxFragmentS : 128 * 1024 * 1024;
1496
- this.stream = new core.ReadBufferStream(null, this.isLittleEndian, _objectSpread2({
1615
+ this.stream = new core.ReadBufferStream(null, _objectSpread2(_objectSpread2({
1497
1616
  clearBuffers: true
1498
- }, options));
1617
+ }, options), {}, {
1618
+ littleEndian: this.isLittleEndian
1619
+ }));
1499
1620
  }
1500
1621
 
1501
1622
  /** Sentinel returned when stream is Part 10 but has no preamble (starts with meta). */
@@ -1881,7 +2002,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
1881
2002
  break;
1882
2003
  }
1883
2004
  // Group length
1884
- stream.increment(tagObj.length);
2005
+ stream.increment(length);
1885
2006
  return _context5.abrupt("continue", 1);
1886
2007
  case 5:
1887
2008
  addTagResult = listener.addTag(tag, tagInfo);
@@ -1950,17 +2071,27 @@ var AsyncDicomReader = /*#__PURE__*/function () {
1950
2071
  * item boundary and returns control here for the next item. Without that
1951
2072
  * offset, read() skips the later Item tags as instructions, and all items
1952
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.
1953
2078
  */
1954
2079
  }, {
1955
2080
  key: "readSequence",
1956
2081
  value: (function () {
1957
2082
  var _readSequence = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(listener, sqTagInfo, options) {
1958
- var length, stream, syntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, _t;
2083
+ var _ref, _sqTagInfo$sequenceRe;
2084
+ var itemOptions, length, stream, readSyntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, decoder, _t;
1959
2085
  return _regeneratorRuntime().wrap(function (_context6) {
1960
2086
  while (1) switch (_context6.prev = _context6.next) {
1961
2087
  case 0:
2088
+ itemOptions = _objectSpread2(_objectSpread2({}, options), {}, {
2089
+ untilTag: null,
2090
+ includeUntilTagValue: false
2091
+ });
1962
2092
  length = sqTagInfo.length;
1963
- stream = this.stream, syntax = this.syntax;
2093
+ stream = this.stream;
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;
1964
2095
  endOffset = length === core.UNDEFINED_LENGTH_FIX ? Number.MAX_SAFE_INTEGER : stream.offset + length;
1965
2096
  case 1:
1966
2097
  _t = stream.offset < endOffset;
@@ -1974,50 +2105,78 @@ var AsyncDicomReader = /*#__PURE__*/function () {
1974
2105
  _t = _context6.sent;
1975
2106
  case 3:
1976
2107
  if (!_t) {
1977
- _context6.next = 8;
2108
+ _context6.next = 10;
1978
2109
  break;
1979
2110
  }
1980
2111
  readLog.debug("readSequence loop", stream.offset, endOffset);
1981
- tagInfo = this.readTagHeader(syntax, options);
2112
+ tagInfo = this.readTagHeader(_objectSpread2(_objectSpread2({}, itemOptions), {}, {
2113
+ readSyntax: readSyntax
2114
+ }));
1982
2115
  tag = tagInfo.tag;
1983
2116
  if (!(tag === core.TagHex.Item)) {
1984
- _context6.next = 5;
2117
+ _context6.next = 7;
1985
2118
  break;
1986
2119
  }
1987
2120
  listener.startObject();
1988
2121
  // defined-length item: stop at its own end (see doc comment)
1989
2122
  itemLength = tagInfo.length;
1990
- itemUntilOffset = itemLength === core.UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset);
1991
- _context6.next = 4;
1992
- return this.read(listener, _objectSpread2(_objectSpread2({}, options), {}, {
1993
- untilOffset: itemUntilOffset
2123
+ itemUntilOffset = itemLength === core.UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset); // A SpecificCharacterSet in the item applies only to that
2124
+ // item (PS3.5 7.5.3), but the item is read on this stream:
2125
+ // put back the decoder the item started with.
2126
+ decoder = stream.decoder;
2127
+ this.sequenceDepth++;
2128
+ _context6.prev = 4;
2129
+ _context6.next = 5;
2130
+ return this.read(listener, _objectSpread2(_objectSpread2({}, itemOptions), {}, {
2131
+ untilOffset: itemUntilOffset,
2132
+ readSyntax: readSyntax
1994
2133
  }));
1995
- case 4:
1996
- _context6.next = 7;
1997
- break;
1998
2134
  case 5:
2135
+ _context6.prev = 5;
2136
+ this.sequenceDepth--;
2137
+ return _context6.finish(5);
2138
+ case 6:
2139
+ stream.setDecoder(decoder);
2140
+ _context6.next = 9;
2141
+ break;
2142
+ case 7:
1999
2143
  if (!(tag === core.TagHex.SequenceDelimitationEnd)) {
2000
- _context6.next = 6;
2144
+ _context6.next = 8;
2001
2145
  break;
2002
2146
  }
2003
2147
  return _context6.abrupt("return");
2004
- case 6:
2148
+ case 8:
2005
2149
  console.warn("Unknown tag info", length, tagInfo);
2006
- throw new Error();
2007
- case 7:
2150
+ throw new Error("Expected an item or a sequence delimitation item in a sequence, found tag ".concat(tag));
2151
+ case 9:
2008
2152
  _context6.next = 1;
2009
2153
  break;
2010
- case 8:
2154
+ case 10:
2011
2155
  case "end":
2012
2156
  return _context6.stop();
2013
2157
  }
2014
- }, _callee6, this);
2158
+ }, _callee6, this, [[4,, 5, 6]]);
2015
2159
  }));
2016
2160
  function readSequence(_x3, _x4, _x5) {
2017
2161
  return _readSequence.apply(this, arguments);
2018
2162
  }
2019
2163
  return readSequence;
2020
- }())
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
+ }
2021
2180
  }, {
2022
2181
  key: "readPixelData",
2023
2182
  value: function readPixelData(tagInfo) {
@@ -2030,16 +2189,28 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2030
2189
  /**
2031
2190
  * Emits one or more listener.value() calls for a fragment, splitting if needed.
2032
2191
  * This does NOT start/pop any array contexts; callers control the surrounding structure.
2192
+ * In a big endian stream, each fragment holds whole words of wordWidth
2193
+ * bytes, swapped to little endian.
2033
2194
  */
2034
2195
  }, {
2035
2196
  key: "_emitSplitValues",
2036
2197
  value: (function () {
2037
2198
  var _emitSplitValues2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(length) {
2038
2199
  var _listener$awaitDrain;
2039
- var stream, listener, maxFragmentSize, offset, chunkSize, buffer;
2200
+ var wordWidth,
2201
+ stream,
2202
+ listener,
2203
+ maxFragmentSize,
2204
+ swap,
2205
+ fragmentSize,
2206
+ offset,
2207
+ chunkSize,
2208
+ buffer,
2209
+ _args7 = arguments;
2040
2210
  return _regeneratorRuntime().wrap(function (_context7) {
2041
2211
  while (1) switch (_context7.prev = _context7.next) {
2042
2212
  case 0:
2213
+ wordWidth = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : 1;
2043
2214
  stream = this.stream, listener = this.listener;
2044
2215
  _context7.next = 1;
2045
2216
  return (_listener$awaitDrain = listener.awaitDrain) === null || _listener$awaitDrain === void 0 ? void 0 : _listener$awaitDrain.call(listener);
@@ -2051,6 +2222,8 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2051
2222
  }
2052
2223
  throw new Error("maxFragmentSize must be a positive number, got ".concat(maxFragmentSize));
2053
2224
  case 2:
2225
+ swap = !stream.isLittleEndian && wordWidth > 1;
2226
+ fragmentSize = swap ? Math.max(wordWidth, maxFragmentSize - maxFragmentSize % wordWidth) : maxFragmentSize;
2054
2227
  offset = 0;
2055
2228
  case 3:
2056
2229
  if (!(offset < length)) {
@@ -2058,11 +2231,14 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2058
2231
  break;
2059
2232
  }
2060
2233
  readLog.trace("_emitSplitValues loop", offset, length);
2061
- chunkSize = Math.min(maxFragmentSize, length - offset);
2234
+ chunkSize = Math.min(fragmentSize, length - offset);
2062
2235
  _context7.next = 4;
2063
2236
  return stream.ensureAvailable(chunkSize);
2064
2237
  case 4:
2065
2238
  buffer = stream.readArrayBuffer(chunkSize);
2239
+ if (swap) {
2240
+ core.swapBytes(buffer, wordWidth);
2241
+ }
2066
2242
  listener.value(buffer);
2067
2243
  offset += chunkSize;
2068
2244
  stream.consume();
@@ -2087,8 +2263,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2087
2263
  key: "readCompressed",
2088
2264
  value: (function () {
2089
2265
  var _readCompressed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_tagInfo) {
2090
- var _listener$information;
2091
- var stream, listener, transferSyntaxUid, isVideo, numberOfFrames, isSingleFrame, offsets, singleArray, startOffset, frameNumber, lastFrame, frameTag, length;
2266
+ var stream, listener, transferSyntaxUid, isVideo, isSingleFrame, offsets, singleArray, startOffset, frameNumber, lastFrame, frameTag, length;
2092
2267
  return _regeneratorRuntime().wrap(function (_context8) {
2093
2268
  while (1) switch (_context8.prev = _context8.next) {
2094
2269
  case 0:
@@ -2099,8 +2274,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2099
2274
  case 1:
2100
2275
  // Check if this is a video transfer syntax
2101
2276
  isVideo = core.isVideoTransferSyntax(transferSyntaxUid); // Check number of frames - only use video logic for single frame (or undefined)
2102
- numberOfFrames = (_listener$information = listener.information) === null || _listener$information === void 0 ? void 0 : _listener$information.numberOfFrames;
2103
- isSingleFrame = !numberOfFrames || parseInt(numberOfFrames) <= 1;
2277
+ isSingleFrame = this.getNumberOfFrames() <= 1;
2104
2278
  _context8.next = 2;
2105
2279
  return this.readOffsets();
2106
2280
  case 2:
@@ -2214,23 +2388,23 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2214
2388
  key: "readUncompressed",
2215
2389
  value: (function () {
2216
2390
  var _readUncompressed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(tagInfo) {
2217
- var _listener$information2;
2218
- var length, listener, numberOfFrames, frameLength, _listener$information3, _listener$information4, _listener$information5, _listener$information6, rows, cols, samplesPerPixel, bitsAllocated, bitsPerFrame, frameNumber;
2391
+ var length, listener, wordWidth, numberOfFrames, frameLength, _listener$information, _listener$information2, _listener$information3, _listener$information4, rows, cols, samplesPerPixel, bitsAllocated, bitsPerFrame, allPixelData, offset, frameNumber;
2219
2392
  return _regeneratorRuntime().wrap(function (_context0) {
2220
2393
  while (1) switch (_context0.prev = _context0.next) {
2221
2394
  case 0:
2222
2395
  length = tagInfo.length;
2223
2396
  listener = this.listener;
2224
- numberOfFrames = parseInt(((_listener$information2 = listener.information) === null || _listener$information2 === void 0 ? void 0 : _listener$information2.numberOfFrames) || 1);
2397
+ wordWidth = this.wordWidth(tagInfo);
2398
+ numberOfFrames = this.getNumberOfFrames();
2225
2399
  frameLength = Math.floor(length / numberOfFrames);
2226
2400
  if (!(numberOfFrames > 1)) {
2227
2401
  _context0.next = 4;
2228
2402
  break;
2229
2403
  }
2230
- rows = (_listener$information3 = listener.information) === null || _listener$information3 === void 0 ? void 0 : _listener$information3.rows;
2231
- cols = (_listener$information4 = listener.information) === null || _listener$information4 === void 0 ? void 0 : _listener$information4.columns;
2232
- samplesPerPixel = (_listener$information5 = listener.information) === null || _listener$information5 === void 0 ? void 0 : _listener$information5.samplesPerPixel;
2233
- bitsAllocated = (_listener$information6 = listener.information) === null || _listener$information6 === void 0 ? void 0 : _listener$information6.bitsAllocated;
2404
+ rows = (_listener$information = listener.information) === null || _listener$information === void 0 ? void 0 : _listener$information.rows;
2405
+ cols = (_listener$information2 = listener.information) === null || _listener$information2 === void 0 ? void 0 : _listener$information2.columns;
2406
+ samplesPerPixel = (_listener$information3 = listener.information) === null || _listener$information3 === void 0 ? void 0 : _listener$information3.samplesPerPixel;
2407
+ bitsAllocated = (_listener$information4 = listener.information) === null || _listener$information4 === void 0 ? void 0 : _listener$information4.bitsAllocated;
2234
2408
  bitsPerFrame = rows * cols * samplesPerPixel * bitsAllocated;
2235
2409
  if (!(bitsPerFrame % 8 !== 0)) {
2236
2410
  _context0.next = 3;
@@ -2253,24 +2427,41 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2253
2427
  }
2254
2428
  throw new Error("Invalid frame length: ".concat(length, " for ").concat(numberOfFrames, " frames"));
2255
2429
  case 4:
2256
- frameNumber = 0;
2430
+ if (!(!this.stream.isLittleEndian && frameLength % wordWidth !== 0)) {
2431
+ _context0.next = 6;
2432
+ break;
2433
+ }
2434
+ _context0.next = 5;
2435
+ return this.stream.ensureAvailable(length);
2257
2436
  case 5:
2437
+ allPixelData = this.stream.readArrayBuffer(length);
2438
+ this.stream.consume();
2439
+ core.swapBytes(allPixelData, wordWidth);
2440
+ for (offset = 0; offset < length; offset += frameLength) {
2441
+ listener.startObject([]);
2442
+ listener.value(allPixelData.slice(offset, offset + frameLength));
2443
+ listener.pop();
2444
+ }
2445
+ return _context0.abrupt("return");
2446
+ case 6:
2447
+ frameNumber = 0;
2448
+ case 7:
2258
2449
  if (!(frameNumber < numberOfFrames)) {
2259
- _context0.next = 8;
2450
+ _context0.next = 10;
2260
2451
  break;
2261
2452
  }
2262
2453
  readLog.trace("readUncompressed loop", frameNumber, numberOfFrames);
2263
2454
  listener.startObject([]);
2264
- _context0.next = 6;
2265
- return this._emitSplitValues(frameLength);
2266
- case 6:
2455
+ _context0.next = 8;
2456
+ return this._emitSplitValues(frameLength, wordWidth);
2457
+ case 8:
2267
2458
  listener.pop();
2268
2459
  // console.log(stream.getBufferMemoryInfo());
2269
- case 7:
2460
+ case 9:
2270
2461
  frameNumber++;
2271
- _context0.next = 5;
2462
+ _context0.next = 7;
2272
2463
  break;
2273
- case 8:
2464
+ case 10:
2274
2465
  case "end":
2275
2466
  return _context0.stop();
2276
2467
  }
@@ -2299,18 +2490,18 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2299
2490
  key: "readUncompressedBitFrame",
2300
2491
  value: (function () {
2301
2492
  var _readUncompressedBitFrame = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(tagInfo) {
2302
- var _listener$information7, _listener$information8, _listener$information9, _listener$information0, _listener$information1;
2493
+ var _listener$information5, _listener$information6, _listener$information7, _listener$information8;
2303
2494
  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;
2304
2495
  return _regeneratorRuntime().wrap(function (_context1) {
2305
2496
  while (1) switch (_context1.prev = _context1.next) {
2306
2497
  case 0:
2307
2498
  length = tagInfo.length;
2308
2499
  listener = this.listener, stream = this.stream;
2309
- numberOfFrames = parseInt(((_listener$information7 = listener.information) === null || _listener$information7 === void 0 ? void 0 : _listener$information7.numberOfFrames) || 1);
2310
- rows = (_listener$information8 = listener.information) === null || _listener$information8 === void 0 ? void 0 : _listener$information8.rows;
2311
- cols = (_listener$information9 = listener.information) === null || _listener$information9 === void 0 ? void 0 : _listener$information9.columns;
2312
- samplesPerPixel = ((_listener$information0 = listener.information) === null || _listener$information0 === void 0 ? void 0 : _listener$information0.samplesPerPixel) || 1;
2313
- bitsAllocated = (_listener$information1 = listener.information) === null || _listener$information1 === void 0 ? void 0 : _listener$information1.bitsAllocated;
2500
+ numberOfFrames = this.getNumberOfFrames();
2501
+ rows = (_listener$information5 = listener.information) === null || _listener$information5 === void 0 ? void 0 : _listener$information5.rows;
2502
+ cols = (_listener$information6 = listener.information) === null || _listener$information6 === void 0 ? void 0 : _listener$information6.columns;
2503
+ samplesPerPixel = ((_listener$information7 = listener.information) === null || _listener$information7 === void 0 ? void 0 : _listener$information7.samplesPerPixel) || 1;
2504
+ bitsAllocated = (_listener$information8 = listener.information) === null || _listener$information8 === void 0 ? void 0 : _listener$information8.bitsAllocated;
2314
2505
  if (!(!rows || !cols || !bitsAllocated)) {
2315
2506
  _context1.next = 1;
2316
2507
  break;
@@ -2338,6 +2529,10 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2338
2529
  case 4:
2339
2530
  allPixelData = stream.readArrayBuffer(totalBytes);
2340
2531
  stream.consume();
2532
+ if (!stream.isLittleEndian) {
2533
+ // the bits of OW data are packed in big endian words
2534
+ core.swapBytes(allPixelData, this.wordWidth(tagInfo));
2535
+ }
2341
2536
 
2342
2537
  // Extract each frame, unpacking bits so each frame starts at byte 0
2343
2538
  for (frameNumber = 0; frameNumber < numberOfFrames; frameNumber++) {
@@ -2379,7 +2574,8 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2379
2574
  }()
2380
2575
  /**
2381
2576
  * Reads raw binary data in chunks and delivers it to the listener.
2382
- * This method reads data in 64KB chunks to manage memory efficiently.
2577
+ * Reads the value in fragments of `maxFragmentSize` bytes.
2578
+ * OW/OF/OL/OD/OV words come as little endian, as on the other read paths.
2383
2579
  */
2384
2580
  )
2385
2581
  }, {
@@ -2392,7 +2588,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2392
2588
  case 0:
2393
2589
  length = tagInfo.length;
2394
2590
  _context10.next = 1;
2395
- return this._emitSplitValues(length);
2591
+ return this._emitSplitValues(length, this.wordWidth(tagInfo));
2396
2592
  case 1:
2397
2593
  case "end":
2398
2594
  return _context10.stop();
@@ -2403,7 +2599,13 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2403
2599
  return _readRawBinary.apply(this, arguments);
2404
2600
  }
2405
2601
  return readRawBinary;
2406
- }())
2602
+ }() /** Bytes per word of the value field; "ox" (a UN pixel data) is OW. */)
2603
+ }, {
2604
+ key: "wordWidth",
2605
+ value: function wordWidth(tagInfo) {
2606
+ var _ValueRepresentation$;
2607
+ return (_ValueRepresentation$ = core.ValueRepresentation.createByTypeString(tagInfo.vr).wordWidth) !== null && _ValueRepresentation$ !== void 0 ? _ValueRepresentation$ : 1;
2608
+ }
2407
2609
  }, {
2408
2610
  key: "isSequence",
2409
2611
  value: function isSequence(tagInfo) {
@@ -2418,14 +2620,15 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2418
2620
  }, {
2419
2621
  key: "readTagHeader",
2420
2622
  value: function readTagHeader() {
2623
+ var _options$readSyntax;
2421
2624
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
2422
2625
  untilTag: null,
2423
2626
  includeUntilTagValue: false
2424
2627
  };
2425
- var stream = this.stream,
2426
- syntax = this.syntax;
2628
+ var stream = this.stream;
2427
2629
  var untilTag = options.untilTag,
2428
2630
  includeUntilTagValue = options.includeUntilTagValue;
2631
+ var syntax = (_options$readSyntax = options.readSyntax) !== null && _options$readSyntax !== void 0 ? _options$readSyntax : this.syntax;
2429
2632
  var implicit = syntax == core.IMPLICIT_LITTLE_ENDIAN;
2430
2633
  var isLittleEndian = syntax !== core.EXPLICIT_BIG_ENDIAN;
2431
2634
  stream.setEndian(isLittleEndian);
@@ -2445,6 +2648,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2445
2648
  var length = null;
2446
2649
  var vr = null;
2447
2650
  var vrType;
2651
+ var wireVrType = null;
2448
2652
  var isCommand = tagObj.group() === 0;
2449
2653
  if (tagObj.isInstruction()) {
2450
2654
  length = stream.readUint32();
@@ -2455,13 +2659,13 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2455
2659
  if (elementData) {
2456
2660
  vrType = elementData.vr;
2457
2661
  if (vrType === "xs") {
2458
- var _this$listener;
2662
+ var _this$listener2;
2459
2663
  // The dictionary meta-VR "xs" ("US or SS") resolves via
2460
2664
  // PixelRepresentation (PS3.5), exactly like the sync
2461
2665
  // reader (DicomMessage._readTag). The listener's
2462
2666
  // information filter tracks (0028,0103), which precedes
2463
2667
  // every xs tag in tag order.
2464
- vrType = DicomMessage.resolveXsVrType((_this$listener = this.listener) === null || _this$listener === void 0 || (_this$listener = _this$listener.information) === null || _this$listener === void 0 ? void 0 : _this$listener.pixelRepresentation);
2668
+ 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);
2465
2669
  }
2466
2670
  } else {
2467
2671
  //unknown tag
@@ -2479,13 +2683,14 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2479
2683
  } else {
2480
2684
  var _DicomMessage$lookupT;
2481
2685
  vrType = stream.readVR();
2686
+ wireVrType = vrType;
2482
2687
  if (vrType === "UN" && (_DicomMessage$lookupT = DicomMessage.lookupTag(tagObj)) !== null && _DicomMessage$lookupT !== void 0 && _DicomMessage$lookupT.vr) {
2483
2688
  vrType = DicomMessage.lookupTag(tagObj).vr;
2484
2689
  if (vrType === "xs") {
2485
- var _this$listener2;
2690
+ var _this$listener3;
2486
2691
  // Same PixelRepresentation-driven US/SS resolution for
2487
2692
  // explicit-VR UN elements whose dictionary VR is "xs".
2488
- 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);
2693
+ 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);
2489
2694
  }
2490
2695
  vr = core.ValueRepresentation.parseUnknownVr(vrType);
2491
2696
  } else {
@@ -2498,11 +2703,16 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2498
2703
  length = stream.readUint16();
2499
2704
  }
2500
2705
  }
2706
+ var sequenceReadSyntax;
2707
+ if (!implicit && wireVrType === "UN" && core.isUnSequenceValue(stream.view, stream.offset, length, vr.type)) {
2708
+ vr = core.ValueRepresentation.createByTypeString("SQ");
2709
+ sequenceReadSyntax = core.IMPLICIT_LITTLE_ENDIAN;
2710
+ }
2501
2711
  var punctuatedTag = core.DicomMetaDictionary.punctuateTag(tag);
2502
2712
  var entry = core.DicomMetaDictionary.dictionary[punctuatedTag];
2503
2713
 
2504
2714
  // Include both the string and object values for vr and tag
2505
- var header = {
2715
+ var header = _objectSpread2({
2506
2716
  vrObj: vr,
2507
2717
  vr: vr.type,
2508
2718
  tag: tag,
@@ -2510,7 +2720,9 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2510
2720
  vm: entry === null || entry === void 0 ? void 0 : entry.vm,
2511
2721
  name: entry === null || entry === void 0 ? void 0 : entry.name,
2512
2722
  length: length === core.UNDEFINED_LENGTH ? -1 : length
2513
- };
2723
+ }, sequenceReadSyntax && {
2724
+ sequenceReadSyntax: sequenceReadSyntax
2725
+ });
2514
2726
  return header;
2515
2727
  }
2516
2728
 
@@ -2524,12 +2736,14 @@ var AsyncDicomReader = /*#__PURE__*/function () {
2524
2736
  key: "readSingle",
2525
2737
  value: (function () {
2526
2738
  var _readSingle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(tagInfo, listener, options) {
2739
+ var _options$readSyntax2;
2527
2740
  var length, stream, syntax, vr, values, times, i, _vr$read, value, _vr$read2, _value, delimiterChar, decoder, valuesForListener;
2528
2741
  return _regeneratorRuntime().wrap(function (_context11) {
2529
2742
  while (1) switch (_context11.prev = _context11.next) {
2530
2743
  case 0:
2531
2744
  length = tagInfo.length;
2532
- stream = this.stream, syntax = this.syntax;
2745
+ stream = this.stream;
2746
+ syntax = (_options$readSyntax2 = options === null || options === void 0 ? void 0 : options.readSyntax) !== null && _options$readSyntax2 !== void 0 ? _options$readSyntax2 : this.syntax;
2533
2747
  _context11.next = 1;
2534
2748
  return this.stream.ensureAvailable(length);
2535
2749
  case 1:
@@ -3317,16 +3531,10 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3317
3531
  //
3318
3532
  // shared
3319
3533
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
3320
- ds.SharedFunctionalGroupsSequence = {
3321
- PlaneOrientationSequence: {
3322
- ImageOrientationPatient: dataset0.ImageOrientationPatient
3323
- },
3324
- PixelMeasuresSequence: {
3325
- PixelSpacing: dataset0.PixelSpacing,
3326
- SpacingBetweenSlices: SpacingBetweenSlices,
3327
- SliceThickness: SpacingBetweenSlices
3328
- }
3329
- };
3534
+ ds.SharedFunctionalGroupsSequence = ImageNormalizer.sharedImagePlaneGroups(dataset0, {
3535
+ SpacingBetweenSlices: SpacingBetweenSlices,
3536
+ SliceThickness: SpacingBetweenSlices
3537
+ });
3330
3538
  ds.ReferencedSeriesSequence = {
3331
3539
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
3332
3540
  ReferencedInstanceSequence: []
@@ -3339,15 +3547,12 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3339
3547
  // and set the referenced series uid
3340
3548
  distanceDatasetPairs.forEach(function (pair) {
3341
3549
  var dataset = pair[1];
3342
- ds.PerFrameFunctionalGroupsSequence.push({
3343
- PlanePositionSequence: {
3344
- ImagePositionPatient: dataset.ImagePositionPatient
3345
- },
3550
+ ds.PerFrameFunctionalGroupsSequence.push(_objectSpread2(_objectSpread2({}, ImageNormalizer.planePositionGroup(dataset)), {}, {
3346
3551
  FrameVOILUTSequence: {
3347
3552
  WindowCenter: dataset.WindowCenter,
3348
3553
  WindowWidth: dataset.WindowWidth
3349
3554
  }
3350
- });
3555
+ }));
3351
3556
  ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
3352
3557
  ReferencedSOPClassUID: dataset.SOPClassUID,
3353
3558
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
@@ -3365,6 +3570,22 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3365
3570
  DimensionDescriptionLabel: "ImagePositionPatient"
3366
3571
  }];
3367
3572
  }
3573
+
3574
+ /**
3575
+ * Fills in the functional groups of a multiframe dataset.
3576
+ *
3577
+ * A missing or empty SharedFunctionalGroupsSequence is built from the
3578
+ * top-level image plane attributes; a one-item array is used as its item.
3579
+ * The shared item gets the list accessors (addAccessors), so both
3580
+ * `SharedFunctionalGroupsSequence.X` and `SharedFunctionalGroupsSequence[0].X`
3581
+ * work.
3582
+ * The PerFrameFunctionalGroupsSequence is filled up to the declared
3583
+ * NumberOfFrames with items at the top-level position, existing items keep
3584
+ * their content, and each item without a FrameContentSequence gets one.
3585
+ * Added items share the position but get increasing InStackPositionNumber.
3586
+ * Items beyond NumberOfFrames are kept unchanged; a null item there is
3587
+ * skipped and does not throw.
3588
+ */
3368
3589
  }, {
3369
3590
  key: "normalizeMultiframe",
3370
3591
  value: function normalizeMultiframe() {
@@ -3388,9 +3609,18 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3388
3609
  if (!ds.PresentationLUTShape) {
3389
3610
  ds.PresentationLUTShape = "IDENTITY";
3390
3611
  }
3612
+ if (Array.isArray(ds.SharedFunctionalGroupsSequence)) {
3613
+ // The shared group has one item; an empty array counts as missing
3614
+ ds.SharedFunctionalGroupsSequence = ds.SharedFunctionalGroupsSequence[0];
3615
+ }
3391
3616
  if (!ds.SharedFunctionalGroupsSequence) {
3392
- core.log.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
3617
+ core.log.warn("Missing SharedFunctionalGroupsSequence; using the top-level image plane attributes");
3618
+ ds.SharedFunctionalGroupsSequence = ImageNormalizer.sharedImagePlaneGroups(ds, {
3619
+ SliceThickness: ds.SliceThickness,
3620
+ SpacingBetweenSlices: ds.SpacingBetweenSlices
3621
+ });
3393
3622
  }
3623
+ ds.SharedFunctionalGroupsSequence = core.addAccessors(ds.SharedFunctionalGroupsSequence);
3394
3624
 
3395
3625
  // TODO: special case!
3396
3626
  if (ds.BodyPartExamined === "PROSTATE") {
@@ -3410,10 +3640,20 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3410
3640
  RescaleSlope: rescaleSlope,
3411
3641
  RescaleType: "US"
3412
3642
  };
3413
- var frameNumber = 1;
3414
- this.datasets.forEach(function (dataset) {
3415
- if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
3416
- ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
3643
+ var frameCount = Math.max(this.datasets.length, Number(ds.NumberOfFrames) || 0);
3644
+ var perFrame = ds.PerFrameFunctionalGroupsSequence || [];
3645
+ ds.PerFrameFunctionalGroupsSequence = Array.isArray(perFrame) ? perFrame : [perFrame];
3646
+ while (ds.PerFrameFunctionalGroupsSequence.length < frameCount) {
3647
+ ds.PerFrameFunctionalGroupsSequence.push(ImageNormalizer.planePositionGroup(ds));
3648
+ }
3649
+ for (var frameNumber = 1; frameNumber <= frameCount; frameNumber++) {
3650
+ var _ds$PerFrameFunctiona, _ref;
3651
+ var item = (_ds$PerFrameFunctiona = ds.PerFrameFunctionalGroupsSequence)[_ref = frameNumber - 1] || (_ds$PerFrameFunctiona[_ref] = {});
3652
+ if (item.FrameContentSequence) {
3653
+ continue;
3654
+ }
3655
+ var dataset = this.datasets[frameNumber - 1] || {};
3656
+ item.FrameContentSequence = {
3417
3657
  FrameAcquisitionDuration: 0,
3418
3658
  StackID: 1,
3419
3659
  InStackPositionNumber: frameNumber,
@@ -3421,12 +3661,10 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3421
3661
  };
3422
3662
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
3423
3663
  if (!isNaN(frameTime)) {
3424
- var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
3425
- frameContentSequence.FrameAcquisitionDateTime = frameTime;
3426
- frameContentSequence.FrameReferenceDateTime = frameTime;
3664
+ item.FrameContentSequence.FrameAcquisitionDateTime = frameTime;
3665
+ item.FrameContentSequence.FrameReferenceDateTime = frameTime;
3427
3666
  }
3428
- frameNumber++;
3429
- });
3667
+ }
3430
3668
 
3431
3669
  //
3432
3670
  // TODO: convert this to shared functional group not top level element
@@ -3452,7 +3690,7 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3452
3690
  count: 0
3453
3691
  };
3454
3692
  ds.PerFrameFunctionalGroupsSequence.forEach(function (functionalGroup) {
3455
- if (functionalGroup.FrameVOILUT) {
3693
+ if (functionalGroup !== null && functionalGroup !== void 0 && functionalGroup.FrameVOILUT) {
3456
3694
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
3457
3695
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
3458
3696
  if (functionalGroup.FrameVOILUTSequence && wc && ww) {
@@ -3511,6 +3749,29 @@ var ImageNormalizer = /*#__PURE__*/function (_Normalizer) {
3511
3749
  value: function vec3Dot(a, b) {
3512
3750
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
3513
3751
  }
3752
+ }, {
3753
+ key: "sharedImagePlaneGroups",
3754
+ value: function sharedImagePlaneGroups(dataset, pixelMeasures) {
3755
+ return {
3756
+ PlaneOrientationSequence: {
3757
+ ImageOrientationPatient: dataset.ImageOrientationPatient
3758
+ },
3759
+ PixelMeasuresSequence: _objectSpread2({
3760
+ PixelSpacing: dataset.PixelSpacing
3761
+ }, pixelMeasures)
3762
+ };
3763
+ }
3764
+ }, {
3765
+ key: "planePositionGroup",
3766
+ value: function planePositionGroup(dataset) {
3767
+ var position = dataset.ImagePositionPatient;
3768
+ return {
3769
+ PlanePositionSequence: {
3770
+ // A copy, so that no two frames share one array
3771
+ ImagePositionPatient: Array.isArray(position) ? position.slice() : position
3772
+ }
3773
+ };
3774
+ }
3514
3775
  }]);
3515
3776
  }(Normalizer);
3516
3777
  var MRImageNormalizer = /*#__PURE__*/function (_ImageNormalizer) {
@@ -6299,7 +6560,7 @@ function h(matrix) {
6299
6560
  var _matrix$shape = _slicedToArray(matrix.shape, 2),
6300
6561
  rows = _matrix$shape[0],
6301
6562
  cols = _matrix$shape[1];
6302
- var result = ndarray(new Uint8Array(rows * cols), [rows, cols]);
6563
+ var result = ndarray(new matrix.data.constructor(rows * cols), [rows, cols]);
6303
6564
  for (var i = 0; i < rows; i++) {
6304
6565
  for (var j = 0; j < cols; j++) {
6305
6566
  result.set(i, j, matrix.get(i, cols - 1 - j));
@@ -6318,7 +6579,7 @@ function v(matrix) {
6318
6579
  var _matrix$shape2 = _slicedToArray(matrix.shape, 2),
6319
6580
  rows = _matrix$shape2[0],
6320
6581
  cols = _matrix$shape2[1];
6321
- var result = ndarray(new Uint8Array(rows * cols), [rows, cols]);
6582
+ var result = ndarray(new matrix.data.constructor(rows * cols), [rows, cols]);
6322
6583
  for (var j = 0; j < cols; j++) {
6323
6584
  for (var i = 0; i < rows; i++) {
6324
6585
  result.set(i, j, matrix.get(rows - 1 - i, j));
@@ -6337,7 +6598,7 @@ function rotateMatrix902D (matrix) {
6337
6598
  var _matrix$shape = _slicedToArray(matrix.shape, 2),
6338
6599
  rows = _matrix$shape[0],
6339
6600
  cols = _matrix$shape[1];
6340
- var result = ndarray(new Uint8Array(rows * cols), [cols, rows]);
6601
+ var result = ndarray(new matrix.data.constructor(rows * cols), [cols, rows]);
6341
6602
  var resultColsMinus1 = result.shape[1] - 1;
6342
6603
  for (var i = 0; i < rows; i++) {
6343
6604
  for (var j = 0; j < cols; j++) {
@@ -11974,12 +12235,8 @@ var Cornerstone3D = {
11974
12235
  CORNERSTONE_3D_TAG: CORNERSTONE_3D_TAG
11975
12236
  };
11976
12237
 
11977
- // TODO: Is there a better name for this? RGBAInt?
11978
- // Should we move it to Colors.js
11979
12238
  function dicomlab2RGBA(cielab) {
11980
- var rgba = Colors.dicomlab2RGB(cielab).map(function (x) {
11981
- return Math.round(x * 255);
11982
- });
12239
+ var rgba = Colors.dicomlab2RGB8(cielab);
11983
12240
  rgba.push(255);
11984
12241
  return rgba;
11985
12242
  }
@@ -12623,6 +12880,11 @@ var DICOMMicroscopyViewer = {
12623
12880
  MeasurementReport: MeasurementReport$1
12624
12881
  };
12625
12882
 
12883
+ /**
12884
+ * @deprecated The adapters moved to `@cornerstonejs/adapters`. Import them
12885
+ * from that package. `@dcmjs-org/dcmjs` keeps this export only for
12886
+ * compatibility with 0.x, and a later major release removes it.
12887
+ */
12626
12888
  var adapters = {
12627
12889
  Cornerstone: Cornerstone,
12628
12890
  Cornerstone3D: Cornerstone3D,
@@ -15675,11 +15937,12 @@ var constants = /*#__PURE__*/Object.freeze({
15675
15937
  });
15676
15938
 
15677
15939
  // Every entry below must be a real dictionary keyword
15678
- // (DicomMetaDictionary.nameMap): cleanTags silently skips names that do not
15940
+ // (DicomMetaDictionary.entryForName()): cleanTags silently skips names that do not
15679
15941
  // resolve, so a misspelled entry means the data it was meant to scrub is
15680
15942
  // left in place (issue #345). Retired attributes use the dictionary's
15681
15943
  // RETIRED_ keyword prefix. All 103 previously non-resolving names were
15682
15944
  // mapped to their intended keywords; none had to be removed.
15945
+ // ResponsiblePersonRole was added to match 0.53.3.
15683
15946
  var tagNamesToEmpty = [
15684
15947
  // please override these in specificReplaceDefaults to have useful values
15685
15948
  "PatientID", "PatientName",
@@ -15692,7 +15955,7 @@ var tagNamesToEmpty = [
15692
15955
  // cat 2/3: CTP: set to increment dates
15693
15956
  "InstanceCreationDate", "StudyDate", "ContentDate", "DateOfSecondaryCapture", "DateOfLastCalibration", "DateOfLastDetectorCalibration", "FrameAcquisitionDateTime", "FrameReferenceDateTime", "RETIRED_StudyVerifiedDate", "RETIRED_StudyReadDate", "RETIRED_ScheduledStudyStartDate", "RETIRED_ScheduledStudyStopDate", "RETIRED_StudyArrivalDate", "RETIRED_StudyCompletionDate", "RETIRED_ScheduledAdmissionDate", "RETIRED_ScheduledDischargeDate", "RETIRED_DischargeDate", "ScheduledProcedureStepStartDate", "ScheduledProcedureStepEndDate", "PerformedProcedureStepStartDate", "PerformedProcedureStepEndDate", "IssueDateOfImagingServiceRequest", "VerificationDateTime", "ObservationDateTime", "DateTime", "Date", "ReferencedDateTime",
15694
15957
  // cat 3/3: CTP: set to remove using @remove
15695
- "AcquisitionDate", "RETIRED_OverlayDate", "RETIRED_CurveDate", "AcquisitionDateTime", "SeriesTime", "AcquisitionTime", "RETIRED_OverlayTime", "RETIRED_CurveTime", "InstitutionName", "InstitutionAddress", "ReferringPhysicianAddress", "ReferringPhysicianTelephoneNumbers", "ReferringPhysicianIdentificationSequence", "TimezoneOffsetFromUTC", "StationName", "StudyDescription", "InstitutionalDepartmentName", "PhysiciansOfRecord", "PhysiciansOfRecordIdentificationSequence", "PerformingPhysicianName", "PerformingPhysicianIdentificationSequence", "NameOfPhysiciansReadingStudy", "PhysiciansReadingStudyIdentificationSequence", "OperatorsName", "OperatorIdentificationSequence", "AdmittingDiagnosesDescription", "AdmittingDiagnosesCodeSequence", "ReferencedStudySequence", "ReferencedPerformedProcedureStepSequence", "ReferencedPatientSequence", "ReferencedImageSequence", "DerivationDescription", "SourceImageSequence", "RETIRED_IdentifyingComments", "IssuerOfPatientID", "PatientBirthTime", "PatientInsurancePlanCodeSequence", "PatientPrimaryLanguageCodeSequence", "PatientPrimaryLanguageModifierCodeSequence", "OtherPatientIDs", "OtherPatientNames", "OtherPatientIDsSequence", "PatientBirthName", "PatientAge", "PatientSize", "PatientWeight", "PatientAddress", "RETIRED_InsurancePlanIdentification", "PatientMotherBirthName", "MilitaryRank", "BranchOfService", "MedicalRecordLocator", "MedicalAlerts", "Allergies", "CountryOfResidence", "RegionOfResidence", "PatientTelephoneNumbers", "EthnicGroup", "Occupation", "SmokingStatus", "AdditionalPatientHistory", "PregnancyStatus", "LastMenstrualDate", "PatientReligiousPreference", "PatientSexNeutered", "ResponsiblePerson", "ResponsibleOrganization", "PatientComments", "DeviceSerialNumber", "PlateID", "GeneratorID", "CassetteID", "GantryID",
15958
+ "AcquisitionDate", "RETIRED_OverlayDate", "RETIRED_CurveDate", "AcquisitionDateTime", "SeriesTime", "AcquisitionTime", "RETIRED_OverlayTime", "RETIRED_CurveTime", "InstitutionName", "InstitutionAddress", "ReferringPhysicianAddress", "ReferringPhysicianTelephoneNumbers", "ReferringPhysicianIdentificationSequence", "TimezoneOffsetFromUTC", "StationName", "StudyDescription", "InstitutionalDepartmentName", "PhysiciansOfRecord", "PhysiciansOfRecordIdentificationSequence", "PerformingPhysicianName", "PerformingPhysicianIdentificationSequence", "NameOfPhysiciansReadingStudy", "PhysiciansReadingStudyIdentificationSequence", "OperatorsName", "OperatorIdentificationSequence", "AdmittingDiagnosesDescription", "AdmittingDiagnosesCodeSequence", "ReferencedStudySequence", "ReferencedPerformedProcedureStepSequence", "ReferencedPatientSequence", "ReferencedImageSequence", "DerivationDescription", "SourceImageSequence", "RETIRED_IdentifyingComments", "IssuerOfPatientID", "PatientBirthTime", "PatientInsurancePlanCodeSequence", "PatientPrimaryLanguageCodeSequence", "PatientPrimaryLanguageModifierCodeSequence", "OtherPatientIDs", "OtherPatientNames", "OtherPatientIDsSequence", "PatientBirthName", "PatientAge", "PatientSize", "PatientWeight", "PatientAddress", "RETIRED_InsurancePlanIdentification", "PatientMotherBirthName", "MilitaryRank", "BranchOfService", "MedicalRecordLocator", "MedicalAlerts", "Allergies", "CountryOfResidence", "RegionOfResidence", "PatientTelephoneNumbers", "EthnicGroup", "Occupation", "SmokingStatus", "AdditionalPatientHistory", "PregnancyStatus", "LastMenstrualDate", "PatientReligiousPreference", "PatientSexNeutered", "ResponsiblePerson", "ResponsiblePersonRole", "ResponsibleOrganization", "PatientComments", "DeviceSerialNumber", "PlateID", "GeneratorID", "CassetteID", "GantryID",
15696
15959
  // we keep - should be SoftwareVersions anyway
15697
15960
  // "SoftwareVersion",
15698
15961
  "ProtocolName", "AcquisitionDeviceProcessingDescription", "RETIRED_AcquisitionComments", "DetectorID", "AcquisitionProtocolDescription", "ContributionDescription", "RETIRED_ModifyingDeviceID", "RETIRED_ModifyingDeviceManufacturer", "RETIRED_ModifiedImageDescription", "ImageComments", "RETIRED_ImagePresentationComments", "RETIRED_StudyIDIssuer", "RETIRED_ScheduledStudyLocation", "RETIRED_ScheduledStudyLocationAETitle", "RETIRED_ReasonForStudy", "RequestingPhysician", "RequestingService", "RequestedProcedureDescription", "RequestedContrastAgent", "RETIRED_StudyComments", "AdmissionID", "RETIRED_IssuerOfAdmissionID", "RETIRED_ScheduledPatientInstitutionResidence", "AdmittingDate", "AdmittingTime", "RETIRED_DischargeDiagnosisDescription", "SpecialNeeds", "ServiceEpisodeID", "RETIRED_IssuerOfServiceEpisodeID", "ServiceEpisodeDescription", "CurrentPatientLocation", "PatientInstitutionResidence", "PatientState", "ReferencedPatientAliasSequence", "VisitComments", "ScheduledStationAETitle", "ScheduledPerformingPhysicianName", "ScheduledProcedureStepDescription", "ScheduledStationName", "ScheduledProcedureStepLocation", "PreMedication", "PerformedStationAETitle", "PerformedStationName", "PerformedLocation", "PerformedStationNameCodeSequence", "PerformedProcedureStepID", "PerformedProcedureStepDescription", "RequestAttributesSequence", "CommentsOnThePerformedProcedureStep", "AcquisitionContextSequence", "PatientTransportArrangements", "RequestedProcedureLocation", "NamesOfIntendedRecipientsOfResults", "IntendedRecipientsOfResultsIdentificationSequence", "PersonAddress", "PersonTelephoneNumbers", "RequestedProcedureComments", "RETIRED_ReasonForTheImagingServiceRequest", "OrderEnteredBy", "OrderEntererLocation", "OrderCallbackPhoneNumber", "ImagingServiceRequestComments", "ConfidentialityConstraintOnPatientDataDescription", "ScheduledStationNameCodeSequence", "ScheduledStationGeographicLocationCodeSequence", "PerformedStationGeographicLocationCodeSequence", "ScheduledHumanPerformersSequence", "ActualHumanPerformersSequence", "HumanPerformerOrganization", "HumanPerformerName", "VerifyingOrganization", "VerifyingObserverName", "AuthorObserverSequence", "ParticipantSequence", "CustodialOrganizationSequence", "VerifyingObserverIdentificationCodeSequence", "PersonName", "ContentSequence", "OverlayData", "RETIRED_OverlayComments", "IconImageSequence", "RETIRED_TopicSubject", "RETIRED_TopicAuthor", "RETIRED_TopicKeywords", "TextString", "RETIRED_Arbitrary", "RETIRED_TextComments", "RETIRED_ResultsIDIssuer", "RETIRED_InterpretationRecorder", "RETIRED_InterpretationTranscriber", "RETIRED_InterpretationText", "RETIRED_InterpretationAuthor", "RETIRED_InterpretationApproverSequence", "RETIRED_PhysicianApprovingInterpretation", "RETIRED_InterpretationDiagnosisDescription", "RETIRED_ResultsDistributionListSequence", "RETIRED_DistributionName", "RETIRED_DistributionAddress", "RETIRED_InterpretationIDIssuer", "RETIRED_Impressions", "RETIRED_ResultsComments", "DigitalSignaturesSequence", "DataSetTrailingPadding"];
@@ -15710,7 +15973,7 @@ function cleanTags(dict) {
15710
15973
  }
15711
15974
  var tags = customTagNamesToEmpty != undefined ? customTagNamesToEmpty : tagNamesToEmpty;
15712
15975
  tags.forEach(function (tag) {
15713
- var tagInfo = core.DicomMetaDictionary.nameMap[tag];
15976
+ var tagInfo = core.DicomMetaDictionary.entryForName(tag);
15714
15977
  if (tagInfo && tagInfo.version != "PrivateTag") {
15715
15978
  var tagNumber = tagInfo.tag,
15716
15979
  tagString = core.Tag.fromPString(tagNumber).toCleanString();
@@ -15747,11 +16010,18 @@ var data = {
15747
16010
  datasetToDict: datasetToDict,
15748
16011
  datasetToBuffer: datasetToBuffer,
15749
16012
  datasetToBlob: datasetToBlob,
16013
+ dictionary: core.dictionary,
16014
+ registerTag: core.registerTag,
15750
16015
  // naturalized-dataset utilities (docs/specs/naturalized-dataset.md)
15751
16016
  setVr: core.setVr,
15752
16017
  setAttribute: core.setAttribute,
15753
16018
  setPersonName: core.setPersonName,
15754
- definePrivateAliases: core.definePrivateAliases
16019
+ definePrivateAliases: core.definePrivateAliases,
16020
+ frameDataset: core.frameDataset,
16021
+ // private blocks of a DICOM JSON dict (NAT-U-PRIV-11)
16022
+ findPrivateBlock: core.findPrivateBlock,
16023
+ reservePrivateBlock: core.reservePrivateBlock,
16024
+ privateBlockKey: core.privateBlockKey
15755
16025
  };
15756
16026
  var async = {
15757
16027
  AsyncDicomReader: AsyncDicomReader
@@ -15819,4 +16089,4 @@ exports.derivations = derivations;
15819
16089
  exports.normalizers = normalizers;
15820
16090
  exports.sr = sr;
15821
16091
  exports.utilities = utilities;
15822
- //# sourceMappingURL=dcmjs.shared-i-QMVPJh.cjs.map
16092
+ //# sourceMappingURL=dcmjs.shared-Gy1xZ3Jj.cjs.map