pydicom.filereader.read_dataset

pydicom.filereader.read_dataset(fp, is_implicit_VR, is_little_endian, bytelength=None, stop_when=None, defer_size=None, parent_encoding='iso8859', specific_tags=None, at_top_level=True)[source]

Return a Dataset instance containing the next dataset in the file.

Parameters
  • fp (file-like) – An opened file-like object.

  • is_implicit_VR (bool) – True if file transfer syntax is implicit VR.

  • is_little_endian (bool) – True if file has little endian transfer syntax.

  • bytelength (int, None, optional) – None to read until end of file or ItemDeliterTag, else a fixed number of bytes to read

  • stop_when (None, optional) – Optional call_back function which can terminate reading. See help for data_element_generator() for details

  • defer_size (int, None, optional) – Size to avoid loading large elements in memory. See dcmread() for more parameter info.

  • parent_encoding – Optional encoding to use as a default in case (0008,0005) Specific Character Set isn’t specified.

  • specific_tags (list or None) – See dcmread() for parameter info.

  • at_top_level (bool) – If dataset is top level (not within a sequence). Used to turn off explicit VR heuristic within sequences

Returns

A Dataset instance.

Return type

dataset.Dataset

See also

Dataset

A collection (dictionary) of DICOM DataElement instances.