Hi Felix,
This is a good and didatic question! Yes, it is possible. You can use TriggeredWindow to split your continuous sequence of frames into chunks beginning and ending on the ROI activity changes (or any other event really). You can then use Index to count the frames inside each sequence (using a SelectMany node group).
I've put together a simple example where the reset event is a key press, but you can replace it with any other event you want:
Inside SelectMany:
If you visualize the output index you should notice it resets every time you hit a key.
Hope this helps.