Internal helper functions for parsing DICOM elements
function readDicomDataSetImplicitUndefinedLength (byteStream, vrCallback) {
  const elements = {};

  while (byteStream.position < byteStream.byteArray.length) {
    const element = readDicomElementImplicit(byteStream, undefined, vrCallback);

    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
  byteStream.warnings.push('eof encountered before finding sequence item delimiter in sequence item of undefined length');

  return new DataSet(byteStream.byteArrayParser, byteStream.byteArray, elements);
}