def GenerateUID()

in ez_wsi_dicomweb/ml_toolkit/dicom_builder.py [0:0]


  def GenerateUID(self) -> str:
    """Generates a random DICOM UUID with the prefix DicomBuilder was constructed with.

    Returns:
      Unique UID starting with |self._uid_prefix|.
    """
    # Generates a unique UID using the Process ID, Host ID and current time.
    # Uses as a period as the separator and combines the generated UUID with the
    # |self._uid_prefix| prefix.
    # Example: 1.3.6.1.4.1.11129.5.3.268914880332007.160162.47.376673
    uuid_components = [
        self._uid_prefix,
        uuid.getnode(),
        abs(os.getpid()),
        datetime.datetime.today().second,
        datetime.datetime.today().microsecond,
    ]
    generated_uuid = '.'.join(
        str(uuid_component) for uuid_component in uuid_components
    )
    return generated_uuid