pydicom.fileutil.length_of_undefined_length

pydicom.fileutil.length_of_undefined_length(fp, delimiter, is_little_endian, read_size=128, rewind=True)

Search through the file to find the delimiter and return the length of the data element.

Parameters:
  • fp (file-like) – The file-like to read.
  • delimiter – See find_delimiter() for parameter info.
  • is_little_endian (bool) – True if little endian, False otherwise.
  • read_size (int) – See find_bytes() for parameter info.
  • rewind (bool) – Flag to rewind to initial position after searching.
Returns:

Byte offset to the delimiter.

Return type:

int

Notes

Note the data element that the delimiter starts is not read here, the calling routine must handle that. Delimiter must be 4 bytes long.