Process module logic's event within displayable node

Hi,

I have a module that invokes custom event MyEvent. I’m looking for a way to catch this event within displayable node.
I can see an option here:

  1. I can invoke the event from the module’s logic but set scene as a caller;
  2. invoke the event from the logic and set the logic as a caller

If I choose the first option than MyEvent enum will be defined in MyLogic.h and the caller will be the scene. I think this is not a good idea.

If I choose the second option then it seems that I will be unable to get module instance from the displayable node and thus I will be unable to addObserver from the node to the logic.

Also there is a third option: from the module logic iterate through all displayable nodes and call the common method (probably ProcessMRMLEvents) and within this method I should process the chosen event. But I think this is also not a best choice.

Is there any recommendation?

In your own custom app you can do it, but in Slicer we don’t let the MRML nodes know about the Logic and the Logic doesn’t know about the GUI. So if you want the displayable node to be notified the Logic would invoke the event on the node or set a value that caused the event to be invoked.

1 Like

Thank you, I will take that into account!