21 October 2005

How to Analyze Digital Images

Forrest M. Mims III, Editor

If you own a digital camera or scanner, you can soon begin doing some serious science. In this article I will show you how to transform photographs of clouds, the sky, soil, leaves, twilight glows, tree rings and countless other subjects into scientific data. Your camera does not have to be particularly fancy. I have published a scientific paper based on an analysis of images made with an old 1998 Fuji with only 1.3 megapixels resolution (F. M. Mims III, Solar aureoles caused by dust, smoke and haze, Applied Optics 42, 492-496, 2003.)

You do not even need a camera to perform many kinds of image analysis. For example, if you want to analyze images of sunspots, clouds, and a huge variety of microbes, plants and animals, you need only have access to the web. You can then download countless public domain images to analyze and study.

When you are equipped with a set of image files, you are nearly ready to do science as sophisticated as any professional scientist equipped with a $5,000 professional camera and a big government grant. All you need is a software tool to analyze your images.

Most people who own a digital camera have at least some experience with software that enhances their photographs. Such software is increasingly common and relatively powerful. Photos can be retouched with a few mouse clicks. Contrast, exposure level, lighting and hue can be quickly adjusted for optimum conditions. While image processing software might be important to your science, you need another kind of software to analyze your images.

Image Analysis Software

Retouching scientific photographs is a touchy subject, especially when changes and adjustments are not explained in articles and papers that use such images. Failing to fully explain enhancements and other changes in scientific photographs can even result in charges of scientific misconduct. While enhancing photos certainly has a role in science (when the enhancement is disclosed and explained), there is another kind of image software that is much more important to many scientists.

Instead of manipulating images, these programs analyze the information in images and provide a range of outputs. These sophisticated software packages can count blood cells, delineate tree rings, calculate the area of an object, superimpose plots of light intensity over a scene and so forth.

Image analysis software has become increasingly important to my research, including a long term photography record of the solar aureole, the bright light that appears around the sun. Haze, dust and smoke can have a significant effect on the size and intensity of the solar aureole. Image processing software can analyze the aureole and permit the dominant kind of aerosol to be inferred.

I also study annual growth rings in trees. This has become a fairly major project, and the front porch of the little farmhouse from which this article is being typed is stacked with tree trunks and branches from the baldcypress and pines that are of special interest. One purpose of the tree ring project is to compare the growth of certain trees with my long term measurements of atmospheric conditions since 1990. Another is to identify possibly novel phenomena, including the asymmetrical deposition of tannin in conifer branches. Image analysis software has become crucially important to this project.

Sometimes I use image processing software to alter a photo that is then scrutinized by image analysis software. This is done for various legitimate reasons. One reason is to improve contrast so the analysis program can better identify changes. Another is to convert an image from color to monotone, a necessity for programs with features that work only with gray scales. Of course any artificial enhancement must be explained should a scientific publication flow from the results.

ImageJ, a Free and Powerful Image Analysis Program

Image analysis programs can be much more expensive than common image processing software. That's probably because the market is a good deal smaller.

Fortunately for amateur and professional scientists alike, this situation changed dramatically with the introduction of ImageJ, a powerful image analysis package written by Wayne Rasband at the National Institutes of Health (NIH). ImageJ is an open source program available to anyone. The program is written in JAVA and can be run on Microsoft, Linux and Macintosh operating systems that have a virtual JAVA engine.

ImageJ can be downloaded from the ImageJ homepage. Before downloading the program, be sure to review the various ImageJ pages and links to become acquainted with the program and to make sure it will run on your system. This step will also impress you with some of the program's applications.

Running ImageJ

Image J has a very simple command window for an image analysis program. When the program is selected, a small, rectangular window appears on your monitor. This serves as a tool box that includes a set of menu options and over a row of icons as shown in Fig. 1.


Figure 1. The ImageJ menu window.

The tiny toolbox window is deceptively powerful. You can access the toolbox in an instant simply by clicking on the ImageJ box in your tool bar. The ImageJ toolbox will then appear on the page you are currently working on, as it did as shown in Fig. 2 while this article was being prepared.


Figure 2. The ImageJ menu window can be made to appear virtually anywhere and
dragged around to a convenient location.

It is impossible to cover all of the many features of ImageJ in this brief article. So let's look at a few specific applications.

Analyzing the Solar Aureole

Figure 3 is a color image of the solar aureole made at the field I call Geronimo Creek Observatory on 25 September 2005. This image was made by pointing the camera at the sun until the sun was centered in the viewfinder. This is done by allowing the light from the viewfinder to shine on a white card behind the camera. When the sunlight projected by the view finder onto the card matches the position of the view finder on the shadow of the camera, the camera is pointed directly at the sun.


Figure 3. Color image of the solar aureole photographed from Geronimo Creek
Observatory on 25 September 2005.

Warning: Never attempt to look at the the sun through a camera view finder! This is very dangerous and may cause permanent damage to your eye.

