Login  Register

Re: Rephrased FFT Question

Posted by Herbie-3 on Mar 21, 2014; 10:15am
URL: http://imagej.273.s1.nabble.com/Rephrased-FFT-Question-tp5007000p5007028.html

Rebecca,

as others have correctly noted already, the result you are showing
in the graph in principle is sound.

What you show is (most probable) the logarithm of the power spectrum.
The power spectrum of a real-valued signal is always symmetric, so you
may consider only one (the left) half of the resulting spectra.
Furthermore, and as mentioned by James Ewing, the low spectral
amplitudes at frequencies above about 300 will allow you to reduce the
number of slices of the stack by a factor of three to four. Before doing
this subsampling, you are to low-pass filter the stack appropriately.

Of course, the computation of 16384 1D-FFTs is time-consuming and of
course the suggested implementation is suboptimum. Dedicated Java-code
could considerably speed-up the processing.

Best

Herbie

::::::::::::::::::::::::::::::::::::::::
On 21.03.14 02:58, Rebecca Keller wrote:

> Yes, this macro is exactly the right thing, but it is really slow
> even when I make the stack 2^n (4096) images and bin it 4 x 4 x 2.
> (128 x 128 x 2048 total voxels.) I would think it could be much
> faster if implemented right, in java perhaps? I would guess that
> opening all those windows is unnecessary, but I am not sure how to
> *not* open them. But anyway, the results are pretty cool--any idea
> what frequency is represented by each image? Also, it's close to
> symmetrical over time--what's going on there, exactly (see attached)?
> I would think if it were symmetrical it would be largest in the
> center as well, but...
>
> Anyway, thanks for this start--I'll see what can be done,
>
> JPK
>
>
>
>
>
> On Thu, Mar 20, 2014 at 12:01 PM, Brian Northan <[hidden email]>
> wrote:
>
>> Hi Rebecca
>>
>> I am not aware of a simple solution, hopefully someone else knows.
>> But someone had a similar problem a while back and it ended up
>> being a fairly involved discussion.  He had to write some macros.
>>
>>
>> http://imagej.1557.x6.nabble.com/Automating-Image-Processing-and-Problems-with-FFTJ-td5004660.html
>>
>>
>>
As Herbie mentioned FFTJ is not macro-recordable, I have a slightly

>> modified version of FFTJ which is recordable and is available here
>>
>> https://github.com/bnorthan/RogueImageJPlugins/releases
>>
>> It is really just a copy of the original except with the small
>> changes talked about in the other thread.
>>
>> I played around with calling FFTJ on individual points in a time
>> series using a python macro.  I think the logic is right but keep
>> in mind it is a hack and pretty slow.   The proper way to do it
>> would be to perform all calculations in one plugin.   This approach
>> loops through every pixel, copies a time profile to a temp image
>> then runs the plugin over and over.
>>
>>
>> https://github.com/bnorthan/RogueImageJPlugins/blob/master/FFTJ_scriptable/macros/Time_Macro.py
>>
>>
>>
>>
>>
>>
On Thu, Mar 20, 2014 at 6:02 AM, Herbie <[hidden email]> wrote:

>>
>>> Rebecca,
>>>
>>> if you manage to extract 1D-"images" from your time series of
>>> images, i.e. in fact pixel sequences as 1D-images, then you may
>>> use the FFTJ-PlugIn to perform 1D-FFTs of each of these series.
>>>
>>> <http://rsb.info.nih.gov/ij/plugins/fftj.html>
>>>
>>> You may use a macro to extract the n^2 1D-images (assuming that
>>> your images are of size n x n). To make use of the FFT speed
>>> advantage, your stack must consist of m images (time slices),
>>> where m is a power of two.
>>>
>>> The problem with FFTJ is, that it isn't perfectly
>>> macro-recordable. It shows a dialog for choosing the result
>>> format. In other words, to fully automatize processing by an
>>> IJ-macro, you need to modify the source code
>> of
>>> FFTJ.
>>>
>>> HTH
>>>
>>> Herbie
>>>
>>> ::::::::::::::::::::::::::::::::::::::::
>>>
>>> On 20.03.14 02:04, Rebecca Keller wrote:
>>>
>>>> Thanks very much for this reference, but actually it is a bit
>>>> cumbersome to come in and out of imagej, since this "plugin"
>>>> requires ms excel for the fft'ing.
>>>>
>>>> Seems like it should be possible to get the current fft
>>>> algorithm to do a 1D FFT on each pixel over time, then
>>>> re-output the timelapse stack as a 2D image in frequency
>>>> domain. Then it would be neat, for example, to make a 2D image
>>>> depth-coded by frequency. I, however, just need to get the
>>>> pixels which all have the same frequencies, which should be
>>>> easy enough to do using the 1D FFT pixelwise which I
>>>> suggested.
>>>>
>>>> JPK
>>>>
>>>> On Wed, Mar 19, 2014 at 5:18 PM, Eric Denarier <
>>>> [hidden email]> wrote:
>>>>
>>>> Hi Rebecca, You may have a look to Claire Smith's CiliaFA
>>>> macro. It
>>>>> reveals frequencies of intensity variation in different zone
>>>>> of a brightfield image. We are using it for high frequency
>>>>> Cilia beating. here is a link to the paper and macro :
>>>>> http://www.ciliajournal.com/content/1/1/14
>>>>>
>>>>>
>>>>> Rebecca Keller <[hidden email]> a écrit :
>>>>>
>>>>> Dear List,
>>>>>
>>>>>>
>>>>>> Let me rephrase: what I am trying to do is locate
>>>>>> oscillations of a certain frequency onto a 2D visual field,
>>>>>> i.e., convert the third dimension (time) of a time-lapse
>>>>>> image series into frequency space. Then I could scan
>>>>>> through frequency space (the new third dimension) to find
>>>>>> groups of pixels with similar oscillation frequencies.
>>>>>>
>>>>>> So I guess what would need to be done is a 1D FFT for each
>>>>>> pixel. Is there any way easily to do this with the current
>>>>>> imagej tools?
>>>>>>
>>>>>> JPK
>>>>>>
>>>>>> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>>>>
>>>>>>
>>>>> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>>>
>>>>>
>>>> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>>
>>>>
>>> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html