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
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 isNone
(defaultTrue
).validate (bool, optional) – If
True
(default) perform validation of the UID usingvalidate_uid()
and raise aValueError
exception if the validation fails. IfFalse
return the UID without performing and validation.
- Returns:
If
allow_none
isTrue
then may returnNone
, otherwise only a UID will be returned.- Return type:
pydicom.uid.UID or None