# Measure cilia beating frequency

Hello,

We would like to quantify the beating frequency of cilia in images like this:

I have already some code in ImageJ that would probably allow to do this:

But I was wondering whether other people also have some code? Maybe to share efforts and experiences…

Thanks!

I have done something similar for Marko a couple of years back. However, the repo contains users’ data so I can’t share it here as is (needs some cleaning up). Will send you an email.

Edited to add: that this was mainly based on the `scipy.signal.periodogram` function (so not in the ImageJ ecosystem).

1 Like

Naively I’d have chosen a kymograph-based approach such as:

• Draw a line at the “edge” of the cilia:

• Image > Stacks > Reslice… without interpolation:

• Analyze > Plot Profile on a line in the region of interest:

… which gives me a periodicity of roughly 35 frames as a “quick and dirty” guess.

4 Likes

@Christian_Tischer didn’t tag his post #imagej, so I guess he was explicitly open for solutions in any software ecosystem, right?

1 Like

Yes, this is correct, e.g. a python notebook solution would also be interesting.

Maybe all you need is just one more step of FFT to make it clean ?

2 Likes

Regarding a Java based solution, does someone know examples where this code is already being used?
@imagejan

AFAICT, the `fft` ops (implemented by @bnorthan mostly) are using this code:

The ops tutorials on FFT are still incomplete, but @gselzer is working on them, I think.

1 Like

Nice! Do you happen to know whether it also works on 1D data? As imglib2 is N-dimensional it should, or?

Let’s just try it (in Groovy):

``````#@ Img input
#@ OpService ops

histogram = ops.run("histogram", input)
fft = ops.run("fft", histogram)
println fft.firstElement()
``````

On the Blobs sample image, this gives:

``````(65024.0) + (0.0)i
``````

… which means it worked technically. Of course running FFT on the histogram might not make much sense here, but I was taking `net.imglib2.histogram.Histogram1d` as a simple example of a 1D `Img`.

1 Like

There is an example showing use of imagej-ops FFT in the script editor under “Templates->Tutorials->Find Template.py”. The only weird thing is that it no longer runs as is, and you have to change the last two input from `ImgPlus` to `Dataset`.

It might be useful because it shows how to visualize the real and complex parts of the FFT and use it to find a template. It’s based on a previously existing imglib2 tutorial.

2 Likes

Thanks for pointing to the template!

For me, it was running fine as is in an up-to-date Fiji (after running the Crop Confocal Series tutorial first).

1 Like