pynetdicom.events.Event¶
-
class
pynetdicom.events.
Event
(assoc, event, attrs=None)¶ Representation of an event.
-
assoc
¶ The association in which the event occurred.
-
event
¶ A
collections.namedtuple
instance representing the event that occurred.- Type
events.InterventionEvent or events.NotificationEvent
-
timestamp
¶ The date/time the event was created. Will be slightly before or after the actual event that this object represents.
- Type
datetime.datetime
-
__init__
(assoc, event, attrs=None)¶ 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 list of pydicom Tags.
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 Dataset with 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 True if a C-CANCEL request has been received.
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
Dataset
may 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 returnedDataset
.- Returns
The decoded Action Information dataset.
- Return type
pydicom.dataset.Dataset
- 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.
- Returns
The request’s (0000,1008) Action Type ID value.
- Return type
int
- 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 list of pydicom Tags.
- 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.Tag
- 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
Dataset
may 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 returnedDataset
.- Returns
The decoded Attribute List dataset.
- Return type
pydicom.dataset.Dataset
- 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
Dataset
may 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 returnedDataset
.- Returns
The decoded Data Set dataset.
- Return type
pydicom.dataset.Dataset
- Raises
AttributeError – If the corresponding event is not a C-STORE request.
-
property
event
Return the corresponding event.
- Returns
The corresponding event as a
collections.namedtuple
.- Return type
events.InterventionEvent or events.NotificationEvent
-
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
Dataset
may 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 returnedDataset
.- Returns
The decoded Event Information dataset.
- Return type
pydicom.dataset.Dataset
- 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.
- Returns
The request’s (0000,1002) Event Type ID value.
- Return type
int
- Raises
AttributeError – If the corresponding event is not an N-EVENT-REPORT request.
-
property
file_meta
¶ Return a pydicom Dataset with the File Meta Information for a C-STORE request’s Data Set.
Contains the following File Meta Information elements:
(0002,0002) Media Storage SOP Class UID
(0002,0003) Media Storage SOP Instance UID
(0002,0010) Transfer Syntax UID
(0002,0012) Implementation Class UID
(0002,0013) Implementation Version Name
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')
- Returns
The File Meta Information suitable for use with the decoded C-STORE request’s Data Set.
- Return type
pydicom.dataset.Dataset
- 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
Dataset
may 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 returnedDataset
.- Returns
The decoded Identifier dataset.
- Return type
pydicom.dataset.Dataset
- Raises
AttributeError – If the corresponding event is not a C-FIND, C-GET or C-MOVE request.
-
property
is_cancelled
¶ Return True if 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 True if 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
bool
-
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
Dataset
may 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 returnedDataset
.- Returns
The decoded Modification List dataset.
- Return type
pydicom.dataset.Dataset
- 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.
- Returns
The request’s (0000,0600) Move Destination value as length 16 bytes (including trailing spaces as padding if required).
- Return type
bytes
- Raises
AttributeError – If the corresponding event is not a C-MOVE request.
-