src/readSequenceElementExplicit.js
function readDicomDataSetExplicitUndefinedLength (byteStream, warnings) {
  const elements = {};

  while (byteStream.position < byteStream.byteArray.length) {
    const element = readDicomElementExplicit(byteStream, warnings);

    elements[element.tag] = element;

    // we hit an item delimiter tag, return the current offset to mark
    // the end of this sequence item
    if (element.tag === 'xfffee00d') {
      return new DataSet(byteStream.byteArrayParser, byteStream.byteArray, elements);
    }
  }

  // eof encountered - log a warning and return what we have for the element
  warnings.push('eof encountered before finding item delimiter tag while reading sequence item of undefined length');

  return new DataSet(byteStream.byteArrayParser, byteStream.byteArray, elements);
}
function readDicomDataSetExplicitUndefinedLength (byteStream, warnings) {
  const elements = {};

  while (byteStream.position < byteStream.byteArray.length) {
    const element = readDicomElementExplicit(byteStream, warnings);

    elements[element.tag] = element;

    // we hit an item delimiter tag, return the current offset to mark
    // the end of this sequence item
    if (element.tag === 'xfffee00d') {
      return new DataSet(byteStream.byteArrayParser, byteStream.byteArray, elements);
    }
  }

  // eof encountered - log a warning and return what we have for the element
  warnings.push('eof encountered before finding item delimiter tag while reading sequence item of undefined length');

  return new DataSet(byteStream.byteArrayParser, byteStream.byteArray, elements);
}
Internal helper functions for parsing DICOM elements