Login  Register

Re: Fourier transform and filtering

Posted by Michael Schmid on Oct 29, 2008; 5:07pm
URL: http://imagej.273.s1.nabble.com/Fourier-transform-and-filtering-tp3694627p3694628.html

Hi Antonio,

there are quite a few differences between "bandpass filter" and  
selecting frequencies in the Fourier domain or "custom filter":

First, it is very important to note that the values (in pixels) in  
"Bandpass filter" are *half* of the spatial frequencies that you can  
read from the status line when moving the cursor over the FFT image.
That's because "structure size" means size of, e.g., a bright  
particle; and the lowest strong Fourier component is that where the  
upper half-cycle of the sinewave corresponds to the particle, the  
negative "surrounding" correspond to the background.

Just in case this is not clear: The values in pixels in "bandpass  
filters" are in real space, i.e., pixels of the image. The scale of  
the custom filter is in frequency space. 1 pixel from the origin  
(center) corresponds to one period per image size, 2 pixels from the  
origin corresponds to two cycles per image size, etc. For images that  
are not 2^n*2^n, "image size" here means the lowest value of 2^n that  
is not smaller than width and height.

If you run "FFT" or "Custom Filter" you will get edge artifacts,  
usually visible in the power spectrum as horizontal and vertical  
lines through the origin (center). The bandpass filter in ImageJ  
continues the image outside the image area with its mirrored  
counterpart to avoid any jumps at the edges, greatly reducing such  
artifacts.
When selecting "Display Filter" of the bandpass filter, with image  
sizes of 2^n or somewhat smaller, you will also see that the filter  
size (equal to the size of the input image) is 2*2^n, due to the  
space needed for the mirrored-image continuation. In this case, you  
have to downscale the filter created by "Display Filter" by a factor  
of 2 before using it as a custom filter.

"Bandpass filter" uses very soft cutoff. You will see this when  
selecting "Display Filter". If the lower and higher cut-off frequency  
are not very different (by factor of, say, 5 or more), even  
frequencies in the center of the band will be noticeably attenuated.

"Bandpass filter" passes spatial frequency 0 unattanuated, i.e., it  
does not change the average gray level of an image.

Hope this helps,

Michael
________________________________________________________________

On 29 Oct 2008, at 13:24, Antonio wrote:

> Hi, I'm recently working with the options "FFT->custom filter" of  
> ImageJ.
>
> My goal is to extract from an image only a selected spatial  
> frequency, then
> transform the image again to obtain the real space distribution of  
> that
> frequency. As custom filters, I use rings of the radius of interest  
> and 2-5
> pixels large.
> But if I execute the command "custom filter", I don't obtain back  
> the same
> image I would by manually perform the filtering. That's to say: I  
> transform
> an image, then overlay the filter (with "image processor->AND"), then
> transform again the result. The final image is totally different  
> from what I
> get with built-in filtering.
>
> Is not clear to me whence this difference should arise, as the "AND"
> operator between the filter and the transformed image is actually  
> like a
> multiplication for a step-function (or square wave) in the  
> frequency domain,
> that's to say a convolution in real space.
> I guess there's some other operations or normalization ImgeJ  
> performs while
> filtering, and I'd need to know some more details about that, to  
> know how to
> interpret my result.
>
> Thanks