FFT and Inverse FFT problem for an Electron Microscope Image

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

FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
I would be so grateful for any direction to this problem I have encountered with Image J please.

I am using OS X 10.10.3 and Image J 1.50 a.

If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.

However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .

I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.

Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?

Thank you for your help.

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

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Michael Schmid
Hi Mark,

this is a restriction of the way how FFTs are handled in ImageJ.

What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.

If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.

If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.

To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.

Michael
________________________________________________________________
On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:

> I would be so grateful for any direction to this problem I have encountered with Image J please.
>
> I am using OS X 10.10.3 and Image J 1.50 a.
>
> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>
> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>
> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>
> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>
> Thank you for your help.
>
> --
> 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: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
Hi Michael,

I am so grateful for your detailed reply and the time you have taken with this.

Can you suggest another  way in Image J (which does not sound possible based on your reply)   or alternative  program for saving the FFT so I could transform it back please (apologies since this is an Image J only board )?

This would be a great help to me .

Thank you  in advance.

Mark

> On 6 Aug 2015, at 08:48, Michael Schmid <[hidden email]> wrote:
>
> Hi Mark,
>
> this is a restriction of the way how FFTs are handled in ImageJ.
>
> What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.
>
> If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.
>
> If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.
>
> To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.
>
> Michael
> ________________________________________________________________
> On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:
>
>> I would be so grateful for any direction to this problem I have encountered with Image J please.
>>
>> I am using OS X 10.10.3 and Image J 1.50 a.
>>
>> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>>
>> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>>
>> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>>
>> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>>
>> Thank you for your help.
>>
>> --
>> 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: FFT and Inverse FFT problem for an Electron Microscope Image

Michael Schmid
Hi Mark,

if you have a program (other than ImageJ) that can do a back transform, for sure it can also to the forward transform, so why not open the input image and do the FFT in that program?

Otherwise, in the FFT options you can select 'Complex Fourier Transform'. These data include all the information, so in principle you could transform them back. Then you just need a program that can read 32-bit float tiffs (or 32-bit raw data) and do the inverse transform based on the complex amplitudes. You might need to swap quadrants if the external program wants to have the origin in the corner, not the center.

Michael
________________________________________________________________
On Aug 6, 2015, at 10:15, Rosenberg, Mark F wrote:

> Hi Michael,
>
> I am so grateful for your detailed reply and the time you have taken with this.
>
> Can you suggest another  way in Image J (which does not sound possible based on your reply)   or alternative  program for saving the FFT so I could transform it back please (apologies since this is an Image J only board )?
>
> This would be a great help to me .
>
> Thank you  in advance.
>
> Mark
>> On 6 Aug 2015, at 08:48, Michael Schmid <[hidden email]> wrote:
>>
>> Hi Mark,
>>
>> this is a restriction of the way how FFTs are handled in ImageJ.
>>
>> What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.
>>
>> If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.
>>
>> If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.
>>
>> To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.
>>
>> Michael
>> ________________________________________________________________
>> On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:
>>
>>> I would be so grateful for any direction to this problem I have encountered with Image J please.
>>>
>>> I am using OS X 10.10.3 and Image J 1.50 a.
>>>
>>> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>>>
>>> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>>>
>>> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>>>
>>> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>>>
>>> Thank you for your help.
>>>
>>> --
>>> 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: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
Hi Michael,
I am excited by your reply. Thank you for that great information.
Can you suggest another program that can do a forward transform ?  I tried Image Magick but I am struggling to install it but I could persevere !
Thanks to your advice I tried the “Complex Fourier Transform” in ImageJ which worked. However, I found I do need to swap the quadrants as you suggest. Can you suggest how I might achieve this please ? Also is there a way of saving the information in 16 bit as the subsequent program only seems to read this.
I really feel I have progressed thanks to your help.
Thank you once again.
Mark


> On 6 Aug 2015, at 10:29, Michael Schmid <[hidden email]> wrote:
>
> Hi Mark,
>
> if you have a program (other than ImageJ) that can do a back transform, for sure it can also to the forward transform, so why not open the input image and do the FFT in that program?
>
> Otherwise, in the FFT options you can select 'Complex Fourier Transform'. These data include all the information, so in principle you could transform them back. Then you just need a program that can read 32-bit float tiffs (or 32-bit raw data) and do the inverse transform based on the complex amplitudes. You might need to swap quadrants if the external program wants to have the origin in the corner, not the center.
>
> Michael
> ________________________________________________________________
> On Aug 6, 2015, at 10:15, Rosenberg, Mark F wrote:
>
>> Hi Michael,
>>
>> I am so grateful for your detailed reply and the time you have taken with this.
>>
>> Can you suggest another  way in Image J (which does not sound possible based on your reply)   or alternative  program for saving the FFT so I could transform it back please (apologies since this is an Image J only board )?
>>
>> This would be a great help to me .
>>
>> Thank you  in advance.
>>
>> Mark
>>> On 6 Aug 2015, at 08:48, Michael Schmid <[hidden email]> wrote:
>>>
>>> Hi Mark,
>>>
>>> this is a restriction of the way how FFTs are handled in ImageJ.
>>>
>>> What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.
>>>
>>> If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.
>>>
>>> If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.
>>>
>>> To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.
>>>
>>> Michael
>>> ________________________________________________________________
>>> On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:
>>>
>>>> I would be so grateful for any direction to this problem I have encountered with Image J please.
>>>>
>>>> I am using OS X 10.10.3 and Image J 1.50 a.
>>>>
>>>> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>>>>
>>>> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>>>>
>>>> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>>>>
>>>> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>>>>
>>>> Thank you for your help.
>>>>
>>>> --
>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Herbie
Mark,

if you go to "Process > FFT", the then open submenu offers what you need.

BTW, what is the reason for your desire to forward and backward FFT?

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::
Am 06.08.15 um 11:53 schrieb Rosenberg, Mark F:

