pydicom.dataset.validate_file_meta

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

Validate the File Meta Information elements in file_meta.

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 and the Type 1 elements given a value if empty:

    • (0002,0001) File Meta Information Version, Type 1

    • (0002,0012) Implementation Class UID, Type 1

    • (0002,0013) Implementation Version Name, Type 3

    and the following elements will be checked to ensure they’re present and have a non-empty value:

    • (0002,0002) Media Storage SOP Class UID, Type 1

    • (0002,0003) Media Storage SOP Instance UID, Type 1

    • (0002,0010) Transfer Syntax UID, Type 1

Raises:
  • ValueError – If enforce_standard is True and any of the Type 1 File Meta Information elements are missing from file_meta or have no value.

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