Friday, February 15, 2013

Learning Tomography: DFR with Fourier Transform

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 numbers

Unfortunately in JavaScript, there is no class Complex, but you can easily create one with the following constructor:

function Complex(real,imaginary) { = real; // Real part = 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);

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:
  1. The management of a 2-slices stack (real and imaginary).
  2. The function DHT is replaced by DFT (Discrete Fourier Transform)

+++ JavaScript IJ snippet: FourierRec_FFTsino.js +++ +++ End of JavaScript IJ snippet +++

Other crazybiocomputing posts

Further readings are available in ...
  • Learning Tomography Series  [Link]
  • Image Processing TOC [Link]

No comments:

Post a Comment