How do I attach and listen to the OHIF viewer's events? how are the subscribe and unsubscribe event is working in here? Is there any event, callback or promise that I can use after the viewport is rendered or ready to render any series?

How do I attach and listen to the OHIF viewer’s events?
How are the subscribe and unsubscribe event is working in here?
Is there any event, callback or promise that I can use after the viewport is rendered or ready to render any series?

  • I want to render and hydrate segmentation at the very starting of the OHIF viewer if any segmentation exists, whenever I open on segmentation mode. My approach is to look for any event, callback or promise that is being executed after the viewport is ready to be hydrated, and then use that to hydrate segmentation.

  • I want to learn how to use events of OHIF viewer to execute conditional code snippets that are dependent on the states of other attributes of OHIF viewer, how are the subscribe and unsubscribe is working in OHIF viewer.

  • OHIF version v3.8

I would really appreciate if anyone could resolve this problem or even provide me any advice based OHIF viewer and this question.

Services Events are published by services and you can look here in the PubSub doc on how to listen to them

There are some Cornerstone events (segmentation added, modified, etc) that are published on eventTarget in @cornerstone3d/core

And most other rendering related events are published on the viewport’s element