> Hi Michael, I am excited by your reply. Thank you for that great
> information. Can you suggest another program that can do a forward
> transform ?  I tried Image Magick but I am struggling to install it
> but I could persevere ! Thanks to your advice I tried the “Complex
> Fourier Transform” in ImageJ which worked. However, I found I do need
> to swap the quadrants as you suggest. Can you suggest how I might
> achieve this please ? Also is there a way of saving the information
> in 16 bit as the subsequent program only seems to read this. I really
> feel I have progressed thanks to your help. Thank you once again.
> Mark
>
>
>> On 6 Aug 2015, at 10:29, Michael Schmid <[hidden email]>
>> wrote:
>>
>> Hi Mark,
>>
>> if you have a program (other than ImageJ) that can do a back
>> transform, for sure it can also to the forward transform, so why
>> not open the input image and do the FFT in that program?
>>
>> Otherwise, in the FFT options you can select 'Complex Fourier
>> Transform'. These data include all the information, so in principle
>> you could transform them back. Then you just need a program that
>> can read 32-bit float tiffs (or 32-bit raw data) and do the inverse
>> transform based on the complex amplitudes. You might need to swap
>> quadrants if the external program wants to have the origin in the
>> corner, not the center.
>>
>> Michael
>> ________________________________________________________________ On
>> Aug 6, 2015, at 10:15, Rosenberg, Mark F wrote:
>>
>>> Hi Michael,
>>>
>>> I am so grateful for your detailed reply and the time you have
>>> taken with this.
>>>
>>> Can you suggest another  way in Image J (which does not sound
>>> possible based on your reply)   or alternative  program for
>>> saving the FFT so I could transform it back please (apologies
>>> since this is an Image J only board )?
>>>
>>> This would be a great help to me .
>>>
>>> Thank you  in advance.
>>>
>>> Mark
>>>> On 6 Aug 2015, at 08:48, Michael Schmid
>>>> <[hidden email]> wrote:
>>>>
>>>> Hi Mark,
>>>>
>>>> this is a restriction of the way how FFTs are handled in
>>>> ImageJ.
>>>>
>>>> What you see as an image is not the FFT but an 8-bit version of
>>>> the power spectrum with logarithmic grayscale and pixel values
>>>> 0 and 255 omitted (reserved for filtering/masking). This
>>>> information is not sufficient for an inverse transform. The FFT
>>>> (actually an FHT) is a hidden property of the image, not
>>>> visible for the user.
>>>>
>>>> If you save the image as "FFT of..." it actually saves the FFT
>>>> (strictly speaking, the FHT), not the displayed image, and
>>>> recovers the displayed image from the FHT data. You may notice
>>>> that any modifications to the displayed image (e.g. by painting
>>>> on it, cropping, etc.) are not saved, you will always get what
>>>> 'Redisplay power spectrum' would show you. If you save it under
>>>> a different name, ImageJ assumes that you want to save the
>>>> displayed image (including any modifications by the user), not
>>>> the FHT.
>>>>
>>>> If you want to do any analysis or further processing of FFTs in
>>>> a different program, apart from measuring peak positions etc.,
>>>> you need a quantitative relationship between the pixel value
>>>> and the power spectrum. You get this when you select 'Raw Power
>>>> Spectrum' in the FFT options. Nevertheless, also the power
>>>> spectrum is insufficient for the inverse transform because the
>>>> it contains only the amplitude (squared), not the phase of the
>>>> Fourier components.
>>>>
>>>> To summarize, if you want to do further processing on an FFT in
>>>> ImageJ, save it as "FFT of..." as .tif or .zip, but beware that
>>>> modifications of the displayed image will get lost. For
>>>> analysis in other programs, save the power spectrum, but you
>>>> won't be able to transform it back.
>>>>
>>>> Michael
>>>> ________________________________________________________________
>>>>
>>>>
On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:

>>>>
>>>>> I would be so grateful for any direction to this problem I
>>>>> have encountered with Image J please.
>>>>>
>>>>> I am using OS X 10.10.3 and Image J 1.50 a.
>>>>>
>>>>> If I open an Electron Microscope Image in Image J  and
>>>>> generate  an FFT and then  save the FFT as “FFT of
>>>>> IMAGENAME”  in tif  or zip format, reopen the FFT in Image J
>>>>> and do an Inverse FFT I can  regenerate the original image as
>>>>> expected.
>>>>>
>>>>> However, if I rename “FFT of  IMAGENAME” to  any other name
>>>>> but  exclude “FFT of ”  in the filename   I cannot do an
>>>>> Inverse FFT  and if  I do an FFT the Image is "lower
>>>>> resolution”  .
>>>>>
>>>>> I have looked at the Info for FFT and all I can see is a
>>>>> change in ID number from -79 to -80 and a change in “Screen
>>>>> Location” coordinates. I don’t know how to edit these.
>>>>>
>>>>> Does anyone have any suggestions  how to get round this
>>>>> renaming problem please because I would like to use the
>>>>> filename in a subsequent program which requires a different
>>>>> format ?
>>>>>
>>>>> Thank you for your help.
>>>>>
>>>>> -- 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Michael Schmid
In reply to this post by Rosenberg, Mark F
Hi Mark,

'swap quadrants' is in the Process>FFT menu.
For conversion to 16 bits, you have to scale your data first:
Find the maximum and minimum (including real&imaginary) and take the the highest absolute value, let's call it globalMax
Then multiply your images with 32767/globalMax, and add 32768.
In Edit>Options>Conversions, have 'scale when converting' off and with Image>Type, convert to 16 bits.

Then, make sure your external program interprets the image as signed integers (-32768 to +32767)

Note that 16-bit accuracy might be insufficient for some FFTs. Especially the 'DC component', i.e. the zero-frequency component can be very high compared to all other Fourier components. So it makes sense to convert the image to 32 bits (float) first, and then subtract the mean value, before doing the FFT.

---
Image Magick: I have no experience with it.

Michael
________________________________________________________________
On Aug 6, 2015, at 11:53, Rosenberg, Mark F wrote:

> Hi Michael,
> I am excited by your reply. Thank you for that great information.
> Can you suggest another program that can do a forward transform ?  I tried Image Magick but I am struggling to install it but I could persevere !
> Thanks to your advice I tried the “Complex Fourier Transform” in ImageJ which worked. However, I found I do need to swap the quadrants as you suggest. Can you suggest how I might achieve this please ? Also is there a way of saving the information in 16 bit as the subsequent program only seems to read this.
> I really feel I have progressed thanks to your help.
> Thank you once again.
> Mark
>
>
>> On 6 Aug 2015, at 10:29, Michael Schmid <[hidden email]> wrote:
>>
>> Hi Mark,
>>
>> if you have a program (other than ImageJ) that can do a back transform, for sure it can also to the forward transform, so why not open the input image and do the FFT in that program?
>>
>> Otherwise, in the FFT options you can select 'Complex Fourier Transform'. These data include all the information, so in principle you could transform them back. Then you just need a program that can read 32-bit float tiffs (or 32-bit raw data) and do the inverse transform based on the complex amplitudes. You might need to swap quadrants if the external program wants to have the origin in the corner, not the center.
>>
>> Michael
>> ________________________________________________________________
>> On Aug 6, 2015, at 10:15, Rosenberg, Mark F wrote:
>>
>>> Hi Michael,
>>>
>>> I am so grateful for your detailed reply and the time you have taken with this.
>>>
>>> Can you suggest another  way in Image J (which does not sound possible based on your reply)   or alternative  program for saving the FFT so I could transform it back please (apologies since this is an Image J only board )?
>>>
>>> This would be a great help to me .
>>>
>>> Thank you  in advance.
>>>
>>> Mark
>>>> On 6 Aug 2015, at 08:48, Michael Schmid <[hidden email]> wrote:
>>>>
>>>> Hi Mark,
>>>>
>>>> this is a restriction of the way how FFTs are handled in ImageJ.
>>>>
>>>> What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.
>>>>
>>>> If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.
>>>>
>>>> If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.
>>>>
>>>> To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.
>>>>
>>>> Michael
>>>> ________________________________________________________________
>>>> On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:
>>>>
>>>>> I would be so grateful for any direction to this problem I have encountered with Image J please.
>>>>>
>>>>> I am using OS X 10.10.3 and Image J 1.50 a.
>>>>>
>>>>> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>>>>>
>>>>> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>>>>>
>>>>> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>>>>>
>>>>> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>>>>>
>>>>> Thank you for your help.
>>>>>
>>>>> --
>>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
Hi Michael,
Thanks so much for your detailed response which has given me so much to work with with more  confidence.
I just tried what you suggested in Image J and I got much further and the reverse FFT made more sense.
Thanks once again.
Mark

