dcmjs 0.51.0 → 0.51.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
@@ -14185,84 +14185,94 @@ var AsyncDicomReader = /*#__PURE__*/function () {
14185
14185
  return stream.ensureAvailable();
14186
14186
  case 1:
14187
14187
  if (!(stream.offset < untilOffset && stream.isAvailable(1, false))) {
14188
- _context5.next = 14;
14188
+ _context5.next = 15;
14189
14189
  break;
14190
14190
  }
14191
14191
  readLog.debug("read loop", stream.offset, untilOffset);
14192
14192
  // Consume before reading the tag so that data before the
14193
14193
  // current tag can be cleared.
14194
14194
  stream.consume();
14195
- tagInfo = this.readTagHeader(options);
14195
+ tagInfo = this.readTagHeader(options); // Stop when the requested tag boundary is reached. readTagHeader()
14196
+ // has already consumed the 4-byte tag but nothing beyond it, so
14197
+ // stream.offset now points at the first byte after the tag (i.e.
14198
+ // the VR field for explicit-LE). Callers that need the start
14199
+ // offset of the tag itself should subtract 4 from stream.offset.
14200
+ if (!tagInfo.isUntilTag) {
14201
+ _context5.next = 2;
14202
+ break;
14203
+ }
14204
+ return _context5.abrupt("continue", 15);
14205
+ case 2:
14196
14206
  tag = tagInfo.tag, tagObj = tagInfo.tagObj, length = tagInfo.length;
14197
14207
  if (!(tag === TagHex.ItemDelimitationEnd)) {
14198
- _context5.next = 2;
14208
+ _context5.next = 3;
14199
14209
  break;
14200
14210
  }
14201
14211
  return _context5.abrupt("return", listener.pop());
14202
- case 2:
14212
+ case 3:
14203
14213
  if (!tagObj.isInstruction()) {
14204
- _context5.next = 3;
14214
+ _context5.next = 4;
14205
14215
  break;
14206
14216
  }
14207
14217
  return _context5.abrupt("continue", 1);
14208
- case 3:
14218
+ case 4:
14209
14219
  if (!(tagObj.group() === 0 || tag === TagHex.DataSetTrailingPadding)) {
14210
- _context5.next = 4;
14220
+ _context5.next = 5;
14211
14221
  break;
14212
14222
  }
14213
14223
  // Group length
14214
14224
  stream.increment(tagObj.length);
14215
14225
  return _context5.abrupt("continue", 1);
14216
- case 4:
14226
+ case 5:
14217
14227
  addTagResult = listener.addTag(tag, tagInfo);
14218
14228
  if (!this.isSequence(tagInfo)) {
14219
- _context5.next = 6;
14229
+ _context5.next = 7;
14220
14230
  break;
14221
14231
  }
14222
- _context5.next = 5;
14232
+ _context5.next = 6;
14223
14233
  return this.readSequence(listener, tagInfo, options);
14224
- case 5:
14225
- _context5.next = 12;
14226
- break;
14227
14234
  case 6:
14235
+ _context5.next = 13;
14236
+ break;
14237
+ case 7:
14228
14238
  if (!tagObj.isPixelDataTag()) {
14229
- _context5.next = 8;
14239
+ _context5.next = 9;
14230
14240
  break;
14231
14241
  }
14232
- _context5.next = 7;
14242
+ _context5.next = 8;
14233
14243
  return this.readPixelData(tagInfo);
14234
- case 7:
14235
- _context5.next = 12;
14236
- break;
14237
14244
  case 8:
14245
+ _context5.next = 13;
14246
+ break;
14247
+ case 9:
14238
14248
  if (!(length === UNDEFINED_LENGTH_FIX)) {
14239
- _context5.next = 9;
14249
+ _context5.next = 10;
14240
14250
  break;
14241
14251
  }
14242
14252
  throw new Error("Can't handle tag ".concat(tagInfo.tag, " with -1 length and not sequence"));
14243
- case 9:
14253
+ case 10:
14244
14254
  if (!((addTagResult === null || addTagResult === void 0 ? void 0 : addTagResult.expectsRaw) === true && length > 0)) {
14245
- _context5.next = 11;
14255
+ _context5.next = 12;
14246
14256
  break;
14247
14257
  }
14248
- _context5.next = 10;
14258
+ _context5.next = 11;
14249
14259
  return this.readRawBinary(tagInfo);
14250
- case 10:
14251
- _context5.next = 12;
14252
- break;
14253
14260
  case 11:
14254
- _context5.next = 12;
14255
- return this.readSingle(tagInfo, listener, options);
14261
+ _context5.next = 13;
14262
+ break;
14256
14263
  case 12:
14257
- listener.pop();
14258
14264
  _context5.next = 13;
14259
- return this.stream.ensureAvailable();
14265
+ return this.readSingle(tagInfo, listener, options);
14260
14266
  case 13:
14267
+ listener.pop();
14268
+ _context5.next = 14;
14269
+ return this.stream.ensureAvailable();
14270
+ case 14:
14261
14271
  _context5.next = 1;
14262
14272
  break;
14263
- case 14:
14264
- return _context5.abrupt("return", listener.pop());
14265
14273
  case 15:
14274
+ return _context5.abrupt("return", listener.pop());
14275
+ case 16:
14266
14276
  case "end":
14267
14277
  return _context5.stop();
14268
14278
  }
@@ -14765,7 +14775,7 @@ var AsyncDicomReader = /*#__PURE__*/function () {
14765
14775
  tagObj: tagObj,
14766
14776
  vr: 0,
14767
14777
  values: 0,
14768
- untilTag: true
14778
+ isUntilTag: true
14769
14779
  };
14770
14780
  }
14771
14781
  }