pydicom.filereader.read_dataset(fp: BinaryIO, is_implicit_VR: bool, is_little_endian: bool, bytelength: int | None = None, stop_when: Callable[[BaseTag, str | None, int], bool] | None = None, defer_size: int | float | str | None = None, parent_encoding: str | MutableSequence[str] = 'iso8859', specific_tags: List[BaseTag] | None = None, at_top_level: bool = True) Dataset[source]

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

  • 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, str or float, optional) – Size to avoid loading large elements in memory. See dcmread() for more parameter info.

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

  • specific_tags (list of BaseTag, optional) – 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


A Dataset instance.

Return type:


See also


A collection (dictionary) of DICOM DataElement instances.