> On 6 Aug 2015, at 11:05, Michael Schmid <[hidden email]> wrote:
>
> Hi Mark,
>
> 'swap quadrants' is in the Process>FFT menu.
> For conversion to 16 bits, you have to scale your data first:
> Find the maximum and minimum (including real&imaginary) and take the the highest absolute value, let's call it globalMax
> Then multiply your images with 32767/globalMax, and add 32768.
> In Edit>Options>Conversions, have 'scale when converting' off and with Image>Type, convert to 16 bits.
>
> Then, make sure your external program interprets the image as signed integers (-32768 to +32767)
>
> Note that 16-bit accuracy might be insufficient for some FFTs. Especially the 'DC component', i.e. the zero-frequency component can be very high compared to all other Fourier components. So it makes sense to convert the image to 32 bits (float) first, and then subtract the mean value, before doing the FFT.
>
> ---
> Image Magick: I have no experience with it.
>
> Michael
> ________________________________________________________________
> On Aug 6, 2015, at 11:53, Rosenberg, Mark F wrote:
>
>> Hi Michael,
>> I am excited by your reply. Thank you for that great information.
>> Can you suggest another program that can do a forward transform ?  I tried Image Magick but I am struggling to install it but I could persevere !
>> Thanks to your advice I tried the “Complex Fourier Transform” in ImageJ which worked. However, I found I do need to swap the quadrants as you suggest. Can you suggest how I might achieve this please ? Also is there a way of saving the information in 16 bit as the subsequent program only seems to read this.
>> I really feel I have progressed thanks to your help.
>> Thank you once again.
>> Mark
>>
>>
>>> On 6 Aug 2015, at 10:29, Michael Schmid <[hidden email]> wrote:
>>>
>>> Hi Mark,
>>>
>>> if you have a program (other than ImageJ) that can do a back transform, for sure it can also to the forward transform, so why not open the input image and do the FFT in that program?
>>>
>>> Otherwise, in the FFT options you can select 'Complex Fourier Transform'. These data include all the information, so in principle you could transform them back. Then you just need a program that can read 32-bit float tiffs (or 32-bit raw data) and do the inverse transform based on the complex amplitudes. You might need to swap quadrants if the external program wants to have the origin in the corner, not the center.
>>>
>>> Michael
>>> ________________________________________________________________
>>> On Aug 6, 2015, at 10:15, Rosenberg, Mark F wrote:
>>>
>>>> Hi Michael,
>>>>
>>>> I am so grateful for your detailed reply and the time you have taken with this.
>>>>
>>>> Can you suggest another  way in Image J (which does not sound possible based on your reply)   or alternative  program for saving the FFT so I could transform it back please (apologies since this is an Image J only board )?
>>>>
>>>> This would be a great help to me .
>>>>
>>>> Thank you  in advance.
>>>>
>>>> Mark
>>>>> On 6 Aug 2015, at 08:48, Michael Schmid <[hidden email]> wrote:
>>>>>
>>>>> Hi Mark,
>>>>>
>>>>> this is a restriction of the way how FFTs are handled in ImageJ.
>>>>>
>>>>> What you see as an image is not the FFT but an 8-bit version of the power spectrum with logarithmic grayscale and pixel values 0 and 255 omitted (reserved for filtering/masking). This information is not sufficient for an inverse transform. The FFT (actually an FHT) is a hidden property of the image, not visible for the user.
>>>>>
>>>>> If you save the image as "FFT of..." it actually saves the FFT (strictly speaking, the FHT), not the displayed image, and recovers the displayed image from the FHT data. You may notice that any modifications to the displayed image (e.g. by painting on it, cropping, etc.) are not saved, you will always get what 'Redisplay power spectrum' would show you. If you save it under a different name, ImageJ assumes that you want to save the displayed image (including any modifications by the user), not the FHT.
>>>>>
>>>>> If you want to do any analysis or further processing of FFTs in a different program, apart from measuring peak positions etc., you need a quantitative relationship between the pixel value and the power spectrum. You get this when you select 'Raw Power Spectrum' in the FFT options. Nevertheless, also the power spectrum is insufficient for the inverse transform because the it contains only the amplitude (squared), not the phase of the Fourier components.
>>>>>
>>>>> To summarize, if you want to do further processing on an FFT in ImageJ, save it as "FFT of..." as .tif or .zip, but beware that modifications of the displayed image will get lost. For analysis in other programs, save the power spectrum, but you won't be able to transform it back.
>>>>>
>>>>> Michael
>>>>> ________________________________________________________________
>>>>> On Aug 5, 2015, at 22:21, Rosenberg, Mark F wrote:
>>>>>
>>>>>> I would be so grateful for any direction to this problem I have encountered with Image J please.
>>>>>>
>>>>>> I am using OS X 10.10.3 and Image J 1.50 a.
>>>>>>
>>>>>> If I open an Electron Microscope Image in Image J  and generate  an FFT and then  save the FFT as “FFT of  IMAGENAME”  in tif  or zip format, reopen the FFT in Image J  and do an Inverse FFT I can  regenerate the original image as expected.
>>>>>>
>>>>>> However, if I rename “FFT of  IMAGENAME” to  any other name but  exclude “FFT of ”  in the filename   I cannot do an Inverse FFT  and if  I do an FFT the Image is "lower resolution”  .
>>>>>>
>>>>>> I have looked at the Info for FFT and all I can see is a change in ID number from -79 to -80 and a change in “Screen Location” coordinates. I don’t know how to edit these.
>>>>>>
>>>>>> Does anyone have any suggestions  how to get round this renaming problem please because I would like to use the filename in a subsequent program which requires a different format ?
>>>>>>
>>>>>> Thank you for your help.
>>>>>>
>>>>>> --
>>>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Dimiter Prodanov-3
In reply to this post by Rosenberg, Mark F
Dear all,

Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
Actually ImageJ implements only the Discrete Hartley transform in order to
avoid as much as possible use of complex numbers.
May be this was a reasonable design choice 15 years ago when ImageJ was
hardly more than an applet displaying an image but now I think it will make
much sense to reconsider this.

