Association (asceprovider)¶
Module contains two key classes for working with DICOM associations:
AssociationAcceptor
for handling incoming association requests.AssociationRequester
for requesting association.
In most cases you won’t have to create AssociationAcceptor or AssociationRequester directly, but
rather they will be created for you by either ClientAE
or AE
. Please, refer to documentation on those classes
on how to request new association or how incoming association are handled.
Each association class is not only responsible for initial establishment, but also for all association life-cycle until it’s either released or aborted.
-
class
pynetdicom2.asceprovider.
PContextDef
(id, sop_class, supported_ts)¶ -
id
¶ Alias for field number 0
-
sop_class
¶ Alias for field number 1
-
supported_ts
¶ Alias for field number 2
-
-
pynetdicom2.asceprovider.
build_pres_context_def_list
(context_def_list)¶ Builds a list of Presntation Context Items
Parameters: context_def_list (Tuple[int,PContextDef]) – list of tuples (presentation context ID and PContextDef) Returns: generator that yields pynetdicom2.pdu.PresentationContextItemRQ
instances
-
class
pynetdicom2.asceprovider.
Association
(local_ae, dul_socket, max_pdu_length)¶ Base association class.
Class is not intended for direct usage and meant to be sub-classed. Class provides basic association interface: creation, release and abort.
-
send
(dimse_msg, pc_id)¶ Sends DIMSE message
Parameters: - dimse_msg (dimsemessages.DIMSEMessage) – DIMSE message
- pc_id (PContextDef) – Presentation Context Definition
-
receive
()¶ Receives DIMSE message
Returns: tuple, containing DIMSE message and presentation context ID Return type: Tuple[dimsemessages.DIMSEMessage, int]
-
kill
()¶ Stops internal DUL service provider.
In most cases you won’t need to use this method directly. Refer to release and abort instead.
-
release
()¶ Releases association.
Requests the release of the association and waits for confirmation
-
-
class
pynetdicom2.asceprovider.
AssociationAcceptor
(request, client_address, local_ae, max_pdu_length)¶ ‘Server-side’ association implementation.
Class is intended for handling incoming association requests.
-
kill
()¶ Overrides base class kill method to set stop-flag for running thread
:rtype : None
-
abort
(reason)¶ Aborts association with specified reason
:rtype : None :param reason: abort reason
-
reject
(result, source, diag)¶ Rejects association with specified parameters
Parameters: - result –
- source –
- diag –
-
accept
(assoc_req)¶ Waits for an association request from a remote AE. Upon reception of the request sends association response based on acceptable_pr_contexts
-
-
class
pynetdicom2.asceprovider.
AssociationRequester
(local_ae, max_pdu_length, remote_ae)¶ Class for managing association request.
Generally you would not need to construct this class directly, rather it would be created for you, when using
AE
orClientAE
.Variables: - context_def_list – presentation context definitions in a form of dict (PC ID -> Presentation Context)
- remote_ae – dictionary, containing remote AET, address, port and other information
- sop_classes_as_scu – dictionary which maps accepted SOP Classes to presentation contexts. empty, until association is established.
-
request
()¶ Requests association with remote AET.
-
get_scu
(sop_class)¶ Get SCU function to use (like for making a C-FIND request).
SCU are generally provided by sopclass module. First argument of the service would be bound to current association and second would be bound to current presentation contexnt.
Parameters: sop_class (Union[str,pydicom.uid.UID]) – SOP Class UID Raises: exceptions.ClassNotSupportedError – raised if provided SOP Class UID is not supported by association. Returns: SCU function
-
abort
(reason=0)¶ Aborts association with specified reason
Parameters: reason – abort reason