Cover

Fourier Transform Lab

Student Edition

A 2D Fourier Transform Tool / Tutorial

Version 1.1.2

© JCrystalSoft, 2008-2010


Introduction

This Software is Freeware and can be distributed freely as long as no profit is derived from doing so.

FTL (Fourier Transform Lab) is aimed mainly at students who wish to have some hands-on experience with some of the most common concepts of working with two-dimensional Fourier Transforms (2D-FT ). Some of those concepts or features also fall into the wide category of digital image processing.

FTL uses a Fast Fourier Transform algorithm (FFT), in order to achieve a near real-time visual feedback. The FFT requires the image dimensions to be a power of two (e.g. 2^8= 256 etc.)

JCrystalSoft gratefully acknowledges the contributions of Emmanuel Aubert and Claude Lecomte for providing the images and HTML tutorial pages.

Features Currently Implemented

  • Forward & Inverse Fourier Transform (FT & iFT)
  • Low-Pass Filter (blurring)
  • High-Pass Filter
  • Custom-Mask Filter (for removing Fourier peaks)
  • Image Histograms
  • Swap Phase Sets
  • Randomize / Discard FT Phases
  • Randomize / Discard FT Magnitudes
  • Easy Image Import (Load, Paste, Drag-Drop)
  • Basic Image Drawing Function (Freehand & Lattice)
  • Basic Scripting Functions
  • Extensive HTML Tutorial (Aubert, Lecomte)
  • VISTA-Ready by using accessible user folder

Limitations

  • Image size is limited to 256 x 256 pixel (2^8 x 2^8)
  • Grey-scale processing only (no color channel splitting)

To Do ...

  • Deconvolution function