To put it simply without canonical state of the art  FFT/IFFT routine
ImageJ is not suitable for serious work in linear filtering/signal
processing.

It will be nice to expose FFTs using for example JTransforms library
https://sites.google.com/site/piotrwendykier/software/jtransforms

I think that the licenses are compatible.

best regards,

Dimiter Prodanov

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

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Herbie
Dear Dimiter,

you wrote:
"ImageJ is not suitable for serious work in linear filtering/signal
processing."

Well I can't fully agree.
I see no restrictions with linear filtering using the ImageJ-FFT in
IJ-macros, although you need to understand how to deal with complex
numbers...


You wrote:
"I think that the licenses are compatible."

_Not true_, because
"JTransforms is distributed under the terms of the BSD-2-Clause license."

and owing to the Hartley transform approach the ImageJ-FFT is license-free!

Accordingly, I wouldn't like to see the current ImageJ FFT-routines
replaced by others, but IJ-PlugIns are always welcome!

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::::::
Am 07.08.15 um 12:12 schrieb Dimiter Prodanov:

> Dear all,
>
> Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
> Actually ImageJ implements only the Discrete Hartley transform in order to
> avoid as much as possible use of complex numbers.
> May be this was a reasonable design choice 15 years ago when ImageJ was
> hardly more than an applet displaying an image but now I think it will make
> much sense to reconsider this.
>
> To put it simply without canonical state of the art  FFT/IFFT routine
> ImageJ is not suitable for serious work in linear filtering/signal
> processing.
>
> It will be nice to expose FFTs using for example JTransforms library
> https://sites.google.com/site/piotrwendykier/software/jtransforms
>
> I think that the licenses are compatible.
>
> best regards,
>
> Dimiter Prodanov
>
> --
> 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: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
In reply to this post by Dimiter Prodanov-3
Dear Dimiter
Thank you for your feedback and suggestions too.
Best Regards,
Mark

> On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]> wrote:
>
> Dear all,
>
> Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
> Actually ImageJ implements only the Discrete Hartley transform in order to
> avoid as much as possible use of complex numbers.
> May be this was a reasonable design choice 15 years ago when ImageJ was
> hardly more than an applet displaying an image but now I think it will make
> much sense to reconsider this.
>
> To put it simply without canonical state of the art  FFT/IFFT routine
> ImageJ is not suitable for serious work in linear filtering/signal
> processing.
>
> It will be nice to expose FFTs using for example JTransforms library
> https://sites.google.com/site/piotrwendykier/software/jtransforms
>
> I think that the licenses are compatible.
>
> best regards,
>
> Dimiter Prodanov
>
> --
> 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: FFT and Inverse FFT problem for an Electron Microscope Image

ctrueden
Hi everyone,

Regarding FFT and IFFT operations, I just wanted to mention that ImageJ Ops
(distributed as part of ImageJ2!) does have these operations [1, 2, 3, 4,
5], driven by the powerful ImgLib2 library [6]. And very soon to be using
JTransforms [7] as mentioned by Dimiter (currently it uses Mines JTK [8,
9]).

So for anyone considering reinventing this wheel: please consider
contributing to Ops rather that starting a new and instantly obsolete
plugin. ;-)

Regards,
Curtis

[1]
https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fft
[2]
https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fftSize
[3]
https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/ifft
[4]
https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L569-L702
[5]
https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L879-L910
[6] https://github.com/imglib/imglib2-algorithm-fft
[7] https://github.com/imglib/imglib2-algorithm-fft/pull/3
[8] https://github.com/imglib/imglib2/issues/61
[9] https://github.com/imglib/imglib2/issues/38


On Fri, Aug 7, 2015 at 9:05 AM, Rosenberg, Mark F <
[hidden email]> wrote:

> Dear Dimiter
> Thank you for your feedback and suggestions too.
> Best Regards,
> Mark
> > On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]> wrote:
> >
> > Dear all,
> >
> > Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
> > Actually ImageJ implements only the Discrete Hartley transform in order
> to
> > avoid as much as possible use of complex numbers.
> > May be this was a reasonable design choice 15 years ago when ImageJ was
> > hardly more than an applet displaying an image but now I think it will
> make
> > much sense to reconsider this.
> >
> > To put it simply without canonical state of the art  FFT/IFFT routine
> > ImageJ is not suitable for serious work in linear filtering/signal
> > processing.
> >
> > It will be nice to expose FFTs using for example JTransforms library
> > https://sites.google.com/site/piotrwendykier/software/jtransforms
> >
> > I think that the licenses are compatible.
> >
> > best regards,
> >
> > Dimiter Prodanov
> >
> > --
> > 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: FFT and Inverse FFT problem for an Electron Microscope Image

bnorthan
If anyone is interested in an example of ops fft, below is a jython script
example that shows how to use the ops fft interface (it also uses
parameterized scripting and calls pieces of imglib2 using jython).  It is
based on this imglib tutorial

https://github.com/imglib/imglib2-tutorials/blob/master/src/main/java/Example6c.java

If one copies and pastes the code at the bottom of this message into the
script editor of the latest Fiji release it should run and produce the same
result as the java tutorial.  The images (DrosophillaWing.tif and
WingTemplate.tif) are available in the imglib2-tutorials repository.

https://github.com/imglib/imglib2-tutorials

Keep in mind the ops fft interfaces are fairly new and still in beta.
Feedback (and contributions) are very welcome - Brian

# @DisplayService display
# @OpService ops
# @net.imagej.Dataset image
# @net.imagej.Dataset template

'''
This example is an 'ops' version of:

http://fiji.sc/ImgLib2_Examples#Example_6c_-_Complex_numbers_and_Fourier_transforms

for which the code and images can be found

https://github.com/imglib/imglib2-tutorials

'''
from net.imglib2.img.display.imagej import ImageJFunctions;
from net.imglib2.type.numeric.complex import ComplexFloatType;
from net.imglib2.outofbounds import OutOfBoundsMirrorExpWindowingFactory;

from net.imglib2.converter import ComplexImaginaryFloatConverter;
from net.imglib2.converter import ComplexPhaseFloatConverter;
from net.imglib2.converter import ComplexRealFloatConverter;

from jarray import array

# perform fft of the template

# basic fft call with no parameters
#templateFFT=ops.fft(template.getImgPlus())

# alternatively to pass an outofbounds factory we have to pass every
parameter.  We want:
# output='None', input=template, borderSize=10 by 10, fast='True',
outOfBoundsFactor=OutOfBoundsMirrorExpWindowingFactory
templateFFT=ops.fft(None, template.getImgPlus(), array([10, 10], 'l'),
True, OutOfBoundsMirrorExpWindowingFactory(0.25));

# display fft (by default in generalized log power spectrum)
ImageJFunctions.show(templateFFT).setTitle("fft power spectrum");

# display fft phase spectrum
ImageJFunctions.show( templateFFT,ComplexPhaseFloatConverter() ).setTitle(
"fft phase spectrum" );

