1. ImageJ, A Useful
Tool for Image
Processing and
Analysis
Joel B. Sheffield
Temple University
Dedicated to the memory of
Dan H. Moore (1909-2008)
Presented at the 2008 meeting of the
Microscopy and Microanalytical Societies
2. Why Image Processing?
1. To improve the appearance of
the image.
2.To bring out obscure details in
an image.
3.To carry out quantitative
measurements
3. Part I. Introduction to ImageJ
History
Advantages
Resources
Macbiophotonics
Mailing List
Wiki
Burger and Burge
Basic Menu Structure
Part II – Special Issues
Operations on all pixels in an image
The histogram
Brightness
Contrast
Look Up Tables
RGB color
Aspects of Analysis of an Image
Measurement
Calibration
Areas and Densities
Confocal Series
Bandpass Filter
5. ImageJ
• An adaptation of NIH image for the Java platform.
• Can run on any computer systems that can run Java (Sun
Microsystems)
• Open source
• Two powerful scripting languages
– Java Plugins
– Macro Language
• Continual Upgrades
• Active community of several thousand users
6. Resources
ImageJ Web Site http://rsb.info.nih.gov/ij
Macbiophotonics: http://www.macbiophotonics.ca/imagej/
Wiki: http://imagejdocu.tudor.lu/
Burger and Burge (a real book!): Digital Image Processing, An
Algorithmic Introduction using Java; Springer Verlag, 2008
7. Introduction to the Main Menu
Of these, we’ll concentrate on:
– Image
– Process
– Analyze
– Plugins
– Help
13. The Image Histogram
Log Scale
The histogram shows the number of pixels of
each value, regardless of location. The log
display allows for the visualization of minor
components. Note that there are unused pixel
values
14. In this case, the log display indicates that virtually all pixel values are used, even
though they are a small percentage of the total.
15. Brightness Adjustment
The brightness adjustment essentially adds or subtracts a constant to every pixel,
causing a shift in the histogram along the x axis, but no change in the distribution
16. Contrast Enhancement
For contrast enhancement, a lower value, in this case, 88, is set at zero, and a higher
value, 166, is set at 255. The values of each of the pixels are adjusted proportionately.
Note that because of the integer values, not all of the pixel values are used.
17. Look-Up Tables
8-bit images have no inherent color values. We normally assign values to each
of the pixels according to a table. Because of earlier display devices, these
values were shades of gray. As displays improved, it became possible to
assign specific colors to given values. In ImageJ, there are three
representations of LUTs.
18. Since some of these images, such as a fluorescence micrograph are of colored
objects, it is useful to apply a color LUT to match the expected image, or to
enhance it, even if the camera was monochrome.
19. The other way to treat color is to assign a set of 3 values, for Red,
Green and Blue to each pixel. For common color images, each of the
three colors is represented as an 8-bit value.
One can think of a color image as consisting of three planes, one
for each of the primary colors
20. As we move the cursor over different parts of the image, the
color values appear in the status bar of the program.
A color histogram is available,
In the Analyze>Tools>Misc. menu
21. This can be used to correct white balance in micrographs
Select an area that is
to be white.
Determine the
adjustments necessary
for each channel, and
use the RGB Recolor
plugin to balance the
values
Adjust brightness and contrast
22. Conversion to grey scale
Since many operations will work only on grey scale images, it is necessary
to consider how the conversions from color images can be accomplished.
There are two approaches, dependent on the type of image.
The simplest is to select the image, go to Image>type, and select 8-bit, or 16 or 32 bit.
23. However, some images, such as fluorescence micrographs taken as RGB
images, can yield surprises.
The reason that the image is so dark is that the routine averages the three channels
(rgb) to generate the image. Since there is no data in g or b, the values for the red
channel are divided by 3, yielding a dark image.
24. We can overcome this by separating the three channels and discarding those
with no data.
25. Compare the two 8-bit images, after correction for brightness
Because of the reduction in values in the 8-bit conversion, there are fewer values in the histogram.
8-bit Channel separation
26. Color Merge
Many fluorescence images are taken in single channel images which are
often merged to generate a single overlapped image.
Some cameras generate rgb images even of single color fluorescence
In that case, the images have to be converted to 8-bit before processing.
28. The value at any pixel is the sum of all four channels. Remember that the
gray channel actually has values for r,g, and b. These are added to the other
values, and exceed the 255 limit.
Since the image is a composite (i.e. each plane is
represented separately and the images are combined), we
can divide each of the planes, so that the maximum value
of the additions is less than 255. We can then adjust
brightness and contrast to compensate without exceeding
the limit.
34. Image courtesy of Wu Yuhong:
1. It is RGB
2. Low contrast
3. Uneven background (stripes from a scanner)
4. Size is given as 1.54x1.18 inches
35. The goal is to count, and measure the spots.
The approach has to evolve, but here are the essential elements:
1. Since all of the spots appear to be black, color is not significant, and
one can use a monochrome image.
2. The background must be dealt with.
3. The spots need to be discriminated from the background –several
options.
4. We can scan a line across the image, storing the coordinates.
Note the slight rise upwards,
Also the range, from 140-ish to
130 or so for the largest dot.
37. Separate channels, scan each.
red
green
blue
It appears that the greatest difference between the background and the
signal is in the red channel, but there are stripes on the image.
38.
39. we can use the graph of the image to make a rough determination of the
threshold, and then tune it by looking as the selection.
40. But look at these
measurements!
Exclude very small objects by
selecting a size > 10
41. Let’s take a closer look at the original image
Specifically the dimensions as given in the header.
We can see how ImageJ decided on these numbers
by looking at the Image>Properties menu item. Note
that it lists the unit of length as the inch, and the
width of a pixel as 0.001667
Where did that come from? Well, if we look at the
image with another program, IrfanView, or Photoshop, we
will discover that the image is listed as containing 600
dpi. That information is encoded in the tiff header for
the image. It is not listed in jpg versions. So, in its
“wisdom”. ImageJ reads the 600 dpi and calculates the
number of inches that would be taken up by 926 pixels.
Since the original image was obtained from a scanner,
using 600 dpi as a standard, this is reasonable.
42. We can change the unit of length to, say, mm, and the pixel width changes to
adjust. The results of the analysis, then, are presented in mm, rather than inches.*
*We have discovered that the camera we use for micrography also includes a value of 96 dpi in our images, which has to
be corrected. The value of 96 is, we assume, related to print size. At any rate, we have to restandardize each image.