pynetdicom.events.trigger

pynetdicom.events.trigger(assoc: Association, event: NotificationEvent | InterventionEvent, attrs: dict[str, Any] | None = None) Any | None[source]

Trigger an event and call any bound handler(s).

Added in version 1.3.

Notification events can be bound to multiple handlers, intervention events can only be bound to a single handler.

Special Attributes

If attrs contains:

  • _is_cancelled key then Event.is_cancelled will be hooked into the value’s callable function.

  • a C-FIND, C-GET or C-MOVE request key then Event.identifier will return the decoded Identifier parameter value.

  • a C-STORE request key then Event.dataset will return the decoded Data Set parameter value.

  • an N-ACTION request key then Event.action_information will return the decoded Action Information parameter value.

  • an N-CREATE request key then Event.attribute_list will return the decoded Attribute List parameter value.

  • an N-EVENT-REPORT request key then Event.event_information will return the decoded Event Information parameter value.

  • an N-SET request key then Event.modification_list will return the decoded Modification List parameter value.

Parameters:
  • assoc (assoc.Association) – The association in which the event occurred.

  • event (events.NotificationEvent or events.InterventionEvent) – The event to trigger.

  • attrs (dict, optional) – The attributes to set in the Event instance that is passed to the event’s corresponding handler functions as {attribute name : value}, default {}.

Raises:

Exception – If an exception occurs in an intervention event handler then the exception will be raised. If an exception occurs in a notification handler then the exception will be caught and logged instead.