Advice on on-line processing of time series

I’m writing code that accepts a time series of 3D images and want to process it on-line; i.e. as they come in. I’m not seeing this topic discussed so maybe it’s too esoteric or maybe I haven’t found the right keywords.

The basic example is that I want to do things like keep statistics on the last N time points like a moving average and variability measure - say to identify noisy regions. I am about to roll my own using RingBuffer and some N-ary filters. Basically I’m wondering if there is something already out there that I’ve missed. Any advice on pitfalls or best practices would also be appreciated.

That sounds like an esoteric topic. Do you need to keep a ring buffer of images, or only the last N statistics? 3D images are usually big.

Edited because I mis-read your question. In truth, I only need the statistics for the last N (N around 8-10). But I do want statistics at each pixel.

I guess you’re hinting at algorithms to do on-line stats that are updateable? I’m aware of Wedford’s algorithm for mean and variance. But I don’t know how one might update to remove the oldest data as the window slides without storing the oldest image.

What I imagined: compute statistics for image i, put the statistics into the ring buffer (stat[i]), then compute current statistics by using a for loop over stat array and combining stat[0]…stat[i] or stat[i-N]…stat[i]. At i+1, you will combine stat[i+1-N]…stat[i+1] into current statistics.

I found some mention of “video in ITK” from a 2010 meeting: https://www.paraview.org/Wiki/ITK/Fall_v4_2010_Meeting

The slides do describe some of the issues I am facing, and propose a class itk::ImageSet (ImageSequence, ImageBag) that sounds like it could be useful to me. Since I cannot find any such classes in ITK, I’m presuming the proposal did not move forward. I’d be curious to know whether the use cases in the slides were met by other means.

@hjmjohnson might remember.

There is the whole ITKVideo group that I believe came out of that work. It includes a RingBuffer. I have never used the group myself.

1 Like