pynetdicom.events.Event¶
- 
class pynetdicom.events.Event(assoc, event, attrs=None)[source]¶
- Representation of an event. - New in version 1.3. - Warning - Some of - Event’s attributes are set dynamically when an event is triggered and are available only for a specific event. For example, the- Event.contextattribute is only available for events such as- evt.EVT_C_ECHO,- evt.EVT_C_STORE, etc. See the handler documentation for a list of what attributes are available for a given event.- 
assoc¶
- The association in which the event occurred. 
 - 
event¶
- A - namedtupleinstance representing the event that occurred.
 - 
timestamp¶
- The date/time the event was created. Will be slightly before or after the actual event that this object represents. - Type
 
 - 
__init__(assoc, event, attrs=None)[source]¶
- Create a new Event. - Parameters
- assoc (association.Association) – The association in which the event occurred. 
- event (events.NotificationEvent or events.InterventionEvent) – The representation of the event that occurred. 
- attrs (dict, optional) – The - {attribute : value}pairs to use to set the- Event’s attributes.
 
 
 - Methods - __init__(assoc, event[, attrs])- Create a new Event. - Attributes - Return an N-ACTION request’s Action Information as a pydicom - Dataset.- Return an N-ACTION request’s Action Type ID as an - int.- Return an N-GET request’s Attribute Identifier List as a - listof pydicom- BaseTag.- Return an N-CREATE request’s Attribute List as a pydicom - Dataset.- Return a C-STORE request’s Data Set as a pydicom - Dataset.- Return the corresponding event. - Return an N-EVENT-REPORT request’s Event Information as a pydicom - Dataset.- Return an N-EVENT-REPORT request’s Event Type ID as an - int.- Return a pydicom - Datasetwith the File Meta Information for a C-STORE request’s Data Set.- Return a C-FIND, C-GET or C-MOVE request’s Identifier as a pydicom - Dataset.- Return - Trueif a C-CANCEL request has been received.- Return a DIMSE service request’s Message ID as - int.- Return an N-SET request’s Modification List as a pydicom - Dataset.- Return a C-MOVE request’s Move Destination as - bytes.- 
property action_information¶
- Return an N-ACTION request’s Action Information as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Action Information dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-ACTION request. 
 
 - 
property action_type¶
- Return an N-ACTION request’s Action Type ID as an - int.- New in version 1.4. - Returns
- The request’s (0000,1008) Action Type ID value. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-ACTION request. 
 
 - 
property attribute_identifiers¶
- Return an N-GET request’s Attribute Identifier List as a - listof pydicom- BaseTag.- Returns
- The (0000,1005) Attribute Identifier List tags, may be an empty list if no Attribute Identifier List was included in the C-GET request. 
- Return type
- list of pydicom.tag.BaseTag 
- Raises
- AttributeError – If the corresponding event is not an N-GET request. 
 
 - 
property attribute_list¶
- Return an N-CREATE request’s Attribute List as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Attribute List dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-CREATE request. 
 
 - 
property dataset¶
- Return a C-STORE request’s Data Set as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Data Set dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not a C-STORE request. 
 
 - 
property event¶
- Return the corresponding event. - New in version 1.4. - Returns
- The corresponding event as a - namedtuple.
- Return type
 
 - 
property event_information¶
- Return an N-EVENT-REPORT request’s Event Information as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Event Information dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-EVENT-REPORT request. 
 
 - 
property event_type¶
- Return an N-EVENT-REPORT request’s Event Type ID as an - int.- New in version 1.4. - Returns
- The request’s (0000,1002) Event Type ID value. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-EVENT-REPORT request. 
 
 - 
property file_meta¶
- Return a pydicom - Datasetwith the File Meta Information for a C-STORE request’s Data Set.- Contains the following File Meta Information elements: - (0002,0000) File Meta Information Group Length - set as - 0, will be updated with the correct value during write
- (0002,0001) File Meta Information Version - set as - 0x0001
- (0002,0002) Media Storage SOP Class UID - set from the request’s Affected SOP Class UID 
- (0002,0003) Media Storage SOP Instance UID - set from the request’s Affected SOP Instance UID 
- (0002,0010) Transfer Syntax UID - set from the presentation context used to transfer the Data Set 
- (0002,0012) Implementation Class UID - set using - PYNETDICOM_IMPLEMENTATION_UID
- (0002,0013) Implementation Version Name - set using - PYNETDICOM_IMPLEMENTATION_VERSION
 - Examples - Add the File Meta Information to the decoded Data Set and save it to the DICOM File Format. - >>> ds = event.dataset >>> ds.file_meta = event.file_meta >>> ds.save_as('example.dcm', write_like_original=False) - Encode the File Meta Information in a new file and append the encoded Data Set to it. This skips having to decode/re-encode the Data Set as in the previous example. - >>> from pydicom.filewriter import write_file_meta_info >>> with open('example.dcm', 'wb') as f: ... f.write(b'\x00' * 128) ... f.write(b'DICM') ... write_file_meta_info(f, event.file_meta) ... f.write(event.request.DataSet.getvalue()) - Returns
- The File Meta Information suitable for use with the decoded C-STORE request’s Data Set. 
- Return type
- Raises
- AttributeError – If the corresponding event is not a C-STORE request. 
 
 - 
property identifier¶
- Return a C-FIND, C-GET or C-MOVE request’s Identifier as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Identifier dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not a C-FIND, C-GET or C-MOVE request. 
 
 - 
property is_cancelled¶
- Return - Trueif a C-CANCEL request has been received.- Returns
- If this event corresponds to a C-FIND, C-GET or C-MOVE request being received by a Service Class then returns - Trueif a C-CANCEL request with a Message ID Being Responded To parameter value corresponding to the Message ID of the service request has been received. If no such C-CANCEL request has been received or if the event is not a C-FIND, C-GET or C-MOVE request then returns- False.
- Return type
 
 - 
property message_id¶
- Return a DIMSE service request’s Message ID as - int.- New in version 1.5. - Returns
- The request’s (0000,0110) Message ID value. 
- Return type
- Raises
- AttributeError – If the corresponding event is not one of the DIMSE service requests. 
 
 - 
property modification_list¶
- Return an N-SET request’s Modification List as a pydicom - Dataset.- Because pydicom defers data parsing during decoding until an element is actually required the returned - Datasetmay raise an exception when any element is first accessed. It’s therefore important that proper error handling be part of any handler that uses the returned- Dataset.- Returns
- The decoded Modification List dataset. 
- Return type
- Raises
- AttributeError – If the corresponding event is not an N-SET request. 
 
 - 
property move_destination¶
- Return a C-MOVE request’s Move Destination as - bytes.- New in version 1.4. - Returns
- The request’s (0000,0600) Move Destination value as length 16 bytes (including trailing spaces as padding if required). 
- Return type
- Raises
- AttributeError – If the corresponding event is not a C-MOVE request. 
 
 
-