Colour Analysis Tools in ImageJ PDF
Colour Analysis Tools in ImageJ PDF
.
Colour Analysis Tools in ImageJ 11 July 2007
Jacqui Ross
Digital Images
= arrays of pixels (picture elements). Each has a value and is made up of bits (8bit, 12bit, 16bit)
RGB
= Red Green Blue
Starts with black and as colours are added, the amount of emitted light is increased (i.e. additive
colour) = Red, Green and Blue « channels » with pixel values for every pixel in each channel
= colour digital cameras, computer display, etc.
For example, for a 24bit colour image, white = R255, G255, B255; black = R0, G0, B0.
Pure red = R255, G0, B0, green = R0, G255, B0, blue = R0, G0, B255.
All other colours are displayed by varying these pixel values.
HSB/HSV
= Hue Saturation Brightness/Value
Each colour shade (hue) has a value.
Saturation is equivalent to intensity, Brightness/Value relate to lightness.
Work in combination. Relates to RGB values.
CIE Lab
= Luminance (L) and two colour components (a, b) which work in an opposing way.
Attempts to approximate human vision, therefore has a larger colour gamut.
L* = 0 = black
L* =100 = white
YUV
= Luma or brightness (Y) + colour signal (U, V combined)
Used for analog TV for creating the picture, e.g. NTSC, PAL, SECAM formats
CMY(K)
= Cyan Magenta Yellow
Starts with white and as colours are added, the amount of absorbed light is increased (i.e.
subtractive colour).
= for pigments, printing, etc.
M + Y = red
C + Y = green
M + C = blue
K (black) is added to improve black since C + M + Y is not true black.
Colour Segmentation
2
• Colour Deconvolution
• 3D Color Inspector
Colour Histogram
http://rsb.info.nih.gov/ij/plugins/color-histogram.html
Gives you histograms of R, G, B values and mean pixel values in a Results table. Works on the
whole image and ROIs.
RGB Recolor
http://rsb.info.nih.gov/ij/plugins/recolor.html
Allows linear alteration of the colors in R, G and B channels of RGB images, where:
New color = Old Color*Scaling Factor + Constant
If the new color is greater than 255 it is set to 255. If it is less than 0 it is set to 0.
3
RGB Measure
http://rsb.info.nih.gov/ij/plugins/rgb-measure.html
Gives you measurements of R, G, B values. Also gives you any other measurements (in R, G, B
channels) as selected in Analyze – Set Measurements, e.g. area, median, min, max, etc. Works on
the whole image and ROIs.
Plugins – RGB Measure
4
Color Profiler
http://rsb.info.nih.gov/ij/plugins/color-profiler.html
A useful tool to determine proportions of R, G, B in the image. Provides a plot of intensity for each
channel as well as tabulated results.
5
Threshold Colour
http://imagejdocu.tudor.lu/imagej-documentation-wiki/plugins/threshold_colour
This plugin is designed as a filter to either pass or stop parts of the image being displayed
depending on the settings you have selected.
You can choose to see the original image or alternatively select threshold to see your selection in
black on white.
There are 4 colour modes available; HSB, RGB, CIE Lab and YUV.
If you find it useful, you can convert your image using additional plugins such as the
Color Space Converter
HSB
Example 1: Haematoxylin & Eosin stained skin section
You can see a number of peaks present in the Hue histogram. The ones to the right represent the
purple/pink colours present in the image. The green one represents the background which is not
totally white.
6
Change Pass to Stop to see the other colour (purple). This allows you to check the segmentation.
You can also change between Original and Filtered.
7
Example 2: DAB/Nissl stained brain section
HSB is a good colour mode to use for DAB because it is often quite dark (saturated) in comparison
with the counterstain used (e.g. Nissl, Haematoxylin) so it’s easier to segment out. In addition,
although DAB has a strong blue component, the hue is quite different from the counterstain.
You can use the Colour Space Converter first to see whether HSB shows the components you
want to separate as distinct.
You can then choose to use the original image for segmentation or the newly converted image.
8
Look at the histograms. If there are a number of peaks present in the hue histogram, it will be
easier to segment the image.
9
Segmentation of Nissl staining
Passes all
Passes all
10
Click on Threshold to get a black/white representation. This is still an RGB image. If you want to
keep it for analysis, RHS mouse click and Duplicate, Rename and save. This is the segmented
Nissl image.
You can binarise the segmented image by going to Image – Process – Make Binary.
11
You can then create masks/selections for the ROI Manager by going to the Edit menu, e.g. Edit –
Select – Create Selection and then Edit – Selection – Add to Manager. The ROI Manager will then
open and add the selection as a ROI.
Click on Original and turn off Threshold to begin segmentation of the DAB staining.
12
Segmentation of DAB staining
You could start by changing Pass to Stop (Hue histogram). This will stop the Nissl staining coming
through. All other hues will pass which means we now see the DAB staining.
Adjust the Saturation and Brightness sliders until only the DAB staining shows through.
13
Click on Threshold.
14
RHS mouse click, Duplicate, Rename, Binarise (Process – Make Binary) and save.
Note that for measuring areas/particles, etc. of binarised images, it is the black area (on white) that
is measured as the object of interest.
15
16
Colour Deconvolution
http://imagejdocu.tudor.lu/imagej-documentation-wiki/plugins/colour_deconvolution
http://www.dentistry.bham.ac.uk/landinig/software/cdeconv/cdeconv.html
Theory: http://home.planet.nl/~ber03728/4N6site/improc/decoplugin/decoexpl/p01.htm
Histological stains are “light absorbing dyes” so can be considered as being subtractive colour.
Requires neutral background to work properly. Vectors need to be worked out from single-stained
control slides or from ROIs where you can be confident that only one stain is present. The vectors
are determined from the optical density of these areas and then normalised.
17
Using built-in vectors
Select the vector you want which most closely resembles your image (e.g. H & E), show matrices
and click OK.
If there are only 2 colours present that you want to separate, (as in this case Haematoxylin from
Eosin), then the result should be one image of each corresponding to the individual stain and
another one which is white. You also get a log file and the matrix data. The values have been
determined experimentally by the lab group of the person who has developed this plugin.
18
Developing your own vectors experimentally
Create one control slide for each individual stain. You then determine the vectors for each stain
using the ROI. You can then combine the vectors to get the matrix to apply to the dual/triple stained
slides.
3D Color Inspector
http://rsb.info.nih.gov/ij/plugins/color-inspector.html
http://www.f4.fhtw-berlin.de/~barthel/ImageJ/ColorInspector//help.htm
Allows you to change the colour display and save a modified image.
By changing the colour rotation (or other attributes), you can improve contrast which may make
segmentation easier.
19
You can also do simple colour segmentation within 3D Inspector as shown below:
Or segment the modified image using other plugins, e.g. Threhold Colour.
20
21
Image Correction Tools
Calculator Plus
http://rsb.info.nih.gov/ij/plugins/calculator-plus.html
Uses image and blank image together with a multiplication factor of 255 as shown below:
Shading Corrector
http://rsb.info.nih.gov/ij/plugins/shading-corrector.html
Works only on 8 bit images. Requires a blank image also as for Calculator Plus.
Colour_Correct
Available at: http://www.dentistry.bham.ac.uk/landinig/software/software.html
22
Does not correct for uneven illumination but compensates for inadequate lamp temperature by
allowing the setting of “black” and “white” points.
Background Correction
Grayscale fluorescence 8bit images only at the moment. Corrects for uneven illumination.
http://rsb.info.nih.gov/ij/plugins/background.html
More….
If you want to read more about image correction for brightfield microscopy, go to:
http://imagejdocu.tudor.lu/imagej-documentation-wiki/how-to/how-to-correct-background-
illumination-in-brightfield-microscopy
Don’t forget to use these tools if necessay, e.g. Process – Enhance contrast or Median or Unsharp
Mask filter, to improve ability to segment the colours.
Acknowledgements
Thanks to the following people for providing images or slides:
Lorraine Rolston
Brent Beaumont
Ursula Byrne
Claire French
Suzanne Reid
Susanne Franke
Thanks also to Dr. Gabriel Landini (School of Dentistry, The University of Birmingham, for
clarification of the Colour Deconvolution plugin.
23