pynetdicom.utils.validate_ae_title

pynetdicom.utils.validate_ae_title(ae_title)[source][source]

Return a valid AE title from ae_title, if possible.

An AE title:

  • Must be no more than 16 characters
  • Leading and trailing spaces are not significant
  • The characters should belong to the Default Character Repertoire excluding 0x5C (backslash) and all control characters

If the supplied ae_title is greater than 16 characters once non-significant spaces have been removed then the returned AE title will be truncated to remove the excess characters.

If the supplied ae_title is less than 16 characters once non-significant spaces have been removed, the spare trailing characters will be set to space (0x20)

Parameters:

ae_title (str or bytes) – The AE title to check

Returns:

A valid AE title (with the same type as the supplied ae_title), truncated to 16 characters if necessary. If Python 3 then only returns bytes.

Return type:

str or bytes

Raises:
  • ValueError – If ae_title is an empty string, contains only spaces or contains control characters or backslash
  • TypeError – If ae_title is not a string or bytes