References

  1. Fourier applets by Steffen Weber ( http://jcrystal.com/steffenweber/java.html)
  2. E.Aubert and C.Lecomte, "Illustrated Fourier transforms for crystallography", J.Appl.Cryst. (2007), 40, 1153-1165
  3. Fourier applet by Jason Gallicchio.


Overview

Some pointers about the usage of FTL are given below. For explanations on the Fourier Transform technique please consult the HTML tutorial. The images in the HTML tutorial were created/used with the commercial software DigitalMicrograph. FTL currently does not support all of the features shown in the tutorial (e.g. Deconvolution, Charge-Flipping etc.).

GUI Layout

The Graphical User Interface is arranged in such a way that one can work on two images at the same time (upper and lower three image boxes)

Each image box has its own menu (!), which can be accessed by a Right-Click on the image or by accessing it from the menu bar at the top of the window.

Shifting Images

Images in box 3 can be dragged with the mouse directly. Images in box 1 can be dragged after selecting their menu [Drawing][None (Shift)]. This feature is especially useful when using with convolutions. The translation of image 1 leaves the FT magnitudes unchanged but changes the FT phase values (also change from centro-symmetric to acentric symmetry possible).

Key Shortcuts: Shift+Arrow-keys to shift Image 1 (top) and Ctrl+Arrow-Keys to shift Image 1 (Bottom).

View FT Image Cross-section / Zoom

Press Alt-key and move mouse over image 2 (without pressing mouse button). Image 3 will show the line profile at the mouse position until Alt-key is released. The profile is always scaled to fit the height of image 3. At the same time a zoomed section of image 2 is displayed in the display area of image 1.

Key-Shortcuts

  • Press <Enter> or <SPACE>for menu [Options][Recalculate All]
  • Press <R> for Reset All (Filters and Image inversion off)
  • Press <L> for the Light-on/off function
  • Press <Alt> and move mouse over FT image for profile / zoom

Image Import

  • Supported file types are *.gif, *.jpg, *.bmp
  • Use menu [Load Image] for importing image files
  • Use [Paste Image] for pasting an image from the clipboard
  • Use drag-and-drop to import an image from Explorer etc.
  • Images that are different in size will be resized to 256x256 pixel
  • Use menu [Reload Image] to undo any changes

Image Export

  • Images are saved as Bitmap files only (*.bmp)
    (Keep that in mind when using the SAVE command in scripts)

Shifting Images

  • Image 3 in each row may be dragged directly
  • Image 1 in each row may be dragged if its drawing mode is set to "None"
  • Use Shift+Arrow or Ctrl+Arrow to shift image 1 (top/bottom)

Drawing (Freehand/Lattice)

One may draw on the first image box in the upper/lower row, in order to modify the image that is to be processed by the FT. One may also choose the menu [New Image] and then draw on it.

When the [Drawing][Freehand] option is selected one draw onto the curent image. When [Drawing][Lattice] is selected the image is cleared and one may draw two basis vectors for a 2D unit cell. After the second vector is set the lattice is drawn.

Fourier Transform

If after some action the FT is not automatically recalculated use the menu [Fourier Transform] on image box 2 in the upper/lower row.

Inverse Fourier Transform (Image Reconstruction)

If after some action the iFT is not automatically recalculated use the menu [Inverse FT] on image box 3 in the upper/lower row.

Low-/High-Pass Filter

Use menu [Low-Pass] / [High-Pass] on image box 2 in the upper/lower row, for switching the filter on/off. When the filter area ring is visible drag it with the mouse to change its radius and observe the effect in the iFT image.

Convolution

Convolution of Image 1 (top) with Image 1 (bottom) is performed by multiplying their FT data (complex number multiplication) followed by an inverse FT.

Deconvolution (not available yet)

Deconvolution of Image 1 (top) with Image 1 (bottom) is performed by dividing their FT data (complex number division) followed by an inverse FT.


Scripts

FTL supports reading and writing of simple scripts in text format. The script files have the extension *.ftscr and are located in the subfolder "..\Scripts\".The script command set may be extended in future as new features are implemented. The script files can be edited with any text editor. Use menu [Scripts][Edit Script] to launch Notepad.

FTL can be launched with a script file as parameter, e.g.: "FTL-SE.exe C:\somefolder\myscript.ftscr"

Curent Command Set

  1. TOP - all subsequent commands use top row of picture boxes (=default)
  2. BOTTOM - all subsequent commands use bottom row of picture boxes
  3. LOAD1 - load image file for picture box 1
  4. NEW1 - clear picture box 1 for drawing etc.
  5. SAVE1 - save image of picture box 1 (Image/Drawing)
  6. SAVE2 - save image of picture box 2 (FT Image)
  7. SAVE3 - save image of picture box 3 (Inverse FT Image)
  8. INVERT1 - invert image in picture box 1
  9. INVERT2 - invert image in picture box 2
  10. INVERT3 - invert image in picture box 3
  11. LOWPASS r - low-pass-filter + radius [pixel] applied to FT
  12. HIGHPASS r - high-pass-filter + radius [pixel] applied to FT
  13. MASK f - mask-filter + mask filename (*.mask) applied to FT
  14. MASK n - mask-filter + number of masks (followed by n lines of x1,y1,x2,y2)
  15. RNDPHASES - randomize FT magnitudes
  16. RNDMODULI - randomize FT magnitudes
  17. CONVOLVE1 - convolution of image 1 with image 2 (FT1*FT2)
  18. CONVOLVE1 - convolution of image 2 with image 1 (FT2*FT1)
  19. EXIT - exit program

Note to 3: If only the short image filename is given (not the full path) it is assumed that he image is located in the folder "..\Images\".

Script File Format

Comment lines start with ' and blank lines in the script file are ignored. The commands do not have to be in upper case. Make sure the image files that are supposed to be loaded still exist at the defined locations and keep in mind that only BMP images can be saved with the SAVE command.

Example of a Script File

'This is a comment
TITLE    Test Script For FFT-SE
LOAD1    H:\FTL-SE\Images\Aubert-Croix.jpg
LOWPASS  20
SAVE3    Aubert-Croix-LP.bmp
INVERT2
SAVE2    Aubert-Croix-LPFT.bmp
HIGHPASS 20
SAVE3    Aubert-Croix-HP.bmp
SAVE2    Aubert-Croix-HPFT.bmp
MASK     test1.mask
SAVE3    Aubert-Croix-MF.bmp
INVERT2
SAVE2    Aubert-Croix-MFFT.bmp

Mask File for Fourier Peak Removal

Custom masks can be given inline within the script file or by calling a separate mask file. When a mask filename without the full path is provided it is assumed that the file resides in the folder "..\Scripts\".

Example with inline mask definition in [pixel]

MASK  2
      134 123 253 130
      1 123 117 130

Example with external mask file:

MASK  H:\FTL-SE\Scripts\test1.mask

The mask file should contain the same mask box definitions as the inline format.


Contacts

You may contact us with bug reports or suggestions for improvements.

Author: Steffen Weber, PhD
Email: jcrystalsoft@gmail.com
Web: http://www.jcrystal.com ; http://www.jcrystal.com/steffenweber

JCrystalSoft homepage:

http://www.jcrystal.com

FTL-SE homepage:

http://www.jcrystal.com/products/ftlse/

Adding New Material

You may email us new images, HTML tutorials etc. for a possible inclusion in future versions of this Student Edition. Please send materials to jcrystalsoft@gmail.com (Subject: FTL-SE). Please do not send any material that is copyrighted by other parties.


What's new?

Version 1.1.2 (08/19/2010)

I added a batch processing feature (menu [File][Batch Processing]) for creating FT images for a whole image folder. You need to specify the input file type (BMP/JPG/GIF) and select one file, so that FTL-SE knows what folder to use. The FT will be calculated with the present settings for brightness, linear/Sqrt scale etc. and saved as BMP images.