pynetdicom.dimse.DIMSEServiceProvider¶
-
class
pynetdicom.dimse.
DIMSEServiceProvider
(assoc)¶ The DIMSE service provider.
A DICOM AE uses the services provided by the DICOM Message Service Element (DIMSE). DIMSE specifies two sets of services.
DIMSE-C supports operations associated with composite SOP Classes and provides effective compatibility with the previous versions of the DICOM standards.
DIMSE-N supports operations associated with normalised SOP Classes and provides an extended set of object-orientated operations and notifications
Service Overview
The DIMSE service provider supports communication between peer DIMSE service users. A service user acts in one of two roles:
invoking DIMSE user
performing DIMSE user
Service users make use of service primitives provided by the DIMSE service provider. A service primitive shall be one of the following types:
request primitive
indication primitive
response primitive
confirmation primitive
These primitives are used as follows:
The invoking service user issues a request primitive to the DIMSE provider
The DIMSE provider receives the request primitive and issues an indication primitive to the performing service user
The performing service user receives the indication primitive and performs the requested service
The performing service user issues a response primitive to the DIMSE provider
The DIMSE provider receives the response primitive and issues a confirmation primitive to the invoking service user
The invoking service user receives the confirmation primitive, completing the DIMSE service.
Service Primitive Classes
DIMSE-C: C_ECHO, C_STORE, C_GET, C_FIND, C_MOVE
DIMSE-N: N_EVENT_REPORT, N_GET, N_GET, N_ACTION, N_CREATE, N_DELETE
Protocol Machine
PS3.7 8.1 The DIMSE protocol machine defines the procedures and the encoding rules necessary to construct Messages used to exchange command requests and responses between peer DIMSE service users.
The DIMSE protocol machine accepts service user requests and response service primitives and constructs Messages defined by the procedures in PS3.7 9.3 and 10.3. The DIMSE protocol machine accepts Messages and passes them to the DIMSE service user by the means of indication and confirmation service primitives.
Messages
Primitive
Type
Message Class
C-CANCEL
Request/indication
C_CANCEL_R
C-ECHO
Request/indication
C_ECHO_RQ
Response/confirmation
C_ECHO_RSP
C-FIND
Request/indication
C_FIND_RQ
Response/confirmation
C_FIND_RSP
C-GET
Request/indication
C_GET_RQ
Response/confirmation
C_GET_RSP
C-MOVE
Request/indication
C_MOVE_RQ
Response/confirmation
C_MOVE_RSP
C-STORE
Request/indication
C_STORE_RQ
Response/confirmation
C_STORE_RSP
N-ACTION
Request/indication
N_ACTION_RQ
Response/confirmation
N_ACTION_RSP
N-CREATE
Request/indication
N_CREATE_RQ
Response/confirmation
N_CREATE_RSP
N-DELETE
Request/indication
N_DELETE_RQ
Response/confirmation
N_DELETE_RSP
N-EVENT-REPORT
Request/indication
N_EVENT_REPORT_RQ
Response/confirmation
N_EVENT_REPORT_RSP
N-GET
Request/indication
N_GET_RQ
Response/confirmation
N_GET_RSP
N-SET
Request/indication
N_SET_RQ
Response/confirmation
N_SET_RSP
-
cancel_rq
¶ A dict of {MessageIDBeingRespondedTo : C_CANCEL} messages received. The dict is cleared out at the start and end of Service Class operations and is limited to a maximum of 10 messages.
- Type
dict
-
message
¶ The DIMSE message.
- Type
dimse_messages.DIMSEMessage
-
msg_queue
¶ A queue holding decoded DIMSE Message primitives received from the peer, except for C-CANCEL requests.
- Type
queue.queue of dimse_messages.DIMSEMessage
References
DICOM Standard, Part 7
-
__init__
(assoc)¶ Initialise the DIMSE service provider.
- Parameters
assoc (association.Association) – The Association to provide DIMSE services for.
Methods
__init__
(assoc)Initialise the DIMSE service provider.
get_msg
([block])Get the next available DIMSE message.
peek_msg
()Return the first message in the message queue or None.
receive_primitive
(primitive)Process a P-DATA primitive received from the remote.
send_msg
(primitive, context_id)Send a DIMSE-C or DIMSE-N message to the peer AE.
Attributes
Return the ACSE’s Association.
Return the DIMSE timeout as numeric or None.
Return the Association’s DUL service provider.
Return the peer’s maximum PDU length.
-
property
assoc
¶ Return the ACSE’s Association.
-
property
dimse_timeout
¶ Return the DIMSE timeout as numeric or None.
-
property
dul
¶ Return the Association’s DUL service provider.
-
get_msg
(block=False)¶ Get the next available DIMSE message.
- Parameters
block (bool) – If True then the function will block until either a message is available or dimse_timeout expires, otherwise non-blocking.
- Returns
The next available (context ID, DIMSE message), which is taken off the queue, or (None, None) if no messages are available within the dimse_timeout period.
- Return type
int, dimse_messages.DIMSEMessage or None, None
-
property
maximum_pdu_size
¶ Return the peer’s maximum PDU length.
-
peek_msg
()¶ Return the first message in the message queue or None.
- Returns
The first (context ID, message) in the queue if one is available, otherwise (None, None). No messages are taken out of the queue.
- Return type
int, dimse_messages.DIMSEMessage or None, None
-
receive_primitive
(primitive)¶ Process a P-DATA primitive received from the remote.
A DIMSE message is split into one or more P-DATA primitives, which must be sent in sequential order. While waiting for all the P-DATA primitives associated with a message the encoded data is stored in self.message, which is decoded only when complete and converted into a DIMSE Message primitive which is added to the msg_queue.
This makes it possible to process incoming P-DATA primitives into DIMSE messages while a service class implementation is running.
- Parameters
primitive (pdu_primitives.P_DATA) – A P-DATA primitive received from the peer to be processed.
-
send_msg
(primitive, context_id)¶ Send a DIMSE-C or DIMSE-N message to the peer AE.
- Parameters
primitive (dimse_primitives DIMSE Primitive class) – The DIMSE message primitive to send to the peer.
context_id (int) – The ID of the presentation context that the message is to be sent under.