Generating 1-d power spectrum from 2-d power spectrum

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating 1-d power spectrum from 2-d power spectrum

Aaron Hendrickson
Hi Everyone,

I am doing some work with analyzing the power spectra of greyscale images.
 The 2-d power spectra are generated using the FFTJ plugin.  What I would
like to do is convert the 2-d power spectra to 1-d by calculating the
average power in specified bands of frequencies.  For example,  I would
like to be able to calculate the average power from the power spectra in
bands of 1/64 cycles/pixel (i.e. the average power within the boundaries of
two concentric circles (centered at the origin) with a difference in radius
of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ website
that can do this?

Thanks,
Aaron.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Generating 1-d power spectrum from 2-d power spectrum

Michael Schmid
Hi Aaron,

you can use the radial profile plot plugin,
  http://rsb.info.nih.gov/ij/plugins/radial-profile.html
You can extract the data from the plot.

By the way, you can also get the 2D power spectrum without an external plugin, using the FFT Options.

Michael
________________________________________________________________
On Oct 25, 2012, at 13:45, Aaron Hendrickson wrote:

> Hi Everyone,
>
> I am doing some work with analyzing the power spectra of greyscale images.
> The 2-d power spectra are generated using the FFTJ plugin.  What I would
> like to do is convert the 2-d power spectra to 1-d by calculating the
> average power in specified bands of frequencies.  For example,  I would
> like to be able to calculate the average power from the power spectra in
> bands of 1/64 cycles/pixel (i.e. the average power within the boundaries of
> two concentric circles (centered at the origin) with a difference in radius
> of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ website
> that can do this?
>
> Thanks,
> Aaron.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Generating 1-d power spectrum from 2-d power spectrum

Aaron Hendrickson
OK thank you Michael.  What I don't understand is when I create a raw power
spectrum of my image with FFTJ and also generate one directly through
ImageJ (raw power spectrum, I get two different power spectrums of
different size and with drastically different pixel values.  I don't
understand why I dont get the same result with both methods.

On Thu, Oct 25, 2012 at 8:46 AM, Michael Schmid <[hidden email]>wrote:

> Hi Aaron,
>
> you can use the radial profile plot plugin,
>   http://rsb.info.nih.gov/ij/plugins/radial-profile.html
> You can extract the data from the plot.
>
> By the way, you can also get the 2D power spectrum without an external
> plugin, using the FFT Options.
>
> Michael
> ________________________________________________________________
> On Oct 25, 2012, at 13:45, Aaron Hendrickson wrote:
>
> > Hi Everyone,
> >
> > I am doing some work with analyzing the power spectra of greyscale
> images.
> > The 2-d power spectra are generated using the FFTJ plugin.  What I would
> > like to do is convert the 2-d power spectra to 1-d by calculating the
> > average power in specified bands of frequencies.  For example,  I would
> > like to be able to calculate the average power from the power spectra in
> > bands of 1/64 cycles/pixel (i.e. the average power within the boundaries
> of
> > two concentric circles (centered at the origin) with a difference in
> radius
> > of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ
> website
> > that can do this?
> >
> > Thanks,
> > Aaron.
> >
> > --
> > 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating 1-d power spectrum from 2-d power spectrum

Herbie-2
Aaron,

I'm sure the support sizes won't differ.

The thing with the values is a question of convention and there are
several possibilities.

Personally, I prefer to see the DC-value of the spectrum to equal the
image mean.

The mentioned plugins use different conventions but this is easy to
correct post hoc.

HTH

Herbie
________________
On 25.10.12 17:05, Aaron Hendrickson wrote:

> OK thank you Michael.  What I don't understand is when I create a raw power
> spectrum of my image with FFTJ and also generate one directly through
> ImageJ (raw power spectrum, I get two different power spectrums of
> different size and with drastically different pixel values.  I don't
> understand why I dont get the same result with both methods.
>
> On Thu, Oct 25, 2012 at 8:46 AM, Michael Schmid<[hidden email]>wrote:
>
>> Hi Aaron,
>>
>> you can use the radial profile plot plugin,
>>    http://rsb.info.nih.gov/ij/plugins/radial-profile.html
>> You can extract the data from the plot.
>>
>> By the way, you can also get the 2D power spectrum without an external
>> plugin, using the FFT Options.
>>
>> Michael
>> ________________________________________________________________
>> On Oct 25, 2012, at 13:45, Aaron Hendrickson wrote:
>>
>>> Hi Everyone,
>>>
>>> I am doing some work with analyzing the power spectra of greyscale
>> images.
>>> The 2-d power spectra are generated using the FFTJ plugin.  What I would
>>> like to do is convert the 2-d power spectra to 1-d by calculating the
>>> average power in specified bands of frequencies.  For example,  I would
>>> like to be able to calculate the average power from the power spectra in
>>> bands of 1/64 cycles/pixel (i.e. the average power within the boundaries
>> of
>>> two concentric circles (centered at the origin) with a difference in
>> radius
>>> of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ
>> website
>>> that can do this?
>>>
>>> Thanks,
>>> Aaron.
>>>
>>> --
>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating 1-d power spectrum from 2-d power spectrum

Michael Schmid
In reply to this post by Aaron Hendrickson
Hi Aaron,

concerning the pixel values, there are different ways to normalize a power spectrum. Usually no one cares about the absolute values. ImageJ gives the same result as FFTJ except for a factor that is the square of the number of pixels (I have tested it: agreement is within the computational accuracy of maybe 5 digits.)

ImageJ always uses square images where the width and height is a power of 2; FFTJ does a Fourier transform (though not a fast one) also with other sizes.
If your images have periodic boundary conditions (if one could tile them without seeing the borders), for ImageJ you should enlarge them to the next power of 2 (use bicubic interpolation). If you have no periodic boundary conditions, and the borders have the same pixel value everywhere, the canvas size should be expanded, with the pixel value used for the border. Otherwise (and this is the usual case), one should usually do some 'soft' padding that does not add additional high-frequency components caused by the sharp borders:
In FFTJ, with no padding, the image is treated as having periodic boundary conditions, i.e., the border between the image and its periodic repetition will have sharp transitions that appear as high-frequency signal in the FFT.
In ImageJ, if the image is not square with a size of 2^n, it is padded to a 2^n-square with a constant that is equal to the mean pixel value. Also this causes sharp transitions between the image and the border. In case of a 2^n-square (e.g. 256x256 pixels), it's the same as FFTJ.

Michael
________________________________________________________________
On Oct 25, 2012, at 17:05, Aaron Hendrickson wrote:

> OK thank you Michael.  What I don't understand is when I create a raw power
> spectrum of my image with FFTJ and also generate one directly through
> ImageJ (raw power spectrum, I get two different power spectrums of
> different size and with drastically different pixel values.  I don't
> understand why I dont get the same result with both methods.
>
> On Thu, Oct 25, 2012 at 8:46 AM, Michael Schmid <[hidden email]>wrote:
>
>> Hi Aaron,
>>
>> you can use the radial profile plot plugin,
>>  http://rsb.info.nih.gov/ij/plugins/radial-profile.html
>> You can extract the data from the plot.
>>
>> By the way, you can also get the 2D power spectrum without an external
>> plugin, using the FFT Options.
>>
>> Michael
>> ________________________________________________________________
>> On Oct 25, 2012, at 13:45, Aaron Hendrickson wrote:
>>
>>> Hi Everyone,
>>>
>>> I am doing some work with analyzing the power spectra of greyscale
>> images.
>>> The 2-d power spectra are generated using the FFTJ plugin.  What I would
>>> like to do is convert the 2-d power spectra to 1-d by calculating the
>>> average power in specified bands of frequencies.  For example,  I would
>>> like to be able to calculate the average power from the power spectra in
>>> bands of 1/64 cycles/pixel (i.e. the average power within the boundaries
>> of
>>> two concentric circles (centered at the origin) with a difference in
>> radius
>>> of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ
>> website
>>> that can do this?
>>>
>>> Thanks,
>>> Aaron.
>>>
>>> --
>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating 1-d power spectrum from 2-d power spectrum

Herbie-2
Thanks Michael,

for being more precise and correct with the details.

(I forgot that FFTJ not only performs FFTs but also plain (and slow)
DFTs. Furthermore, I didn't refer to power spectra but to the modulus of
the amplitude spectra that in my opinion should be used instead. Power
spectra sometimes have a physical meaning but no meaning that I know of
in image processing.)

Best

Herbie
_______________________________________
On 25.10.12 17:29, Michael Schmid wrote:

> Hi Aaron,
>
> concerning the pixel values, there are different ways to normalize a power spectrum. Usually no one cares about the absolute values. ImageJ gives the same result as FFTJ except for a factor that is the square of the number of pixels (I have tested it: agreement is within the computational accuracy of maybe 5 digits.)
>
> ImageJ always uses square images where the width and height is a power of 2; FFTJ does a Fourier transform (though not a fast one) also with other sizes.
> If your images have periodic boundary conditions (if one could tile them without seeing the borders), for ImageJ you should enlarge them to the next power of 2 (use bicubic interpolation). If you have no periodic boundary conditions, and the borders have the same pixel value everywhere, the canvas size should be expanded, with the pixel value used for the border. Otherwise (and this is the usual case), one should usually do some 'soft' padding that does not add additional high-frequency components caused by the sharp borders:
> In FFTJ, with no padding, the image is treated as having periodic boundary conditions, i.e., the border between the image and its periodic repetition will have sharp transitions that appear as high-frequency signal in the FFT.
> In ImageJ, if the image is not square with a size of 2^n, it is padded to a 2^n-square with a constant that is equal to the mean pixel value. Also this causes sharp transitions between the image and the border. In case of a 2^n-square (e.g. 256x256 pixels), it's the same as FFTJ.
>
> Michael
> ________________________________________________________________
> On Oct 25, 2012, at 17:05, Aaron Hendrickson wrote:
>
>> OK thank you Michael.  What I don't understand is when I create a raw power
>> spectrum of my image with FFTJ and also generate one directly through
>> ImageJ (raw power spectrum, I get two different power spectrums of
>> different size and with drastically different pixel values.  I don't
>> understand why I dont get the same result with both methods.
>>
>> On Thu, Oct 25, 2012 at 8:46 AM, Michael Schmid<[hidden email]>wrote:
>>
>>> Hi Aaron,
>>>
>>> you can use the radial profile plot plugin,
>>>   http://rsb.info.nih.gov/ij/plugins/radial-profile.html
>>> You can extract the data from the plot.
>>>
>>> By the way, you can also get the 2D power spectrum without an external
>>> plugin, using the FFT Options.
>>>
>>> Michael
>>> ________________________________________________________________
>>> On Oct 25, 2012, at 13:45, Aaron Hendrickson wrote:
>>>
>>>> Hi Everyone,
>>>>
>>>> I am doing some work with analyzing the power spectra of greyscale
>>> images.
>>>> The 2-d power spectra are generated using the FFTJ plugin.  What I would
>>>> like to do is convert the 2-d power spectra to 1-d by calculating the
>>>> average power in specified bands of frequencies.  For example,  I would
>>>> like to be able to calculate the average power from the power spectra in
>>>> bands of 1/64 cycles/pixel (i.e. the average power within the boundaries
>>> of
>>>> two concentric circles (centered at the origin) with a difference in
>>> radius
>>>> of 1/64 cylces/pixel).  Is there any existing plugins on the imageJ
>>> website
>>>> that can do this?
>>>>
>>>> Thanks,
>>>> Aaron.
>>>>
>>>> --
>>>> 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