Title :IMAGE Version 1.03 Keywords :Image Processing Computer :MACII Operating System :Mac Programming Language :Pascal Hardware Requirements :8 bit Video Author(s) :Wayne Rasband Correspondence Address :National Institues of Health :Bldg 36, Room 2A-03, Bethesda, Md.20892 :BITNET:WSR@NIHCU Documentation: Image Version 1.03 Introduction 2 System Requirements 2 Menus 2 File Menu 2 Edit Menu 6 Options Menu 7 Functions Menu 11 Analysis Menu 13 Font and Style Menus 16 Tools 17 Windows 20 Image Windows 20 Gray Map 20 CLUT 21 Histogram 21 Results 21 Upcoming Features 22 File Formats 22 Program Limitations 24 New Versions and Bug Reports 24 Introduction Image is a program for the Macintosh II for doing digital image processing and analysis. It can acquire, enhance, measure, edit, animate, print and pseudocolor images. It reads and writes TIFF and PICT files, providing compatibility with many other Macintosh programs, including ImageStudio, PixelPaint, and Digital Darkroom. It supports many standard image processing functions including histogram equalization, contrast enhancement, density profiling, smoothing, sharpening, edge detection, and noise reduction. It can measure lengths and x-y coordinates, and compute the average density and area of user defined regions of interest. Length and area measurements results can be calibrated to provide real world values. Density calibration can be done against radiation or optical density standards using any user specified units. The user can select from any of eight different curve fitting methods for generating calibration curves. It provides MacPaint-like editing of color and grayscale images, including the ability to draw lines, rectangles, ovals and text. It can flip, rotate, invert and scale selections. It supports multiple windows and 8 levels of magnification. All editing, filtering, and measurement functions operate at any level of magnification and are undoable. It uses digital halftoning to print images on PostScript printers and Floyd-Steinberg dithering for printing on non-PostScript printers. It supports the Data Translation QuickCapture frame grabber card for digitizing images using a TV camera. Acquired images can be shading corrected and frame averaged. System Requirements For full operation, Image requires a Mac II with at least 2 megabytes of memory, but 4 megabytes, or more, is recommended for doing animation, for simultaneously displaying more than a handful of pictures, for running under MultiFinder, or for doing frame averaging. Image also requires an 8-bit video card capable of displaying 256 colors or shades of gray. Image supports film recorders, PostScript laser printers, and the Tektronix color printer. File Menu New Newly created windows are filled with the current background color. The default size is 600 pixels wide and 512 pixels high. This can be changed in the More Options dialog box. Open You can open three types of files: 1) 4-bit and 8-bit gray scale TIFF files, of type RTIFFS, created by many other Mac programs, including Image Studio, Digital Darkroom, and many scanner programs. 2) PICT files, of type RPICTS, created by many Mac programs, including MacDraw, Digital Darkroom, and PixelPaint. Hold down the Option key if you want to use the current palette to display the PICT file. 3) The Image picture file format(RIPICS), which is unique to the Image program. These files can no longer be written by Image, since the IPIC format been replaced by the TIFF. Import Opens files created by the IBM-PC based MCID image analysis system from Imaging Research. These files are expected to be of type TEXT (actually, they are binary files) and to contain the line width(less one) in the first 16-bit word and the number of lines(less one) in the second 16-bit word, immediately followed by the pixel data in row order. The width and height are stored in Intel byte order, which is the opposite of the normal 68000 byte order. Eventually, the Import command will be expanded to support additional file types. Close Closes the currently active image, Plot, or Histogram window, i.e., the one with the highlighted title bar. Save Resaves the currently active image to the disk. In the case of a newly created window, you will be prompted for a name. Files are resaved in their original format. In other words, files in TIFF format are resaved in TIFF format, and files in PICT format are resaved in PICT format. Save As TIFF Saves the currently active image to a file in TIFF format. You will be asked to enter a name for the new file. Changes to Save Selection As TIFF if a rectangular selection is active, allowing you to save a subsection of the image. TIFF is the default file format in Image and is the best format for saving digitized or scanned images. Save as PICT Saves the currently active image to a PICT file. PICT files can be exported to many other Mac programs, including PixelPaint, Digital Darkroom, SuperPaint, and MacDraw. PICT files also have the advantage of being more compact if the image contains large areas of uniform density, which is typical of computer generated images. Changes to Save Selection As PICT if a rectangular selection is active. Save Preferences Saves(as a resource in the Image application file) the current state of the following Image program parameters: % Foreground color % Background color % Brush size % Smudger diameter % Airbrush diameter % Color Look-Up Table mode % Color palette position and width % Text attributes, including font, size, style, and justification % Extra colors % Invert Video switch % Measurement Options % Profile Plot Options % Frames averaged by Average Frames command % Size of image created by New command Revert to Saved Reverts to the most recently saved version of the file, effectively undoing all changes made since the last Save command. Duplicate Creates a new window the size of the current rectangular selection, copies the selection to the new window, and then makes the new window the active window. The entire image is duplicated if no selection is active. Get Info Presents up the following window with contains information about the status of the system and of the currently active picture window. Halftone Options Allows you to specify how halftoning is done on the LaserWriter or other PostScript printers. Halftoning is a technique which allows gray-scale images to printed on a device whose pixels can only be black or white. This is accomplished by dividing the printer pixels into small groups(or cells) according to some pattern(called the halftone screen). Within each cell, a dot is drawn whose size is proportional to the gray level of that part of the image. A screen frequency of about 50 halftone cells per inch, providing a cell size of 6 x 6 pixels, is optimum for a 300 dots per inch laser printer. Page Setup Lets you specify printing orientation (portrait or landscape) and scale (25% to 400%). The quality of density profile plots and calibration plots will be better if you leave the scale set at 100% and enlarge the plot widow before printing the plot. Print This command lets you print images, plots, histograms, and the results of measurements. What gets printed is determined by which window is active at the time. The print command changes (e.g, Print Image, Print Plot, etc.) depending on which window is active. Print Image - Prints the currently active image on PostScript printers using halftoning to simulate gray levels. Any colors are converted to shades of gray(using the equivalent of the Apply Lookup Table command). For higher quality text and line drawings, hold down the Option key at the start of printing, and laser printing will done using bitmap smoothing instead of halftoning. Color printing is supported on the Tektronix 4693D color printer and similar printers. If you have made a rectangular selection, only the selection will be printed. Use the Dither command to simulate shades of gray when printing on other than PostScript printers. Print Plot - Prints the current density profile or calibration plot. The size of the printed plot is proportional to the size of the plot window. Print Histogram - Prints the contents of the histogram window. Print Readings - Prints the results of measurements made with the Measure Command. The Print Readings is available when you have used the Measure command at least once and the results window is active. Print Lengths - Prints the results of length measurements made with the ruler tool. This command is available when the results window is active and you have made at least one length measurement. Print Points - Prints the X-Y coordinate pairs resulting from using the point measurement tool. This command is available when the results window is active and you have recorded at least one point. Load Palette You can open two kinds of palette files: 1) The standard Image pseudocolor palette, of type RICOLS, which are limited to a maximum of 32 colors, and are unique to the Image program. Pseudocolor palette colors can be edited using the eyedropper tool, and the number of colors can be changed using the Set Number of Colors command. 2) Palettes created by the PixelPaint program, of type RPX05S. PixelPaint has a powerful palette editor which can be used to create palettes with up to 256 colors or gray levels. Save Palette Saves the current pseudocolor palette, including its position and width, to a file. Edit Menu Undo Reverses the effect of the last editing or filtering operation. When using the Measure command, Undo deletes the most recent measurements. Cut Copies the contents of the current selection to the Clipboard and then fills the selection with the current background color. Copy Places a copy of the contents of the current selection on the Clipboard. You can use the eyedropper tool to copy colors from the CLUT window to the Clipboard. Copy and Paste of colors is limited to pseudocolor palettes. Copy will also copy the entire contents of the CLUT, Plot, or Histogram window to the Clipboard if one of these is the active window. Paste Displays the contents of the Clipboard in the currently active image window. The pasted object is automatically selected, allowing you to move it by clicking on it and dragging. With rectangular objects, hold down the Option key and drag to expand or contract the selection. You can also use the paste command to paste colors copied with the eyedropper tool back into the CLUT window. Clear Erases the current selection using the current background color. The Delete key(or Backspace key on the small keyboard) is a handy shortcut for this command. Fill Fills the current selection with the current foreground color. You can change the color after the selection has been filled by clicking in the CLUT window. The entire image window is filled if no selection is active. Invert Inverts the current selection, or the entire image if no selection is active. Draw Boundary Outlines the current selection using the current foreground color and line width. Both the color and line width can be dynamically changed as long as the selection is still active. Special Paste Similar to Paste, except the selection is copied to the screen using ROrS mode, rather then RCopyS mode, allowing you to transparently see both the object being pasted and the underlying image. This has potential for aligning two images, and works particularly well for bi- level images, such as PICT files created by MacDraw, or images resulting from use of the Trace Edges or Dither commands. Alignment works best when the foreground color is set to black and the background to white. While Special Pasting you can vary the color of the object being pasted by clicking in the CLUT window , which can result in interesting effects. Special Paste can also be used to color objects in black and white PICT files created by SuperPaint, MacDraw and similar programs. Simply select the object you want to color, Copy, Special Paste, then select a color by clicking in the CLUT window. Select All This command is equivalent to using the rectangular selection tool to select the entire picture, including portions that may be offscreen. Rotate Left Rotates the contents of the current rectangular selection counter- clockwise 90 degrees. Holding the Option key down causes the original object to be erased before being replaced by the rotated version. Rotate Right Rotates the contents of the current rectangular selection clockwise 90 degrees. Hold the Option key down to erase before rotating. Rotate Rotates the contents of the current rectangular selection an arbitrary number of degrees. Rotation will be clockwise if you specify a positive number and counter-clockwise if you specify a negative number. Options Menu Invert Palette Vertically flips the current color palette. Set Number of Colors Allows you to change the the number of colors used in the current pseudocolor palette. Any added colors will be set to shades of gray. Newly added colors can be edited by selecting the eyedropper tool and double-clicking in the CLUT window on the color you want to change. Set Extra Colors Allows you to reserve up to six entries in the Color Look-Up Table for colors that will not be altered by routines that manipulate the look- up table. For example, you could use an extra color to add color annotation to a grayscale picture. Extra colors are displayed at the bottom of the CLUT window, allowing you to edit them by double- clicking with the eyedropper Tool. Palettes Image currently supports four different types of look-up tables: 1) Grayscale - Consists 256 shades of gray. Contrast and brightness can be altered by manipulating the transformation function displayed in the Gray Map window. This function can be applied to the pixel data in memory, thereby making any contrast and brightness changes permanent, by using the Apply Look-Up Table command. 2) Pseudocolor - This is the default color mode in Image and was inherited from the PDPP11 version. In this mode your are limited to a maximum of 32 colors. You can use the CLUT tool(the double headed arrow) to both stretch (changing contrast) and shift the colors within the CLUT. Also, in this mode, you can edit colors by double clicking on them with the eyedropper tool. 3) System - This is Apple's standard palette for the Mac II. It is the same as the PixelPaint's System palette. You can use the CLUT tool to rotate this palette. 4) 256 Color Spectrum - This is a continuous color spectrum which you can rotate using the CLUT tool. Profile Plot Options Displays a dialog box, shown below, which allows you to set various options relating to density profile plots generated by the profile plot tool and the Column Average Plot command. In the Auto Scale mode, profile plots will be scaled depending on the minimum and maximum density values. In the Fixed Scale mode, the y-axis range is fixed and the minimum and maximum may be specified. The Fixed Plot Size mode allows specify the size of the plot window. This is useful for pasting a series of plots into an image window. Profile plot options can be made permanent using the Save Preferences command. More Options Displays a dialog box, shown below, which allows you to change various Image parameters. New Width and New Height specify the size of images created using the New command. If Invert Video Input is checked, images acquired using the Data Translation frame grabber will be inverted. Frames to Average is the number of video frames that will be averaged by the Average Frames command. The status of all of these parameters can be made permanent using Save Preferences. Scale to Fit Window If checked, you can use the size box, in the lower right corner, to rescale the image in the active window. Clicking in the zoom box of an image window will switch that window to Scale to Fit mode, and then scale the window(and image) to fit the screen. You are not allowed to change the aspect ratio of an image. Density Slice Creates a continuous range of red entries in the video lookup table, and allows you to expand and contract it and to slide it up and down. Density slicing allows you to highlight and measure regions of interest based on their density content. Click and drag near the top of the density slice in the CLUT to vary its size, and click and drag near the bottom to slide it up and down. Double click on the slice with the eyedropper tool to change its color. The Measure and Show Histogram commands ignore pixels outside of the density slice when density slicing is active. The Apply Look-Up Table command can be used to set all pixels which are within the density slice to the foreground color and all other pixels to the background color. Functions Menu Filtering Functions(Smooth, Sharpen, etc.) These functions, with the exception of Reduce Noise and Dither, are implemented using 3 X 3 spatial convolutions, where the value of each pixel in the selection is replaced with the weighted average of its 3 X 3 neighborhood. For correct operation, they require a grayscale image, or a pseudocolored image that started out as a grayscale image. Filtering is not limited to rectangular selections. If no selection is active the entire image will be filtered. Filtering operations can be aborted by typing Command-Period. The 3 X 3 tables shown below are the weighting coefficients for the filters which use spatial convolution. The popularity of plus and minus one in these tables is due to the fact that multiplication by one is very efficient, i.e, multiplication by one is unnecessary. Smooth - This filter blurs(softens) the selection area. It can be used to reduce noise in an image. Hold the Option key down for increased blurring. 1 1 1 1 1 1 (If Option key down) 1 4 1 1 1 1 1 1 1 1 1 1 Sharpen - Increases contrast and accentuates detail in the selection, but may also accentuate noise. To minimize this problem, you can Smooth and/or Reduce Noise before using Sharpen. -1 -1 -1 -1 9 -1 -1 -1 -1 Trace Edges - Produces a binary image with a black background and white outlines representing objects in the original image. Two convolutions are done, generating vertical and horizontal derivatives and the larger of the two result is used. If the resulting pixel is above a threshold value it is set to white, otherwise it is set to black. You can increase or decrease the number of edges by preprocessing the image. Increasing contrast and Sharpening will increase the number of edges found, decreasing contrast and smoothing do the opposite. 1 1 1 -1 0 1 0 0 0 -1 0 1 -1 -1 -1 -1 0 1 Shadow - Increases contrast and produces a diagonal shadowing effect. -2 1 0 -1 1 1 0 1 2 Reduce Noise - This is a Rmedian filterS, where each pixel is replaced with the median value of its 3 X 3 neighborhood. This a time consuming operation because, for each pixel in the selection, the nine pixels in the 3X3 neighborhood must be sorted and the center pixel replaced with the median value(the fifth). For a demonstration of the effectiveness of median filtering try removing random spot noise generated using an air brush with a diameter of around 50. Dither - Uses the Floyd-Steinberg error diffusion algorithm to convert the current selection to a binary(black and white only) image. Dithering can be useful for exporting pictures to applications such as MacPaint, MicroSoft Word or MacDraw that can only accept bi-level images. Dithering can also be used for printing on the ImageWriter, or other non-PostScript printers. The quality of dithered images can frequently be improved by increasing contrast using the Gray Map window before doing the dithering. Color images should be converted to grayscale using the Apply Lookup Table command before being dithered. Photo Mode Erases the entire screen to the current background color and then redraws the current image window without the menu bar, title bar, tool palette, etc. Holding down the Option key while selection this command will cause the image to be drawn starting at the top of the screen using the space formally occupied by the Menu Bar. Run Movie Erases the screen to the current background color and then animates the currently opened images by repeatedly drawing them to the screen at the location of the currently active window. The images will be drawn in the order in which they are listed in the Windows menu. The speed of drawing can be controlled by pressing keys '1' through '9'. The right and left arrow keys can be used to single step through the images. Press the mouse button to stop the animation. You can use the Finder's Open command to cause Image to automatically load a series of pictures which make up a movie. To do this, exit to the Finder, put the files you would like loaded into a folder, select View by Name, Select All, and then Open. Enhance Contrast Computes the density histogram of the current selection(or of the entire image if there is no current selection) and uses it to create a new gray map look-up function which will increase contrast of the entire image. The newly created look-up table function is displayed in the Gray Map window. Use the Apply Look-Up Table command to make the contrast change permanent. This command only works with grayscale images. Equalize Performs histogram equalization based on the density histogram of the current selection. A new gray map look-up function is generated which more evenly distribute the gray levels of the image. This will usually improve contrast. The newly created look-up table function is displayed in the Gray Map window. Use the Apply Look-Up Table command to make the contrast change permanent. Equalization only works with grayscale images. Apply Look-Up Table Applies the current look-up table function to each pixel in the current selection (or of the entire image if there is no current selection). This command provides a way of making brightness and contrast changes permanent. It can be used to posterize(reduce the number of gray values) an image by loading and Applying, for example, a palette consisting of four shades of gray.It can also be used to convert color images to grayscale, and to convert a density sliced image to bi-level(black and white only). If density slicing is in effect all pixels within the density slice will be set to the foreground color and all other pixels will be set to the background color. Change Color Changes the color of all pixels in the selection(or the entire image if no selection is active) that are in the current foreground color to the current background color. For example, to change a solid white background to black you would set the foreground color to white, the background color to black and then use Change Color. To be more precise, Change Color changes all pixels using the current foreground index value(a number in the range 0 to 255) to the current background color index value. It is possible that a given color on the screen could be represented by several different index values. In this case, Change Color may not behave as expected. Start Digitizing Captures TV camera images using the Data Translation DT2255-60Hz QuickCapture frame grabber card. While digitizing, you are allowed to change contrast, alter color schemes, zoom, or pan. Clicking in the Camera window with any tool except the magnifying glass or the grabber will cause digitizing to stop. While digitizing is in progress Start Digitizing changes to Stop Digitizing. If you use the Histogram command after you have started digitizing, it will generate continuous histograms. Average Frames Averages video frames acquired from a TV camera, or other video source, to reduce noise. Averaging will be done only for the current rectangular selection, or for the entire image if there is no selection. The number of frames to be averaged can be specified using the More Options command. If the number of frames is set to nine, then median filtering will be done on those nine frames, rather than averaging. Average Frames can use a lot of memory since it acquires and stores the frames before averaging them. Analysis Menu Measure Computes the mean, standard deviation, minimum and maximum intensity of the pixels in the current selection. In addition, you can use the Measurement Options command to enable other measurements, such as perimeter length. Undo will delete the last measurement. If the minimum density is less than 1, or the maximum is greater than 254, then a message will be displayed indicating the possibility of saturation. If density slicing is enabled, then only pixels within the density slice will be included in the computation. If Set Scale has been used to establish the spatial scale, then the area of the selection will be given in calibrated units, such as square millimeters. If Calibrate has been used to perform density calibration, then density readings will be converted, using the standard curve generated by Calibrate, and the results reported in calibrated units, such as optical density or isotope concentration. Show Results Displays a list of the current measurements. At the bottom of the widow are buttons that can be used to Save, Print, or Copy(to the Clipboard) the readings, or to Reset the measurement counter. Show Results displays length measurements if the current tool is the ruler and you have made at least one length measurement. Likewise, it displays X-Y coordinates if the current tool is the pointing tool, and you have recorded X-Y coordinates. Measurement Options Allows you to specify which measurement will be displayed(and Saved, Printed or Copied) by Show Results. Double-clicking on the polygon tool will also bring up this dialog box. Area -Area of the selection in square pixels. Area will be given in calibrated units, such as square millimeters, if you have used Set Scale to do spatial calibration. Mean Density - Mean density is given in calibrated units if you have used the Calibrate command to generate a standard curve. Standard Deviation - This is the standard deviation of the pixel densities used to generate the mean density. X-Y Coordinates - Center of the selection's bounding rectangle. Modal Density - Most frequently occurring density level within the selection. Corresponds to the highest point in the density histogram. Perimeter Length - Length around the outside of the selection. Only computed for freehand and polygon selections. Integrated Density - Used to measure the size(volume) of spots(such as protein spots on a two-dimensional electrophoresis gel). Computed using the following formula: IntegratedDensity=N * MeanDensity - N * BackgroundDensity where N is number of pixels in the selection, and BackgroundLevel is the modal density after smoothing the density histogram. Show Histogram Displays a plot that shows the distribution of gray levels within the selection. The plot shows, for each of the possible 256 gray levels, the number of pixels in the selection that have that gray level. Histograms are not limited to rectangular areas. When the cursor is over the Histogram window, X(the gray level) and Y(the number of pixel with that gray level) are dynamically updated in the Results Window. Column Average Plot Generates a density profile plot, where the width of the plot is equal to the width of the current rectangular selection and each point in the plot represents the average intensity of the pixels in the corresponding column in the selection. The Profile Plot Options dialog box can be used to control various aspects of these plots. Save Blank Field Use this command to save a median brightness blank field which will be used to correct for nonuniform illumination and for the nonuniform response of the video camera. Before using this command you must start digitizing and adjust the lens diaphragm and/or lightbox intensity so that the average pixel value, as shown by the dynamic pixel value displayed in the Results window, is approximately 128. The Stop Digitizing command will use the reference image previously acquired by Save Blank Field to correct shading errors in the newly acquired image. It does this by dividing each pixel in the newly acquired image by a correction factor computed for each of the 300,000 pixels in the blank field. The correction factor is generated by dividing each blank field pixel value by the mean blank field density. You can digitize a single frame without shading correction by holding down the Option key while selecting Stop Digitizing. Close the RBlank FieldS window if you want to stop doing shading correction. Set Scale Performs spacial calibration so that results from length and area measurements can be presented in calibrated units, such as millimeters. Before using this command you must first measure a known distance along a ruler or other scale using the ruler tool. Then, simply enter this value in the Set Scale dialog box. Double-clicking on the ruler will also present this dialog box. Calibrate Allows you to calibrate to a set of density standards, such as a calibrated optical density step tablet, or radioactive isotope concentrations. Before using this command, use the Reset command to set the measurement counter to zero, and use the Measure command to record the mean density of each of the standards. Reset Reset the counters used for area(density), length, and X-Y coordinate measurements to zero. Restore Selection Returns the selection outline to its precise original position immediately after an operation that had removed it. Useful for repeatedly selecting corresponding areas of an image. Can also be used to transfer a selection outline from one window to another. Font and Style Menus Text handling in Image is similar to that in Macintosh painting programs such as MacPaint, SuperPaint, and PixelPaint, with the exception that you currently can only change characteristics, such as size and style, of the last line entered. You are allowed to change the color(by clicking in the CLUT window), size, typeface, style and justification of the current line of text after the text has been entered. The background color can be changed by option-clicking in the CLUT window. Tool Palette The window containing the tool palette, as well as all the other windows displayed by Image, can be freely moved around the screen. All the tools work at any of the eight available levels of magnification. Magnifying Glass - Click within the active image window to zoom. Double-click on the magnifying glass to unzoom. Option-click within the image window to unzoom in steps. Scrolling Tool(Grabber) - Moves images within windows. Selection Rectangle - Use this tool to specify a rectangular subregion for use by commands in the Edit, Functions and Analysis menus. Rectangular selections can be Saved, Copied, Cleared, Filled, Duplicated, Scaled, Flipped, Rotated, Framed, Inverted, Framed, filtered, or Measured. Hold down the Shift key to constrain the selection to be square. Double-click to select the entire image. As the rectangle is being drawn, its width and height are shown in the Results window. Oval, Polygon, Freehand, Rounded Rectangle - These are outlining tools for defining non-rectangular subregions for use by various commands in the Edit, Functions and Analysis menus. Regions defined by these tools, along with the rectangle tool, can Copied, Filled, Cleared, Inverted, Framed, filtered, or Measured. The Fill command allows you to change colors after a region has been filled by clicking in the CLUT window. Similarly, Draw Boundary allows you to change the line width by clicking on the lines in the Tools window. Pencil - Draws thin lines using the current foreground color. Option-click to pick up the color under the pencil. This works in either the current picture window or the CLUT window. It is not necessary to hold down the Option key to pick up colors from the CLUT window. Holding down the Shift key causes pencil movements to be constrained to be either horizontal or vertical. Eraser - Erases to the current background color. Option-click to pick up background colors from within the image window. Also picks up background colors from the CLUT window. Holding down the Shift key causes eraser movements to be constrained to be either horizontal or vertical. The color of the eraser indicates the current background color. The background color is used by the Cut and Clear commands and as the background color for text. Paint Brush - Draws in the current foreground color. Option-click to pick up the color under the brush . It is not necessary to hold down the Option key to pick up colors from the CLUT window. The color of the brush indicates the current foreground color. Double-click on the brush to change its size. Holding down the Shift key causes brush movements to be constrained to be either horizontal or vertical. CLUT Tool - This tool is used to dynamically modify the Color Look- Up Table(CLUT) by clicking and dragging in the CLUT window. Airbrush Tool - Double-click to change the brush diameter. Ruler - Draws straight lines and measures linear distances. Lines can be constrained to be either vertical or horizontal by holding down the Shift key. Line width is specified by clicking on the lines at the bottom of the Tools window. Distances are given in pixels unless Set Scale has been used to perform spatial calibration. Option-click on the ruler to bring up the Set Scale dialog box. Use Show Results to display length measurements. Smudging Tool - Double-click to change the diameter of the be smudging area. Density Profile Tool - Produces a graphic plot of the gray levels along a line which you generate as if you were using a line drawing tool. If you don't want the line left in the picture window, use Undo to delete it. Averaging will be performed if the line width is greater than one. For example, assume the maximum line width is selected by clicking on the thickest line at the bottom of the tool palette, then each data point plotted is the average of eight pixels. The Plot window, unlike the Histogram window, my be resized. Lines can be constrained to horizontal or vertical be holding down the Shift key. Plots can be copied to the Clipboard and then pasted into a picture window. In addition to the plot, the Copy command also copies the plot data to the Clipboard as a single column of numbers, where it can be pasted into analysis and plotting programs, such as KaleidaGraph. Various aspects of the plots produced by this tool can be altered using the Profile Plot Options command. Double-clicking on the density profile tool causes the Profile Plot Options dialog to be presented. Paint Bucket - This is a MacPaint-like Paint Bucket. It causes all pixels located where paint can leak from the starting point to be changed to the foreground color. In conjunction with density slicing, it can be used for measuring areas under profile plots. Profile plots must first be pasted into an image window before they can be filled using the Paint Bucket. There is currently a bug which prevents paint from leaking near the right edge of images with widths that are not evenly divisible by eight. Text Tool - When only words will do. Allows typing in the Font and Style chosen in the appropriate menus. Various attributes of the text, such as font, size and color, can be changed after the text has been entered, but once another tool has been chosen, or you have typed Return, the text becomes part of the image's bitmap. Eyedropper - Picks up colors from the active picture window and from the CLUT window. Option-click to pick up background colors. If you are using pseudocolor, double-clicking on a color in the CLUT window causes the Color Picker dialog box to be displayed, allowing you to modify that color. Double-clicking in the CLUT window also allows you to change the density slice color when Image is in the density slicing mode. Angle Tool - Measures the angle formed by two lines drawn through a point by this tool. The value is shown interactively in the results window. Undo can be used to delete the lines if they are not wanted. Counting Tool - Counts objects and records their X-Y coordinates, leaving behind markers so that objects are not counted twice. Markers are drawn in the current foreground color and their size is related to the current line width. Use the Show Results command to display the X-Y coordinates. Line Width - Allows user to choose the line width used by the ruler and profile plot tools and by the Draw Boundary command. The lines are 1, 2, 3, 4, 6, or 8 pixels in width. Image Windows Images are displayed within image windows, such as the one above, which are created using New, Open, Import, or Duplicate. The size of image windows created using the New command can be specified in the More Options dialog box. The Close Box closes the window and frees the memory used to store the image. The Zoom Box switches the window to RScale to Fit WindowS mode and resizes the window to make it as large as possible, while still maintaining the same aspect ratio. You can restore the window to its original size by clicking again in the Zoom Box, or by using Unzoom. Note that the magnifying Glass and the Grabber tools do not work in Scale to Fit mode. The Grow Box is used for resizing the window. If you are in the Scale to Fit mode the image will be rescaled to fit any resized window. You can use the Grow Box to make the window larger than its original size if you have zoomed in using the magnifying glass. Gray Map Window This window is used to vary brightness and contrast by loading different functions into the video look-up table. To vary brightness, click and drag inside the frame, which moves the plot(a piece-wise linear density transformation function) horizontally. This changes the Y-intercept of the function while maintaining the slope fixed. To change contrast, click and drag in the margin to move the two points which define the function. A good strategy for improving the contrast of grayscale image is to click(outside the frame) in the lower left hand corner, than drag horizontally to the right until the image starts to saturate. Similarly, click in the upper right hand corner, and drag horizontally to the left. If you are using a color palette, clicking in this window switches to grayscale mode. Double-click to reset the look-up table to a 256 gray level ramp(an identity function). CLUT Window If you are in grayscale mode, click in this window will load the video look-up table(CLUT) with a pseudocolor palette. The default pseudocolor palette consists of 20 colors. Click and drag near the bottom of the palette to move it within the CLUT. Click and drag near the top of the palette to stretch it. Click in this window with any of the drawing tools to pick up a new drawing (foreground) color. 256 color palettes, such as the one produced by the 256 Color Spectrum command can be RrotatedS, but not stretched. Click in the CLUT widow with the eraser, or Option-click with any other tool, to pick up a new background color. Double-click on a color with the eyedropper tool to edit it. Use Save to save the modified palette with the image, or Save Palette As to save the palette separately. Histogram Window This window displays the gray level histogram produced by the Show Histogram command. This is a function that shows, for each of the 256 possible gray levels, the number of pixels within the selection that have that gray level. The actual histogram values will be dynamically displayed in the Results window whenever the cursor is over the histogram window. The histogram plot can be copied to the clipboard(using Copy) whenever the histogram window is active. Results Window X, Y and Value at the top of the Results window are dynamically updated variables that have different meanings depending on which window the cursor is in. Image Window - X and Y are the current cursor coordinates, where the origin of the coordinate system is at the lower left- hand corner and positive X is to the right and positive Y is up. Value is the grayscale value of the pixel at the current X-Y coordinates. The range of values is from 0(white) to 255(black). In the case of color or pseudocolor images, Value is the index used by the color look-up table. If you are printing an image, X is the line currently being printed and Y is the total number of lines. CLUT Window - Value is the grayscale value(look-up table index) pointed to by the eyedropper. You can use this information to set the foreground or background grayscale, or color, to a specific grayscale value or index. Gray Map Window - X and Y display the X-Y coordinates of the gray map control point you are currently changing by dragging the mouse. To change one of the two control points you click and drag near the border of the gray map. Histogram Window - X is the current X-axis(grayscale) value, Y is the number of pixels in the selection which have that value. Upcoming Features(in no particular order) % Registration of two images using a movable transparent overlay % Speed up Airbrush and Smudging tools % On-line help % Image arithmetic % Labeled color and grayscale scales % Automatic boundary tracking tool % Tile Windows command % More than 32 colors in pseudocolor palettes File Formats TIFF Files Created by Image Bytes 0-7 contain the TIFF header. Bytes 8-97 contain the TIFF directory. Within the TIFF directory, bytes 30-31 contain the picture width, and bytes 42-43 contain the picture height. Bytes 98-255 are currently unused and are set to zero. Byes 256-767 contain a 512 byte header which is unique to the Image program. This header is located at bytes 0-511 in the IPIC format. Image data starts at byte 768, stored in row order, one byte per pixel. The information provided here should be adequate for writing a program to read a TIFF created by Image. It is not sufficient for creating TIFF files that Image, or any other program, can read. More detailed information on the TIFF format is available from either Aldus Corporation or MicroSoft. Import File Format The easiest way to create an image file that can be read by Image is to duplicate the MCID format accepted by the Import command. These files contain the line width less one in bytes 0-1, the number of lines less one in bytes 2-3, followed by the 8-bit pixel data in row order. The 2 bytes (one 16-bit word)used to store the width and height are stored in Intel/VAX byte order, where the low order byte is first. The Import command expects these files to be of type TEXT, although they are actually binary files. The following Pascal program is an example of how to create a file that can be Imported into Image. PROGRAM MakeRamp; { This example Pascal program that creates a picture file that can be opened using Image's Import command. } VAR f:text; i,line,pixel,PixelsPerLine,nLines:integer; BEGIN write('Pixels Per Line: '); readln(PixelsPerLine); write('Number of Lines: '); readln(nlines); writeln('Creating image. This may take a few minutes.'); rewrite(f,'Ramp'); write(f,chr((PixelsPerLine-1) MOD 256)); write(f,chr((PixelsPerLine-1) DIV 256)); write(f,chr((nlines-1) MOD 256)); write(f,chr((nlines-1) DIV 256)); FOR line:=1 TO nlines DO FOR pixel:=0 TO PixelsPerLine-1 DO write(f,chr(pixel)); close(f); END. IPIC Format IPIC files, which Image can open but longer create, use a very simple file format consisting of a 512 byte header followed by uncompressed 8-bit pixel data. The format is similar to that used by the PDP-11 version of Image, and, in fact, the Macintosh version of Image can read the files produced by PDP-11 version of Image. The easiest way to generate a file that the Mac version of Image can read is to duplicate the PDP-11 file format, where bytes 0-1 contain the number of lines using Intel/VAX byte order and bytes 2-3 contain the number of pixels per line, also using Intel/VAX byte order. Image data starts at byte 512, and is stored in row order. Pixels are always one byte(8-bits) in length, where 0 is black(minimum intensity) and 255 is white(maximum intensity. The file type and creator of the file must be IPIC and IMAG, respectively. Palette File Format Pseudocolor palette files, which are of type ICOL, contain the number of colors in byte 0. Byte 1 contains the starting location of the palette within the CLUT and byte 2 specifies how many times each color is replicated. Bytes 3-31 are currently unused, and are set to zero. Bytes 32-63 are used for storing red, bytes 64-95 for storing green, and bytes 96-127 for storing blue. In other words, starting at byte 32, 32 unsigned bytes are used for storing the red intensity values, then 32 bytes are used for storing green intensity values, and finally, 32 bytes are used for storing blue. Program Limitations The maximum number of pixels per line is 2048. There is no arbitrary limit(other than memory requirements) on the maximum number of lines in an image. Image uses two 300K(405K if more than 2 megabytes of memory is free when Image starts up) buffers as Undo and Clipboard buffers. Many program function will not work with images larger than these buffers. The size of these buffers can be increased by changing a constant and recompiling. The maximum number of colors allowed in a pseudocolor palette is 32. This will probably be increased in some future version. The maximum number of characters that can be saved, printed, or copied to the clipboard is 10,000. The maximum number of area(density) measurements is 200. The maximum number of length measurements is 100 and the maximum number of X-Y coordinates pairs that can be recorded is 500. The maximum number of allowed density standards is 20. Updated Versions and Bug Reports Image is available from many Macintosh bulletin boards and user group libraries. A reasonably current version, including Pascal source code and example images, should be available from one of the following: 1) DL10 of MACPRO on CompuServe 2) Twilight Clone BBS in Silver Spring, MD, 301-946-5032 Bug reports and suggestions for future versions are welcome. I can be reached at any of the following addresses: Wayne Rasband Internet: wayne%nih- csl@ncifcrf.gov National Institutes of Health uucp: uunet!ncifcrf.gov!nih- csl!wayne Bldg 36, Room 2A-03 BitNet: wsr@nihcu Bethesda, MD 20892 CompuServe: 76067,3454