Cover

Fourier Painter
Version 1.0.1

© JCrystalSoft, 2012-2017

Copyright © 2012-2017, JCrystalSoft


Introduction
Fourier Painter is a program suite for performing Fourier transforms of 1D and 2D data. The concept for its creation is based on my other software FTL-SE (Fourier Transform Lab - Student Edition). Fourier Painter runs on the Microsoft .NET Framework 2.0, which should be available even on older computers running Windows XP.

There are many free and very good image processing applications available on the Internet. The included Image Editor is therefore not meant to be competitive with such applications, but rather provides a convenient way to create and edit images within Fourier Painter. The screen capture functions from the [File]-menu of "Image Editor" and the line scan features may prove especially useful to some users as these features are not commonly found in other programs.

By bundling five individual programs with different feature sets it is hoped that the user will find this program suite useful. Especially the possibility to perform live FT from the webcam video stream should prove popular.

Current Features Include ...

  • Image processing, Screen captures
  • Gradient editor / Apply color gradients
  • FT from webcam video
  • Forward & Inverse Fourier Transform (FT & iFT)
  • Low-Pass Filter (blurring)
  • High-Pass Filter
  • Band-Pass / Band-Stop 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
  • Windows 7-Ready by using accessible user folder
  • 3D Plots (surface plots)
  • 1D Plots (line scans)

FFT Routines

"Fourier Transform Lab" uses the routine FOURN from the book "Numerical Recipes". The program "2D-Fourier Transforms" uses an external DLL for the fastest option and optionally the slower FOURN or FOUR1 from the book can be used. The fast Fourier transform routines require images to be square with a width and height of 2^n pixels. Fourier Painter automatically makes these adjustments so you can load images of any aspect ratio.

Grayscale/Color FT

By default the FT Spectrum is calculated for a grayscale image (only one color channel, i.e.: gray). One may select the option [Perform Color FT] from the context menu of the FT image. Applying a Color FT takes about three times as long and requires three times the memory, because the FTs have to be performed on each color channel (red, green, blue) and then recombined. When using the "Color FT" option in "Fourier Transform Lab" the FT spectrum will not use a gradient, but a composite of red, green and blue as this may prove useful for educational purposes.

FT for Webcam video

Use menu [Webcam] in the "Fourier Transform Lab" to start/stop a webcam. You may want to enable the "Binarize Input" option from the FT Image's context menu if you want to put drawings in front of the camera.

Memory Usage

Other programs usually try to release the used memory for the complex data arrays as soon is possible. Fourier Painter does not do this, because the data may be needed for the 1D line scans, for viewing the FT data or for applying a different color gradient.

FT Image Brightness/Scale

Instead of providing a brightness factor adjustment as in FTL-SE, Fourier Painter offers three types of scaling (linear, Sqrt, Log). The scaling type can be selected from the context menu of the FT Image.

1D-Scan Profiles

Each line plot panel has its own context menu in addition to the [Plot]-menu on the top menu bar. For non-FT Images one can select a color channel from the [Plot]-menu ("Intensity"=gray). When displaying line scans for FT images with "Intensity" selected the original raw data (magnitudes of complex data) will be used. When another color channel is selected the FT image is treated as a normal image.

Undo Options

Image Editor and 2D-Fourier Transforms allow several undo/redo levels. Image modifications in Fourier Transform Lab can be undone by reloading the image using the context menu of the original image. In 2D-Fourier Transforms select the first tab with the original image and use menu [Image][Undo].

Image Import

  • Supported file types are *.png, *.jpg, *.gif, *.tif, *.bmp
  • Use menu [File][Open] 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.

To Do ...

  • Deconvolution
  • Webpage export
  • Suggestions welcome

References

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


Overview

Launch Pad

This program starts from the desktop-shortcut and serves as a launcher for the individual programs in this suite. It also checks for updates, provides a shortcut to the user-data folder and performs the product activation.

