pydicom.dataset.validate_file_meta

pydicom.dataset.validate_file_meta(file_meta: pydicom.dataset.FileMetaDataset, enforce_standard: bool = True) None[source]

Validate the File Meta Information elements in file_meta.

Changed in version 1.2: Moved from pydicom.filewriter.

Parameters
  • file_meta (Dataset) – The File Meta Information data elements.

  • enforce_standard (bool, optional) –

    If False, then only a check for invalid elements is performed. If True (default), the following elements will be added if not already present:

    • (0002,0001) File Meta Information Version

    • (0002,0012) Implementation Class UID

    • (0002,0013) Implementation Version Name

    and the following elements will be checked:

    • (0002,0002) Media Storage SOP Class UID

    • (0002,0003) Media Storage SOP Instance UID

    • (0002,0010) Transfer Syntax UID

Raises
  • ValueError – If enforce_standard is True and any of the checked File Meta Information elements are missing from file_meta.

  • ValueError – If any non-Group 2 Elements are present in file_meta.