pynetdicom.association.ServiceUser¶
- 
class pynetdicom.association.ServiceUser(assoc, mode)[source]¶
- Convenience class for the - Associationservice user.- An - Associationobject has two- ServiceUserattributes, 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 requestor- ServiceUserrequires (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 - ServiceUserrequires (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 
 
 - 
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
 
 - 
__init__(assoc, mode)[source]¶
- 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 - listof- PresentationContextitems 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 - dictof the accepted SOP Class Common Extended Negotiation.- Return the Asynchronous Operations Window operations numbers. - Return a - listof Extended Negotiation items.- The Implementation Class UID as a - UID.- The Implementation Version Name as - str(if available).- Return a - dictwith information about the- ServiceUser.- Return - Trueif the- ServiceUseris the association acceptor.- Return - Trueif the- ServiceUseris the association requestor.- The maximum PDV size as - int.- Return the mode as - str, either- 'requestor'or- 'acceptor'.- A - listof the requestor’s requested presentation contexts.- Return any SCP/SCU Role Selection items. - Return the SOP Class Common Extended items. - Return any SOP Class Extended items. - The supported presentation contexts. - Return the User Identity Negotiation Item (if available). - Returns a - listof the User Information items.- Return - Trueif the current object can be changed.- 
property accepted_common_extended¶
- Return a - dictof 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)[source]¶
- 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: 
- 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 - listof 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) 
 
 - 
get_contexts(cx_type)[source]¶
- Return a - listof- PresentationContextitems 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¶
- The Implementation Class UID as a - UID.- Returns
- Returns the Implementation Class UID if the requestor or if the acceptor and they have accepted the negotiation. Returns - Noneif the acceptor and they have rejected the negotiation.
- Return type
 
 - 
property info¶
- Return a - dictwith information about the- ServiceUser.
 - 
property is_acceptor¶
- Return - Trueif the- ServiceUseris the association acceptor.
 - 
property is_requestor¶
- Return - Trueif the- ServiceUseris the association requestor.
 - 
remove_negotiation_item(item)[source]¶
- 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: 
- Raises
- RuntimeError – If attempting to remove an item after association negotiation has started. 
- TypeError – If item it not an extended negotiation item. 
 
 
 - 
reset_negotiation_items()[source]¶
- 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. - Returns
- The SCP/SCU Role Selection items as - {'SOP Class UID' : SCP_SCU_RoleSelectionNegotiation}.
- Return type
 
 - 
property sop_class_common_extended¶
- Return the SOP Class Common Extended items. - If the - ServiceUseris 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
 
 - 
property sop_class_extended¶
- Return any SOP Class Extended items. - Returns
- The SOP Class Extended items as - {'SOP Class UID' : Service Class Application Information}.
- Return type
 
 - 
property supported_contexts¶
- The 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 writeable¶
- Return - Trueif the current object can be changed.