pydicom.data.get_testdata_file#
- pydicom.data.get_testdata_file(name: str, read: bool = False, download: bool = True) str | Dataset | None[source]#
- Return an absolute path to the first matching dataset with filename name that is found in a local or external pydicom datastore. - 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. - Changed in version 2.3: Added the download keyword parameter. - Parameters:
- name (str) – The full file name (without path) 
- read (bool, optional) – If - Truethen use- dcmread()to read the file and return the corresponding- FileDataset. Default- False.
- download (bool, optional) – If - True(default) download the file if missed locally.
 
- Returns:
- The absolute path of the file if found, the dataset itself if read is - True, or- Noneif the file is not found.
- Return type:
- str, pydicom.dataset.Dataset or None 
- Raises:
- ValueError – If name is an absolute path. 
 
