Auto Threshold

From Fiji

Jump to: navigation, search
Auto Threshold (ImageJ)
Author Gabriel Landini, plus others (see below)
Maintainer Gabriel Landini (G.Landini at bham. ac. uk)
File Auto_Threshold.jar
Source on gitweb (1 file)
Latest version v1.9 (30 Oct 2009)
Development status active


Contents

[edit] Purpose

This plugin binarises 8-bit images using various global (histogram-derived) thresholding methods. The segmented phase is always shown as white (255).

For local thresholding rather than global, see the Auto Local Threshold plugin.

[edit] Installation

ImageJ: requires v1.42m or newer. Copy the Auto_Threshold.jar file from http://www.dentistry.bham.ac.uk/landinig/software/auto_threshold.jar into the ImageJ/Plugins folder and either restart ImageJ or run the Help>Update Menus command. After this a new command should appear in Image>Adjust>Auto Threshold.

Fiji: this plugin is part of the Fiji distribution, there is no need to download it.

[edit] Use

Method selects the algorithm to be applied (detailed below).

The Ignore black and Ignore white options set the image histogram bins for [0] and [255] greylevels to 0 respectively. This may be useful if the digitised image has under- or over- exposed pixels.

White object on black background sets to white the pixels with values above the threshold value (otherwise, it sets to white the values less or equal to the threshold).

Set Threshold instead of Threshold (single images) sets the thresholding LUT, without changing the pixel data. This works only for single images.

It you are processing a stack, two additional options are available: Stack can be used to process all the slices (the threshold of each slice will be computed separately). If this option is left unchecked, only the current slice will be processed. Use stack histogram first computes the histogram of the whole stack, then computes the threshold based on that histogram and finally binarises all the slices with that single value. Selecting this option also selects the Stack option above automatically.


[edit] Available methods

[edit] Try all

Which method segments your data best? One can attempt to answer this question using the Try all option. This produces a montage with results from all the methods, allowing to explore how the different algorithms perform on a particular image or stack. When using stacks, in some cases it might not be a good idea to segment each slice individually rather than with a single threshold for all slices (try the mri-stack.tif from the sample images to better understand this issue).


Image:lymp.png

Original image


Image:lympm2.png

Try all methods.

When processing stacks with many slices, the montages can become very large (~16 times the original stack size) and one risks running out of RAM. A popup window will appear (when stacks have more than 25 slices) to confirm whether the procedure should display the montaged results. Select No to compute the threshold values and display them in the log window.


[edit] Default

This is the original method of auto thresholding available in ImageJ, which is a variation of the IsoData algorithm (described below). The Default option should return the same values as the Image>Adjust>Threshold>Auto, when selecting Ignore black and Ignore white. To indicate segmentation of the desired phase, use the White objects on black background option. The IsoData method is also known as iterative intermeans.


[edit] Huang