# display fft real values
ImageJFunctions.show( templateFFT,ComplexRealFloatConverter() ).setTitle(
"fft real values" );

# display fft imaginary values
ImageJFunctions.show( templateFFT, ComplexImaginaryFloatConverter()
).setTitle( "fft imaginary values" );

# complex invert the fft of the template
c = ComplexFloatType();
for  t in templateFFT:
    c.set(t);
    t.complexConjugate();
    c.mul(t);
    t.div(c);

# create Img memory for inverse FFT and compute inverse
templateInverse=ops.createImg(array([template.dimension(0),
template.dimension(1)], 'l'))

ops.ifft(templateInverse, templateFFT)
display.createDisplay("template inverse", templateInverse)

# convolve templateInverse with image
final=ops.convolve(image, templateInverse);
display.createDisplay("final", final)

On Fri, Aug 7, 2015 at 4:40 PM, Curtis Rueden <[hidden email]> wrote:

> Hi everyone,
>
> Regarding FFT and IFFT operations, I just wanted to mention that ImageJ Ops
> (distributed as part of ImageJ2!) does have these operations [1, 2, 3, 4,
> 5], driven by the powerful ImgLib2 library [6]. And very soon to be using
> JTransforms [7] as mentioned by Dimiter (currently it uses Mines JTK [8,
> 9]).
>
> So for anyone considering reinventing this wheel: please consider
> contributing to Ops rather that starting a new and instantly obsolete
> plugin. ;-)
>
> Regards,
> Curtis
>
> [1]
>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fft
> [2]
>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fftSize
> [3]
>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/ifft
> [4]
>
> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L569-L702
> [5]
>
> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L879-L910
> [6] https://github.com/imglib/imglib2-algorithm-fft
> [7] https://github.com/imglib/imglib2-algorithm-fft/pull/3
> [8] https://github.com/imglib/imglib2/issues/61
> [9] https://github.com/imglib/imglib2/issues/38
>
>
> On Fri, Aug 7, 2015 at 9:05 AM, Rosenberg, Mark F <
> [hidden email]> wrote:
>
> > Dear Dimiter
> > Thank you for your feedback and suggestions too.
> > Best Regards,
> > Mark
> > > On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]> wrote:
> > >
> > > Dear all,
> > >
> > > Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
> > > Actually ImageJ implements only the Discrete Hartley transform in order
> > to
> > > avoid as much as possible use of complex numbers.
> > > May be this was a reasonable design choice 15 years ago when ImageJ was
> > > hardly more than an applet displaying an image but now I think it will
> > make
> > > much sense to reconsider this.
> > >
> > > To put it simply without canonical state of the art  FFT/IFFT routine
> > > ImageJ is not suitable for serious work in linear filtering/signal
> > > processing.
> > >
> > > It will be nice to expose FFTs using for example JTransforms library
> > > https://sites.google.com/site/piotrwendykier/software/jtransforms
> > >
> > > I think that the licenses are compatible.
> > >
> > > best regards,
> > >
> > > Dimiter Prodanov
> > >
> > > --
> > > 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: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
Thank you very much for that. I will try this code later when I am near my computer.
Just one query please ? How does it work  where I would like my final image to be 16 bits please ? Thank you for taking the time to do this.

Sent from my iPad

> On 10 Aug 2015, at 13:30, Brian Northan <[hidden email]> wrote:
>
> If anyone is interested in an example of ops fft, below is a jython script
> example that shows how to use the ops fft interface (it also uses
> parameterized scripting and calls pieces of imglib2 using jython).  It is
> based on this imglib tutorial
>
> https://github.com/imglib/imglib2-tutorials/blob/master/src/main/java/Example6c.java
>
> If one copies and pastes the code at the bottom of this message into the
> script editor of the latest Fiji release it should run and produce the same
> result as the java tutorial.  The images (DrosophillaWing.tif and
> WingTemplate.tif) are available in the imglib2-tutorials repository.
>
> https://github.com/imglib/imglib2-tutorials
>
> Keep in mind the ops fft interfaces are fairly new and still in beta.
> Feedback (and contributions) are very welcome - Brian
>
> # @DisplayService display
> # @OpService ops
> # @net.imagej.Dataset image
> # @net.imagej.Dataset template
>
> '''
> This example is an 'ops' version of:
>
> http://fiji.sc/ImgLib2_Examples#Example_6c_-_Complex_numbers_and_Fourier_transforms
>
> for which the code and images can be found
>
> https://github.com/imglib/imglib2-tutorials
>
> '''
> from net.imglib2.img.display.imagej import ImageJFunctions;
> from net.imglib2.type.numeric.complex import ComplexFloatType;
> from net.imglib2.outofbounds import OutOfBoundsMirrorExpWindowingFactory;
>
> from net.imglib2.converter import ComplexImaginaryFloatConverter;
> from net.imglib2.converter import ComplexPhaseFloatConverter;
> from net.imglib2.converter import ComplexRealFloatConverter;
>
> from jarray import array
>
> # perform fft of the template
>
> # basic fft call with no parameters
> #templateFFT=ops.fft(template.getImgPlus())
>
> # alternatively to pass an outofbounds factory we have to pass every
> parameter.  We want:
> # output='None', input=template, borderSize=10 by 10, fast='True',
> outOfBoundsFactor=OutOfBoundsMirrorExpWindowingFactory
> templateFFT=ops.fft(None, template.getImgPlus(), array([10, 10], 'l'),
> True, OutOfBoundsMirrorExpWindowingFactory(0.25));
>
> # display fft (by default in generalized log power spectrum)
> ImageJFunctions.show(templateFFT).setTitle("fft power spectrum");
>
> # display fft phase spectrum
> ImageJFunctions.show( templateFFT,ComplexPhaseFloatConverter() ).setTitle(
> "fft phase spectrum" );
>
> # display fft real values
> ImageJFunctions.show( templateFFT,ComplexRealFloatConverter() ).setTitle(
> "fft real values" );
>
> # display fft imaginary values
> ImageJFunctions.show( templateFFT, ComplexImaginaryFloatConverter()
> ).setTitle( "fft imaginary values" );
>
> # complex invert the fft of the template
> c = ComplexFloatType();
> for  t in templateFFT:
>    c.set(t);
>    t.complexConjugate();
>    c.mul(t);
>    t.div(c);
>
> # create Img memory for inverse FFT and compute inverse
> templateInverse=ops.createImg(array([template.dimension(0),
> template.dimension(1)], 'l'))
>
> ops.ifft(templateInverse, templateFFT)
> display.createDisplay("template inverse", templateInverse)
>
> # convolve templateInverse with image
> final=ops.convolve(image, templateInverse);
> display.createDisplay("final", final)
>
>> On Fri, Aug 7, 2015 at 4:40 PM, Curtis Rueden <[hidden email]> wrote:
>>
>> Hi everyone,
>>
>> Regarding FFT and IFFT operations, I just wanted to mention that ImageJ Ops
>> (distributed as part of ImageJ2!) does have these operations [1, 2, 3, 4,
>> 5], driven by the powerful ImgLib2 library [6]. And very soon to be using
>> JTransforms [7] as mentioned by Dimiter (currently it uses Mines JTK [8,
>> 9]).
>>
>> So for anyone considering reinventing this wheel: please consider
>> contributing to Ops rather that starting a new and instantly obsolete
>> plugin. ;-)
>>
>> Regards,
>> Curtis
>>
>> [1]
>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fft
>> [2]
>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fftSize
>> [3]
>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/ifft
>> [4]
>>
>> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L569-L702
>> [5]
>>
>> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L879-L910
>> [6] https://github.com/imglib/imglib2-algorithm-fft
>> [7] https://github.com/imglib/imglib2-algorithm-fft/pull/3
>> [8] https://github.com/imglib/imglib2/issues/61
>> [9] https://github.com/imglib/imglib2/issues/38
>>
>>
>> On Fri, Aug 7, 2015 at 9:05 AM, Rosenberg, Mark F <
>> [hidden email]> wrote:
>>
>>> Dear Dimiter
>>> Thank you for your feedback and suggestions too.
>>> Best Regards,
>>> Mark
>>>> On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]> wrote:
>>>>
>>>> Dear all,
>>>>
>>>> Handing of FFTs (and complex numbers) is a definite weakness of ImageJ.
>>>> Actually ImageJ implements only the Discrete Hartley transform in order
>>> to
>>>> avoid as much as possible use of complex numbers.
>>>> May be this was a reasonable design choice 15 years ago when ImageJ was
>>>> hardly more than an applet displaying an image but now I think it will
>>> make
>>>> much sense to reconsider this.
>>>>
>>>> To put it simply without canonical state of the art  FFT/IFFT routine
>>>> ImageJ is not suitable for serious work in linear filtering/signal
>>>> processing.
>>>>
>>>> It will be nice to expose FFTs using for example JTransforms library
>>>> https://sites.google.com/site/piotrwendykier/software/jtransforms
>>>>
>>>> I think that the licenses are compatible.
>>>>
>>>> best regards,
>>>>
>>>> Dimiter Prodanov
>>>>
>>>> --
>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

