dcmjs 0.30.1 → 0.30.2

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
@@ -8468,6 +8468,11 @@ var ValueRepresentation = /*#__PURE__*/function () {
8468
8468
  }
8469
8469
  return vr;
8470
8470
  }
8471
+ }, {
8472
+ key: "parseUnknownVr",
8473
+ value: function parseUnknownVr(type) {
8474
+ return new ParsedUnknownValue(type);
8475
+ }
8471
8476
  }]);
8472
8477
  return ValueRepresentation;
8473
8478
  }();
@@ -9534,60 +9539,108 @@ var UnknownValue = /*#__PURE__*/function (_BinaryRepresentation) {
9534
9539
  }
9535
9540
  return _createClass(UnknownValue);
9536
9541
  }(BinaryRepresentation);
9537
- var OtherWordString = /*#__PURE__*/function (_BinaryRepresentation2) {
9538
- _inherits(OtherWordString, _BinaryRepresentation2);
9539
- var _super30 = _createSuper(OtherWordString);
9540
- function OtherWordString() {
9542
+ var ParsedUnknownValue = /*#__PURE__*/function (_BinaryRepresentation2) {
9543
+ _inherits(ParsedUnknownValue, _BinaryRepresentation2);
9544
+ var _super30 = _createSuper(ParsedUnknownValue);
9545
+ function ParsedUnknownValue(vr) {
9541
9546
  var _this29;
9542
- _classCallCheck(this, OtherWordString);
9543
- _this29 = _super30.call(this, "OW");
9547
+ _classCallCheck(this, ParsedUnknownValue);
9548
+ _this29 = _super30.call(this, vr);
9544
9549
  _this29.maxLength = null;
9545
- _this29.padByte = PADDING_NULL;
9550
+ _this29.padByte = 0;
9546
9551
  _this29.noMultiple = true;
9552
+ _this29._isBinary = true;
9553
+ _this29._allowMultiple = false;
9554
+ _this29._isExplicit = true;
9547
9555
  return _this29;
9548
9556
  }
9549
- return _createClass(OtherWordString);
9557
+ _createClass(ParsedUnknownValue, [{
9558
+ key: "read",
9559
+ value: function read(stream, length, syntax) {
9560
+ var arrayBuffer = this.readBytes(stream, length, syntax)[0];
9561
+ var streamFromBuffer = new ReadBufferStream(arrayBuffer, true);
9562
+ var vr = ValueRepresentation.createByTypeString(this.type);
9563
+ var values = [];
9564
+ if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
9565
+ var times = length / vr.maxLength,
9566
+ i = 0;
9567
+ while (i++ < times) {
9568
+ values.push(vr.read(streamFromBuffer, vr.maxLength, syntax));
9569
+ }
9570
+ } else {
9571
+ var val = vr.read(streamFromBuffer, length, syntax);
9572
+ if (!vr.isBinary() && singleVRs$1.indexOf(vr.type) == -1) {
9573
+ values = val;
9574
+ if (typeof val === "string") {
9575
+ values = val.split(String.fromCharCode(VM_DELIMITER));
9576
+ }
9577
+ } else if (vr.type == "SQ") {
9578
+ values = val;
9579
+ } else if (vr.type == "OW" || vr.type == "OB") {
9580
+ values = val;
9581
+ } else {
9582
+ Array.isArray(val) ? values = val : values.push(val);
9583
+ }
9584
+ }
9585
+ return values;
9586
+ }
9587
+ }]);
9588
+ return ParsedUnknownValue;
9550
9589
  }(BinaryRepresentation);
9551
- var OtherByteString = /*#__PURE__*/function (_BinaryRepresentation3) {
9552
- _inherits(OtherByteString, _BinaryRepresentation3);
9553
- var _super31 = _createSuper(OtherByteString);
9554
- function OtherByteString() {
9590
+ var OtherWordString = /*#__PURE__*/function (_BinaryRepresentation3) {
9591
+ _inherits(OtherWordString, _BinaryRepresentation3);
9592
+ var _super31 = _createSuper(OtherWordString);
9593
+ function OtherWordString() {
9555
9594
  var _this30;
9556
- _classCallCheck(this, OtherByteString);
9557
- _this30 = _super31.call(this, "OB");
9595
+ _classCallCheck(this, OtherWordString);
9596
+ _this30 = _super31.call(this, "OW");
9558
9597
  _this30.maxLength = null;
9559
9598
  _this30.padByte = PADDING_NULL;
9560
9599
  _this30.noMultiple = true;
9561
9600
  return _this30;
9562
9601
  }
9563
- return _createClass(OtherByteString);
9602
+ return _createClass(OtherWordString);
9564
9603
  }(BinaryRepresentation);
9565
- var OtherDoubleString = /*#__PURE__*/function (_BinaryRepresentation4) {
9566
- _inherits(OtherDoubleString, _BinaryRepresentation4);
9567
- var _super32 = _createSuper(OtherDoubleString);
9568
- function OtherDoubleString() {
9604
+ var OtherByteString = /*#__PURE__*/function (_BinaryRepresentation4) {
9605
+ _inherits(OtherByteString, _BinaryRepresentation4);
9606
+ var _super32 = _createSuper(OtherByteString);
9607
+ function OtherByteString() {
9569
9608
  var _this31;
9570
- _classCallCheck(this, OtherDoubleString);
9571
- _this31 = _super32.call(this, "OD");
9609
+ _classCallCheck(this, OtherByteString);
9610
+ _this31 = _super32.call(this, "OB");
9572
9611
  _this31.maxLength = null;
9573
9612
  _this31.padByte = PADDING_NULL;
9574
9613
  _this31.noMultiple = true;
9575
9614
  return _this31;
9576
9615
  }
9577
- return _createClass(OtherDoubleString);
9616
+ return _createClass(OtherByteString);
9578
9617
  }(BinaryRepresentation);
9579
- var OtherFloatString = /*#__PURE__*/function (_BinaryRepresentation5) {
9580
- _inherits(OtherFloatString, _BinaryRepresentation5);
9581
- var _super33 = _createSuper(OtherFloatString);
9582
- function OtherFloatString() {
9618
+ var OtherDoubleString = /*#__PURE__*/function (_BinaryRepresentation5) {
9619
+ _inherits(OtherDoubleString, _BinaryRepresentation5);
9620
+ var _super33 = _createSuper(OtherDoubleString);
9621
+ function OtherDoubleString() {
9583
9622
  var _this32;
9584
- _classCallCheck(this, OtherFloatString);
9585
- _this32 = _super33.call(this, "OF");
9623
+ _classCallCheck(this, OtherDoubleString);
9624
+ _this32 = _super33.call(this, "OD");
9586
9625
  _this32.maxLength = null;
9587
9626
  _this32.padByte = PADDING_NULL;
9588
9627
  _this32.noMultiple = true;
9589
9628
  return _this32;
9590
9629
  }
9630
+ return _createClass(OtherDoubleString);
9631
+ }(BinaryRepresentation);
9632
+ var OtherFloatString = /*#__PURE__*/function (_BinaryRepresentation6) {
9633
+ _inherits(OtherFloatString, _BinaryRepresentation6);
9634
+ var _super34 = _createSuper(OtherFloatString);
9635
+ function OtherFloatString() {
9636
+ var _this33;
9637
+ _classCallCheck(this, OtherFloatString);
9638
+ _this33 = _super34.call(this, "OF");
9639
+ _this33.maxLength = null;
9640
+ _this33.padByte = PADDING_NULL;
9641
+ _this33.noMultiple = true;
9642
+ return _this33;
9643
+ }
9591
9644
  return _createClass(OtherFloatString);
9592
9645
  }(BinaryRepresentation); // these VR instances are precreate and are reused for each requested vr/tag
9593
9646
  var VRinstances = {
@@ -10213,7 +10266,12 @@ var DicomMessage = /*#__PURE__*/function () {
10213
10266
  vr = ValueRepresentation.createByTypeString(vrType);
10214
10267
  } else {
10215
10268
  vrType = stream.readVR();
10216
- vr = ValueRepresentation.createByTypeString(vrType);
10269
+ if (vrType === "UN" && DicomMessage.lookupTag(tag) && DicomMessage.lookupTag(tag).vr) {
10270
+ vrType = DicomMessage.lookupTag(tag).vr;
10271
+ vr = ValueRepresentation.parseUnknownVr(vrType);
10272
+ } else {
10273
+ vr = ValueRepresentation.createByTypeString(vrType);
10274
+ }
10217
10275
  if (vr.isExplicit()) {
10218
10276
  stream.increment(2);
10219
10277
  length = stream.readUint32();