Login  Register

Re: Frequency Filtering in Time Dimension?

Posted by Herbie on Nov 01, 2018; 12:56pm
URL: http://imagej.273.s1.nabble.com/Frequency-Filtering-in-Time-Dimension-tp5021367p5021387.html

Good day Jacob,

Butterworth or Bessel filters are filters that play a significant role
if the filters have to be implemented electronically as *causal* filters
for real-time processing of temporal signals.

For this purpose, Gaussian or hard-limiting filters are difficult to
realize electronically. Not so for the processing of static signals such
as images that are per se a-causal. Hard-limiting low-pass filters are
easy to implement in the Fourier-domain (Just limit the Fourier-spectral
extent) for a-causal signals and you can do this with ImageJ.

Because here and with ImageJ we deal with images, filter-characteristics
that are typical for the processing of causal time-signals don't play a
role and I don't think that they are or will be implemented for use with
ImageJ.

Regards

Herbie
______

PS:
Th mathematical proof that a Gaussian is a so-called Fourier-pair,
i.e.the fact that a Gaussian corresponds to a Gaussian by
Fourier-transformation, is quite involved.

::::::::::::::::::::::::::::::::::::::::::
Am 31.10.18 um 17:32 schrieb Jacob Keller:

> Thanks Michael--this is really clear and helpful! I checked out some Bode
> plots of various filters, and it seems Gaussian is pretty non-brick wall. I
> wonder whether a Butterworth or Bessel filter has been implemented?
>
> JPK
>
> On Wed, Oct 31, 2018 at 7:36 AM Michael Schmid <[hidden email]>
> wrote:
>
>> Hi Jacob,
>>
>> when you are doing a Gaussian Blur, in the Fourier domain it corresponds
>> to multiplying the amplitudes with a Gaussian as well.
>>
>> A Gaussian
>>      exp(-pi * x²/a²)
>> in real space corresponds to
>>      exp(-pi * f² * a²)
>> in Fourier space
>>
>> If you want to attenuate a frequency component f1 by a factor 1/e =
>> 0.37, you thus need a² = 1/(pi f1²), i.e. exp (pi² * f1² * x²)
>>
>> In terms of sigma, a Gaussian is given by
>>     exp(-x²/(2*sigma²))
>>
>> Thus, attenuation by a factor of 1/e at f1 corresponds to
>>     sigma = 1/(pi * f1 * sqrt(2))
>>
>>
>> You can easily check it with the following macro:
>>
>> period = 16;  // between about 10 and 100
>>                 // best accuracy with powers of 2
>> f=1/period;   // spatial frequency
>> newImage("Untitled", "32-bit white", 256, 256, 1);
>> run("Macro...", "code=v=sin(2*PI*x*"+f+")");  //create sine wave
>> sigma = 1/(PI*f*sqrt(2));
>> run("Gaussian Blur...", "sigma="+sigma);
>> run("Set Measurements...", "min display redirect=None decimal=4");
>> makeRectangle(25, 0, 200, 256);
>> run("Measure");
>>
>>
>> You will see that the maxima and minima of the sine wave (which has had
>> an original amplitude of 1) gets attenuated to an amplitude of about 0.37.
>>
>> If you take sigma = 1/(pi * f1) you will get an attenuation factor of
>> 1/e² = 0.13 at the frequency f1.
>>
>> So far an excursion into the math of Gaussians and their Fourier
>> transform...
>>
>>
>> Michael
>> ________________________________________________________________
>> On 30.10.18 16:23, Jacob Keller wrote:
>>   >>
>>   >> do you have simply a 1D data set or an image stack, with slices for
>>   >> different times?
>>   >>
>>   >
>>   > The latter--image stack, one plane over time.
>>   >
>>   > - In the second case, you can use Process>Filters>Gaussian Blur 3D and
>>   >> specify the x and y sigma as zero.
>>   >> For high-pass filtering, you would have to duplicate the stack first
>> and
>>   >> then subtract the filtered image.
>>   >>
>>   >
>>   > Ah, this is a great idea--I will try it out. How can I figure out the
>>   > relationship between sigma and the desired frequency cutoff? For
>> example,
>>   > let's say the stack has 120 frames per period--what sigma value should
>> be
>>   > input?
>>   >
>>   > Thanks very much for these suggestions--I think they are going to be
>>   > very helpful,
>>   >
>>   > Jacob
>>   >
>>   > If you rather want moving averages or a median, you can reslice the
>>   >> stack (Image>Stacks>Reslice) to have the time direction in x or y and
>>   >> apply the 'Fast Filters' plugin, which can do 1D filtering. Then
>> Reslice
>>   >> to make time the z axis again.
>>   >> The 'Fast Filters' plugin also has an option to subtract the filtered
>>   >> image (i.e., highpass operation)
>>   >>
>>   >>
>>   >> Michael
>>   >> ________________________________________________________________
>>   >> On 29.10.18 20:51, Jacob Keller wrote:
>>   >>> Hi All,
>>   >>>
>>   >>> is there a way to do high-pass/low-pass filtering in the time
>> dimension?
>>   >> Or
>>   >>> a suggestion for a workaround?
>>   >>>
>>   >>> All the best,
>>   >>>
>>   >>> Jacob Keller
>>   >>
>>   >> --
>>   >> 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