Skip to content

Dicom UID

UID Generation module

generate_uid(entropy_sources=None)

Generate a unique DICOM UID with the GRPM prefix.

Parameters:

Name Type Description Default
entropy_sources Optional[List[str]]

The GRPM prefix will be appended with a SHA512 hash of the given list which means the result is deterministic and should make the original data unrecoverable.

None

Returns:

Type Description
str

A DICOM UID of up to 64 characters.

Source code in pygrpm/dicom/uid.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def generate_uid(entropy_sources: Optional[List[str]] = None) -> uid.UID:
    """Generate a unique DICOM UID with the GRPM prefix.

    Parameters
    ----------
    entropy_sources
        The GRPM prefix will be appended with a SHA512 hash of the given list
        which means the result is deterministic and should make the original
        data unrecoverable.

    Returns
    -------
    str
        A DICOM UID of up to 64 characters.

    """
    return uid.generate_uid(prefix=GRPM_PREFIX, entropy_srcs=entropy_sources)