pynetdicom.dimse.DIMSEServiceProvider¶
-
class
pynetdicom.dimse.DIMSEServiceProvider(dul, dimse_timeout=None, maximum_pdu_size=16382)[source][source]¶ 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 -
dimse_timeout¶ The number of seconds before the DIMSE service timeout. A value of
Noneindicates no timeout.Type: numeric or None
-
dul¶ The DICOM Upper Layer service provider.
Type: dul.DULServiceProvider
-
message¶ The DIMSE message.
Type: dimse_messages.DIMSEMessage
References
- DICOM Standard, Part 7
-
__init__(dul, dimse_timeout=None, maximum_pdu_size=16382)[source][source]¶ Start the DIMSE service provider.
Parameters: - dul (dul.DULServiceProvider) – The DICOM Upper Layer service provider.
- dimse_timeout (int or float or None) – The number of seconds before the DIMSE service timeout. A value of None indicates no timeout.
- maximum_pdu_size (int) – The maximum PDU size when sending DIMSE messages, default 16382.
Methods
__init__(dul[, dimse_timeout, maximum_pdu_size])Start the DIMSE service provider. debug_receive_c_cancel_rq(msg)Debugging function when a C-CANCEL-*-RQ is received. debug_receive_c_echo_rq(msg)Debugging function when a C-ECHO-RQ is received. debug_receive_c_echo_rsp(msg)Debugging function when a C-ECHO-RSP is received. debug_receive_c_find_rq(msg)Debugging function when a C-FIND-RQ is received. debug_receive_c_find_rsp(msg)Debugging function when a C-FIND-RSP is received. debug_receive_c_get_rq(msg)Debugging function when a C-GET-RQ is received. debug_receive_c_get_rsp(msg)Debugging function when a C-GET-RSP is received. debug_receive_c_move_rq(msg)Debugging function when a C-MOVE-RQ is received. debug_receive_c_move_rsp(msg)Debugging function when a C-MOVE-RSP is received. debug_receive_c_store_rq(msg)Debugging function when a C-STORE-RQ is received. debug_receive_c_store_rsp(msg)Debugging function when a C-STORE-RSP is received. debug_receive_n_action_rq(msg)Debugging function when an N-ACTION-RQ is received. debug_receive_n_action_rsp(msg)Debugging function when an N-ACTION-RSP is received. debug_receive_n_create_rq(msg)Debugging function when an N-CREATE-RQ is received. debug_receive_n_create_rsp(msg)Debugging function when an N-CREATE-RSP is received. debug_receive_n_delete_rq(msg)Debugging function when an N-DELETE-RQ is received. debug_receive_n_delete_rsp(msg)Debugging function when an N-DELETE-RSP is received. debug_receive_n_event_report_rq(msg)Debugging function when an N-EVENT-REPORT-RQ is received. debug_receive_n_event_report_rsp(msg)Debugging function when an N-EVENT-REPORT-RSP is received. debug_receive_n_get_rq(msg)Debugging function when an N-GET-RQ is received. debug_receive_n_get_rsp(msg)Debugging function when an N-GET-RSP is received. debug_receive_n_set_rq(msg)Debugging function when an N-SET-RQ is received. debug_receive_n_set_rsp(msg)Debugging function when an N-SET-RSP is received. debug_send_c_cancel_rq(msg)Debugging function when a C-CANCEL-*-RQ is sent. debug_send_c_echo_rq(msg)Debugging function when a C-ECHO-RQ is sent. debug_send_c_echo_rsp(msg)Debugging function when a C-ECHO-RSP is sent. debug_send_c_find_rq(msg)Debugging function when a C-FIND-RQ is sent. debug_send_c_find_rsp(msg)Debugging function when a C-FIND-RSP is sent. debug_send_c_get_rq(msg)Debugging function when a C-GET-RQ is sent. debug_send_c_get_rsp(msg)Debugging function when a C-GET-RSP is sent. debug_send_c_move_rq(msg)Debugging function when a C-MOVE-RQ is sent. debug_send_c_move_rsp(msg)Debugging function when a C-MOVE-RSP is sent. debug_send_c_store_rq(msg)Debugging function when a C-STORE-RQ is sent. debug_send_c_store_rsp(msg)Debugging function when a C-STORE-RSP is sent. debug_send_n_action_rq(msg)Debugging function when an N-ACTION-RQ is sent. debug_send_n_action_rsp(msg)Debugging function when an N-ACTION-RSP is sent. debug_send_n_create_rq(msg)Debugging function when an N-CREATE-RQ is sent. debug_send_n_create_rsp(msg)Debugging function when an N-CREATE-RSP is sent. debug_send_n_delete_rq(msg)Debugging function when an N-DELETE-RQ is sent. debug_send_n_delete_rsp(msg)Debugging function when an N-DELETE-RSP is sent. debug_send_n_event_report_rq(msg)Debugging function when an N-EVENT-REPORT-RQ is sent. debug_send_n_event_report_rsp(msg)Debugging function when an N-EVENT-REPORT-RSP is sent. debug_send_n_get_rq(msg)Debugging function when an N-GET-RQ is sent. debug_send_n_get_rsp(msg)Debugging function when an N-GET-RSP is sent. debug_send_n_set_rq(msg)Debugging function when an N-SET-RQ is sent. debug_send_n_set_rsp(msg)Debugging function when an N-SET-RSP is sent. on_receive_dimse_message(message)Controls which debugging function is called when receiving. on_send_dimse_message(message)Controls which debugging function is called when sending. receive_msg([wait])Receive a DIMSE message from the peer. send_msg(primitive, context_id)Send a DIMSE-C or DIMSE-N message to the peer AE. -
static
debug_receive_c_cancel_rq(msg)[source][source]¶ Debugging function when a C-CANCEL-*-RQ is received.
Covers C-CANCEL-FIND-RQ, C-CANCEL-GET-RQ and C-CANCEL-MOVE-RQ
Parameters: msg (dimse_messagesC_CANCEL_RQ) – The received C-CANCEL-RQ message.
-
static
debug_receive_c_echo_rq(msg)[source][source]¶ Debugging function when a C-ECHO-RQ is received.
C-ECHO Request Parameters
(M) Message ID(M) Affected SOP Class UIDParameters: msg (dimse_messagesC_ECHO_RQ) – The received C-ECHO-RQ message.
-
static
debug_receive_c_echo_rsp(msg)[source][source]¶ Debugging function when a C-ECHO-RSP is received.
C-ECHO Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(M) StatusParameters: msg (dimse_messages.C_ECHO_RSP) – The received C-ECHO-RSP message.
-
static
debug_receive_c_find_rq(msg)[source][source]¶ Debugging function when a C-FIND-RQ is received.
C-FIND Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) IdentifierParameters: msg (dimse_messagesC_FIND_RQ) – The received C-FIND-RQ message.
-
static
debug_receive_c_find_rsp(msg)[source][source]¶ Debugging function when a C-FIND-RSP is received.
C-FIND Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(C) Identifier(M) StatusParameters: msg (dimse_messages.C_FIND_RSP) – The received C-FIND-RSP message.
-
static
debug_receive_c_get_rq(msg)[source][source]¶ Debugging function when a C-GET-RQ is received.
C-GET Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) IdentifierParameters: msg (dimse_messagesC_GET_RQ) – The received C-GET-RQ message.
-
static
debug_receive_c_get_rsp(msg)[source][source]¶ Debugging function when a C-GET-RSP is received.
C-GET Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Identifier(M) Status(C) Number of Remaining Sub-operations(C) Number of Completed Sub-operations(C) Number of Failed Sub-operations(C) Number of Warning Sub-operationsParameters: msg (dimse_messagesC_GET_RSP) – The received C-GET-RSP message.
-
static
debug_receive_c_move_rq(msg)[source][source]¶ Debugging function when a C-MOVE-RQ is received.
C-MOVE Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) Move Destination(M) IdentifierParameters: msg (dimse_messagesC_MOVE_RQ) – The received C-MOVE-RQ message.
-
static
debug_receive_c_move_rsp(msg)[source][source]¶ Debugging function when a C-MOVE-RSP is received.
C-MOVE Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Identifier(M) Status(C) Number of Remaining Sub-operations(C) Number of Completed Sub-operations(C) Number of Failed Sub-operations(C) Number of Warning Sub-operationsParameters: msg (dimse_messagesC_MOVE_RSP) – The received C-MOVE-RSP message.
-
static
debug_receive_c_store_rq(msg)[source][source]¶ Debugging function when a C-STORE-RQ is received.
C-STORE Request Elements
(M) Message ID(M) Affected SOP Class UID(M) Affected SOP Instance UID(M) Priority(U) Move Originator Application Entity Title(U) Move Originator Message ID(M) Data SetParameters: msg (dimse_messagesC_STORE_RQ) – The received C-STORE-RQ message.
-
static
debug_receive_c_store_rsp(msg)[source][source]¶ Debugging function when a C-STORE-RSP is received.
C-STORE Response Elements
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Affected SOP Instance UID(M) StatusParameters: msg (dimse_messagesC_STORE_RSP) – The received C-STORE-RSP message.
-
static
debug_receive_n_action_rq(msg)[source][source]¶ Debugging function when an N-ACTION-RQ is received.
Parameters: msg (dimse_messages.N_ACTION_RQ) – The received N-ACTION-RQ message.
-
static
debug_receive_n_action_rsp(msg)[source][source]¶ Debugging function when an N-ACTION-RSP is received.
Parameters: msg (dimse_messages.N_ACTION_RSP) – The received N-ACTION-RSP message.
-
static
debug_receive_n_create_rq(msg)[source][source]¶ Debugging function when an N-CREATE-RQ is received.
Parameters: msg (dimse_messages.N_CREATE_RQ) – The received N-CREATE-RQ message.
-
static
debug_receive_n_create_rsp(msg)[source][source]¶ Debugging function when an N-CREATE-RSP is received.
Parameters: msg (dimse_messages.N_CREATE_RSP) – The received N-CREATE-RSP message.
-
static
debug_receive_n_delete_rq(msg)[source][source]¶ Debugging function when an N-DELETE-RQ is received.
Parameters: msg (dimse_messages.N_DELETE_RQ) – The received N-DELETE-RQ message.
-
static
debug_receive_n_delete_rsp(msg)[source][source]¶ Debugging function when an N-DELETE-RSP is received.
Parameters: msg (dimse_messages.N_DELETE_RSP) – The received N-DELETE-RSP message.
-
static
debug_receive_n_event_report_rq(msg)[source][source]¶ Debugging function when an N-EVENT-REPORT-RQ is received.
Parameters: msg (dimse_messages.N_EVENT_REPORT_RQ) – The received N-EVENT-REPORT-RQ message.
-
static
debug_receive_n_event_report_rsp(msg)[source][source]¶ Debugging function when an N-EVENT-REPORT-RSP is received.
Parameters: msg (dimse_messages.N_EVENT_REPORT_RSP) – The received N-EVENT-REPORT-RSP message.
-
static
debug_receive_n_get_rq(msg)[source][source]¶ Debugging function when an N-GET-RQ is received.
Parameters: msg (dimse_messages.N_GET_RQ) – The received N-GET-RQ message.
-
static
debug_receive_n_get_rsp(msg)[source][source]¶ Debugging function when an N-GET-RSP is received.
Parameters: msg (dimse_messages.N_GET_RSP) – The received N-GET-RSP message.
-
static
debug_receive_n_set_rq(msg)[source][source]¶ Debugging function when an N-SET-RQ is received.
Parameters: msg (dimse_messages.N_SET_RQ) – The received N-SET-RQ message.
-
static
debug_receive_n_set_rsp(msg)[source][source]¶ Debugging function when an N-SET-RSP is received.
Parameters: msg (dimse_messages.N_SET_RSP) – The received N-SET-RSP message.
-
static
debug_send_c_cancel_rq(msg)[source][source]¶ Debugging function when a C-CANCEL-*-RQ is sent.
Covers C-CANCEL-FIND-RQ, C-CANCEL-GET-RQ and C-CANCEL-MOVE-RQ.
Parameters: msg (dimse_messages.C_CANCEL_RQ) – The C-CANCEL-*-RQ message to be sent.
-
static
debug_send_c_echo_rq(msg)[source][source]¶ Debugging function when a C-ECHO-RQ is sent.
C-ECHO Request Parameters
(M) Message ID(M) Affected SOP Class UIDParameters: msg (dimse_messages.C_ECHO_RQ) – The C-ECHO-RQ message to be sent.
-
static
debug_send_c_echo_rsp(msg)[source][source]¶ Debugging function when a C-ECHO-RSP is sent.
C-ECHO Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(M) StatusParameters: msg (dimse_messages.C_ECHO_RSP) – The C-ECHO-RSP message to be sent.
-
static
debug_send_c_find_rq(msg)[source][source]¶ Debugging function when a C-FIND-RQ is sent.
C-FIND Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) IdentifierParameters: msg (dimse_messages.C_FIND_RQ) – The C-FIND-RQ message to be sent.
-
static
debug_send_c_find_rsp(msg)[source][source]¶ Debugging function when a C-FIND-RSP is sent.
C-FIND Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(C) Identifier(M) StatusParameters: msg (dimse_messages.C_FIND_RSP) – The C-FIND-RSP message to be sent.
-
static
debug_send_c_get_rq(msg)[source][source]¶ Debugging function when a C-GET-RQ is sent.
C-GET Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) IdentifierParameters: msg (dimse_messages.C_GET_RQ) – The C-GET-RQ message to be sent.
-
static
debug_send_c_get_rsp(msg)[source][source]¶ Debugging function when a C-GET-RSP is sent.
C-GET Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Identifier(M) Status(C) Number of Remaining Sub-operations(C) Number of Completed Sub-operations(C) Number of Failed Sub-operations(C) Number of Warning Sub-operationsParameters: msg (dimse_messages.C_GET_RSP) – The C-GET-RSP message to be sent.
-
static
debug_send_c_move_rq(msg)[source][source]¶ Debugging function when a C-MOVE-RQ is sent.
C-MOVE Request Parameters
(M) Message ID(M) Affected SOP Class UID(M) Priority(M) Move Destination(M) IdentifierParameters: msg (dimse_messages.C_MOVE_RQ) – The C-MOVE-RQ message to be sent.
-
static
debug_send_c_move_rsp(msg)[source][source]¶ Debugging function when a C-MOVE-RSP is sent.
C-MOVE Response Parameters
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Identifier(M) Status(C) Number of Remaining Sub-operations(C) Number of Completed Sub-operations(C) Number of Failed Sub-operations(C) Number of Warning Sub-operationsParameters: msg (dimse_messages.C_MOVE_RSP) – The C-MOVE-RSP message to be sent.
-
static
debug_send_c_store_rq(msg)[source][source]¶ Debugging function when a C-STORE-RQ is sent.
C-STORE Request Elements
(M) Message ID(M) Affected SOP Class UID(M) Affected SOP Instance UID(M) Priority(U) Move Originator Application Entity Title(U) Move Originator Message ID(M) Data SetParameters: msg (dimse_messages.C_STORE_RQ) – The C-STORE-RQ message to be sent.
-
static
debug_send_c_store_rsp(msg)[source][source]¶ Debugging function when a C-STORE-RSP is sent.
C-STORE Response Elements
(U) Message ID(M) Message ID Being Responded To(U) Affected SOP Class UID(U) Affected SOP Instance UID(M) StatusParameters: msg (dimse_messages.C_STORE_RSP) – The C-STORE-RSP message to be sent.
-
static
debug_send_n_action_rq(msg)[source][source]¶ Debugging function when an N-ACTION-RQ is sent.
Parameters: msg (dimse_messages.N_ACTION_RQ) – The N-ACTION-RQ message to be sent.
-
static
debug_send_n_action_rsp(msg)[source][source]¶ Debugging function when an N-ACTION-RSP is sent.
Parameters: msg (dimse_messages.N_ACTION_RSP) – The N-ACTION-RSP message to be sent.
-
static
debug_send_n_create_rq(msg)[source][source]¶ Debugging function when an N-CREATE-RQ is sent.
Parameters: msg (dimse_messages.N_CREATE_RQ) – The N-CREATE-RQ message to be sent.
-
static
debug_send_n_create_rsp(msg)[source][source]¶ Debugging function when an N-CREATE-RSP is sent.
Parameters: msg (dimse_messages.N_CREATE_RSP) – The N-CREATE-RSP message to be sent.
-
static
debug_send_n_delete_rq(msg)[source][source]¶ Debugging function when an N-DELETE-RQ is sent.
Parameters: msg (dimse_messages.N_DELETE_RQ) – The N-DELETE-RQ message to be sent.
-
static
debug_send_n_delete_rsp(msg)[source][source]¶ Debugging function when an N-DELETE-RSP is sent.
Parameters: msg (dimse_messages.N_DELETE_RSP) – The N-DELETE-RSP message to be sent.
-
static
debug_send_n_event_report_rq(msg)[source][source]¶ Debugging function when an N-EVENT-REPORT-RQ is sent.
Parameters: msg (dimse_messages.N_EVENT_REPORT_RQ) – The N-EVENT-REPORT-RQ message to be sent.
-
static
debug_send_n_event_report_rsp(msg)[source][source]¶ Debugging function when an N-EVENT-REPORT-RSP is sent.
Parameters: msg (dimse_messages.N_EVENT_REPORT_RSP) – The N-EVENT-REPORT-RSP message to be sent.
-
static
debug_send_n_get_rq(msg)[source][source]¶ Debugging function when an N-GET-RQ is sent.
Parameters: msg (dimse_messages.N_GET_RQ) – The N-GET-RQ message to be sent.
-
static
debug_send_n_get_rsp(msg)[source][source]¶ Debugging function when an N-GET-RSP is sent.
Parameters: msg (dimse_messages.N_GET_RSP) – The N-GET-RSP message to be sent.
-
static
debug_send_n_set_rq(msg)[source][source]¶ Debugging function when an N-SET-RQ is sent.
Parameters: msg (dimse_messages.N_SET_RQ) – The N-SET-RQ message to be sent.
-
static
debug_send_n_set_rsp(msg)[source][source]¶ Debugging function when an N-SET-RSP is sent.
Parameters: msg (dimse_messages.N_SET_RSP) – The N-SET-RSP message to be sent.
-
on_receive_dimse_message(message)[source][source]¶ Controls which debugging function is called when receiving.
Function will be called immediately after receiving and decoding a DIMSE message.
Parameters: message (dimse_messages.DIMSEMessage) – The DIMSE message that was received.
-
on_send_dimse_message(message)[source][source]¶ Controls which debugging function is called when sending.
Will be called immediately prior to encoding and sending a DIMSE message.
Parameters: message (dimse_messages.DIMSEMessage) – The DIMSE message to be sent.
-
receive_msg(wait=False)[source][source]¶ Receive a DIMSE message from the peer.
Set the DIMSE provider in a mode ready to receive a response from the peer
Parameters: wait (bool, optional) – Wait until a response has been received (default: False). Returns: Returns the complete DIMSE message and its presentation context ID or None, None. Return type: dimse_messages.DIMSEMessage, int or None, None
-
send_msg(primitive, context_id)[source][source]¶ 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.