Discussion:
Regarding FFT
akash verma
2012-08-11 16:06:43 UTC
Permalink
Hello sir
I am new user of Imagej . I have to find phase from interferogram can you
give me an idea about how i will find a pahse and also how filter out the
first order after taking Fourier transform.
Thanks in advance
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
David M Gauntt
2012-08-14 15:27:52 UTC
Permalink
The instruction below describe how to perform a Fourier Transform on your image, and get the phase of the Fourier transform. This may not be what your are trying to do, however.

1) Select the command "Process/FFT/FFT Options…". Select the "Complex Fourier Transform" option.

2) With your image open, select "Process / FFT / FFT". This will produce a 2 image stack containing the real and imaginary componts of the FT.

3) Display the "Real" image in the stack, and then select "File/Save As/Text image…". Save the file and name it "Real.txt".

4) Display the "Imaginary" image in the stack, and then select "File/Save As/Text image…". Save the file and name it "Imaginary.txt".

5) Open Excel, and Import the Real.txt file into Excel as tab delimited text.

6) Import the Imaginary.txt file into Excel as tab delimited text.

7) Create a new Excel spreadsheet, and save it as an Excel spreadsheet named "Phase.xls" (or Phase.xlsx").

8) Enter the following formula in the first cell of phase.xlsx: =ATAN2(Real.txt!A1,Imaginary.txt!A1)

9) Copy this formula into the rest of the cells of the new spreadsheet. If your real and imaginary images are 128x128 pixels, then copy into the first 128 rows and 128 columns.

10) Save phase.xls, then save a copy as a text file as "phase.txt".

11) In ImageJ, select "File / Import / Text Image…" to import "phase.txt".

You have now opened the phase image, with the phase in radians.

Hello sir
I am new user of Imagej . I have to find phase from interferogram can you
give me an idea about how i will find a pahse and also how filter out the
first order after taking Fourier transform.
Thanks in advance

--
David M. Gauntt, Ph.D.
Associate Professor,
Division of Medical Physics and Engineering
UAB Department of Radiology

mailto:dmgauntt-***@public.gmane.org
205-975-3777



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Gabriel Landini
2012-08-14 16:07:51 UTC
Permalink
Post by David M Gauntt
The instruction below describe how to perform a Fourier Transform on your
image, and get the phase of the Fourier transform. This may not be what
your are trying to do, however.
1) Select the command "Process/FFT/FFT Options…". Select the "Complex
Fourier Transform" option.
2) With your image open, select "Process / FFT / FFT". This will produce a
2 image stack containing the real and imaginary componts of the FT.
3) Display the "Real" image in the stack, and then select "File/Save As/Text
image…". Save the file and name it "Real.txt".
4) Display the "Imaginary" image in the stack, and then select "File/Save
As/Text image…". Save the file and name it "Imaginary.txt".
5) Open Excel, and Import the Real.txt file into Excel as tab delimited text.
6) Import the Imaginary.txt file into Excel as tab delimited text.
7) Create a new Excel spreadsheet, and save it as an Excel spreadsheet named
"Phase.xls" (or Phase.xlsx").
=ATAN2(Real.txt!A1,Imaginary.txt!A1)
9) Copy this formula into the rest of the cells of the new spreadsheet. If
your real and imaginary images are 128x128 pixels, then copy into the
first 128 rows and 128 columns.
10) Save phase.xls, then save a copy as a text file as "phase.txt".
11) In ImageJ, select "File / Import / Text Image…" to import "phase.txt".
You have now opened the phase image, with the phase in radians.
That could be made into a macro and save all the file transfer to excel.

Warning - Warning - Warning - Warning - Warning - Warning -

I am not sure the result is correct, so could somebody with some sample data
please check? Maybe this needs some quadrant swapping? Not sure.
I am also not sure if the operands of the atan2 function in excel match the
ones in the macro function.

//---------------
setBatchMode(true);
a=getTitle();
run("FFT Options...", "fft complex");
run("FFT");
selectWindow("Complex of "+a);
run("Duplicate...", "title=phase");
w=getWidth();
h=getHeight();
imag=newArray(w);
for (y=0;y<h;y++){
selectWindow("Complex of "+a);
setSlice(2);
for(x=0;x<w;x++){
imag[x]=getPixel(x,y);
}
selectWindow("phase");
for(x=0;x<w;x++){
putPixel(x,y, atan2(getPixel(x,y), imag[x]));
}
}
setBatchMode(false);
selectWindow("phase");
run("Enhance Contrast", "saturated=0.0");
//---------------

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Tom Hennessy
2012-08-14 16:28:54 UTC
Permalink
Hi Gabriel,

