pynetdicom.utils.validate_ae_title

pynetdicom.utils.validate_ae_title(ae_title)

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).

AE titles are made up of the Default Character Repertoire (the Basic G0 Set of ISO646) excluding character code 0x5c (backslash) and all control characters.

Parameters

ae_title (bytes) – The AE title to check.

Returns

A valid AE title truncated to 16 characters if necessary. If Python 3 then only returns bytes, if Python 2 then returns str.

Return type

str or bytes

Raises

ValueError – If ae_title is an empty string, contains only spaces or contains control characters or backslash.