With the camera lens set at infinity, a black ball slightly larger in diameter than the camera lens is held in front of the camera lens by means of a piano wire. When the shadow of the ball falls directly over the lens, the shutter is snapped.

While ImageJ can analyze certain features of the image in Fig. 3 in full color, the image was converted to monotone for the analysis described next.

First, I used the ImageJ toolbox to open the selected monotone image, which quickly appeared on the monitor. The task bar along the bottom of the monitor then showed two ImageJ buttons. The toolbox was indicated by a button with a microscope icon. The selected image was indicated by a second button with a microscope icon and the first 19 characters of the image's file name. Since I wanted to analyze the image, I clicked on the microscope icon. The ImageJ toolbox appeared on the image.

Figure 4 shows the black and white monotone image with a superimposed histogram. The histogram was generated almost instantly from the ImageJ toolbox and was dragged to where it is shown here.


Figure 4. Monotone version of Fig. 3 with an intensity histogram generated using ImageJ,
an open source image analysis program.

Figure 5 shows a 3-dimensional surface plot of the image quickly generated by the toolbox. This provides a 3-D visualization of the intensity of the aureole around the sun. Visualizations like this are powerful tools for displaying and helping understand phenomena like the solar aureole.


Figure 5. Surface plot of a monotone version of Fig. 3 generated by the ImageJ program.

Figure 6 shows an intensity plot across the center of the solar aureole made with the toolbox. The vertical axis (y) is linear with respect to the brightness of the sky. This is the kind of plot I use to find data about the nature of the aerosols that cause the aureole. For example, dust causes a much more sharply defined aureole than smoke and haze. The aureole shown in Fig. 6 is fairly small and is caused by haze.


Figure 6. Intensity plot across the solar aureole in Fig. 3 generated by the ImageJ program.

Analyzing Tree Rings

Annual growth rings in tree trunks and branches are significantly influenced by rainfall and sunlight. They are generally wider during wet years.

Figure 7 is an intensity scan across the sanded and polished rings of a large baldcypress (Taxodium distichum). The tree was downed by a major flood along the Guadalupe River in Texas on 4 July 2002. The horizontal (x) axis is the scan across the growth rings. The vertical axis (y) is the brightness of the wood at each point in the scan.

Figure 7 clearly shows the annual growth rings. Wide rings are associated with wet, El Niño years. This figure is very typical of single axis intensity scans produced by image analysis programs like ImageJ. An annotated version of this scan has been prepared for publication in a scientific paper.


Figure 7. Scan of the annual growth rings of a branch from a baldcypress tree (Taxodium distichum).

Analyzing Colonies of Bacteria and Molds

Figure 8 is an array of 3M Petrifilm nutrient media films designed to culture bacteria (left 4 films)and fungi (right 4 films). These films were exposed by my daughter Sarah Anna Mims when she first verified her discovery that biomass smoke is loaded with living microbes (Sarah A. Mims and Forrest M. Mims III, Fungal spores are transported long distances in smoke from biomass fires, Atmospheric Environment 38, 651-655, 2004). The upper row of films was exposed to smoke from burning grass (note the black ash). The lower row of films was exposed to nearby clean air for the same length of time. Clearly, the upper row of films has many more colony forming units (CFUs) than the lower row. (The fungi CFUs at lower right are much larger than those at upper right because there are so few of them.)


Figure 8. Color image of an array of Petrifilm nutrient media films exposed by Sarah Anna Mims to smoke (upper row) and clean air (lower row) while verifying her discovery of living microbes in biomass smoke. The 4 films at left are for bacteria and the 4 at right are for molds.

Various kinds of enhancement and analysis can be used to study the Petrifilms exposed by Sarah. Figure 9 shows a contrast-enhanced view of a monotone version of Fig. 8 that makes the CFUs stand out more.


Figure 9. Contrast-enhanced, monotone view of the color image in Fig. 8 that emphasizes the bacteria and fungi colony forming units (CFUs).

Figure 10 shows the contrast enhanced view with added edge enhancement. This step makes the ash from the smoke more obvious. For more information about Sarah Mims's discovery see NASA's "Smoke's Surprising Secret" and the 2005 Popular Mechanics Breakthrough Awards.


Figure 10. This is an edge-enhanced view of Fig. 9 to emphasize the presence of the ash in the Petrifilms exposed to smoke (upper row).

Conclusion

This article in only a very brief introduction to the amazing power of modern image analysis software. ImageJ is open source and free. It can be used with countless scientific images available on the web. You can begin using this powerful program to analyze images only minutes after you download and install it.

Hopefully this article will encourage student and other amateur scientists to become familiar with ImageJ and to use it to perform serious science. Be sure to acknowledge ImageJ and the source of any images from the web that you analyze. A reference to this article will also be appreciated.

Should you find an interesting application for ImageJ or use it in a student science fair project or adult amateur science project, please send a description of your project to "Backscatter" department of The Citizen Scientist. Articles about ImageJ applications will also be considered. Send your proposal to the editor.


   
Copyright 2005 by Society for Amateur Scientists