SOFTWARE SOLUTIONS

NIH Image for Alignment of Serial Sections

by David J. Merritt

(Posted June 12, 1998 · Issue 32)

Introduction

An enormous amount of information about cell and tissue structure can be obtained from examining serial sections with the light microscope. But an added dimension can be achieved by capturing a series of aligned serial section images displaying them as animation, giving the impression of flying through the sections.
Figure 1
This can help interpret the structure of a tissue better than examining one section at a time. The procedures, and the Align-at-Capture macro described here, help you align sections (see figure 1) during the image capture process using NIH Image and commonly available hardware.

NIH Image is a public-domain image analysis system for the Macintosh. Users can obtain the source code, as well as compiled versions, from the NIH Image Web site. The program's powerful features enable users to carry out densitometric analysis of gels, count particles, measure structures, and make QuickTime movies from a series of images. By modifying NIH Image source code or writing macros, users can create customized image analysis programs. Many user-contributed macros already exist, and a lively email discussion group allows new users to gain valuable insights about NIH Image and image analysis in general. HMS Beagle has fully reviewed NIH Image.

Requirements

The method described herein requires a microscope-mounted video camera, a frame-grabber card (or the built-in frame grabber found in some Macintosh computers) and NIH Image running on a Macintosh. Many frame grabbers and cameras are compatible with NIH-Image. A Scion LG-3 frame grabber and Cohu CCD camera were used by this author. A second monitor showing the live video signal coming from the camera is useful, though not essential. A TV can be used as a monitor by splitting the signal via a T connector placed in the cable connecting the video camera to the frame grabber. A better solution is to use a video monitor with pass-through signal, which allows you to connect the camera to the monitor, and the monitor to the frame grabber.

The Solution

One of NIH Image's most useful attributes is that its macro language allows users to carry out repetitive or wearisome tasks. Macros are composed of a series of commands based on a Pascal-like programming language. They are created as text files that can be modified and saved from within NIH Image or any word processor. The document Inside NIH Image has useful information about macro programming, and NIH Image: Use in Fluorescence and Confocal Microscopy has many useful tips and macros for light microscopy and image reconstruction.

To obtain the Align-at-Capture macro, select its link and save the page as a text file from within your Web browser. You can then run the macro by opening the text file via the Load Macros command of NIH Image. Align-at-Capture works by rapidly switching the NIH Image active screen window between two sources. One source is the reference image - the last image saved - and the other is the live camera signal. The two images are brought into close alignment by shifting and rotating the specimen stage or the camera mount. Close alignment is obvious when there is minimal movement between the two. With a mouse click, the camera image is saved and becomes the new reference image. This process is then repeated for every image to be captured. The advantage of this method over post-capture alignment is that the operator can assess the accuracy of alignment by choosing any number of characteristics in the sections. Post-capture methods rely on the identification of fiducial points that may be difficult to define, or may not extend through the full series of sections.

Running the Align Macro

The first step is to optimize the microscope and its illumination. It is preferable to optimize image visualization right from the beginning rather than having to repeat the alignment process. Next, launch NIH Image and capture a reference image. As a rule, the Average Frames command, which averages four sequential images, is preferred over the Stop Capturing command, which captures a single frame. Frame averaging eliminates electrical noise originating from the camera, especially if visualization requires an increase in gain. This can be demonstrated by comparing the histograms of an image in which a single frame has been captured with the image in which four frames have been averaged. The averaged histogram is much smoother than the histogram for the single frame.

font SIZE="3">

