IMAGEJ
IMAGEJ
15
in ImageJ
Sean M. Hartig1
1
Baylor College of Medicine, Houston, Texas
ABSTRACT
Image analysis methods have been developed to provide quantitative assessment of
microscopy data. In this unit, basic aspects of image analysis are outlined, including
software installation, data import, image processing functions, and analytical tools that
can be used to extract information from microscopy data using ImageJ. Step-by-step
protocols for analyzing objects in a fluorescence image and extracting information from
two-color tissue images collected by bright-field microscopy are included. Curr. Protoc.
Mol. Biol. 102:14.15.1-14.15.12. C 2013 by John Wiley & Sons, Inc.
BASIC
Image analysis methods are quantitative tools for analyzing fluorescence and bright-field
PROTOCOL
microscopy data. Applications include measurement of gene products as a function of
time or perturbation, tissue architecture, morphometric analysis of organelle features,
tracking of cells, and subcellular trafficking of proteins.
This unit focuses on the basic use of ImageJ, a freeware application available from the
NIH at http://imagej.nih.gov/ij/download.html. It is well-suited for analysis of immuno-
histochemical labeling (UNIT 14.6), localization of fluorescent fusion proteins (UNIT 9.7C),
spectral-imaging from multi-label tissue sections (UNIT 14.19), and images collected by
confocal microscopy (UNIT 14.11). ImageJ is designed to handle various types of image
data across many computing platforms, and has been widely adopted by biologists for its
utility and ease of use. ImageJ is available for Macintosh, Windows, and Linux and runs
as either an online applet or as a downloadable application. Plug-ins that add functional-
ity to ImageJ are available (http://rsb.info.nih.gov/ij/plugins/) with new additions being
added to the library continuously. An image processing package of ImageJ called Fiji,
which comes with added functionality and includes many useful plug-ins by default, has
gained popularity (http://fiji.sc/wiki/index.php/Fiji).
ImageJ can display, edit, analyze, process, save, and print 8-bit, 16-bit, and 32-bit
grayscale and 8-bit and 24-bit color images. Image formats including TIFF, GIF, JPEG,
BMP, DICOM, FITS, and ‘raw’ can be imported and read as single images or stacks. The
Bio-Formats plug-in allows for many additional instrument-specific file formats to be
read, and it also contains intuitive controls for loading and displaying multi-dimensional
data. ImageJ incorporates a number of useful tools for image processing. For example,
ImageJ has a simple background subtraction routine that can reconcile uneven image
backgrounds, and can easily calculate area, pixel value statistics, distances, and an-
gles of user-defined selections. It can also create density histograms and line profile
plots. Standard image processing functions such as contrast enhancement, sharpening,
smoothing, edge detection, and median filtering are supported. It can perform geometric
transformations such as scaling, rotation, and flipping. The program supports any num-
ber of windows (images) simultaneously, limited only by available memory (see below). In Situ
Hybridization
and Immuno-
histochemistry
The functionality of ImageJ is extended by the vast collection of freely available plug-
ins, including the plug-in described below for unmixing commonly used probes in
immunohistochemistry. The term ‘unmixing’ refers to extracting individual spectral
profiles from images, that contain spectrally overlapping mixtures of absorbing dyes
or fluorophores. This unit covers the reliable extraction of data from fluorescence and
brightfield microscopy images, rather than the equipment needed for imaging. Thus, this
unit covers data import, image processing functions, and analytical tools that can be used
to extract information from small microscopy data sets using ImageJ. Several platforms
are available that perform automated analysis of microscopy images for large data sets,
including CellProfiler (UNIT 14.17). Small microscopy data sets are a size amenable to
manual analysis using ImageJ (e.g., <100 images). Large datasets, often acquired by
automated or high-throughput microscopy, are not amenable to manual analysis due to
the volume of collected images (e.g., often >1000 images).
NOTE: A uniform protocol should always be used when acquiring images. Focus, sensi-
tivity, exposure time, and any other experimental conditions should be kept as constant
as possible. Altering any one of these critical parameters during acquisition for some but
not all members of a dataset can result in misrepresentation of data. Altering sensitivity,
for example, could seriously compromise quantitative comparisons of different images.
Materials
Image files: TIFF, GIF, JPEG, DICOM, BMP, PNG, and FITS native formats can
be opened in ImageJ without plug-ins—lossless image formats (BMP, TIFF,
PNG, GIF) are preferred for quantitative analysis; JPEGs are usually
compressed in a way that does not include all of the original data and often
contain spatial and/or chromatic artifacts not present in the raw data
Image types: The bit depth defines the number of gray levels for any image—8-
and 16-bit (unsigned) integer images consist of 256 (0 to 255) and 65,536 (0 to
65,535) gray levels, respectively; 32-bit images use floating-point numbers; for
RGB color images, each pixel is assigned a specific intensity for each of the
three-color channels (red, green, blue); splitting 24-bit RGB images generates
three 8-bit images (red, green, blue)
Download and install ImageJ
1. Download ImageJ (http://imagej.nih.gov/ij/download.html).
Specific details regarding ImageJ installation on Macintosh and Windows are available at
http://imagej.nih.gov/ij/docs/install. The current version of ImageJ is v1.47a (July 2012).
2. Ensure the ImageJ application is not open, then download the Bio-Formats plug-in
(available at http://loci.wisc.edu/bio-formats/imagej). Install the plug-in by navi-
gating to the plug-ins folder located in the ImageJ installation directory using the
computer’s file system manager (i.e., Explorer or Finder), and place a copy of the
downloaded file into this folder.
3. Download and install the PoissonNMF plug-in (available from http://www.mh-
hannover.de/cellneurophys/poissonNMF). Install the plug-in by dragging the link
directly from a Web browser onto the ImageJ toolbar.
The plug-in subsequently appears under the Plug-in menu option.
4. Become familiar with the menu commands. ImageJ and Fiji have identical menubars
Image Analysis and tools that include the following eight items (Fig. 14.15.1):
and Manipulation
in ImageJ
14.15.2
Supplement 102 Current Protocols in Molecular Biology
menubar
tools
Figure 14.15.1 ImageJ (upper) and Fiji (lower) interface running in Mac OS X. The ImageJ and Fiji main
windows contain the toolbar (in Windows and Linux the menubar is contained at the top of this window). The
ImageJ toolbar contains tools for making selections (e.g., Lasso), drawings, zooming and scrolling, etc. The
status bar is located directly below the toolbar. When the cursor is over an image, the status bar displays
pixel intensities and coordinates. The status bar also displays memory in use, memory available, and percent
memory. As selections are created or resized, selection properties (e.g., location, width, etc.) are displayed on
the status bar.
File: Basic file operations (opening, saving, creating new images). Most commands
are intuitive.
Edit: Drawing and editing commands. Global settings, including “memory &
threads” (see below), can be found here.
Process: Image processing, including filters, arithmetic, filters, and point operations.
Plug-ins: Add-ins can be managed here. All user-installed macros, scripts, and plug-
ins can be accessed here.
6. For simple gray-scale images or color images, simply click and drag the image icon
from the Windows/Mac/Linux file explorer window into ImageJ.
7. Select the File−>Open option. In the explorer window, navigate to the file location
to open the image.
In Situ
Hybridization
8. To load multiple image slices in a stack, select File−>Import−>Image Sequence. and Immuno-
Navigate to one of the images in the sequence. A pop-up window will appear allowing histochemistry
14.15.3
Current Protocols in Molecular Biology Supplement 102
Figure 14.15.2 Image display and contrast stretching. After an image is loaded, slider bars in
the B&C window can be used to interactively alter the brightness and contrast of the active image.
The histogram at the top of the window captures the distribution of pixel intensities in the image,
while the overlapping line graph shows how pixel values map to the range of values present in the
image. The two numbers under the plot are the minimum and maximum displayed pixel values,
which define the display range. The Brightness slider modulates image brightness by shifting the
display range. The Contrast slider increases or decreases contrast by varying the width of the
display range. The narrower the display range, the higher the contrast.
you to enter a common string pattern. Any image file with this string pattern in the
current working directory will be loaded as part of an image sequence.
9. Click Plugins−>LOCI−>Bio-Formats Importer. A pop-up window will appear al-
lowing you to specify how the data is visualized and how much of the data is loaded.
This option is specific to ImageJ with the Bio-Formats plug-in and is convenient
for loading higher dimensional data (3-D, time series, multi-color) or images with
uncommon file types.
Image−>Adjust−>Brightness/Contrast
Process−>Subtract Background
Image Analysis Process−>Filters.
and Manipulation
in ImageJ
14.15.4
Supplement 102 Current Protocols in Molecular Biology
Figure 14.15.3 The freehand selection tool (see Lasso). The freehand selection tool uses the cur-
sor to create a user-defined region of interest. Shown are HeLa nuclei stained with 4 6-diamidino-
2-phenylindole (DAPI) to identify nuclei. Microscopy was performed at 20× magnification.
13. Using the Auto selection, ImageJ will automatically scale brightness and contrast
based on an analysis of the image histogram.
This is done by allowing a small percentage of pixels in the image to become saturated.
Lasso
15. In the main ImageJ window, select the Freehand selections tool. Use the lasso tool
to manually draw an elliptical region of interest around one of the cells. This can be
used to circle a clump of cells, a single cell, or a subcellular region like the nucleus.
In Situ
16. Select Analyze−>Measure to take measurements under the manually defined region Hybridization
of interest (Fig. 14.15.3). and Immuno-
histochemistry
14.15.5
Current Protocols in Molecular Biology Supplement 102
Background subtraction
The rolling ball method of background subtraction is commonly used to correct for uneven
backgrounds in an image by subtracting signals at a predefined distance (radius) from the
brightest pixels. The radius should be set to at least the size of the largest object that is not
part of the background. Smaller radius size definitions will subtract foreground signal.
The methods below describe how background subtraction is performed on fluorescence
images using ImageJ. In this background subtraction approach, a background image is
approximated as a smoothed version of the input image, followed by subtraction from
the original image.
17. Load an image (either immunofluorescence, brightfield IHC, or unmixed IHC) into
ImageJ. If the image has multiple color channels, split the channels by running
Image−>Color−>Split Channels. Apply the subsequent steps to each channel.
18. Select Process−>Subtract Background. Make sure Light Background is unchecked
for fluorescence images or checked for brightfield images. Enable the preview and
adjust the rolling ball radius field. Note that the rolling ball radius should be bigger
than the average nucleus’ radius. It may be useful to toggle the Create Background
(do not subtract) option to see what is being subtracted from the image. Finish this
step by unchecking Create Background and then the OK button.
Automated object identification and segmentation
Multicellular images can be segmented into regions of interest using automated ap-
proaches. The thresholding and object detection methods presented below can be used to
segment objects, such as sub-cellular organelles (lysosomes, mitochondria, Golgi appa-
ratus), cells, or clumps of cells. An example of nuclei identification is presented below.
Nuclei are detected by applying a threshold to the image, separating foreground signal
from background signal. Nuclear objects are defined as contiguous sets of pixels. Then,
morphological operations are applied to improve the resulting object quality.
19. Load an image. Perform background correction using the methods described in the
Background Subtraction subsection.
20. Duplicate the image by running Image−>Duplicate. The following operations will
be performed on the duplicate image, leaving the original image untouched.
21. Smooth the image (Process−>Smooth) to prevent noise from being detected.
22. Use a global threshold to distinguish between foreground and background pix-
els (Image−>Adjust−>Threshold). In the Threshold window, choose an automatic
threshold method or use the slider bar to choose a suitable threshold. Many of the
automatic threshold methods work by converting the image into a histogram, where-
upon the software finds a threshold that best separates two distributions of signal
(foreground, background).
In Fiji, locally adaptive thresholds are also available if the image has uneven background
signal, and these can be accessed through Image−>Adjust−>Auto Local Threshold.
However, applying background subtraction before thresholding can oftentimes yield sim-
ilar results.
14.15.6
Supplement 102 Current Protocols in Molecular Biology
Figure 14.15.4 A sample segmentation and feature extraction example in ImageJ. (A) Thresh-
olding was used to distinguish foreground and background pixels. The result is all pixels either set
to black (foreground) or white (backround) to create a binary image. (B) The Analyze Particles
command was used to count and measure properties (features) associated with the binary image.
A report was generated (lower right), which indicates the number of objects identified, object area,
and mean pixel value associated with each object.
objects. Close will perform a dilation followed by an erosion, which removes small holes
in objects.
14.15.7
Current Protocols in Molecular Biology Supplement 102
Segmenting cells from nucleus seeds (optional)
26. Duplicate the nucleus mask image (Image−>Duplicate). Perform subsequent oper-
ations on the duplicated image.
27. Run Process−>Binary−>Voronoi to identify regions around the nuclei. Voronoi
tessellation functions by calculating the centroid of each nucleus, then defining
regions such that any pixel in a region is closest to its defining nucleus centroid.
28. Run Process−>Math−>Multiply, and set the value to 255. Then, invert the image
(Edit−>Invert). Make the image a binary type by Process−>Binary−>Make Binary.
Feature extraction
Images contain millions of pixels, which capture a mixture of spatial information. After
object identification, a manageable number of measurements can be collected from a
particular region of interest. Furthermore, sometimes it is important these measurements
be invariant to the orientation of the region or position in the image, meaning the features
used should be tailored to match to the desired types of analysis. In the example below,
measurement of the fluorescence intensity in each nucleus is desired.
Note that some dyes (e.g., di-aminobenzidine) scatter light, so the Beer-Lambert law
cannot be used to determine concentrations, although it still can be used to enhance the
image for visualization.
32. Load an IHC image into ImageJ using methods described in the Loading Images
section above. Consider a brightfield image (Fig. 14.15.5A, upper left) of a tissue
Image Analysis section from human prostate cancer tissue available from the Human Protein Atlas
and Manipulation
in ImageJ (Uhlen et al., 2005; http://www.proteinatlas.org/images/1/131 A 9 1.jpg)
14.15.8
Supplement 102 Current Protocols in Molecular Biology
Figure 14.15.5 Unmixing multispectral images using the PoissinNMF plug-in. (A) The input into the plug-in is a grayscale
stack, with each slice in the stack representing a different spectral channel. The grayscale stack can be from a plain RGB
image using the methods described in the Approximating the Optical Density/Absorbance in 8-Bit Color Brightfield Images
section. (B) Once the plug-in is initiated, various unmixing parameters can be manually assigned. (C) When the unmixing
routine is executed on the input image, progress windows pop up showing the spectra of the dyes in the image. (D) Images
are displayed as grayscale stacks, with the number of slices matching the user-set number of sources.
37. Use the existing IHC image (Fig. 14.15.5A) processed as described in the Approxi- In Situ
mating the Optical Density/Absorbance in Brightfield Images section. Hybridization
and Immuno-
histochemistry
14.15.9
Current Protocols in Molecular Biology Supplement 102
38. Run Plugins−>PoissonNMF. This plug-in uses non-negative matrix factorization to
unmix an image with X mixed channels into a resulting image of Y sources. So if we
are dealing with hematoxylin- and DAB-stained tissue captured in an RGB image,
three mixed channels can be unmixed into two sources (Neher et al., 2009).
39. When the first Poisson NMF window pops up, enter the number of spectral sources.
For example, if hematoxylin and DAB are being used in IHC, this value should be
2. Click OK.
40. In the second Poisson NMF window, you will be presented with various parameter
options. Once the parameters are adjusted (Fig. 14.15.5B), press Run. Parameters
include:
Subsamples: the plug-in subsamples the data and performs coarse grained analysis
on larger subsets of data, while performing finer-grained analysis on smaller sets.
This is done to speed up the plug-in, and allow it to obtain fine-grained results quicker
than if it were processing all of the data at once.
Segregation bias: when spectra overlap strongly, the NMF solution tends to estimate
narrow spectra and incompletely unmix sources. The segregation bias is a factor
used to counter the overlap of the estimated label distributions.
Saturation threshold: if the signal in any channel at a certain pixel is above this
parameter value, the pixel is excluded. If saturated or nearly saturated pixels are
present, emission spectra are distorted.
Keep spectra fixed: generally, if the spectra are not known in advance, this can be
ignored. If there are some regions in the images that have staining representative
of the dye spectrum (with no other overlapping dyes), a region of interest can be
selected in the image and the plug-in will measure a spectrum in that region, and this
routine will be initialized to this spectrum.
41. Two windows will pop up as the plug-in works to unmix the stains. The PoissonNMF
spectra windows shows the spectra as they are being determined by the plug-in. While
the PoissonNMF is running. . . window is open, the plug-in is operating normally
(Fig. 14.15.5C).
42. Once the PoissonNMF results window opens, the unmixing is complete. The NMF
sources window shows the unmixed channels (Fig. 14.15.5D). The image in the
upper corner is the RGB merge after spectral unmixing of the three channels.
COMMENTARY
Background Information level of individual images, which is appropri-
Continuing developments in auto-focus, ate for most general microscopy data.
image analysis, illumination, and data reduc- Innovations in automated imaging and anal-
Image Analysis
tion/visualization have made microscopy a ysis have enabled image-based screening at
and Manipulation quantitative tool for biology. This unit de- high experimental throughputs in both live and
in ImageJ scribes manual processing in ImageJ at the fixed cell assays (Pepperkok and Ellenberg,
14.15.10
Supplement 102 Current Protocols in Molecular Biology
2006). These approaches combine automated Saturated pixels cause a loss of important
image acquisition and powerful information information
processing strategies, commonly referred to Care must be taken during image acquisi-
as high content analysis (HCA). In general, tion not to acquire too many saturated pixels.
HCA provides significantly more information Saturation occurs when intensities above the
than non-imaging assays by using multiple cameras detection limit are detected. Too much
probes in one assay and allowing the exam- saturation in an image can make it impossible
ination of intact cells. HCA involves probing to make quantitative measurements regarding
cells in microtiter plates or on slides with sin- amounts of probe, as any additional level of ex-
gle or multiple fluorescent markers. Images pression above the saturation threshold is lost.
are acquired with a high-resolution imaging To avoid saturated pixels, parameters such as
instrument for rapid capture of cell images exposure time should be optimized to maxi-
coupled to the extraction of detailed informa- mize the dynamic range of intensity detection.
tion using software platforms like CellProfiler
(Carpenter et al., 2006; Jones et al., 2008). Evaluating segmentation
The use of CellProfiler, in lieu of ImageJ for While object detection methods can be ap-
large datasets, is described in UNIT 14.17. Other plied to a vast number of scales, there is no uni-
platforms that perform high-throughput analy- versal segmentation method. In other words, a
sis of microscopy data include CyteSeer (Vala segmentation routine may work well in one
Sciences; http://www.valasciences.com), the condition, but fail in another case. Therefore,
Pipeline Pilot image analysis toolbox (Ac- it is important for users to evaluate segmenta-
celrys; http://www.accelrys.com), PhenoRip- tion methods. One simple approach to evalu-
per (Rajaram et al., 2012), and Cell-ID 1.4 ate the method consists of manually segment-
(UNIT 14.18). ing the images, and then identifying the num-
HCA allows the consideration of single cell ber of times (1) the automated method agrees
phenotypes based on marker intensity or mor- with the manual method (true positive, TP),
phological features. However, data analysis (2) the automated method identifies a region
and management challenges in HCA are sig- not present in the manual method (false posi-
nificant given the large datasets and the com- tive, FP), or (3) the automated method misses
plexity of feature extraction from images. Al- something (false negative, FN). From this, pre-
ternatives to HCA include enzymatic assays cision (TP/(TP+FP)) and recall (TP/(TP+FN))
(e.g., luciferase, UNIT 9.7B), western blotting can be used to assess performance.
(UNIT 10.8), and flow cytometry. While these
techniques can be highly valuable, they can Troubleshooting
also have limitations in throughput, can dis- Sometimes, image files initially look black.
rupt cell integrity, and be labor intensive. Depending on the bit depth and the contrast, as
well as how the images are loaded, it is some-
times necessary to manually contrast stretch
Critical Parameters the image (see Loading images and Contrast
Image acquisition Stretching).
Image processing and analysis is highly de- In most cases, smaller memory allocations
pendent on image quality. Parameters associ- will work for images requiring less RAM.
ated with image collection should be kept as However, large datasets or images cause some
constant as possible during data acquisition: operations to fail, and it may be necessary to
focus, exposure times, illumination, and back- increase the maximum memory accordingly
ground artifacts. Background signal should be (see step 4).
assessed using negative controls for immuno-
histochemistry (UNIT 14.6) and, when possible, Anticipated Results
individual spectra should be collected for mul- Measurement results displayed in Results
tispectral experiments (UNIT 14.19). Tables can be copied into text files or imported
into Microsoft Excel. Images generated after
Optical density assessment processing can be saved in any of the image
When using IHC images to calculate the formats discussed previously (see Materials).
optical density, the Beer-Lambert law works
best for dyes that absorb light. Concentrations Time Considerations
of dyes (e.g., di-aminobenzidine) scatter light The time to use basic functions described In Situ
and cannot be accurately modeled by the Beer- Hybridization
above is minimal (hours). However, image and Immuno-
Lambert law due to light scattering. processing can be time-consuming if datasets histochemistry
14.15.11
Current Protocols in Molecular Biology Supplement 102
are large. In addition, there are currently >600 separation techniques for the decomposition of
plug-ins available for ImageJ, and many re- multiply labeled fluorescence images. Biophys.
J. 96:3791-3800.
quire an investment of time to both understand
and incorporate into analysis approaches. The Pepperkok, R. and Ellenberg, J. 2006. High-
throughput fluorescence microscopy for systems
use of complex routines or previously pre-
biology. Nat. Rev. Mol. Cell Biol. 7:690-696.
pared plug-ins may take days for the user
Rajaram, S., Pavie, B., Wu, L.F., and Altschuler, S.J.
to be comfortable with application and out-
2012. PhenoRipper: Software for rapidly profil-
put (training or use). Excellent online help ing microscopy images. Nat. Methods 9:635-
(http://imagej.nih.gov/ij/index.html) is avail- 637.
able at the ImageJ Website with several help Uhlen, M., Bjorling, E., Agaton, C., Szigyarto,
menus embedded into the toolbar commands. C.A., Amini, B., Andersen, E., Andersson,
A.C., Angelidou, P., Asplund, A., Asplund, C.,
Literature Cited Berglund, L., Bergstrom, K., Brumer, H., Cer-
Carpenter, A.E., Jones, T.R., Lamprecht, M.R., jan, D., Ekstrom, M., Elobeid, A., Eriksson, C.,
Clarke, C., Kang, I.H., Friman, O., Guertin, Fagerberg, L., Falk, R., Hansson, M., Hedham-
D.A., Chang, J.H., Lindquist, R.A., Moffat, J., mar, M., Hercules, G., Kampf, C., Larsson, K.,
Golland, P., and Sabatini, D.M. 2006. CellPro- Lindskog, M., Lodewyckx, W., Lund, J., Lunde-
filer: Image analysis software for identifying berg, J., Magnusson, K., Malm, E., Nilsson, P.,
and quantifying cell phenotypes. Genome Biol. Odling, J., Oksvold, P., Olsson, I., Oster, E., Ot-
7:R100. tosson, J., Paavilainen, L., Persson, A., Rimini,
R., Rockberg, J., Runeson, M., Sivertsson, A.,
Jones, T.R., Kang, I.H., Wheeler, D.B., Lindquist, Skollermo, A., Steen, J., Stenvall, M., Sterky, F.,
R.A., Papallo, A., Sabatini, D.M., Golland, P., Stromberg, S., Sundberg, M., Tegel, H., Tourle,
and Carpenter, A.E. 2008. CellProfiler Analyst: S., Wahlund, E., Walden, A., Wan, J., Wernerus,
Data exploration and analysis software for com- H., Westberg, J., Wester, K., Wrethagen, U., Xu,
plex image-based screens. BMC Bioinformatics L. L., Hober, S., and Ponten, F. 2005. A human
9:482. protein atlas for normal and cancer tissues based
Neher, R.A., MItkovski, M., Kirchhoff, F., Neher, on antibody proteomics. Mol. Cell. Proteomics
E., Theis, F.J., and Zeug, A. 2009. Blind source 4:1920-1932.
Image Analysis
and Manipulation
in ImageJ
14.15.12
Supplement 102 Current Protocols in Molecular Biology