Are you available to chat on Instant Messenger or Facebook chat. I'm
struggling with this task that I am trying to complete? I am willing
to pay via PayPal if you can help me.
Post by Gabriel Landini
Post by David M Gauntt
The instruction below describe how to perform a Fourier Transform on your
image, and get the phase of the Fourier transform. This may not be what
your are trying to do, however.
1) Select the command "Process/FFT/FFT Options…". Select the "Complex
Fourier Transform" option.
2) With your image open, select "Process / FFT / FFT". This will produce a
2 image stack containing the real and imaginary componts of the FT.
3) Display the "Real" image in the stack, and then select "File/Save As/Text
image…". Save the file and name it "Real.txt".
4) Display the "Imaginary" image in the stack, and then select "File/Save
As/Text image…". Save the file and name it "Imaginary.txt".
5) Open Excel, and Import the Real.txt file into Excel as tab delimited text.
6) Import the Imaginary.txt file into Excel as tab delimited text.
7) Create a new Excel spreadsheet, and save it as an Excel spreadsheet named
"Phase.xls" (or Phase.xlsx").
=ATAN2(Real.txt!A1,Imaginary.txt!A1)
9) Copy this formula into the rest of the cells of the new spreadsheet. If
your real and imaginary images are 128x128 pixels, then copy into the
first 128 rows and 128 columns.
10) Save phase.xls, then save a copy as a text file as "phase.txt".
11) In ImageJ, select "File / Import / Text Image…" to import "phase.txt".
You have now opened the phase image, with the phase in radians.
That could be made into a macro and save all the file transfer to excel.
Warning - Warning - Warning - Warning - Warning - Warning -
I am not sure the result is correct, so could somebody with some sample data
please check? Maybe this needs some quadrant swapping? Not sure.
I am also not sure if the operands of the atan2 function in excel match the
ones in the macro function.
//---------------
setBatchMode(true);
a=getTitle();
run("FFT Options...", "fft complex");
run("FFT");
selectWindow("Complex of "+a);
run("Duplicate...", "title=phase");
w=getWidth();
h=getHeight();
imag=newArray(w);
for (y=0;y<h;y++){
selectWindow("Complex of "+a);
setSlice(2);
for(x=0;x<w;x++){
imag[x]=getPixel(x,y);
}
selectWindow("phase");
for(x=0;x<w;x++){
putPixel(x,y, atan2(getPixel(x,y), imag[x]));
}
}
setBatchMode(false);
selectWindow("phase");
run("Enhance Contrast", "saturated=0.0");
//---------------
Cheers
Gabriel
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
Tom Hennessy

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Tom Hennessy
2012-08-14 16:31:46 UTC
Permalink
Or are either of you available? The task I've got to complete should
be easy for advanced users like yourself.

I have 16 X-ray grey scale images (8-bit), all of which have been
taken at different angles.

I need change the horizontal shift of the images and add them together
so I can move through the focal plane.

Here is a link to the 16 images that I am trying to process:
http://www.sendspace.com/file/cnwzmk

If you can help that would be great.

Thanks.
Post by Tom Hennessy
Hi Gabriel,
Are you available to chat on Instant Messenger or Facebook chat. I'm
struggling with this task that I am trying to complete? I am willing
to pay via PayPal if you can help me.
Post by Gabriel Landini
Post by David M Gauntt
The instruction below describe how to perform a Fourier Transform on your
image, and get the phase of the Fourier transform. This may not be what
your are trying to do, however.
1) Select the command "Process/FFT/FFT Options…". Select the "Complex
Fourier Transform" option.
2) With your image open, select "Process / FFT / FFT". This will produce a
2 image stack containing the real and imaginary componts of the FT.
3) Display the "Real" image in the stack, and then select "File/Save As/Text
image…". Save the file and name it "Real.txt".
4) Display the "Imaginary" image in the stack, and then select "File/Save
As/Text image…". Save the file and name it "Imaginary.txt".
5) Open Excel, and Import the Real.txt file into Excel as tab delimited text.
6) Import the Imaginary.txt file into Excel as tab delimited text.
7) Create a new Excel spreadsheet, and save it as an Excel spreadsheet named
"Phase.xls" (or Phase.xlsx").
=ATAN2(Real.txt!A1,Imaginary.txt!A1)
9) Copy this formula into the rest of the cells of the new spreadsheet. If
your real and imaginary images are 128x128 pixels, then copy into the
first 128 rows and 128 columns.
10) Save phase.xls, then save a copy as a text file as "phase.txt".
11) In ImageJ, select "File / Import / Text Image…" to import "phase.txt".
You have now opened the phase image, with the phase in radians.
That could be made into a macro and save all the file transfer to excel.
Warning - Warning - Warning - Warning - Warning - Warning -
I am not sure the result is correct, so could somebody with some sample data
please check? Maybe this needs some quadrant swapping? Not sure.
I am also not sure if the operands of the atan2 function in excel match the
ones in the macro function.
//---------------
setBatchMode(true);
a=getTitle();
run("FFT Options...", "fft complex");
run("FFT");
selectWindow("Complex of "+a);
run("Duplicate...", "title=phase");
w=getWidth();
h=getHeight();
imag=newArray(w);
for (y=0;y<h;y++){
selectWindow("Complex of "+a);
setSlice(2);
for(x=0;x<w;x++){
imag[x]=getPixel(x,y);
}
selectWindow("phase");
for(x=0;x<w;x++){
putPixel(x,y, atan2(getPixel(x,y), imag[x]));
}
}
setBatchMode(false);
selectWindow("phase");
run("Enhance Contrast", "saturated=0.0");
//---------------
Cheers
Gabriel
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
Tom Hennessy
--
Tom Hennessy

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Gabriel Landini
2012-08-14 17:18:42 UTC
Permalink
Post by Tom Hennessy
I have 16 X-ray grey scale images (8-bit), all of which have been
taken at different angles.
I need change the horizontal shift of the images and add them together
so I can move through the focal plane.
http://www.sendspace.com/file/cnwzmk
You could try the stack alignment using SIFT in Fiji, but not sure it will do
what you want, because all the x rays appear to have been taken from a
different angles so fiducial points are difficult to find.
Other than that I can only suggest to do it by hand with the align slice
plugin:
http://www.dentistry.bham.ac.uk/landinig/software/align_slice.zip

Cheers
Gabriel

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

Continue reading on narkive:
Loading...