Implements Huang's fuzzy thresholding method. This uses Shannon's entropy function (one can also use Yager's entropy function).

Ported from ME Celebi's fourier_0.8 routines [1] and [2].


[edit] Intermodes

This assumes a bimodal histogram. The histogram is iteratively smoothed using a running average of size 3, until there are only two local maxima: j and k. The threshold t is then computed as (j+k)/2. Images with histograms having extremely unequal peaks or a broad and flat valley are unsuitable for this method. method

Ported from Antti Niemistö's Matlab code. See here for an excellent slide presentation and his original Matlab code.


[edit] IsoData

Iterative procedure based on the isodata algorithm of:

The procedure divides the image into object and background by taking an initial threshold, then the averages of the pixels at or below the threshold and pixels above are computed. The averages of those two values are computed, the threshold is incremented and the process is repeated until the threshold is larger than the composite average. That is,

threshold = (average background + average objects)/2. 

Several implementations of this method exist. See the source code for further comments.


[edit] Li

Implements Li's Minimum Cross Entropy thresholding method based on the iterative version (2nd reference below) of the algorithm.

  • Li, CH & Lee, CK (1993), "Minimum Cross Entropy Thresholding", Pattern Recognition 26(4): 617-625
  • Li, CH & Tam, PKS (1998), "An Iterative Algorithm for Minimum Cross Entropy Thresholding", Pattern Recognition Letters 18(8): 771-776

Ported from ME Celebi's fourier_0.8 routines [3] and [4].


[edit] MaxEntropy

Implements Kapur-Sahoo-Wong (Maximum Entropy) thresholding method:

  • Kapur, JN; Sahoo, PK & Wong, ACK (1985), "A New Method for Gray-Level Picture Thresholding Using the Entropy of the Histogram", Graphical Models and Image Processing 29(3): 273-285

Ported from ME Celebi's fourier_0.8 routines [5] and [6].


[edit] Mean

Uses the mean of grey levels as the threshold. It is used by some other methods as a first guess threshold.

  • Glasbey, CA (1993), "An analysis of histogram-based thresholding algorithms", CVGIP: Graphical Models and Image Processing 55: 532-537


[edit] MinError(I)

An iterative implementation of Kittler and Illingworth's Minimum Error thresholding.

This implementation seems to converge more often than the original. Nevertheless, sometimes the algorithm does not converge to a solution. In that case a warning is reported to the log window and the result defaults to the initial estimate of the threshold which is computed using the Mean method. The Ignore black or Ignore white options might help to avoid this problem.

  • Kittler, J & Illingworth, J (1986), "Minimum error thresholding", Pattern Recognition 19: 41-47

Ported from Antti Niemistö's Matlab code. See here for an excellent slide presentation and the original Matlab code.

[edit] Minimum

Similarly to the Intermodes method, this assumes a bimodal histogram. The histogram is iteratively smoothed using a running average of size 3, until there are only two local maxima. The threshold t is such that yt−1 > yt <= yt+1.

Images with histograms having extremely unequal peaks or a broad and flat valley are unsuitable for this method.

Ported from Antti Niemistö's Matlab code. See here for an excellent slide presentation and the original Matlab code.


[edit] Moments

Tsai's method attempts to preserve the moments of the original image in the thresholded result.

Ported from ME Celebi's fourier_0.8 routines [7] and [8].


[edit] Otsu

Otsu's threshold clustering algorithm searches for the threshold that minimizes the intra-class variance, defined as a weighted sum of variances of the two classes.

See also the Wikipedia article on Otsu's method.

Ported from C++ code by Jordan Bevik.


[edit] Percentile

Assumes the fraction of foreground pixels to be 0.5.

Ported from Antti Niemistö's Matlab code. See here for an excellent slide presentation and the original Matlab code.


[edit] RenyiEntropy

Similar to the MaxEntropy method, but using Renyi's entropy instead.

  • Kapur, JN; Sahoo, PK & Wong, ACK (1985), "A New Method for Gray-Level Picture Thresholding Using the Entropy of the Histogram", Graphical Models and Image Processing 29(3): 273-285

Ported from ME Celebi's fourier_0.8 routines [9] and [10].


[edit] Shanbhag

Shanbhag, Abhijit G. (1994), "Utilization of information measure as a means of image thresholding", Graph. Models Image Process. (Academic Press, Inc.) 56 (5): 414--419, ISSN 1049-9652, DOI 10.1006/cgip.1994.1037

Ported from ME Celebi's fourier_0.8 routines [11] and [12].


[edit] Triangle

This is an implementation of the Triangle method:

Modified from from Johannes Schindelin plugin Triangle_Algorithm.

See also: http://www.ph.tn.tudelft.nl/Courses/FIP/noframes/fip-Segmenta.html#Heading118

The Triangle algorithm, a geometric method, cannot tell whether the data is skewed to one side or another, but assumes a maximum peak (mode) near one end of the histogram and searches towards the other end. This causes a problem in the absence of information of the type of image to be processed, or when the maximum is not near one of the histogram extremes (resulting in two possible threshold regions between that max and the extremes). Here the algorithm was extended to find on which side of the max peak the data goes the furthest and searches for the threshold within that largest range.


[edit] Yen

Implements Yen's thresholding method from:

Ported from ME Celebi's fourier_0.8 routines [13] and [14].