pynetdicom.utils.set_uid

pynetdicom.utils.set_uid(value: Union[None, str, bytes, UID], name: str, allow_empty: bool = True, allow_none: bool = True, validate: bool = True) Optional[UID][source]

Convert value to a UID and apply validation.

Parameters
  • value (str, bytes, UID (and optionally None)) – The value to be converted.

  • name (str) – The name of the parameter being converted.

  • allow_empty (bool, optional) – If True then allow an empty UID (default).

  • allow_none (bool, optional) – Allow the returned value to be None if value is None (default True).

  • validate (bool, optional) – If True (default) perform validation of the UID using validate_uid() and raise a ValueError exception if the validation fails. If False return the UID without performing and validation.

Returns

If allow_none is True then may return None, otherwise only a UID will be returned.

Return type

pydicom.uid.UID or None