Reliable way of tracking active image in viewport

How can I reliably track what image is currently ACTIVE in the viewport? (as in, user has clicked on it and it has a yellow border around it, ready to receive input)

Which OHIF version you are using?

Hello! 4.8.5, I believe.

You can take the index from here

Cheers! Now how do I access an image object knowing the viewport index? i haven’t seen a method for getting a viewport from id. Thank you.

I was able to achieve what I was looking to do by adding an event listener on Cornerstone Element Event: cornerstonetoolsmeasurementadded and accessing the image through event.detail.image

1 Like

Hi @supasus, could you please share the snippet of your code? thanks a lot, i could really use some help! :grin: