dcmjs 0.53.0 → 0.53.1

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.js CHANGED
@@ -9013,6 +9013,12 @@
9013
9013
  var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start + 1;
9014
9014
  return this.view.hasData(start, end);
9015
9015
  }
9016
+
9017
+ /**
9018
+ * Returns a read stream over the next `length` bytes and moves past them.
9019
+ * The new stream decodes text with this stream's decoder, so sequence items
9020
+ * use the dataset's SpecificCharacterSet.
9021
+ */
9016
9022
  }, {
9017
9023
  key: "more",
9018
9024
  value: function more(length) {
@@ -9026,7 +9032,9 @@
9026
9032
  // start: this.offset,
9027
9033
  // stop: this.offset + length
9028
9034
  // });
9029
- var newBuf = new ReadBufferStream(this.slice(this.offset, this.offset + length));
9035
+ var newBuf = new ReadBufferStream(this.slice(this.offset, this.offset + length), null, {
9036
+ decoder: this.decoder
9037
+ });
9030
9038
  this.increment(length);
9031
9039
  newBuf.setComplete();
9032
9040
  return newBuf;
@@ -9077,7 +9085,8 @@
9077
9085
  littleEndian: littleEndian
9078
9086
  })]);
9079
9087
  _this2.noCopy = options.noCopy;
9080
- _this2.decoder = new TextDecoder("latin1");
9088
+ // A stream over part of a dataset gets the dataset's decoder in options
9089
+ _this2.decoder = options.decoder || new TextDecoder("latin1");
9081
9090
  if (buffer instanceof BufferStream) {
9082
9091
  _this2.view.from(buffer.view, options);
9083
9092
  _this2.isComplete = true;
@@ -11203,7 +11212,9 @@
11203
11212
  key: "read",
11204
11213
  value: function read(stream, length, syntax, readOptions) {
11205
11214
  var arrayBuffer = this.readBytes(stream, length, syntax)[0];
11206
- var streamFromBuffer = new ReadBufferStream(arrayBuffer, true);
11215
+ var streamFromBuffer = new ReadBufferStream(arrayBuffer, true, {
11216
+ decoder: stream.decoder
11217
+ });
11207
11218
  var vr = ValueRepresentation.createByTypeString(this.type);
11208
11219
  if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
11209
11220
  var values = [];
@@ -14662,7 +14673,7 @@
14662
14673
  key: "readSequence",
14663
14674
  value: function () {
14664
14675
  var _readSequence = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(listener, sqTagInfo, options) {
14665
- var length, stream, syntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, _t;
14676
+ var length, stream, syntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, decoder, _t;
14666
14677
  return _regeneratorRuntime().wrap(function (_context6) {
14667
14678
  while (1) switch (_context6.prev = _context6.next) {
14668
14679
  case 0:
@@ -14699,12 +14710,16 @@
14699
14710
  // first item because read() treats subsequent Item tags
14700
14711
  // as instructions and skips them.
14701
14712
  itemLength = tagInfo.length;
14702
- itemUntilOffset = itemLength === UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset);
14713
+ itemUntilOffset = itemLength === UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset); // A SpecificCharacterSet in the item applies only to that
14714
+ // item (PS3.5 7.5.3), but the item is read on this stream:
14715
+ // put back the decoder the item started with.
14716
+ decoder = stream.decoder;
14703
14717
  _context6.next = 4;
14704
14718
  return this.read(listener, _objectSpread2(_objectSpread2({}, options), {}, {
14705
14719
  untilOffset: itemUntilOffset
14706
14720
  }));
14707
14721
  case 4:
14722
+ stream.setDecoder(decoder);
14708
14723
  _context6.next = 7;
14709
14724
  break;
14710
14725
  case 5: