class_docstr: This class provides reading of pixel data from DICOM files. It is
  focussed on getting the pixel data, not the meta info.
  
  To use, first create an instance of this class (giving it
  a file object or filename). Next use the info attribute to
  get a dict of the meta data. The loading of pixel data is
  deferred until get_numpy_array() is called.
  
  Comparison with Pydicom
  -----------------------
  
  This code focusses on getting the pixel data out, which allows some
  shortcuts, resulting in the code being much smaller.
  
  Since the processing of data elements is much cheaper (it skips a lot
  of tags), this code is about 3x faster than pydicom (except for the
  deflated DICOM files).
  
  This class does borrow some code (and ideas) from the pydicom
  project, and (to the best of our knowledge) has the same limitations
  as pydicom with regard to the type of files that it can handle.
  
  Limitations
  -----------
  
  For more advanced DICOM processing, please check out pydicom.
  
    * Only a predefined subset of data elements (meta information) is read.
    * This is a reader; it can not write DICOM files.
    * (just like pydicom) it can handle none of the compressed DICOM
      formats except for "Deflated Explicit VR Little Endian"
      (1.2.840.10008.1.2.1.99).
class_docstr_tok: ["This","class","provides","reading","of","pixel","data","from","DICOM","files",".","It","is","focussed","on","getting","the","pixel","data",",","not","the","meta","info",".","To","use",",","first","create","an","instance","of","this","class","(","giving","it","a","file","object","or","filename",")",".","Next","use","the","info","attribute","to","get","a","dict","of","the","meta","data",".","The","loading","of","pixel","data","is","deferred","until","get_numpy_array","(",")","is","called",".","Comparison","with","Pydicom","--","--","--","--","--","--","--","--","--","--","--","-","This","code","focusses","on","getting","the","pixel","data","out",",","which","allows","some","shortcuts",",","resulting","in","the","code","being","much","smaller",".","Since","the","processing","of","data","elements","is","much","cheaper","(","it","skips","a","lot","of","tags",")",",","this","code","is","about","3x","faster","than","pydicom","(","except","for","the","deflated","DICOM","files",")",".","This","class","does","borrow","some","code","(","and","ideas",")","from","the","pydicom","project",",","and","(","to","the","best","of","our","knowledge",")","has","the","same","limitations","as","pydicom","with","regard","to","the","type","of","files","that","it","can","handle",".","Limitations","--","--","--","--","--","-","For","more","advanced","DICOM","processing",",","please","check","out","pydicom",".","*","Only","a","predefined","subset","of","data","elements","(","meta","information",")","is","read",".","*","This","is","a","reader",";","it","can","not","write","DICOM","files",".","*","(","just","like","pydicom",")","it","can","handle","none","of","the","compressed","DICOM","formats","except","for","``","Deflated","Explicit","VR","Little","Endian","''","(","1.2.840.10008.1.2.1.99",")","."]
docstr: Copied (in compacted form) from PyDicom
  Copyright Darcy Mason.
docstr_tok: ["Copied","(","in","compacted","form",")","from","PyDicom","Copyright","Darcy","Mason","."]
code: def _read_undefined_length_value(self, read_size=128):
      """Copied (in compacted form) from PyDicom
      Copyright Darcy Mason.
      """
      fp = self._file
      # data_start = fp.tell()
      search_rewind = 3
      bytes_to_find = struct.pack(
          self._unpackPrefix + "HH",
          SequenceDelimiterTag[0],
          SequenceDelimiterTag[1],
      )
  
      found = False
      value_chunks = []
      while not found:
          chunk_start = fp.tell()
          bytes_read = fp.read(read_size)
          if len(bytes_read) < read_size:
              # try again,
              # if still don't get required amount, this is last block
              new_bytes = fp.read(read_size - len(bytes_read))
              bytes_read += new_bytes
              if len(bytes_read) < read_size:
                  raise EOFError(
                      "End of file reached before sequence "
                      "delimiter found."
                  )
          index = bytes_read.find(bytes_to_find)
          if index != -1:
              found = True
              value_chunks.append(bytes_read[:index])
              fp.seek(
                  chunk_start + index + 4
              )  # rewind to end of delimiter
              length = fp.read(4)
              if length != b"\0\0\0\0":
                  logger.warning(
                      "Expected 4 zero bytes after undefined length "
                      "delimiter"
                  )
          else:
              fp.seek(fp.tell() - search_rewind)  # rewind a bit
              # accumulate the bytes read (not including the rewind)
              value_chunks.append(bytes_read[:-search_rewind])
  
      # if get here then have found the byte string
      return b"".join(value_chunks)
  
imports: import sys
  import os
  import struct
  import logging
  import numpy
label_desc: Use image node_id 9 for calling the SimpleDicomReader obj's underlying member method code with example usage: obj._read_undefined_length_value(read_size) and returns: bytes