Auto Local Threshold

Revision as of 12:55, 15 April 2009 by Landini (talk | contribs) (New page: {{Infobox Plugin | software = ImageJ | name = Auto Local Threshold | author = Gabriel Landini, plus others (see below) | maintainer ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Auto Local Threshold (ImageJ)
Author Gabriel Landini, plus others (see below)
Maintainer Gabriel Landini (G.Landini at bham. ac. uk)
File included in Auto_Threshold.jar
Source (1 file)
Latest version v1.7 (14 April 2009)
Development status active


Purpose

This plugin binarises 8-bit images using various global (histogram-derived) thresholding methods.


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 Local Threshold.

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

Use

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

The radius sets the radius of the local domain over which the threshold will be computed,


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).

Special parameters 1 and 2 sets specific values for each method. Those are detailed below for each method.

It you are processing a stack, one additional options is available: Stack can be used to process all the slices.


Available methods

Try all

Which method segments your data best? You can attempt to answer this question using the Try all option. This produces a montage with results from all the methods, so one can explore how the different algorithms perform on an image or stack.

Epith.png

Original image


Epithm.png

Try all methods.

When processing stacks with many slices, the montages can become very large (several 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 stack montages.

Bernsen

Implements Bernsen's thresholding method. Note that this implementation uses circular windows instead of rectangular in the original.

Parameter 1: is the contrast threshold. The default value is 15. Any number different than 0 will change the value.

Parameter 2: not used, ignored.

The method uses a user-provided contrast threshold. If the local contrast (max-min within the radius of the pixel) is smaller than the contrast threshold, the pixel is labelled can be found in Venkateswarluh and Boyle. The threshold is set at the midgrey value (the mean of the minimum and maximum grey values in the local window). If the local contrast (max-min) is below a certain contrast threshold the neighbourhood is considered to consist only of one class.

if ( local_contrast < contrast_threshold )
 pixel = ( mid_gray >= 128 ) ? object :  background
else
 pixel = (pixel >= mid_gray ) ? object : background


  • Bernsen, J (1986), "Dynamic Thresholding of Grey-Level Images", Proc. of the 8th Int. Conf. on Pattern Recognition

Based on ME Celebi's fourier_0.8 routines [1] and [2].


Mean

This selects the threshold as the mean of the local greyscale distribution. A variation of this method uses the mean - C, where C is a constant.

Parameter 1: is the C value. The default value is 0. Any other number will change its value.

Parameter 2: not used, ignored.

Median

This selects the threshold as the median of the local greyscale distribution. A variation of this method uses the median - C, where C is a constant.

Parameter 1: is the C value. The default value is 0. Any other number will change its value.

Parameter 2: not used, ignored.


MidGrey

This selects the threshold as the mid-grey of the local greyscale distribution (i.e. (max + min)/2. A variation of this method uses the median - C, where C is a constant.

Parameter 1: is the C value. The default value is 0. Any other number will change its value.

Parameter 2: not used, ignored.



Niblack

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 [3] and [4].


Mean

Uses the mean of grey levels as the trhreshold. 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


MinError(I)

An iterative implementation of Kittler and Illingworth's Minimum Error thresholding. This seems to be more converge more often than the original implementation.

Nevertheless, sometimes the algorithm does not converge to a solution. In that case a warning is reported to the log window. 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.


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.


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 [5] and [6].


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.


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.


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 [7] and [8].


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 [9] and [10].


Triangle

This is an implementation of the Triangle method:

Incorporated 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). The algorithm was extended to find out on which side of the max peak the data goes the furthest, and searches the threshold in largest range.


Yen

Implements Yen's thresholding method from:

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