http://imagej.273.s1.nabble.com/Rephrased-FFT-Question-tp5007000p5007026.html
Hi Rebecca - What you’re looking at is a spectrum that runs from 0 to the highest frequency you can sample. The high-frequency points are aliasing in - they are actually negative frequency points (points with a negative phase shift). You can employ various tricks to center the 0 frequency in the middle of the plot (modulation is straightforward - multiply every other image by -1), but the easiest thing to do is to right-shift (or left-shift, same thing) N/2 points, wrapping your high frequency points into the negative points. Then, instead of IIIlliii…….iiilllIII, you get …..iiillIIIIllii…… I hope this makes sense.
I’m not clear about what the ‘fft’ plugin actually does. Usually, fast fourier (finite) transforms are performed on complex data. All your data is real, so you should be able to gain a factor of 2 in speed if the algorithm is correct. See the Wikipedia page on FFTs.
Now, judging by your spectrum, you have vastly oversampled the data. Unless there is something interesting in the “grass" of your spectrum, you should be able to down-sample to 1024 without a loss of information and a substantial (factor of more than 4) gain in speed. I’d recommend actually summing every 4 images and then doing the FFT. That will give you a gain in signal-to-noise.
Now -about the spectrum - your low-frequency points are just related to the average intensity of the pixel you’re sampling. Not very interesting. You can apodize in the frequency domain and do a back-FFT to see what the higher frequency points are doing, but that’s kind of clunky. Probably the easiest thing to do would be to run a high-pass filter (in the time direction) over your data before the transform. That might actually reveal more of the behavior of the system you are studying than an FFT-apodize-backFFT. If you run a band-pass filter in the time direction, you can pick out the parts of the image that are moving in a particular frequency band.
I hope this helps.
> 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> <whole_stack_FFT.png>