bnorthan
Hi Mark

I do not think the low level library(s) that ops uses (currently Mines,
probably JTransform in the future) support 16 bit FFT.  (if anyone knows
otherwise let me know).

Earlier in this thread Michael Schmid gave some nice instruction on how to
convert the result to 16 bit, subtracting the DC component first to avoid
scaling problems.   The same logic should eventually be easy to implement
in ops.

Brian

On Mon, Aug 10, 2015 at 8:44 AM, Rosenberg, Mark F <
[hidden email]> wrote:

> Thank you very much for that. I will try this code later when I am near my
> computer.
> Just one query please ? How does it work  where I would like my final
> image to be 16 bits please ? Thank you for taking the time to do this.
>
> Sent from my iPad
>
> > On 10 Aug 2015, at 13:30, Brian Northan <[hidden email]> wrote:
> >
> > If anyone is interested in an example of ops fft, below is a jython
> script
> > example that shows how to use the ops fft interface (it also uses
> > parameterized scripting and calls pieces of imglib2 using jython).  It is
> > based on this imglib tutorial
> >
> >
> https://github.com/imglib/imglib2-tutorials/blob/master/src/main/java/Example6c.java
> >
> > If one copies and pastes the code at the bottom of this message into the
> > script editor of the latest Fiji release it should run and produce the
> same
> > result as the java tutorial.  The images (DrosophillaWing.tif and
> > WingTemplate.tif) are available in the imglib2-tutorials repository.
> >
> > https://github.com/imglib/imglib2-tutorials
> >
> > Keep in mind the ops fft interfaces are fairly new and still in beta.
> > Feedback (and contributions) are very welcome - Brian
> >
> > # @DisplayService display
> > # @OpService ops
> > # @net.imagej.Dataset image
> > # @net.imagej.Dataset template
> >
> > '''
> > This example is an 'ops' version of:
> >
> >
> http://fiji.sc/ImgLib2_Examples#Example_6c_-_Complex_numbers_and_Fourier_transforms
> >
> > for which the code and images can be found
> >
> > https://github.com/imglib/imglib2-tutorials
> >
> > '''
> > from net.imglib2.img.display.imagej import ImageJFunctions;
> > from net.imglib2.type.numeric.complex import ComplexFloatType;
> > from net.imglib2.outofbounds import OutOfBoundsMirrorExpWindowingFactory;
> >
> > from net.imglib2.converter import ComplexImaginaryFloatConverter;
> > from net.imglib2.converter import ComplexPhaseFloatConverter;
> > from net.imglib2.converter import ComplexRealFloatConverter;
> >
> > from jarray import array
> >
> > # perform fft of the template
> >
> > # basic fft call with no parameters
> > #templateFFT=ops.fft(template.getImgPlus())
> >
> > # alternatively to pass an outofbounds factory we have to pass every
> > parameter.  We want:
> > # output='None', input=template, borderSize=10 by 10, fast='True',
> > outOfBoundsFactor=OutOfBoundsMirrorExpWindowingFactory
> > templateFFT=ops.fft(None, template.getImgPlus(), array([10, 10], 'l'),
> > True, OutOfBoundsMirrorExpWindowingFactory(0.25));
> >
> > # display fft (by default in generalized log power spectrum)
> > ImageJFunctions.show(templateFFT).setTitle("fft power spectrum");
> >
> > # display fft phase spectrum
> > ImageJFunctions.show( templateFFT,ComplexPhaseFloatConverter()
> ).setTitle(
> > "fft phase spectrum" );
> >
> > # display fft real values
> > ImageJFunctions.show( templateFFT,ComplexRealFloatConverter() ).setTitle(
> > "fft real values" );
> >
> > # display fft imaginary values
> > ImageJFunctions.show( templateFFT, ComplexImaginaryFloatConverter()
> > ).setTitle( "fft imaginary values" );
> >
> > # complex invert the fft of the template
> > c = ComplexFloatType();
> > for  t in templateFFT:
> >    c.set(t);
> >    t.complexConjugate();
> >    c.mul(t);
> >    t.div(c);
> >
> > # create Img memory for inverse FFT and compute inverse
> > templateInverse=ops.createImg(array([template.dimension(0),
> > template.dimension(1)], 'l'))
> >
> > ops.ifft(templateInverse, templateFFT)
> > display.createDisplay("template inverse", templateInverse)
> >
> > # convolve templateInverse with image
> > final=ops.convolve(image, templateInverse);
> > display.createDisplay("final", final)
> >
> >> On Fri, Aug 7, 2015 at 4:40 PM, Curtis Rueden <[hidden email]>
> wrote:
> >>
> >> Hi everyone,
> >>
> >> Regarding FFT and IFFT operations, I just wanted to mention that ImageJ
> Ops
> >> (distributed as part of ImageJ2!) does have these operations [1, 2, 3,
> 4,
> >> 5], driven by the powerful ImgLib2 library [6]. And very soon to be
> using
> >> JTransforms [7] as mentioned by Dimiter (currently it uses Mines JTK [8,
> >> 9]).
> >>
> >> So for anyone considering reinventing this wheel: please consider
> >> contributing to Ops rather that starting a new and instantly obsolete
> >> plugin. ;-)
> >>
> >> Regards,
> >> Curtis
> >>
> >> [1]
> >>
> >>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fft
> >> [2]
> >>
> >>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fftSize
> >> [3]
> >>
> >>
> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/ifft
> >> [4]
> >>
> >>
> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L569-L702
> >> [5]
> >>
> >>
> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L879-L910
> >> [6] https://github.com/imglib/imglib2-algorithm-fft
> >> [7] https://github.com/imglib/imglib2-algorithm-fft/pull/3
> >> [8] https://github.com/imglib/imglib2/issues/61
> >> [9] https://github.com/imglib/imglib2/issues/38
> >>
> >>
> >> On Fri, Aug 7, 2015 at 9:05 AM, Rosenberg, Mark F <
> >> [hidden email]> wrote:
> >>
> >>> Dear Dimiter
> >>> Thank you for your feedback and suggestions too.
> >>> Best Regards,
> >>> Mark
> >>>> On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]>
> wrote:
> >>>>
> >>>> Dear all,
> >>>>
> >>>> Handing of FFTs (and complex numbers) is a definite weakness of
> ImageJ.
> >>>> Actually ImageJ implements only the Discrete Hartley transform in
> order
> >>> to
> >>>> avoid as much as possible use of complex numbers.
> >>>> May be this was a reasonable design choice 15 years ago when ImageJ
> was
> >>>> hardly more than an applet displaying an image but now I think it will
> >>> make
> >>>> much sense to reconsider this.
> >>>>
> >>>> To put it simply without canonical state of the art  FFT/IFFT routine
> >>>> ImageJ is not suitable for serious work in linear filtering/signal
> >>>> processing.
> >>>>
> >>>> It will be nice to expose FFTs using for example JTransforms library
> >>>> https://sites.google.com/site/piotrwendykier/software/jtransforms
> >>>>
> >>>> I think that the licenses are compatible.
> >>>>
> >>>> best regards,
> >>>>
> >>>> Dimiter Prodanov
> >>>>
> >>>> --
> >>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: FFT and Inverse FFT problem for an Electron Microscope Image

