pydicom.data.get_testdata_file

pydicom.data.get_testdata_file(name: str, read: bool = False) Optional[Union[str, Dataset]][source]

Return an absolute path to the first matching dataset with filename name.

New in version 1.4.

First searches the local pydicom data store, then any locally available external sources, and finally the files available in the pydicom/pydicom-data repository.

Changed in version 2.1: Modified to search locally available external data sources and the pydicom/pydicom-data repository

Changed in version 2.2: Added the read keyword parameter.

Parameters
  • name (str) – The full file name (without path)

  • read (bool, optional) – If True then use dcmread() to read the file and return the corresponding FileDataset. Default False.

Returns

The absolute path of the file if found, the dataset itself if read is True, or None if the file is not found.

Return type

str, pydicom.dataset.Dataset or None