dcmjs 0.24.6 → 0.24.9

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.es.js CHANGED
@@ -3418,8 +3418,40 @@ var EXPLICIT_LITTLE_ENDIAN$1 = "1.2.840.10008.1.2.1";
3418
3418
  var EXPLICIT_BIG_ENDIAN = "1.2.840.10008.1.2.2";
3419
3419
  var singleVRs$1 = ["SQ", "OF", "OW", "OB", "UN", "LT"];
3420
3420
  var encodingMapping = {
3421
+ "": "iso-8859-1",
3422
+ "iso-ir-6": "iso-8859-1",
3423
+ "iso-ir-13": "shift-jis",
3424
+ "iso-ir-100": "latin1",
3425
+ "iso-ir-101": "iso-8859-2",
3426
+ "iso-ir-109": "iso-8859-3",
3427
+ "iso-ir-110": "iso-8859-4",
3428
+ "iso-ir-126": "iso-ir-126",
3429
+ "iso-ir-127": "iso-ir-127",
3430
+ "iso-ir-138": "iso-ir-138",
3431
+ "iso-ir-144": "iso-ir-144",
3432
+ "iso-ir-148": "iso-ir-148",
3433
+ "iso-ir-166": "tis-620",
3434
+ "iso-2022-ir-6": "iso-8859-1",
3435
+ "iso-2022-ir-13": "shift-jis",
3436
+ "iso-2022-ir-87": "iso-2022-jp",
3437
+ "iso-2022-ir-100": "latin1",
3438
+ "iso-2022-ir-101": "iso-8859-2",
3439
+ "iso-2022-ir-109": "iso-8859-3",
3440
+ "iso-2022-ir-110": "iso-8859-4",
3441
+ "iso-2022-ir-126": "iso-ir-126",
3442
+ "iso-2022-ir-127": "iso-ir-127",
3443
+ "iso-2022-ir-138": "iso-ir-138",
3444
+ "iso-2022-ir-144": "iso-ir-144",
3445
+ "iso-2022-ir-148": "iso-ir-148",
3446
+ "iso-2022-ir-149": "euc-kr",
3447
+ "iso-2022-ir-159": "iso-2022-jp",
3448
+ "iso-2022-ir-166": "tis-620",
3449
+ "iso-2022-ir-58": "iso-ir-58",
3421
3450
  "iso-ir-192": "utf-8",
3422
- "": "latin1"
3451
+ gb18030: "gb18030",
3452
+ "iso-2022-gbk": "gbk",
3453
+ "iso-2022-58": "gb2312",
3454
+ gbk: "gbk"
3423
3455
  };
3424
3456
  var encapsulatedSyntaxes = ["1.2.840.10008.1.2.4.50", "1.2.840.10008.1.2.4.51", "1.2.840.10008.1.2.4.57", "1.2.840.10008.1.2.4.70", "1.2.840.10008.1.2.4.80", "1.2.840.10008.1.2.4.81", "1.2.840.10008.1.2.4.90", "1.2.840.10008.1.2.4.91", "1.2.840.10008.1.2.4.92", "1.2.840.10008.1.2.4.93", "1.2.840.10008.1.2.4.94", "1.2.840.10008.1.2.4.95", "1.2.840.10008.1.2.5", "1.2.840.10008.1.2.6.1", "1.2.840.10008.1.2.4.100", "1.2.840.10008.1.2.4.102", "1.2.840.10008.1.2.4.103"];
3425
3457
 