Image Editor

This is a generic image editor used by the other programs or as a stand-alone program with many useful image processing options, of which the screen capture functions, the gradient editor and the 1D scans should prove especially useful. When it is called by the other programs using the menu item [Edit Image] you only need to close its window when you are done editing and the image will be copied to the clipboard and pasted back into the program it was called from.

Fourier Transform Lab (FTL)

This may be considered to be the main component of the suite, since it allows many experiments and visualizations to be performed that can be of great educational value. Users of FTL-SE will find that the usage of this FTL is quite similar. Once familiar with it one can use "2D-Fourier Transforms" in a similar way. Any image size can be loaded but the display size is restricted to 256 x 256 pixels. Use the context menu of the input image [Size Mode] to specify how you want the images to be loaded.

2D-Fourier Transforms (2DFT)

This is the program in the suite to be used for processing larger images. Three tabs are provided for the original image, the FT image and the output image. The FFT size can be restricted to 512 x 512, 1024 x 1024 or 2048 x 2048, in order to keep the processing time reasonably short. We will try to optimize the FFT routines further in future versions. Custom masks can be saved to files and loaded again for images of the same size as the one for which the masks were created.

1D-Fourier Transforms (1DFT)

This is a simple program for applying FT filters to 1D data, which can be imported, pasted or drawn by hand.

Image Surface Plot

This program shows images as height maps or surface plots with adjustable heights that can also be inverted. It can be used as a stand-alone program or be called from other programs.

Volume Viewer

This program displays electron density maps in XPLOR format as obtained by charge flipping programs, such as MDI-TAOS and SuperFlip. This is a stand-alone program that is not listed in the Launch Pad.

Fourier Transform of Webcam Video

Use menu [Webcam] in the "Fourier Transform Lab" to start/stop a webcam. You may want to enable the "Binarize Input" option from the FT Image's context menu if you want to put drawings in front of the camera.


Image Editor
There are many free and very good image processing applications available on the Internet. The included Image Editor is therefore not meant to be competitive with those applications, but rather provides a convenient way to create and edit images within Fourier Painter and provides some special features that are not commonly found in other programs.Image Editor uses a single document interface (SDI) to work with only one image at a time.

Image Processing

All the standard processing functions for brightness-, contrast-, gamma corrections, color conversions, black/white, grayscale and kernel operations such as blurring and sharpening are offered. For Fourier Filters use the program 2D-Fourier Transforms.

Histogram Panel

Select menu [View][Histogram & Navigator] to view the histogram. When it is visible the histogram is automatically created when an image is loaded, which can cause some delay for larger images. Right-click for its context menu.

Navigator Panel / Zooming

Use the buttons or the slider to change the zoom factor of the image. Drag the visible area rectangle in the navigator to move the visible image section when the image does not fit the window. You can also use the mouse-wheel over the image to change the zoom value and drag the image directly with the mouse without using the navigator panel. The image context menu and the menu [View] can also be used to toggle the image size between 100% and fit to screen size.

Context Menus

A context menu is invoked by a Right-Click on a control such as a picture box. Image Editor has three context menu for the main display area, for the histogram panel and for the thumbnail panel.

Image context menu | Histogram panel | Thumbnail panel

Screen Captures

Select menu [File][Capture Screen] to select a capture type. The Image Editor will minimize to the Windows taskbar. Then you can click at another window if you wish to capture a single window or select a rectangle by mouse-drag if you wish to capture a screen region.

Other ways to capture the full screen or a single window is to use a keyboard shortcut and then paste the image from the clipboard. Use the "PrtScn"-Key to capture the whole screen or use "Alt+PrtScn" to capture only the active window.

Scan Line Plots

Image Editor supports horizontal, vertical and free line scans. Use the menu [Plot] to select an option and the color channel you wish to extract. Use the context menu of the line plot for more options, such as inverting the Y value or showing the color gradient of the selected line as a background image.

Relief Plots

Select menu [Plot][Relief Plot] and one of the options thereunder for a simple 3D-effect. This is only useful for certain types of images. Use the menu [Edit][Undo] before selecting another option.

Surface Plots

Select menu [Plot][Surface Plot] to launch Image Surface Plot for the whole image. When using the selection tool you can view the surface plot for the selected rectangle using the menu [Selection][Surface Plot].

Undo Options

Several undo/redo levels are possible. Use the image's context menu or menu [Edit][Undo]. When trying out several color gradients apply "undo", in order to undo a previous gradient before selecting another gradient.

Gradient Editor

In Fourier Painter only Image Editor provides access to the gradient editor while other programs allow only the application of a gradient via their [Gradient]-menu. New gradients that are saved from Image Editor are then available in the other programs as well.

Use menu [Gradient][Gradient Editor]. Select an existing file or create a new gradient. Click on empty regions under the gradient preview to insert new color droppers. Click a dropper to select it. Drag the color droppers to the desired position. Right-Click a dropper to edit its color. Double-Click a dropper to delete it or press "Delete"-key to remove a selected dropper. Before closing the window click the "Save"-button, in order to save the changes. When a dropper is selected one may also use the textbox to enter a position value (0-255) or click the color box under the textbox for changing the color.

Applying Gradients

When testing several color gradients apply "undo", in order to undo a previously applied gradient before selecting another gradient.

Drawing Quasiperiodic Tilings / Saving Vertices

Select menu [Render][Quasiperiodic Tilings]. In addition to perform the drawing of tiling from 5- to 2-fold symmetry one may also save the vertex coordinates as two-column data in a text file (*.xy). One may choose between two origin choices when saving the coordinates. Select file type "XY File" to save x,y-values as used for drawing the tiling or use file type "XY File {Center at (0,0)}" to move the center to x=0 and y= 0.


Fourier Transform Lab
The functionality of FTL is largely based on my previous software FTL-SE, which was written in a different programming language and which had a somewhat different feature set. The main difference is that this FTL can perform color FT, has more FT filter options, image layout options and can save images in formats other than BMP.

Usage

Load or draw an input image in the left image boxes. The drawing tools on the tool palette are only for use with the input images. The FT image is automatically calculated. The third box usually shows the image that was reconstructed by an inverse Fourier transform unless some other display option is selected, such as "Magnitude+Phase", "Real Part", "Imag Part" or a static "FT Surface". Select menu item [View][Synchronize iFT] if you wish to calculate the inverse FT while you are drawing on the input image. Use the context menu on the FT image for changing its intensity scaling or for selecting FT filter option.

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 has its own context menu (Right-click on image). Each image box is framed by a border with a text label. Click the frame to select the image box. Right-click on the frame to see another menu, which is identical to the [Image]-menu on the top menu bar. The [Image]-menu acts on whichever image box is currently selected. The display of box 3 can be changed to be "Reconstruction", "Magnitude+Phase", "Real Part", "Imag Part" or a static "FT Surface" image. The selection can be made from the [Option]-menu or by clicking at the label of box 3, whereupon a drop-down menu appears.

Right-Click the window's background to bring up another context menu, which lets you quickly change the layout of the image boxes. This is equivalent to using the menu [View][Layout].

Context Menus

A context menu is invoked by a Right-Click on a control such as a picture box. FTL has context menus for each image box plus context menus for the frame around each image box, which is identical to the [Image]-menu on the menu bar.

Changing Output Type

By default the third image shows the reconstructed image. You can click at the label "Reconstruction" for a drop-down selection of other options. This will act only on the selected image box. If you wish to select a common output type for both output images use the menu [Options][Show Mag+Phases] etc.

Selecting an Image

Click on the frame around an image box, in order to select it. Then the [Image]-menu on the menu bar will act on the selected image and the rotation slider on the tool palette will act on the corresponding input image.

Shifting Images

Images in box 1 can be dragged with the mouse directly after selecting the "mover"-tool from the tool palette. This feature is especially useful for visualizing the effect of an origin shift when using with convolutions or its effect of the phase values. The translation of image 1 leaves the FT magnitudes unchanged but changes the FT phase values.

FT for Webcam video

Use menu [Webcam] to start/stop a webcam. You may want to enable the "Binarize Input" option from the FT Image's context menu if you want to put drawings in front of the camera. At the top right corner of the input image a Stop/Start button will become visible. It will disappear when you load another image or create a new image for the upper input image.

Convolution

Both input images are required to perform a convolution using their context menu item [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. You may use menu [View][Shape Controls] to draw a Gaussian PSF as the second (bottom) input image, then shift it by (1/2,1/2) using the [Image]-menu before you apply a convolution from the context menu of the upper input image.

Undo Options

FTL does currently not offer any undo/redo levels. Use the context menu item [Reload Image] or [New Image] of the input image instead.

Temporary Rotations

Use the vertical slider on the tool palette for rotating the selected input image, in order to view the effect of a rotation on the FT image. When the mousebutton is released the rotation is undone. The corners of a rotated input image are filled with the selected background color.

Gradients for Color FT

FTL uses the selected color gradient only if the default grayscale FT is performed. When the option [Perform Color FT] in the context menu of the FT image is selected FTL will render the FT image as a composite of the corresponding color channels (red, green, blue).

FT Image Brightness

Three intensity scaling options are provided to change the overall brightness of the FT image. Select "Linear Scale", Sqrt Scale" or "Log Scale" from the context menu of the FT image.


2D-Fourier Transforms

2DFT works basically like the FTL when a layout with only one row of image boxes is chosen. However, since the images are not restricted to 256 x 256 pixels a tabbed layout of the images is used here.

Input Image

Use [File][Open] to load a PNG, JPG, GIF, TIF or BMP image file or use [File][New] to create a new image for drawing. Input images do not have to be of square dimensions. 2DFT automatically creates a square image internally that is suitable for the application of the FFT algorithm. Whenever the input image is modified the FT image and output image are discarded, since a new FT must be performed to reflect the changes.

FT Filters

Use the context menu of the FT image or the menu [Fourier] for selecting a FT filter option. For custom masks click on the image to create a circular dot mask or draw rectangles to be used as masks. 2DFT automatically adds the masks that are related by the inversion center symmetry. Use menu [Fourier][Custom Masks] to save the masks to a file (*.msk) or load them from a file. When a mask file is to be loaded the input image dimensions must match the image size for which the mask file was created.

Line-Scan Profiles

Each line plot panel has its own context menu in addition to the [Plot]-menu on the top menu bar. For non-FT Images one can select a color channel from the [Plot]-menu ("Intensity"=gray). When displaying line scans for FT images with "Intensity" selected the original raw data (magnitudes of complex data) will be used. When another color channel is selected the FT image is treated as a normal image.

Undo Options

2DFT allows several undo/redo levels. Select the first tab with the original image and use menu [Image][Undo].

Gradients for Color FT

In contrast to FTL, 2DFT applies the selected gradient also when the option [Perform Color FT] in the context menu of the FT image is selected.

FT Image Brightness

Three intensity scaling options are provided to change the overall brightness of the FT image. Select "Linear Scale", Sqrt Scale" or "Log Scale" from the context menu of the FT image.

FFT Method

Three FFT algorithms are implemented of which the external DLL option is the fastest. Use menu [Fourier][Method] to change the selection. Future versions may not offer multiple methods. The brightness of the FT image differs somewhat for the different methods, as they use a different internal scaling for the complex array data.


1D-Fourier Transforms
This program is provided as a simple way to perform FT filtering on 1D data. Data can be imported from text files (one column or two-column data, i.e.: Y or X Y data). Data can also be pasted using the "Paste Data" option from the context menu of top plot panel. Header lines that contain text will be skipped during the data import.

Context Menus

Each plot panel has its own context menu (Right-Click), which offers options independent form the menus at the menu bar.

Zooming

The mouse can be used to select a zoom rectangle for a plot, unless its "Lock Range" option is selected. When clicking the [New to Draw]-button the range of the input graph will be locked as the mouse will be used to draw a new input graph.

Power Spectrum

Changing the filter radius can be achieved using the sliders in the panel [FT Options] or by dragging the vertical bars in the power spectrum plot. The yellow bar indicates the lower filter radius and the blue one the upper filter radius.

Saving Data

The output data from the bottom plot panel can be saved as a text file using the menu [File][Save]. If you wish to save the data from the other panels you may use the "Copy Data" option form their context menus and then use a text editor to paste and save the data.


Image Surface Plot
The surface plot window can be launched as a stand-alone application from the Launch Pad or from Image Editor, Fourier Transform Lab and 2D-Fourier Transforms for a full image or a selected image region.

Fourier Images vs. Other Images

Normal images will be rendered in their original colors. FT images are imported as raw data in grayscale. You can then select any color gradient you wish to apply. Other gradients can be created using the "Gradient Editor" from [Gradient]-menu of the Image Editor.

Zooming

Use Right-Mouse-Button-Drag on the right half of the display area or the mouse wheel.

Rotation

Use Right-Mouse-Button-Drag on the left half of the display area to rotate about the screen normal or use Left-Mouse-Button-Drag on the whole display area for rotations about the horizontal and vertical screen axis.

Context Menu

Right-Click on the display for the context menu, which is the same as the [Plot]-menu at the top. Key-Shortcuts are indicated in the menu.


Volume Viewer

This module is not listed in the Launch Pad, as it's use is limited to loading electron density maps. Just double-click the corresponding VolumeViewer.exe in the Fourier Painter folder directly.

File Formats

Currently only two file formats are supported, the XPLOR format (*.xplor files, as created by MDI-TAOS, SuperFlip etc) and a polygon terrain file (*.trn files as created by several MDI programs)

User Interface

Click at the Log-scale density histogram for changing the displayed density level.

Zooming

Use Right-Mouse-Button-Drag on the right half of the display area or the mouse wheel.

Rotation

Use Right-Mouse-Button-Drag on the left half of the display area to rotate about the screen normal or use Left-Mouse-Button-Drag on the whole display area for rotations about the horizontal and vertical screen axis.

Context Menu

Right-Click on the display for the context menu, which is the same as the [Plot]-menu at the top. Key-Shortcuts are indicated in the menu.


Launch Pad
Instead of providing five icons for the individual programs, Fourier Painter creates a single desktop shortcut, which will start the launch pad, from which you can select the program you wish to run. You can drop image files on the program's name, in order to open the image with the selected program.

  1. Click the pin to keep the launch pad open
  2. Close launch pad
  3. Program selectors (accept file drop)

Click the [Help]-link with the Right Mouse Button, in order to view this help file in your own web browser. Left-Click the link to view it with Fourier Painter's own HTML browser.

Click the [Browse]-link to view the application data folder. This is different from the installation folder, as Windows does not permit applications to write temporary files into the installation folder.

Click the [About]-link to view application details. At the same time launch pad will check for updates.

When an update is detected you will be asked if you wish to open the update web page.


Contacts
Feel free to contact me with bug reports or suggestions for improvements.

Author:
 Steffen Weber, PhD

Email:
jcrystalsoft@gmail.com

JCrystalSoft homepage:
http://www.jcrystal.com

Fourier Painter homepage:
http://www.jcrystal.com/products/fp/


What's new
  • 07/05/2012: release of Fourier Painter 1.0.0.
  • 00/00/2016: removed activation requirements
  • 04/08/2017: included volume viewer


FAQ
  • No questions received yet