Rosenberg, Mark F
 Hi   Brian
Thanks for your  valuable reply  and for tying in with Michael's really useful  thread.
Kind regards
Mark
 

Sent from my iPad

> On 10 Aug 2015, at 14:50, Brian Northan <[hidden email]> wrote:
>
> Hi Mark
>
> I do not think the low level library(s) that ops uses (currently Mines,
> probably JTransform in the future) support 16 bit FFT.  (if anyone knows
> otherwise let me know).
>
> Earlier in this thread Michael Schmid gave some nice instruction on how to
> convert the result to 16 bit, subtracting the DC component first to avoid
> scaling problems.   The same logic should eventually be easy to implement
> in ops.
>
> Brian
>
> On Mon, Aug 10, 2015 at 8:44 AM, Rosenberg, Mark F <
> [hidden email]> wrote:
>
>> Thank you very much for that. I will try this code later when I am near my
>> computer.
>> Just one query please ? How does it work  where I would like my final
>> image to be 16 bits please ? Thank you for taking the time to do this.
>>
>> Sent from my iPad
>>
>>> On 10 Aug 2015, at 13:30, Brian Northan <[hidden email]> wrote:
>>>
>>> If anyone is interested in an example of ops fft, below is a jython
>> script
>>> example that shows how to use the ops fft interface (it also uses
>>> parameterized scripting and calls pieces of imglib2 using jython).  It is
>>> based on this imglib tutorial
>>>
>>>
>> https://github.com/imglib/imglib2-tutorials/blob/master/src/main/java/Example6c.java
>>>
>>> If one copies and pastes the code at the bottom of this message into the
>>> script editor of the latest Fiji release it should run and produce the
>> same
>>> result as the java tutorial.  The images (DrosophillaWing.tif and
>>> WingTemplate.tif) are available in the imglib2-tutorials repository.
>>>
>>> https://github.com/imglib/imglib2-tutorials
>>>
>>> Keep in mind the ops fft interfaces are fairly new and still in beta.
>>> Feedback (and contributions) are very welcome - Brian
>>>
>>> # @DisplayService display
>>> # @OpService ops
>>> # @net.imagej.Dataset image
>>> # @net.imagej.Dataset template
>>>
>>> '''
>>> This example is an 'ops' version of:
>>>
>>>
>> http://fiji.sc/ImgLib2_Examples#Example_6c_-_Complex_numbers_and_Fourier_transforms
>>>
>>> for which the code and images can be found
>>>
>>> https://github.com/imglib/imglib2-tutorials
>>>
>>> '''
>>> from net.imglib2.img.display.imagej import ImageJFunctions;
>>> from net.imglib2.type.numeric.complex import ComplexFloatType;
>>> from net.imglib2.outofbounds import OutOfBoundsMirrorExpWindowingFactory;
>>>
>>> from net.imglib2.converter import ComplexImaginaryFloatConverter;
>>> from net.imglib2.converter import ComplexPhaseFloatConverter;
>>> from net.imglib2.converter import ComplexRealFloatConverter;
>>>
>>> from jarray import array
>>>
>>> # perform fft of the template
>>>
>>> # basic fft call with no parameters
>>> #templateFFT=ops.fft(template.getImgPlus())
>>>
>>> # alternatively to pass an outofbounds factory we have to pass every
>>> parameter.  We want:
>>> # output='None', input=template, borderSize=10 by 10, fast='True',
>>> outOfBoundsFactor=OutOfBoundsMirrorExpWindowingFactory
>>> templateFFT=ops.fft(None, template.getImgPlus(), array([10, 10], 'l'),
>>> True, OutOfBoundsMirrorExpWindowingFactory(0.25));
>>>
>>> # display fft (by default in generalized log power spectrum)
>>> ImageJFunctions.show(templateFFT).setTitle("fft power spectrum");
>>>
>>> # display fft phase spectrum
>>> ImageJFunctions.show( templateFFT,ComplexPhaseFloatConverter()
>> ).setTitle(
>>> "fft phase spectrum" );
>>>
>>> # display fft real values
>>> ImageJFunctions.show( templateFFT,ComplexRealFloatConverter() ).setTitle(
>>> "fft real values" );
>>>
>>> # display fft imaginary values
>>> ImageJFunctions.show( templateFFT, ComplexImaginaryFloatConverter()
>>> ).setTitle( "fft imaginary values" );
>>>
>>> # complex invert the fft of the template
>>> c = ComplexFloatType();
>>> for  t in templateFFT:
>>>   c.set(t);
>>>   t.complexConjugate();
>>>   c.mul(t);
>>>   t.div(c);
>>>
>>> # create Img memory for inverse FFT and compute inverse
>>> templateInverse=ops.createImg(array([template.dimension(0),
>>> template.dimension(1)], 'l'))
>>>
>>> ops.ifft(templateInverse, templateFFT)
>>> display.createDisplay("template inverse", templateInverse)
>>>
>>> # convolve templateInverse with image
>>> final=ops.convolve(image, templateInverse);
>>> display.createDisplay("final", final)
>>>
>>>> On Fri, Aug 7, 2015 at 4:40 PM, Curtis Rueden <[hidden email]>
>> wrote:
>>>>
>>>> Hi everyone,
>>>>
>>>> Regarding FFT and IFFT operations, I just wanted to mention that ImageJ
>> Ops
>>>> (distributed as part of ImageJ2!) does have these operations [1, 2, 3,
>> 4,
>>>> 5], driven by the powerful ImgLib2 library [6]. And very soon to be
>> using
>>>> JTransforms [7] as mentioned by Dimiter (currently it uses Mines JTK [8,
>>>> 9]).
>>>>
>>>> So for anyone considering reinventing this wheel: please consider
>>>> contributing to Ops rather that starting a new and instantly obsolete
>>>> plugin. ;-)
>>>>
>>>> Regards,
>>>> Curtis
>>>>
>>>> [1]
>>>>
>>>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fft
>>>> [2]
>>>>
>>>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/fftSize
>>>> [3]
>>>>
>>>>
>> https://github.com/imagej/imagej-ops/tree/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/ifft
>>>> [4]
>>>>
>>>>
>> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L569-L702
>>>> [5]
>>>>
>>>>
>> https://github.com/imagej/imagej-ops/blob/imagej-ops-0.16.0/src/main/java/net/imagej/ops/filter/FilterNamespace.java#L879-L910
>>>> [6] https://github.com/imglib/imglib2-algorithm-fft
>>>> [7] https://github.com/imglib/imglib2-algorithm-fft/pull/3
>>>> [8] https://github.com/imglib/imglib2/issues/61
>>>> [9] https://github.com/imglib/imglib2/issues/38
>>>>
>>>>
>>>> On Fri, Aug 7, 2015 at 9:05 AM, Rosenberg, Mark F <
>>>> [hidden email]> wrote:
>>>>
>>>>> Dear Dimiter
>>>>> Thank you for your feedback and suggestions too.
>>>>> Best Regards,
>>>>> Mark
>>>>>> On 7 Aug 2015, at 11:12, Dimiter Prodanov <[hidden email]>
>> wrote:
>>>>>>
>>>>>> Dear all,
>>>>>>
>>>>>> Handing of FFTs (and complex numbers) is a definite weakness of
>> ImageJ.
>>>>>> Actually ImageJ implements only the Discrete Hartley transform in
>> order
>>>>> to
>>>>>> avoid as much as possible use of complex numbers.
>>>>>> May be this was a reasonable design choice 15 years ago when ImageJ
>> was
>>>>>> hardly more than an applet displaying an image but now I think it will
>>>>> make
>>>>>> much sense to reconsider this.
>>>>>>
>>>>>> To put it simply without canonical state of the art  FFT/IFFT routine
>>>>>> ImageJ is not suitable for serious work in linear filtering/signal
>>>>>> processing.
>>>>>>
>>>>>> It will be nice to expose FFTs using for example JTransforms library
>>>>>> https://sites.google.com/site/piotrwendykier/software/jtransforms
>>>>>>
>>>>>> I think that the licenses are compatible.
>>>>>>
>>>>>> best regards,
>>>>>>
>>>>>> Dimiter Prodanov
>>>>>>
>>>>>> --
>>>>>> 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
Reply | Threaded
Open this post in threaded view
|

