Spectral unmixing

Color deconvolution

[no download link, this description itself explains the steps to quantify staining in tissue sections]

The Color Deconvolution plugin for ImageJ can be used to digitally separate up to three stains from brightfield images, after which standard ImageJ commands can be used. The algorithm is described in Ruifork and Johnston (2001).

However, it is very important to take into consideration the caveats on the linked URL. In particular, note that:

  • Stain colors depend on numerous factors, such as the precise stains and scanner; therefore, the 'default' stain vectors (used to define the colors) are unlikely to be optimal and may be very inaccurate. See the URL instructions for how to create new stain vectors.
  • Pixel values should be interpreted with extreme caution; in particular, note the warning regarding 'brown' staining that attempting to quantify DAB intensity using this plugin is not a good idea.

Note, the pixel values provided by this plugin are 8-bit and not equivalent to 'optical densities' frequently presented in the literature.

Color deconvolution is particularly helpful in separating stains so that stained regions can be detected (e.g. by setting a threshold), and then the number or areas of stained structures may be quantified. Two potential approaches would be:

  1. If one measurement should be made for the entire image:
    • Image > Adjust > Threshold...
    • Edit > Selection > Create Selection
    • Analyze > Measure
  2. If distinct structures should be measured:
    • Image > Adjust > Threshold...
    • Analyze > Analyze Particles...
has topic
has function

This plugin is bundled with Fiji. For installation in ImageJ1, download from the link below and manually install the class file. 


The colour deconvolution plugin (java and class files) for ImageJ and Fiji implements stain separation using Ruifrok and Johnston's method described in [1]. The code is based on a NIH Image macro kindly provided by A.C. Ruifrok.
The plugin assumes images generated by colour subtraction (i.e. light-absorbing dyes such as those used in bright field histology or ink on printed paper). However, the dyes should not be neutral grey (most histological stains are not so).
If you intend to work with this plugin, it is important to read the original paper to understand how new vectors are determined and how the procedure works.
The plugin works correctly when the background is neutral (white to grey), so background subtraction with colour correction must be applied to the images before processing.
The plugin provides a number of "built in" stain vectors some of which were determined experimentally in our lab (marked in the source with GL), but you should determine your own vectors to achieve an accurate stain separation, depending on the stains and methods you use. See the note below.
The built-in vectors are :

  • Haematoxylin and Eosin (H&E) x2
  • Haematoxylin and DAB (H DAB)
  • Feulgen Light Green
  • Giemsa
  • Fast Red, Fast Blue and DAB
  • Methyl green and DAB
  • Haematoxylin, Eosin and DAB (H&E DAB)
  • Haematoxylin and AEC (H AEC)
  • Azan-Mallory
  • Masson Trichrome
  • Alcian blue & Haematoxylin
  • Haematoxylin and Periodic Acid - Schiff (PAS)
  • RGB subtractive
  • CMY subtractive
  • User values entered by hand
  • Values interactively determined from rectangular ROIs
has function