pynetdicom.association.ServiceUser¶
-
class
pynetdicom.association.
ServiceUser
(assoc, mode)¶ Convenience class for the
Association
service user.An
Association
object has twoServiceUser
attributes, one representing the association Requestor and the other the association Acceptor. Once both have been defined sufficiently to be considered valid then association negotiation can begin. The RequestorServiceUser
requires (at a minimum) the following in order to be valid:For association as requestor:
AE title (ae_title)
Address and port number (address and port)
Maximum PDU length (maximum_length)
Implementation class UID (implementation_class_uid)
At least one presentation context (requested_contexts)
For association as acceptor:
AE title
Address and port number
The Acceptor
ServiceUser
requires (at a minimum) the following in order to be valid:For association as requestor:
Address and port number
For association as acceptor:
AE title
Address and port number
Maximum PDU length
Implementation class UID
-
address
¶ The TCP/IP address of the AE.
- Type
str
-
ae_title
¶ The AE’s AE title.
- Type
bytes
-
port
¶ The port number of the AE.
- Type
int
-
primitive
¶ The A-ASSOCIATE primitive (request if mode is ‘requestor’, accept/reject if mode is ‘acceptor’) sent or received by the AE during association negotiation.
- Type
None or pdu_primitives.A_ASSOCIATE
-
__init__
(assoc, mode)¶ Create a new ServiceUser.
- Parameters
assoc (association.Association) – The parent Association.
mode (str) – The operation mode of the AE represented by the ServiceUser, either ‘requestor’ or ‘acceptor’. This is not necessarily the same as the association’s mode.
Methods
__init__
(assoc, mode)Create a new ServiceUser.
add_negotiation_item
(item)Add an extended negotiation item to the user information.
get_contexts
(cx_type)Return a list of PresentationContext corresponding to cx_type.
remove_negotiation_item
(item)Remove an extended negotiation item from the user information.
Remove all extended negotiation items.
Attributes
Return a dict of the accepted SOP Class Common Extended Negotiation.
Return the Asynchronous Operations Window operations numbers.
Return a list of Extended Negotiation items.
Return the Implementation Class UID as a pydicom UID.
Return the Implementation Version Name as str (if available).
Return a dict with information about the ServiceUser.
Return True if the ServiceUser is the association acceptor.
Return True if the ServiceUser is the association requestor.
Return the maximum PDV size as int.
Return the mode as str, either ‘requestor’ or ‘acceptor’.
Return a list of the requestor’s requested presentation contexts.
Return any SCP/SCU Role Selection items as a dict.
Return any SOP Class Common Extended items as dict.
Return any SOP Class Extended items as dict.
Return a list of supported presentation contexts.
Return the User Identity Negotiation Item (if available).
Returns a list of the User Information items.
Return True if the current object can be changed.
-
property
accepted_common_extended
¶ Return a dict of the accepted SOP Class Common Extended Negotiation.
- Returns
The {SOP Class UID : (Service Class UID, Related General SOP Class Identification)} for the accepted SOP Class Common Extended negotiation items.
- Return type
dict of 2-tuple
- Raises
RuntimeError – If called when the requestor.
-
add_negotiation_item
(item)¶ Add an extended negotiation item to the user information.
Items can only be added prior to starting the association negotiation.
- Parameters
item (pdu_primitives.ServiceParameter) – An extended negotiation item, one of SCP_SCU_RoleSelectionNegotiation, UserIdentityNegotiation, AsynchronousOperationsWindowNegotiation, SOPClassExtendedNegotiation or SOPClassCommonExtendedNegotiation.
- Raises
RuntimeError – If attempting to add an item after association negotiation has started.
TypeError – If item it not an extended negotiation item.
-
property
asynchronous_operations
¶ Return the Asynchronous Operations Window operations numbers.
- Returns
The (Maximum Number of Operations Invoked, Maximum Number of Operations Performed) or (1, 1) if no Asynchronous Operations Window Negotiation item is in the extended negotiation items.
- Return type
2-tuple of int
-
property
extended_negotiation
¶ Return a list of Extended Negotiation items.
Extended Negotiation items are:
SCP/SCU Role Selection Negotiation (0 or more)
Asynchronous Operations Window Negotiation (0 or 1)
SOP Class Extended Negotiation (0 or more)
SOP Class Common Extended Negotiation (0 or more)
User Identity Negotiation (0 or 1)
- Returns
If mode is ‘requestor’ then returns a list of the proposed extended negotiation items, otherwise returns a list of the extended negotiation item responses.
- Return type
list
-
get_contexts
(cx_type)¶ Return a list of PresentationContext corresponding to cx_type.
- Parameters
cx_type (str) –
The type of contexts to return, if mode is ‘requestor’:
If the association has not yet been negotiated then ‘requested’.
If the association has been negotiated then ‘requested’ or ‘pcdl’.
If mode is ‘acceptor’:
If the association has not yet been negotiated then ‘supported’.
If the association has been negotiated then ‘supported’ or ‘pcdrl’.
- Returns
A list of presentations contexts, if cx_type is ‘requested’ then the requested presentation contexts, if ‘pcdl’ then the presentation contexts from the A-ASSOCIATE (request) primitive’s Presentation Context Definition List parameter. If ‘supported’ then the supported presentation contexts, if ‘pcdrl’ then the presentation contexts from the A-ASSOCIATE (accept) primitive’s Presentation Context Definition Results List parameter.
- Return type
list of presentation.PresentationContext
-
property
implementation_class_uid
¶ Return the Implementation Class UID as a pydicom UID.
- Returns
Returns the Implementation Class UID if the requestor or if the acceptor and they have accepted the negotiation. Returns None if the acceptor and they have rejected the negotiation.
- Return type
pydicom.uid.UID or None
-
property
implementation_version_name
¶ Return the Implementation Version Name as str (if available).
- Returns
Returns None if the acceptor and they have rejected the negotiation or if no Implementation Version Name Notification item has been included in the association negotiation. Otherwise returns the Implementation Version Name.
- Return type
str or None
-
property
info
¶ Return a dict with information about the ServiceUser.
-
property
is_acceptor
¶ Return True if the ServiceUser is the association acceptor.
-
property
is_requestor
¶ Return True if the ServiceUser is the association requestor.
-
property
maximum_length
¶ Return the maximum PDV size as int.
- Returns
Returns the Maximum Received Length if the requestor or if the acceptor and they have accepted the negotiation. Returns None if the acceptor and they have rejected the negotiation.
- Return type
int or None
-
property
mode
¶ Return the mode as str, either ‘requestor’ or ‘acceptor’.
-
remove_negotiation_item
(item)¶ Remove an extended negotiation item from the user information.
Items can only be removed prior to starting the association negotiation.
- Parameters
item (pdu_primitives.ServiceParameter) – An extended negotiation item, one of SCP_SCU_RoleSelectionNegotiation, UserIdentityNegotiation, AsynchronousOperationsWindowNegotiation, SOPClassExtendedNegotiation or SOPClassCommonExtendedNegotiation.
- Raises
RuntimeError – If attempting to remove an item after association negotiation has started.
TypeError – If item it not an extended negotiation item.
-
property
requested_contexts
¶ Return a list of the requestor’s requested presentation contexts.
-
reset_negotiation_items
()¶ Remove all extended negotiation items.
Items can only be removed prior to starting the association negotiation.
- Raises
RuntimeError – If attempting to clear the extended negotiation items after association negotiation has started.
-
property
role_selection
¶ Return any SCP/SCU Role Selection items as a dict.
- Returns
The SCP/SCU Role Selection items as {SOP Class UID : SCP_SCU_RoleSelectionNegotiation}.
- Return type
dict
-
property
sop_class_common_extended
¶ Return any SOP Class Common Extended items as dict.
If the ServiceUser is the association acceptor then no SOP Class Common Extended items will be present in the User Information.
- Returns
The SOP Class Common Extended items as {SOP Class UID : item}.
- Return type
dict
-
property
sop_class_extended
¶ Return any SOP Class Extended items as dict.
- Returns
The SOP Class Extended items as {SOP Class UID : Service Class Application Information}.
- Return type
dict
-
property
supported_contexts
¶ Return a list of supported presentation contexts.
- Returns
The supported presentation contexts when acting as an acceptor.
- Return type
list of presentation.PresentationContext
-
property
user_identity
¶ Return the User Identity Negotiation Item (if available).
- Returns
Returns the User Identity item if one is available, otherwise None.
- Return type
-
property
user_information
¶ Returns a list of the User Information items.
-
property
writeable
¶ Return True if the current object can be changed.