pynetdicom.association.ServiceUser¶
- class pynetdicom.association.ServiceUser(assoc: Association, mode: str)[source]¶
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
- 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: Association, mode: str) None [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’smode
.
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
ofPresentationContext
items 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.Get or set the AE title.
Return the Asynchronous Operations Window operations numbers.
Return a
list
of Extended Negotiation items.The Implementation Class UID as a
UID
.Get or set the Implementation Version Name.
Return a
dict
with information about theServiceUser
.Return
True
if theServiceUser
is the association acceptor.Return
True
if theServiceUser
is the association requestor.The maximum PDV size as
int
.Return the mode as
str
, either'requestor'
or'acceptor'
.A
list
of 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
list
of the User Information items.Return
True
if the current object can be changed.- property accepted_common_extended: dict[UID, tuple[UID, list[UID]]]¶
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: MaximumLengthNotification | ImplementationClassUIDNotification | ImplementationVersionNameNotification | AsynchronousOperationsWindowNegotiation | SCP_SCU_RoleSelectionNegotiation | SOPClassExtendedNegotiation | SOPClassCommonExtendedNegotiation | UserIdentityNegotiation) None [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: tuple[int, int]¶
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: list[MaximumLengthNotification | ImplementationClassUIDNotification | ImplementationVersionNameNotification | AsynchronousOperationsWindowNegotiation | SCP_SCU_RoleSelectionNegotiation | SOPClassExtendedNegotiation | SOPClassCommonExtendedNegotiation | UserIdentityNegotiation]¶
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)
- get_contexts(cx_type: str) list[PresentationContext] [source]¶
Return a
list
ofPresentationContext
items 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:
- property implementation_class_uid: UID | None¶
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
None
if the acceptor and they have rejected the negotiation.- Return type:
pydicom.uid.UID or None
- property implementation_version_name: str | None¶
Get or set the Implementation Version Name.
- Parameters:
value (str or None) – The value to use for the Implementation Version Name, or
None
if no Implementation Version Name Notification item is to be included in the association negotiation. Can only be set prior to association negotiation.- 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 is_acceptor: bool¶
Return
True
if theServiceUser
is the association acceptor.
- property is_requestor: bool¶
Return
True
if theServiceUser
is the association requestor.
- property maximum_length: int | None¶
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
- remove_negotiation_item(item: MaximumLengthNotification | ImplementationClassUIDNotification | ImplementationVersionNameNotification | AsynchronousOperationsWindowNegotiation | SCP_SCU_RoleSelectionNegotiation | SOPClassExtendedNegotiation | SOPClassCommonExtendedNegotiation | UserIdentityNegotiation) None [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.
- property requested_contexts: list[PresentationContext]¶
A
list
of the requestor’s requested presentation contexts.
- reset_negotiation_items() None [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: dict[UID, SCP_SCU_RoleSelectionNegotiation]¶
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: dict[UID, SOPClassCommonExtendedNegotiation]¶
Return the SOP Class Common Extended items.
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:
- property sop_class_extended: dict[UID, bytes]¶
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: list[PresentationContext]¶
The supported presentation contexts.
- Returns:
The supported presentation contexts when acting as an acceptor.
- Return type:
- property user_identity: UserIdentityNegotiation | None¶
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: list[MaximumLengthNotification | ImplementationClassUIDNotification | ImplementationVersionNameNotification | AsynchronousOperationsWindowNegotiation | SCP_SCU_RoleSelectionNegotiation | SOPClassExtendedNegotiation | SOPClassCommonExtendedNegotiation | UserIdentityNegotiation]¶
Returns a
list
of the User Information items.