In this series dedicated to Direct Fourier Reconstruction (DFR), here is a new version based on Discrete Fourier Transform rather than the Hartley Transform...
Compared to the Hartley Transform, the Fourier transform (FT) uses complex numbers [Wikipedia].
1 - Complex numbers
1-1- JavaScript and complex numbersUnfortunately in JavaScript, there is no class Complex, but you can easily create one with the following constructor:
function Complex(real,imaginary) {
this.re = real; // Real part
this.im = imaginary; // Imaginary part
}
but, as we don't need many functionalities, a simple associative array - in this case - is enough and a complex number can be defined as follows:
var complex = {"re":real,"im":imaginary};
1-2- ImageJ and FFT
In ImageJ, a FT can be stored in a 2-slices 32-bit stack: a first slice entitled 'Real' and a second slice 'Imaginary'. Moreover, if this stack contains a title beginning with 'Complex of ', it is automatically recognized as a frequency stack by ImageJ and an inverse FFT can be applied.
var FT = IJ.createImage("Complex of A", "32-bit Black", w, w, 2);
FT.getStack().setSliceLabel("Real",1);
FT.getStack().setSliceLabel("Imaginary",2);
Note: Functions getVoxel(...) and setVoxel(...) can be used to access the pixel values within the stack.
2- Script: Computing FT(sinogram)
The algorithm is exactly the same than previously [Link], the only differences are:- The management of a 2-slices stack (real and imaginary).
- The function DHT is replaced by DFT (Discrete Fourier Transform)
+++ JavaScript IJ snippet: FourierRec_FFTsino.js +++
+++ End of JavaScript IJ snippet +++
No comments:
Post a Comment