@@ -3472,21 +3504,24 @@ var DicomMessage = /*#__PURE__*/function () {
3472
3504
  if (cleanTagString === "00080005") {
3473
3505
  if (readInfo.values.length > 0) {
3474
3506
  var coding = readInfo.values[0];
3475
- coding = coding.replaceAll("_", "-").replaceAll(" ", "-").toLowerCase();
3507
+ coding = coding.replace(/[_ ]/g, "-").toLowerCase();
3476
3508
 
3477
3509
  if (coding in encodingMapping) {
3478
3510
  coding = encodingMapping[coding];
3479
- }
3480
-
3481
- try {
3482
3511
  bufferStream.setDecoder(new TextDecoder(coding));
3483
- } catch (error) {
3484
- console.warn(error);
3512
+ } else if (ignoreErrors) {
3513
+ console.warn("Unsupported character set: ".concat(coding, ", using default character set"));
3514
+ } else {
3515
+ throw Error("Unsupported character set: ".concat(coding));
3485
3516
  }
3486
3517
  }
3487
3518
 
3488
3519
  if (readInfo.values.length > 1) {
3489
- console.warn("multiple encodings not supported, using first encoding!", readInfo.values);
3520
+ if (ignoreErrors) {
3521
+ console.warn("Using multiple character sets is not supported, proceeding with just the first character set", readInfo.values);
3522
+ } else {
3523
+ throw Error("Using multiple character sets is not supported: ".concat(readInfo.values));
3524
+ }
3490
3525
  }
3491
3526
 
3492
3527
  readInfo.values = ["ISO_IR 192"]; // change SpecificCharacterSet to UTF-8
@@ -3543,7 +3578,7 @@ var DicomMessage = /*#__PURE__*/function () {
3543
3578
  stream.increment(128);
3544
3579
 
3545
3580
  if (stream.readAsciiString(4) !== "DICM") {
3546
- throw new Error("Invalid a dicom file");
3581
+ throw new Error("Invalid DICOM file, expected header is missing");
3547
3582
  }
3548
3583
 
3549
3584
  var el = DicomMessage._readTag(stream, useSyntax),
@@ -8150,7 +8185,8 @@ var FreehandRoi = /*#__PURE__*/function () {
8150
8185
  value: function getMeasurementData(MeasurementGroup) {
8151
8186
  var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup),
8152
8187
  defaultState = _MeasurementReport$ge.defaultState,
8153
- SCOORDGroup = _MeasurementReport$ge.SCOORDGroup;
8188
+ SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
8189
+ NUMGroup = _MeasurementReport$ge.NUMGroup;
8154
8190
 
8155
8191
  var state = _objectSpread2(_objectSpread2({}, defaultState), {}, {
8156
8192
  toolType: FreehandRoi.toolType,
@@ -8165,6 +8201,9 @@ var FreehandRoi = /*#__PURE__*/function () {
8165
8201
  hasBoundingBox: true
8166
8202
  }
8167
8203
  },
8204
+ cachedStats: {
8205
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
8206
+ },
8168
8207
  color: undefined,
8169
8208
  invalidated: true
8170
8209
  });
@@ -8189,7 +8228,8 @@ var FreehandRoi = /*#__PURE__*/function () {
8189
8228
  handles = _tool.handles,
8190
8229
  finding = _tool.finding,
8191
8230
  findingSites = _tool.findingSites,
8192
- cachedStats = _tool.cachedStats;
8231
+ _tool$cachedStats = _tool.cachedStats,
8232
+ cachedStats = _tool$cachedStats === void 0 ? {} : _tool$cachedStats;
8193
8233
  var points = handles.points;
8194
8234
  var _cachedStats$area = cachedStats.area,
8195
8235
  area = _cachedStats$area === void 0 ? 0 : _cachedStats$area,
@@ -8606,7 +8646,7 @@ var EllipticalRoi = /*#__PURE__*/function () {
8606
8646
  toolType: EllipticalRoi.toolType,
8607
8647
  active: false,
8608
8648
  cachedStats: {
8609
- area: NUMGroup.MeasuredValueSequence.NumericValue
8649
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
8610
8650
  },
8611
8651
  handles: {
8612
8652
  end: {
@@ -8639,7 +8679,8 @@ var EllipticalRoi = /*#__PURE__*/function () {
8639
8679
  }, {
8640
8680
  key: "getTID300RepresentationArguments",
8641
8681
  value: function getTID300RepresentationArguments(tool) {
8642
- var cachedStats = tool.cachedStats,
8682
+ var _tool$cachedStats = tool.cachedStats,
8683
+ cachedStats = _tool$cachedStats === void 0 ? {} : _tool$cachedStats,
8643
8684
  handles = tool.handles,
8644
8685
  finding = tool.finding,
8645
8686
  findingSites = tool.findingSites;
@@ -8874,7 +8915,7 @@ var CircleRoi = /*#__PURE__*/function () {
8874
8915
  toolType: CircleRoi.toolType,
8875
8916
  active: false,
8876
8917
  cachedStats: {
8877
- area: NUMGroup.MeasuredValueSequence.NumericValue,
8918
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0,
8878
8919
  // Dummy values to be updated by cornerstone
8879
8920
  radius: 0,
8880
8921
  perimeter: 0
@@ -8913,7 +8954,8 @@ var CircleRoi = /*#__PURE__*/function () {
8913
8954
  }, {
8914
8955
  key: "getTID300RepresentationArguments",
8915
8956
  value: function getTID300RepresentationArguments(tool) {
8916
- var cachedStats = tool.cachedStats,
8957
+ var _tool$cachedStats = tool.cachedStats,
8958
+ cachedStats = _tool$cachedStats === void 0 ? {} : _tool$cachedStats,
8917
8959
  handles = tool.handles,
8918
8960
  finding = tool.finding,
8919
8961
  findingSites = tool.findingSites;
@@ -14718,7 +14760,8 @@ var RectangleRoi = /*#__PURE__*/function () {
14718
14760
  value: function getMeasurementData(MeasurementGroup) {
14719
14761
  var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup),
14720
14762
  defaultState = _MeasurementReport$ge.defaultState,
14721
- SCOORDGroup = _MeasurementReport$ge.SCOORDGroup;
14763
+ SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
14764
+ NUMGroup = _MeasurementReport$ge.NUMGroup;
14722
14765
 
14723
14766
  var state = _objectSpread2(_objectSpread2({}, defaultState), {}, {
14724
14767
  toolType: RectangleRoi.toolType,
@@ -14735,6 +14778,9 @@ var RectangleRoi = /*#__PURE__*/function () {
14735
14778
  },
14736
14779
  initialRotation: 0
14737
14780
  },
14781
+ cachedStats: {
14782
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
14783
+ },
14738
14784
  color: undefined,
14739
14785
  invalidated: true
14740
14786
  });
@@ -14756,7 +14802,8 @@ var RectangleRoi = /*#__PURE__*/function () {
14756
14802
  value: function getTID300RepresentationArguments(tool) {
14757
14803
  var finding = tool.finding,
14758
14804
  findingSites = tool.findingSites,
14759
- cachedStats = tool.cachedStats,
14805
+ _tool$cachedStats = tool.cachedStats,
14806
+ cachedStats = _tool$cachedStats === void 0 ? {} : _tool$cachedStats,
14760
14807
  handles = tool.handles;
14761
14808
  console.log("getTID300 Rectangle", tool, cachedStats, handles);
14762
14809
  var start = handles.start,
@@ -15185,7 +15232,7 @@ var Length$2 = /*#__PURE__*/function () {
15185
15232
  }
15186
15233
  },
15187
15234
  cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
15188
- length: NUMGroup.MeasuredValueSequence.NumericValue
15235
+ length: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
15189
15236
  })
15190
15237
  };
15191
15238
  return state;
@@ -15197,7 +15244,8 @@ var Length$2 = /*#__PURE__*/function () {
15197
15244
  finding = tool.finding,
15198
15245
  findingSites = tool.findingSites,
15199
15246
  metadata = tool.metadata;
15200
- var cachedStats = data.cachedStats,
15247
+ var _data$cachedStats = data.cachedStats,
15248
+ cachedStats = _data$cachedStats === void 0 ? {} : _data$cachedStats,
15201
15249
  handles = data.handles;
15202
15250
  var referencedImageId = metadata.referencedImageId;
15203
15251
 
@@ -15215,7 +15263,10 @@ var Length$2 = /*#__PURE__*/function () {
15215
15263
  x: end[0],
15216
15264
  y: end[1]
15217
15265
  };
15218
- var distance = cachedStats["imageId:".concat(referencedImageId)].length;
15266
+
15267
+ var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
15268
+ distance = _ref.length;
15269
+
15219
15270
  return {
15220
15271
  point1: point1,
15221
15272
  point2: point2,
@@ -15315,7 +15366,8 @@ var Bidirectional$2 = /*#__PURE__*/function () {
15315
15366
  finding = tool.finding,
15316
15367
  findingSites = tool.findingSites,
15317
15368
  metadata = tool.metadata;
15318
- var cachedStats = data.cachedStats,
15369
+ var _data$cachedStats = data.cachedStats,
15370
+ cachedStats = _data$cachedStats === void 0 ? {} : _data$cachedStats,
15319
15371
  handles = data.handles;
15320
15372
  var referencedImageId = metadata.referencedImageId;
15321
15373
 
@@ -15323,9 +15375,10 @@ var Bidirectional$2 = /*#__PURE__*/function () {
15323
15375
  throw new Error("Bidirectional.getTID300RepresentationArguments: referencedImageId is not defined");
15324
15376
  }
15325
15377
 
15326
- var _cachedStats$ = cachedStats["imageId:".concat(referencedImageId)],
15327
- length = _cachedStats$.length,
15328
- width = _cachedStats$.width;
15378
+ var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
15379
+ length = _ref.length,
15380
+ width = _ref.width;
15381
+
15329
15382
  var points = handles.points; // Find the length and width point pairs by comparing the distances of the points at 0,1 to points at 2,3
15330
15383
 
15331
15384
  var firstPointPairs = [points[0], points[1]];
@@ -15477,7 +15530,7 @@ var EllipticalROI = /*#__PURE__*/function () {
15477
15530
  }
15478
15531
  },
15479
15532
  cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
15480
- area: NUMGroup.MeasuredValueSequence.NumericValue
15533
+ area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
15481
15534
  })
15482
15535
  };
15483
15536
  return state;
@@ -15489,7 +15542,8 @@ var EllipticalROI = /*#__PURE__*/function () {
15489
15542
  finding = tool.finding,
15490
15543
  findingSites = tool.findingSites,
15491
15544
  metadata = tool.metadata;
15492
- var cachedStats = data.cachedStats,
15545
+ var _data$cachedStats = data.cachedStats,
15546
+ cachedStats = _data$cachedStats === void 0 ? {} : _data$cachedStats,
15493
15547
  handles = data.handles;
15494
15548
  var referencedImageId = metadata.referencedImageId;
15495
15549
 
@@ -15546,7 +15600,9 @@ var EllipticalROI = /*#__PURE__*/function () {
15546
15600
  });
15547
15601
  }
15548
15602
 
15549
- var area = cachedStats["imageId:".concat(referencedImageId)].area;
15603
+ var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
15604
+ area = _ref.area;
15605
+
15550
15606
  return {
15551
15607
  area: area,
15552
15608
  points: points,