MLx Home | MLx menu | MLx buttons | Widgets | Index | What's New

Image files

The Image_Files menu is the first blue menu in the main MLx menu. It is used to load single images or groups of images. (loading example) TIFF mages can be binary, gray scale or RGB color. (As of 2/97, MacLispx ignores the color palette of indexed color images and loads them as gray level images). MacLispix does NOT load pict files, but does load specialized file types such as Gatan, RAE, and PLab. You must know the file type of the image (TIFF, Raw, etc.) Images may also be loaded using the Stack Widget. Images are saved primarily as TIFF files. The Raw file format is available for transferring a file or a stack to other programs or computer systems.


Read file - name Options

 


File formats

This menu item is the means by which images are read into MacLispix. Use the Image Formats Widgets to read and write other file formats than TIFF and raw.

 


Example: Loading three images for an RGB overlay.

The menues for reading TIFF files looks like this:

menu showing read and read-multiple

where the first two types of image files that can be read are shown (TIFF and RAW), as well as the options for reading the tiff files (one at a time, or a group of them at once). If read is selected, then a single image will be selected from the choose file dialog and read. If read multiple is selected, then again, a single image will be selected, but the 'load' button will now say 'sample'. (Note - these images are in the Demo - RGB Overlay folder.)

After clicking on a file, a dialog will list of all of the files in the folder with the same extension:

Any of the images can be selected with the mouse.

The Select All button selects all of the files. Single images can be de-selected by command-clicking on them.

Hold down the command key while clicking on any of the files to toggle the selection/deselection. Hold down both the command key and the mouse and drag along the files to select a group of them. Selected files may be scattered among non selected files.


When the desired group of files is selected, press the Select button to load the files.

After the files are loaded, the last image will appear in the upper right corner of the screen:

Successive images are placed on top of the previous ones, so that only the last title bar is visible. If the top image is dragged with the mouse (click and drag the title bar), the image underneath will be uncovered. Note as you click that the title bars for all of the images except the one in the front are grayed out.

To list what images what images have been loaded, use the Info button in the Images collumn of the Image Buttons window. This which lists the images by name, along with their dimensions, array element types, the amount of memory they are taking (in kilobytes), and the complete file name (not shown). The list is printed in the Monitor window. Click on the window, or bring it to the front to see the printout.

This listing follows the depth order of the images, so that 'Kowala blue', the front image, is last.

The array element type is '(unsigned-byte 8)' -- the image pixels are unsigned bytes - the values go from 0 - 255. This is the most common type of image, and the type used in NIH Image. MacLispix uses a variety of element types: byte (signed and unsigned), 2 and 4 byte integers (signed and unsigned), 8 byte reals (floating point), complex, bit, RGB, and others.

Next are the image dimensions - 300x170. This means that the images are 300 pixels wide and 170 pixels high.

The next collumn gives the amount of memory the image takes, in Kilobytes. Ie: 300 x 170 = 51000 pixels, or 51,000 bytes. 51000/1024 = 49.8K. The amount listed here is only for the image data array.

Actually, images take up more room than this: Each image window has a scaled copy of the image data - the scaled copy has one byte pixels - a pixmap, and some overhead for the window, and various attributes. The amount of memory that the images take may be compared to the amount assigned to MacLispix in the Finder - Get Info window. Use the Info -> Print Memory Quotas button in the Miscl collumn.


TIFF file format

The multiple menu is for reading in groups of images at a time. They must have the same extension and be in the same folder. The images will probably need to be transposed if they are coming from or going to another program such as NIH Image. The pixel values may also need inverting. Transposition, means that the image appears on its side, that is flipped while holding the upper left and lower right corners.

Note: if the palette of a gray scale window is modified with a slider, then the Scaled image along with the palette will be stored, rather than the original data. This is true even though the slider may have been closed, if the image was not restored to gray scale. To save the original data, reset the palette to gray scale with the LUT -> Gray Scale button, or by double clicking on the slider.

The Notes functions are implemented for TIFF files.


These are the TIFF file formats for reading ane writing image arrays (actual data).

The TIFF format is varied and flexible. At the moment, MacLispix is limited to reading Mac (not IBM ) byte order.

Note: RGB TIFF images written by Gatan's Digital Micrograph may need to be 'laundered' with Adobe Photoshop - there are multiple strips in the Gatan TIFF format, while Adobe writes the entire image in one strip, which MacLispix can read. (Don't use LZW compression. Don't have an asterisk '*' in the file or folder names of any image.)


Raw file format

Raw images are just stored as a long string of bytes or 16 bit integers. The scan lines (VAX FORTRAN) or columns (Common Lisp) are stored one after another. There is no information stored with the image as regarding the dimensions, pixel type, etc. If the image was stored row by row, it will appear in MacLispix as if it were flipped along the diagonal (upper right to lower left). This can be corrected before displaying with the MLx - pixel array-ops - in place - transpose menu. If the bytes of 16 bit pixels have been reversed, which is also machine dependent, this can also be corrected using the reverse bytes array operation.

The raw file format for stacks consists of one file per stack - all of the images are kept in one file. If there is an accompanying _dat file (VoxBlast format), then the stack will be read without having to input the image dimensions and other information. When a stack is written in raw format, the _dat file is also written for direct input into VoxBlast.

Text file format

Text images are in ascii format: plain text files that can be edited with a word processor. The files, of course, are much larger than binary files (all of the other formats here) and take much longer to read and write.

The file should have one row of pixels per line of text. (Note - this can make VERY wide text files). Each line of text should end with a CR (return, #\return, ASCII 13). The numbers can be any LISP readable format which includes integers (of any size), floating point and exponential. The numbers should be separated by spaces, tabs or commas, etc. There must be at least one delimiting character between each number. There may be more than one, and there may be other characters such as spaces between the numbers also.

Note, for kernels for NIH Image, the format is (from 'About Image') : "Each line should be terminated with a carriage return, and the coefficients should be separated by one or more spaces, or a tab."