NIH Image Tutorial

The basic requirements to run the NIH Image program are a Macintosh computer that will support an eight bit color monitor and that has at least 4 megabytes of RAM. The following instructions presuppose basic knowledge of computer operations, such as copying, scrolling, and opening programs. Although the Macintosh programs will work with System 6, we have assumed in writing the instructions and the Lesson Guides that System 7 will be available for most computers.(If you are uncertain of what System you are running, click and hold on the Apple at the top left of the Menu bar. The first line should read: About this Mac. If this does not appear, you are running System 6.)

These instructions are meant only to get you started on the programs. The best way to go through them is with a computer and the CD readily to hand. Complete instructions are included in the documentation files in the Software directory.

NIH Image (for the MAC)

NIH Image was developed by the National Institutes of Health to allow scientists to study medical and biological systems. It has since been adopted for other scientific applications, such as in the Planetary Data Systems CD series. Many of its features are quite specialized but many are similar to standard Macintosh paint programs.

1. Getting started. We suggest that you copy NIH Image to the hard disks of all computers that will be used with the Modules. You will notice that when you copy the programs, NIH Image assumes the name Image. We have provided NIH Image version 1.57 on the SIRCED02 CD-ROM. You will find both a Power PC version of NIH Image 1.57 (PPC) and a version for older Macintoshes (68k) in the Software folder on the CD.

The Lesson Guides presuppose that you have followed the next instructions. We have designed them to make it as easy as possible for you and your students to locate the programs and the images that will be used. You should make aliases of the two principal programs and place the aliases on the desktop (System 7 only). This helps students locate the programs immediately and it also helps keep them from inadvertently crashing the system by poking around looking for the programs. You will notice that the NIH Image icon is a microscope. To make an alias: Click on the name or icon of the program; Go to the Menu Bar; Click on File; Drag the mouse to Make Alias and click. The alias will appear directly adjacent to the icon for the original file. Drag the alias to the desktop. When you double-click on the alias it will open the original file.

2. Opening an image. You also need to place a folder on the desk top labeled Today's Images and copy the images for any module into that folder.

To make a folder: File: New Folder. A new folder will appear labeled "UNTITLED FOLDER". Drag this to the desktop. Click once on its name and wait. A box will eventually appear around it. Type the name Today's Images in the box.

Copy the images in the Module01 folder Images (Documents:Module01.txt:Image) into a temporary folder like Today's Images. Double click on the folder . You should see several image icons. Double click on the icon GalOptic.pic. This will open both the NIH Image program and the image of earth taken from Galileo.

To open a second image File:Open. You will be presented with a window which shows several images. Open as many as the memory can handle. Close them by clicking in the box in the upper left hand corner or by going to File:Close.

3. Image too Large for Screen. Image and screen sizes vary. Some images may be too large to fit on the available screen. In this case, you have two options:

a) You can shrink the image by going to the Menu bar: Options: Scale to Fit Window. Or you may click once in the small box at the top right of the title bar (the bar that says GalOptic.pic).

b) You may prefer to keep the image the same size and move it around on the screen. To do this, go to Tools (on the left hand side of the screen). Click the mouse on (second icon down on the left). Now bring the mouse to the center of the screen, click and hold it, and drag it up and to the left. The image should move with it.

4. Enhancing an image Open TestImag.pic NIH Image displays images as 256 shades of gray or as 256 colors. In either case, each shade or color has its own digital number (DN). Go to the Look Up Table or LUT (left side of screen) and bring the cursor from the bottom of the LUT to the top. Look at the Info window as you do this. (If it is hidden, you may bring it up by clicking on Windows:Info.) You should see the DNs next to the word Values vary from 0 to 255 as you move the cursor up and down the table. Move your cursor around TestImag.pic. This is an image of an area of tropical rain forest in Belize, Central America. Notice that the DNs are very high in the dark portions and they come close to zero in the very light portions. Notice also that the Info window also shows the X and Y coordinates of the tip of the cursor (or the center of the crossbar). This allows you to reference a particular pixel in the image.

Often it is the case that most of the gray shades have DN values bunched together and it is difficult to see much contrast. To see how heavily the pixel values are clustered you may go to Analyze: Show Histogram. You will see a histogram showing the number of pixels that have the DNs from 0 to 255, as below:

Now run the cursor along the base of the histogram and look at the Info window. Notice how the values are clustered between DNs 167 and 187. You will often want to improve the amount of contrast on your images by spreading out the DN values. You may do this in several ways.

Go to Tools and double click on the rectangular selection tool (top right). This selects the entire image (you should see "ANTS" marching around the outside of the image.) Now go to Process: Enhance Contrast. This will change the contrast just a little. Try Process: Equalize. Is there a more dramatic change? Now click on the image. The ants should disappear. Then, go to Process:Apply LUT. Try Analyze:Show Histogram again. Notice how the histogram has changed. NIH Image spreads out the number of pixels allocated to each gray value to make an image easier to read. You may experiment with enhancing contrast by doing several things. Draw out a box (click and hold the mouse as you move down and to the right) in an area where you would like to see more contrast. Look at the histogram before and after you Apply LUT. You may also move the graphic tools around by fooling with the Map at bottom left.

5. Getting back to an original image. Often you will find that you or your student has made undesired changes in an image. You will be happy to know that you will never change the original as stored in the CD. Usually, however, you can redisplay the original image on your disk by going to: File:Revert to Saved. If this does not work, get it from the CD.

6. Finding images to open. Occasionally, you will be in the NIH Image program and you will need to move from one folder to another. For example, you may be in the NIH Image folder and need to get a desktop folder or to the CD. Go to File:Open and this box will come up on the screen:

Notice that there are no choices shown in the window. To find your way to folders which will offer you choices, you should bring the cursor to the arrow next to the words NIH Image, and click and hold. A menu will pop down. Continue to hold while pulling down to the desired folder, such as Today's Images (or you may click on the Desktop icon next to the window). You should see a selection of folders. Continue to open them (double click) until you reach the folder and image you wish. You may have as many images open as you have available memory. An efficient way of viewing several images is to go to Windows:Tile Images or Windows:Cascade Images.

TIFF and PICT. These are the two file formats that are opened directly by the command Open as used in NIH Image. Many other sorts of images can be opened as well, by using the command Import, as you will see later in Module 3 activities.

7. Enlarging an image. Bring up an image, go to Tools, and click on the magnifying glass . Now bring the cursor to a section of the image that you would like to enlarge. Click on that section. You can see the image has enlarged. If you click several times, you will note that the image gets larger and larger until you reach the limit of its resolution. Notice that the pixel itself enlarges. Move the mouse around and verify that the DN remains the same for the entire pixel as it is enlarged.

Returning to the original size. Hold down the Option key on the keyboard as you click in the window or double click on .

Deselecting the magnifying glass. Click on another tool icon to get out of the magnifying glass mode.

8 Changing from grayscale to color Bring up TestImag.pic Go to Options: Color Tables. Move the cursor to the right and click on Fire 1. Then try the other available selections. Select a pixel and check its DN as you go from one Color Table to another. Now bring up EARTHGAL.PIC. Go to Options:Grayscale. Now check the other color tables.

9. Saving changes NIH Image will not save changes to an image unless you tell it to do so. If you would like to save an altered version of the image you have been working with, go to File:Save As. A window will pop up that will ask you to give the file a name and will give you several choices. Name the file and consider where you wish to save. it. You may wish to establish a Desktop folder named Saved Images for students to put their work into. (Click on Desktop on the right of the Image window. Click on Saved Images. Then click on Open. Finally Click on Save.)

Closing images and exiting the program. File: Close and File:Quit. If you have forgotten to save your changes, Image will give you a prompt.

You will discover many features to NIH image as you go along. We urge you to read the documentation (About NIH Image) and to explore the features. If you encounter problems with memory, be sure to read the next section as well as the section in the documentation on memory thoroughly.

* Memory management in NIH IMAGE

Image processing, by its nature, is very memory intensive. Sooner or later you will get a message that memory is low. You will get this message for one of two reasons: there is a problem with "EXTERNAL MEMORY" or a problem with "INTERNAL MEMORY". Dealing with these problems can be extremely frustrating. What follows is first a description of what the various memory terms mean and steps to follow in setting the memory and trouble shooting the problems. Then we will address some common memory messages and give some steps.

1) External Memory We use this term to refer to the amount of memory that the program occupies on your computer when it is open. Typically, when you have a problem with this, either the program won't start up or you will receive the following sort of Memory Message:

