HenriquesLab / NanoPyx

Nanoscopy library for Python (NanoPyx, the successor to NanoJ) - focused on light microscopy and super-resolution imaging
Creative Commons Attribution 4.0 International
63 stars 8 forks source link

Run SRRF in "Realtime" #96

Open beniroquai opened 9 months ago

beniroquai commented 9 months ago

First of all: Great project! Thanks a lot for making all that open-source! I really appreciate that! :-) While screening the code, I had a question: Would it be possible to reconstruct frames using eSRRF while they are flying in? As far as I understood, the code requires a chunk of images, but would it also be possible to provide a "sliding" window and update the result continuously? Did you ever think about that? As of now, I'm not 100% sure how much memory/computational overload the creation of the SRRF object takes - maybe I can ignore it.

Thanks a lot!

brunomsaraiva commented 9 months ago

Hi @beniroquai, currently we don't have that kind of feature. However, as the code currently is implemented the Radial Gradient Convergence (RGC) calculations are done independently of the temporal correlation. In practice this means that you can calculate smaller chunks of RGC and generate temporary results of the temporal correlation. Once you would have RGC calculated for your desired frames, you could perform a rolling average to see the update effect of more frames.

If you're using the python package this would entail calling the run method of the eSRRF class on the smaller chunks, store them and when all of them have been calculated, just concatenate all of the chunks in one single array and perform the temporal correlation of your choice for a static output or a rolling average for the sliding window effect.

In terms of computational overload, as the code stands, if using the GPU, you could lose performance by having multiple writing/reading call into the GPU memory.