pynetdicom.utils.set_uid#
- pynetdicom.utils.set_uid(value: None | str | bytes | UID, name: str, allow_empty: bool = True, allow_none: bool = True, validate: bool = True) UID | None[source]#
Convert value to a
UIDand 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
Truethen allow an empty UID (default).allow_none (bool, optional) – Allow the returned value to be
Noneif value isNone(defaultTrue).validate (bool, optional) – If
True(default) perform validation of the UID usingvalidate_uid()and raise aValueErrorexception if the validation fails. IfFalsereturn the UID without performing and validation.
- Returns:
If
allow_noneisTruethen may returnNone, otherwise only a UID will be returned.- Return type:
pydicom.uid.UID or None