Once you have captured the reference image, save it as "00" in a folder. Open "00" so that it is the only image open in NIH Image. Load the macro using the "Load Macros" command under the "Special" menu and locate the Align-at-Capture macro text file. Press "A" to start the macro, or highlight the macro under the "Special" menu. The computer monitor will flicker between the saved image and the live image. If you have not moved the microscope stage or camera since capturing the first image, then the apparent movement will be negligible. However, when you move the stage you will see a great difference in the 2 images on the screen. Redirect the light path into the microscope eyepieces and bring the next section into the center of the field of view before returning the light path to the camera. Alternatively, while watching the monitor that displays the live video image, move the microscope stage to bring the next section into the middle of the field of view. Remember to refocus the camera image. Now turn to your computer monitor and shift and rotate the microscope stage or camera until the images are at their closest alignment. This is obvious when there is minimal back, forward or rotational movement on the monitor. When you are satisfied that the alignment is as close as possible and the camera image is in focus, hold the mouse button down to capture and save the image. For the first saved image, a dialog box opens, asking for a folder and filename. Subsequent images are automatically saved to the folder with the filenames 02, 03, 04, etc. To finish capturing your series of sections, click Command. It is best to capture a full series of sections in a single session because it can be difficult to reproduce the microscope and lighting settings precisely. Changes in background lighting are very obvious when sections are animated.

The next step is to view your sections as an animation. Post-processing of your images may be necessary, especially to sharpen the sections. Open all of the sections captured and transfer the images into slices of a stack by clicking on the Windows to Stack command under the Stacks menu. Load the Stacks macros that come with NIH Image and run Sharpen. To reduce the size of your files, you may want to crop your images to include only the region of interest. Make a rectangular selection using the Marquee tool and run Crop and Scale from the Stacks macros. Set scale to 1 if you want to maintain the existing scale and animate the macro from the Special menu. You can change the rate of the animation by pressing a number on the keyboard. To save the animated stack as a QuickTime movie, open your stack and select QuickTime under the Save As menu. Use JPEG compression to compress your files to a size suitable for Web viewing.

The QuickTime movie posterior.mov (325 KB) was created in NIH Image. Some of the images used in this animation (figure 1) are serial transverse sections of the posterior portion of a Trichogramma larva (parasitoid wasp). Constructing the QuickTime movie facilitates visualization of the connection between the midgut and hindgut of this larva.

How It Works

This simple macro makes the live camera image the active window. It then refers back to the reference image, copies it, and pastes it into the camera window. It then repeats the process in a loop, terminating the loop when the mouse button is clicked, whereupon it averages and saves the image. A balance in the presentation time of the reference and camera images was established by using multiple paste and undo commands within the loop. The flicker rate will also vary with the speed of your computer's processor. If it seems too fast for your comfort, try adding another paste command followed by an undo command to slow the cycle. If it is too slow, delete one or more of the paste commands. Visit http://www.apple.com/quicktime/preview/info/what.htm to see more animations created in NIH Image.

Acknowledgements

The original idea for this solution came from Chris Woodcock at University of Massachusetts at Amherst, where we were using the application MegaVision to align and capture serial sections. I also owe a debt to Dave Tieman (Tieman et al., 1986) and others at the State University of New York at Albany who published a seminal paper on the use of computers in 3-D reconstruction. Thanks to Anthony O'Toole for aligning and capturing the sections of the fly nervous system.


Tell us about your experiences with this software.

Previous Software Solutions Articles
Tracking Moving Fibroblasts across Multiple Fields of
View with Image-Pro
Jonathan D. Byrd, Chad A. Wyckoff, Leslie A. Cary, Kenneth J. Karcich,
Jun-Lin Guan, and Robert D. Frisina
(Posted May 15, 1998 · Issue 30)
Differential Equations with pro Fit
Kurt Sutter
(Posted April 17, 1998 · Issue 28)
Getting Lecture Notes Online with Documentation Studio
Dylan Bulseco
(Posted March 6, 1998 · Issue 26)
Minimal Models for Glucose and Insulin Kinetics with MLAB
Gary D. Knott
(Posted January 9, 1998 · Issue 23)
Automated Analysis of a Fluorescent Assay for
Nitrite with Microcal Origin and LabTalk
Dylan Bulseco and Christopher Schonhoff
(Posted December 5, 1997 · Issue 21)
Protein Shape Dynamics with Proteinmorphosis
by Yu Yi
(Posted October 31, 1997 · Issue 19)