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.es.js CHANGED
@@ -9007,6 +9007,12 @@ var BufferStream = /*#__PURE__*/function () {
9007
9007
  var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start + 1;
9008
9008
  return this.view.hasData(start, end);
9009
9009
  }
9010
+
9011
+ /**
9012
+ * Returns a read stream over the next `length` bytes and moves past them.
9013
+ * The new stream decodes text with this stream's decoder, so sequence items
9014
+ * use the dataset's SpecificCharacterSet.
9015
+ */
9010
9016
  }, {
9011
9017
  key: "more",
9012
9018
  value: function more(length) {
@@ -9020,7 +9026,9 @@ var BufferStream = /*#__PURE__*/function () {
9020
9026
  // start: this.offset,
9021
9027
  // stop: this.offset + length
9022
9028
  // });
9023
- var newBuf = new ReadBufferStream(this.slice(this.offset, this.offset + length));
9029
+ var newBuf = new ReadBufferStream(this.slice(this.offset, this.offset + length), null, {
9030
+ decoder: this.decoder
9031
+ });
9024
9032
  this.increment(length);
9025
9033
  newBuf.setComplete();
9026
9034
  return newBuf;
@@ -9071,7 +9079,8 @@ var ReadBufferStream = /*#__PURE__*/function (_BufferStream2) {
9071
9079
  littleEndian: littleEndian
9072
9080
  })]);
9073
9081
  _this2.noCopy = options.noCopy;
9074
- _this2.decoder = new TextDecoder("latin1");
9082
+ // A stream over part of a dataset gets the dataset's decoder in options
9083
+ _this2.decoder = options.decoder || new TextDecoder("latin1");
9075
9084
  if (buffer instanceof BufferStream) {
9076
9085
  _this2.view.from(buffer.view, options);
9077
9086
  _this2.isComplete = true;
@@ -11197,7 +11206,9 @@ var ParsedUnknownValue = /*#__PURE__*/function (_BinaryRepresentation2) {
11197
11206
  key: "read",
11198
11207
  value: function read(stream, length, syntax, readOptions) {
11199
11208
  var arrayBuffer = this.readBytes(stream, length, syntax)[0];
11200
- var streamFromBuffer = new ReadBufferStream(arrayBuffer, true);
11209
+ var streamFromBuffer = new ReadBufferStream(arrayBuffer, true, {
11210
+ decoder: stream.decoder
11211
+ });
11201
11212
  var vr = ValueRepresentation.createByTypeString(this.type);
11202
11213
  if (vr.isBinary() && length > vr.maxLength && !vr.noMultiple) {
11203
11214
  var values = [];
@@ -14656,7 +14667,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
14656
14667
  key: "readSequence",
14657
14668
  value: function () {
14658
14669
  var _readSequence = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(listener, sqTagInfo, options) {
14659
- var length, stream, syntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, _t;
14670
+ var length, stream, syntax, endOffset, tagInfo, tag, itemLength, itemUntilOffset, decoder, _t;
14660
14671
  return _regeneratorRuntime().wrap(function (_context6) {
14661
14672
  while (1) switch (_context6.prev = _context6.next) {
14662
14673
  case 0:
@@ -14693,12 +14704,16 @@ var AsyncDicomReader = /*#__PURE__*/function () {
14693
14704
  // first item because read() treats subsequent Item tags
14694
14705
  // as instructions and skips them.
14695
14706
  itemLength = tagInfo.length;
14696
- itemUntilOffset = itemLength === UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset);
14707
+ itemUntilOffset = itemLength === UNDEFINED_LENGTH_FIX ? endOffset : Math.min(stream.offset + itemLength, endOffset); // A SpecificCharacterSet in the item applies only to that
14708
+ // item (PS3.5 7.5.3), but the item is read on this stream:
14709
+ // put back the decoder the item started with.
14710
+ decoder = stream.decoder;
14697
14711
  _context6.next = 4;
14698
14712
  return this.read(listener, _objectSpread2(_objectSpread2({}, options), {}, {
14699
14713
  untilOffset: itemUntilOffset
14700
14714
  }));
14701
14715
  case 4:
14716
+ stream.setDecoder(decoder);
14702
14717
  _context6.next = 7;
14703
14718
  break;
14704
14719
  case 5: