Process Menu

Smooth
Blurs the active image or selection. This filter replaces each pixel with the average of its 3x3 neighborhood.

Sharpen
Increases contrast and accentuates detail in the image or selection, but may also accentuate noise. This filter uses the following weighting factors to replace each pixel with a weighted average of the 3x3 neighborhood.

    -1 -1 -1
    -1 12 -1
    -1 -1 -1

Find Edges
Uses a Sobel edge detector to highlight sharp changes in intensity in the active image or selection. Two 3x3 convolution kernels (show below) are used to generate vertical and horizontal derivatives. The final image is produced by combining the two derivatives using the square root of the sum of the squares.

     1  2  1     1  0 -1
     0  0  0     2  0 -2
    -1 -2 -1     1  0 -1

Enhance Contrast
Enhances image contrast by using either histogram stretching or histogram equalization. Both methods are described in detail in the
Hypermedia Image Processing Reference. Look up "enhancement" in the index. This command does not alter pixel values as long as Normalize or Equalize Histogram are not checked.

[Dialog]

The Saturated Pixels value determines the number of pixels in the image that are allowed to become saturated. Increasing this value will increase contrast. This value should be greater than zero to prevent a few outlying pixel from causing the histogram stretch to not work as intended.

Check Normalize and ImageJ will recalculate the pixel values of the image so the range is equal to the maximum range for the data type, or 0-1.0 for float images. The maximum range is 0-255 for 8-bit images and 0-65535 for 16-bit images. Note that normalization of RGB images is not supported.

Check Equalize Histogram to enhance the image using histogram equalization. Create a selection and the equalization will be based on the histogram of the selection. Uses a modified algorithm that takes the square root of the histogram values. Hold the alt key down to use the standard histogram equalization algorithm. The "Saturated Pixels" and "Normalize" parameters are ignored when Equalize Histogram is checked. The equalization code was contributed by Richard Kirk.

Noise>
Use the commands in this submenu to add noise to images or remove it. For more advanced capabilities, check out Erik Meijering's RandomJ package (Binomial, Exponential, Gamma, Gaussian, Poisson and Uniform) at
www.imagescience.org/meijering/software/randomj/.

Add Noise
Adds random noise to the image or selection. The noise is Gaussian (normally) distributed with a mean of zero and standard deviation of 25.

Add More Noise
Adds Gaussian noise with a mean of zero and standard deviation of 75.

Salt and Pepper
Adds salt and pepper noise to the image or selection by randomly replacing 2.5% of the pixels with black pixels and 2.5% with white pixels. Note: this command only works with 8-bit images.

Despeckle
This is a median filter. It replaces each pixel with the median value in its 3 x 3 neighborhood. This is a time consuming operation because, for each pixel in the selection, the nine pixels in the 3x3 neighborhood must be sorted and the center pixel replaced with the median value (the fifth). Median filters a good at removing salt and pepper noise.

Shadows>
Commands in this submenu produce a shadow effect, with light appearing to come from a direction corresponding to the command name. The commands use Convolve3x3, ImageJ's 3x3 convolution function. Two of the convolution kernels are shown in the illustration. Shadows Demo uses all eight kernels to demonstrate the speed of Convolve3x3.

Binary>
This submenu contains commands that process binary (black and white) images. These commands assume objects are black and background is white. Some of the commands (Erode, Dilate, Open and Close) also work with continuous tone images

Threshold
Converts grayscale images to black and white and color images to the eight primary colors. The threshold level is determined by analysing the histogram of the current selection, or of the entire image if there is no selection.

Erode
Replaces each pixel with the minimum (lightest) value in the 3x3 neighborhood. With binary images, removes pixels from the edges of black objects. With grayscale and color images, reduces the size of objects that are darker than background.

Dilate
Replaces each pixel with the maximum (darkest) value in the 3x3 neighborhood. With binary images, adds pixels to the edges of black objects. With grayscale and color images, increases the size of objects that are darker than background.

Open
Performs an erosion operation, followed by dilation. With binary images, this smoothes objects and removes isolated pixels.

Close
Performs a dilation operation, followed by erosion. With binary images, this smoothes objects and fills in small holes.

Set Iterations...
Allows you to specify the number of times erosion, dilation, opening, and closing are performed. The default is one.

Outline
Generates a one pixel wide outline of black objects in a binary image.

Skeletonize
Repeatably removes pixels from the edges of objects in a binary image until they are reduced to single pixel wide skeletons. Objects are assummed to be black and backgound white.

Distance Map
Generates a Euclidian distance map (EDM). Each foreground (black) pixel in the binary image is replaced with a gray value equal to that pixel's distance from the nearest background (white) pixel.

Ultimate Points
Generates the ultimate eroded points (UEPs) of the EDM. Requires a binary image as input. The UEPs represent the centers of particles that would be separated by segmentation. The UEP's gray value is equal to the radius of the inscribed circle of the corresponding particle. Note that the EDM is smoothed which results in fewer noise induced errors but causes the gray values of the UEPs to be slightly lower, i.e. it slightly reduces the estimated particle sizes.

Watershed (v1.31b or later)
Watershed segmentation is a way of automatically separating or cutting apart particles that touch. It requires a binary image containing black particles on a white background. It first calculates the Euclidian distance map (EDM) and finds the ultimate eroded points (UEPs). It then dilates each of the UEPs (the peaks or local maxima of the EDM) as far as possible - either until the edge of the particle is reached, or the edge of the region of another (growing) UEP. Watershed segmentation works best for smooth convex objects that don't overlap too much.

watershed example

Enable debugging in Edit/Options/Miscellaneous and the Watershed command will create an animation that shows how the watershed algorithm works. An example is available.

Math>
The commands in this submenu add (subtract, multiply, etc.) a constant to each pixel in the active image or selection. When the result value overflows/underflows the legal range of the image's data type, the value is reset to the maximum/minimum value. With stacks, selections are ignored and the specified operation is performed on all slices in the stack.

Add...
Adds a constant to the image. With 8-bit images, results greater than 255 are set to 255. With 16-bit signed images, results greater than 65,535 are set to 65,535.

Subtract...
Subtracts a constant from the image. With 8-bit and 16-bit images, results less than 0 are set to 0.

Multiply...
Multiplies the image by the specified real constant. With 8-bit images, results greater than 255 are set to 255. With 16-bit signed images, results greater than 65,535 are set to 65,535.

Divide...
Divides the image by the specified real constant. Attempts to divide by zero will be ignored.

AND...
Does a bitwise AND of the image and the specified binary constant.

OR...
Does a bitwise OR of the image and the specified binary constant.

XOR...
Does a bitwise XOR of the image and the specified binary constant.

Min...
Pixels in the image with a value less than the specified constant are replaced by the constant.

Max...
Pixels in the image with a value greater than the specified constant are replaced by the constant.

Gamma...
Applies the function f(p) = (p/255)^gamma*255 to each pixel (p) in the image or selection, where 0.1 <= gamma <= 5.0. For RGB images, this function is applied to all three color channels. For 16-bit images, the image min and max are used for scaling instead of 255.

Log...
For 8-bit images, applies the function f(p) = log(p) * 255/log(255) to each pixel (p) in the image or selection. For RGB images, this function is applied to all three color channels. For 16-bit images, the image min and max are used for scaling instead of 255. For float images, no scaling is done. To calculate log10 of the image, multiply the result of this operation by 0.4343 (1/log(10).

Reciprocal
Generates the reciprocal of the active image or selection. Only works with 32-bit float images.

NaN Background
Sets non-thresholded pixels in 32-bit float images to the NaN (Not a Number) value. For float images, the "Apply" option in Image/Adjust Threshold runs this command. Pixels with a value of Float.NaN (0f/0f), Float.POSITIVE_INFINITY (1f/0f) or Float.NEGATIVE_INFINITY (-1f/0f) are ignored when making measurements on 32-bit float images.

Abs
Generates the absolute value of the active image or selection. Only works with 32-bit float images.

FFT>
The commands in this submenu support frequency domain display, editing and processing. They are based on an implementation of the 2D Fast Hartley Transform (FHT) contributed by Arlo Reeves, the author of the
ImageFFT spinoff of NIH Image.

FFT
Computes the Fourier transform and displays the power spectrum. The frequency domain image is stored as 32-bit float FHT attached to the 8-bit image that displays the power spectrum. Commands in this submenu, such as Inverse FFT, operate on the 32-bit FHT, not on the 8-bit power spectrum. All other ImageJ commands only "see" the power spectrum.

If the mouse is over an active frequency domain (FFT) window, its location is displayed in polar coordinates. The angle is expressed in degrees, while the radius is expressed in pixels per cycle (p/c). In ImageJ 1.33i or later, the radius is expressed in [units] per cycle (e.g. mm/c) if the spatial scale of the image was defined using Analyze/Set Scale. An example is available.

Inverse FFT
Computes the inverse Fourier transform. You can filter or mask spots on the transformed (frequency domain) image and do an inverse transform to produce an image which only contains the frequencies selected or which suppresses the frequencies selected. Use ImageJ's selection tools and fill/clear commands to draw black or white areas that mask portions of the transformed image. Black areas (pixel value=0) cause the corresponding frequences to be filtered (removed) and white areas (pixel value=255) cause the corresponding frequences to be passed. It is not, however, possible to both filter and pass during the same inverse transform.

fft example

There is another example that demonstrates how to remove noise from images generated by a laser scanning confocal microscope.

Redisplay Power Spectrum
Recomputes the power spectrum from the frequency domain image (32-bit FHT). This command allows you to start over if you mess up while editing the 8-bit power spectrum image.

Bandpass Filter..
This is a built in version of Joachim Walter's FFT Filter plugin.

Custom Filter..
This command does fourier space filtering of the active using a user-supplied image as the filter. For an example, see the FFTCustomFilterDemo macro.

Filters>
This submenu contains miscellaneous filters and plugin filters that have been installed by the Plugins/Utilities/Install Plugin command. For more information, refer to the Hypermedia Image Processing Reference at
http://www.dai.ed.ac.uk/HIPR2/. Click on Index and look up the keywords convolution, Gaussian, median, mean, erode, dilate and unsharp.

Convolve...
Does spatial convolution using a kernel entered into a text area. A kernel is a matrix whose center corresponds to the source pixel and the other elements correspond to neighboring pixels. The destination pixel is calculated by multiplying each source pixel by its corresponding kernel coefficient and adding the results. There is no arbitrary limit to the size of the kernel but it must be square and have an odd width.

Rows in the text area must all have the same number of coefficients, the rows must be terminated with a carriage return, and the coefficients must be separated by one or more spaces. Kernels can be pasted into the text area using the control-V keyboard shortcut. Checking Normalize Kernel causes each coefficient to be divided by the sum of the coefficients, preserving image brightness.

The kernel shown is a 9 x 9 "Mexican hat", which does both smoothing and edge detection in one operation. Note that kernels can be saved in a text file (using copy (control-C) and paste), displayed as an image using File/Import/As Text Image, scaled to a reasonable size using Image/Adjust/Size, and plotted using the Surface Plot plugin.

Guassian Blur...
Smooths the current image by doing a convolution using a square, Gaussian (bell-shaped) kernel. The width of the kernel, in pixels, is 2*radius+1, where radius is entered into a dialog box.

Median...
Reduces noise in the active image by replacing each pixel with the median of the neighboring pixel values.

Mean...
Smooths the current image by replacing each pixel with the neighborhood mean. The size of the neighborhood is specified by entering its radius in a dialog box.

Minimum...
This filter does grayscale erosion by replacing each pixel in the image with the smallest pixel value in that pixel's neighborhood.

Maximum...
This filter does grayscale dilation by replacing each pixel in the image with the largest pixel value in that pixel's neighborhood.

Unsharp Mask...
Sharpens and enhances edges by subtracting a blurred version of the image (the unsharp mask) from the original. The unsharp mask is created by Gaussian blurring the original image and then multiplying by the "Mask Weight" parameter. Increase the Guassian blur radius to increase contrast and increase the "Mask Weight" value for additional edge enhancement.

Variance...
Heighlights edges in the image by replacing each pixel with the neighborhood variance.

Show Circular Masks
Generates a stack containing examples of the circular masks used by the Median, Mean, Minimum, Maximum and Variance filters for various neighborhood sizes.

Image Calculator...
Performs arithmetic and logical operations between two images selected from popup menus. Image1 or both the Image1 and Image2 can be stacks. If both are stacks, they must have the same number of slices. Image1 and Image2 must be the same data type but do not have to be the same size.

You can select one of 12 operators from the Operation: popup menu. Check Create New Window and a new image or stack will be created to hold the result. Otherwise, the result of the operation replaces some or all of Image1. With 32-bit (float) images, pixels resulting from division by zero are set to the largest possible value (3.4e38). This value can be redefined in Edit/Options/Miscellaneous/Divide by Zero Value

Add img1 = img1+img2
Subtract img1 = img1-img2
Multiply img1 = img1*img2
Divide img1 = img1/img2
AND img1= img1 AND img2
OR img1 = img1 OR img2
XOR img1 = img1 XOR img2
Min img1 = min(img1,img2)
Max img1 = max(img1,img2)
Average img1 = (img1+img2)/2
Difference img1 = |img1-img2|
Copy img1 = img2

In these examples, the source and destination have inverted LUTs so zero pixels are white. Operations on images with non-inverted LUTs, and RGB images, will not produce the same results.

Subtract Background...
Removes smooth continuous backgrounds from gels and other images. Uses a rolling ball algorithm inspired by Stanley Sternberg's article, "Biomedical Image Processing", IEEE Computer, January 1983. Based on NIH Image Pascal code written by Michael Castle and Janice Keller of the University of Michigan Mental Health Research Institute. The Rolling Ball Radius should be at least as large as the radius of the largest object in the image that is not part of the background.

[Example]

Repeat Command
Reruns the previous command. The Undo and Open commands are skipped. For a shortcut, type shift-R.

| Analyze Menu | Contents | Home |