Since images tend to be very large, programs that work with them often need to occupy lots of memory. If you have a problem with external memory, you will need to make more memory available to the program or you will need to reduce the amount of memory the program needs. Ideally, you should have at least three times as much memory available for NIH Image as the size of the largest image you will use. However, you can run the program with substantially less. There are a number of steps you should follow.

a) Sometimes there is a simple solution. You may have several other programs open. Close everything that is open but NIH Image. ( You can find out what else is running by clicking and holding on the icon at the top right of your screen., next to the question mark).

b) Sometimes, due to the fact that memory can be "SPLIT" by previous applications, you will need to close everything, restart the computer, and then open NIH Image.

b) You may still have a problem because your computer does not have enough RAM. You can find out how much memory NIH Image is currently using by closing the program, highlighting the Image icon, and going to:

File: Get Info. (If you have clicked on the Alias, you must now click on Find Original and then on File:Get Info again.) You will see two boxes at the bottom:

Suggested Size: 4000K Minimum Preferred Size: 4000K*

* This is called Current Size in some earlier versions of Image

You may change the size of the memory the program requires by changing the number in the Current Size box. You may change this number up or down, according to your needs. Click at the top left of the Get Info window to close it and implement the changes the memory allocation for NIH Image you have made.

2) Internal Memory You will occasionally receive the following message:

We are referring to the Clipboard and Undo buffers when we refer to Internal Memory. Image processing programs have many tools with which you can change the appearance of images that are being displayed. NIH Image keeps a copy of the original image in a buffer within the program, in order to provide you the opportunity to Undo any changes you make. It also keeps space to put items into the Clipboard for standard Copy and Paste operations. If your buffers are too small, you may be unable to complete an operation or, after completing the operation, you may be unable to return to the original image. On the other hand, if you have set the buffers too large, you may receive threatening messages when you open the program. In general, you may ignore the latter.

To set the Internal Memory, do the following. After opening Image you should go to Options: Preferences. Then go to Undo & Clipboard buffer, double click in the box, and change the number. Recall that ideally your buffer should be at least the size of the largest image you are working with (but see below about PICT images). If you are low on RAM, you will not be able to get that high but you will increase what you are able to do by increasing the size of the buffers as much as you can. Then quit and restart NIH Image (you must do this in order for the changes to take effect). Increasing the Internal Memory changes the External Memory requirements. Thus, you should consider whether you will need to increase the Current Memory to get rid of those annoying message boxes. Now, open up the program again. You should now be able to display most images.

3) Typical problems

a) The program won't open. Try:

i) Closing all other applications

ii) Closing all applications and restarting the computer

iii) Reducing Preferred Memory

iv) Running Virtual Memory (Check your System Manual or Control Panels:Memory) for this. If you are able to run virtual memory it will slow your computer considerably but it will allow you to do some things you would not otherwise be able to do.

b) You get messages that your Undo&Clipboard Buffers are too small. You increase their size and you get messages saying "CAN'T ALLOCATE THE UNDO & CLIPBOARD BUFFERS". Neither of these will be a problem if you only wish to look at an image. If you wish to process it you need to increase the size of the Preferred Memory.

c) You changed the size of the Preferred Memory and it hasn't had any effect. Did you close the Get Info box after you typed in the size change? If so, try increasing it again.

d) You open a few images and then run out of memory. Quit NIH Image and increase the Preferred Memory, or decrease the memory allocated to the Undo & Clipboard buffers.

e) You attempt to use one of the Tools and nothing happens. You need to increase the memory allocated to the Undo & Clipboard buffers.

f) The memory seems to have been set right. Then you attempt to open a PICT image that should be 300K in size and you can't open it. PICT images are compressed - that is , they occupy less space when stored on your disk than they do when opened up and displayed In fact, they can occupy as much as 16 times as much memory when they are opened up. if you are having a problem with them, you need to increase the Preferred Memory.

g) Nothing works. Quit the program and go to the beach.

Teacher's Guide Frequently Asked Questions

Converted to the IBM-PC by Al Wong, sirced03@southport.jpl.nasa.gov

Jet Propulsion Laboratory
4800 Oak Grove Drive
Pasadena, CA 91109