On complex-valued linear filtering in the frequency domain

Herbie
In reply to this post by Dimiter Prodanov-3
To those who are interested!

A nice feature of ImageJ is that complex-valued images are represented
as stacks consisting of two slices that are called "Real" and
"Imaginary". In this sense ImageJ can deal with complex "numbers" (pixel
values).

If the complex-valued Fourier spectrum of an image is
        S_1 = a_11 + i*a_12
and a complex-valued Fourier-spectral filter function is
        S_2 = a_21 + i*a_22,
then their product
        S_3 = S_1 * S_2 = a_31 + i*a_32
computes as

S_3 = a_11 * (a_21 + i*a_22) + i*a_12 * (a_21 + i*a_22);

and consequently

a_31 = a_11 * a_21 - a_12 * a_22; (Real part of product)
a_32 = a_11 * a_22 + a_12 * a_21; (Imaginary part of product)

With ImageJ the above is easily performed by slice arithmetics using the
"Image Calculator...". The stack S_3 of the Fourier-spectral product is
composed of the real part a_31 in slice 1 and the imaginary part a_32 in
slice 2.

All steps can be easily implemented as an ImageJ-macro or plugin.

Of course, the filtered image is obtained by applying the inverse
Fourier-transformation to S_3.

Best regards

Herbie

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

Re: On complex-valued linear filtering in the frequency domain

ctrueden
Hi Herbie,

Have you considered creating a wiki page describing this workflow?

Perhaps here? http://imagej.net/Scripting_toolbox
Or here? http://imagej.net/Cookbook
Or as a new page?

Regards,
Curtis

On Tue, Aug 11, 2015 at 11:11 AM, Herbie <[hidden email]> wrote:

> To those who are interested!
>
> A nice feature of ImageJ is that complex-valued images are represented as
> stacks consisting of two slices that are called "Real" and "Imaginary". In
> this sense ImageJ can deal with complex "numbers" (pixel values).
>
> If the complex-valued Fourier spectrum of an image is
>         S_1 = a_11 + i*a_12
> and a complex-valued Fourier-spectral filter function is
>         S_2 = a_21 + i*a_22,
> then their product
>         S_3 = S_1 * S_2 = a_31 + i*a_32
> computes as
>
> S_3 = a_11 * (a_21 + i*a_22) + i*a_12 * (a_21 + i*a_22);
>
> and consequently
>
> a_31 = a_11 * a_21 - a_12 * a_22; (Real part of product)
> a_32 = a_11 * a_22 + a_12 * a_21; (Imaginary part of product)
>
> With ImageJ the above is easily performed by slice arithmetics using the
> "Image Calculator...". The stack S_3 of the Fourier-spectral product is
> composed of the real part a_31 in slice 1 and the imaginary part a_32 in
> slice 2.
>
> All steps can be easily implemented as an ImageJ-macro or plugin.
>
> Of course, the filtered image is obtained by applying the inverse
> Fourier-transformation to S_3.
>
> Best regards
>
> Herbie
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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