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

PGT RAS Format

-- files have '.ras' extension --

SUN Raster (Image) File Format

as implemented by PGT

Written for John Small, to read image files written on his Hitachi S-4500 FESEM by the PGT IMIX image collection and processing system.

The RAS file format can have more than one file. This widget currently reads one image with its header. The (gray level) image dimensions and (unsigned integer) bit depth are variable. (Bit depths of 8 and 16 have bee tested as of 9/4/97).

The information in the header called im->name is put in the MacLispix Note slot for the image, which appears as an overlay on top of the image, and which will be put in the Comments box (Get Info window) of the file if it is saved in TIFF format. Dale routinely puts documentation information in this slot, as he collects the images on the scope.

Updates might include RGB color and multiple images per file. 9/4/97 DSB

Format Description

File format information, from source code supplied by Margie Mott, PGT, 4/22/97.

The format of PGT images is based on Sun raster files, with PGT-specific information appended.

If the file is a multi-image file, such as an X-ray map, the file format is similar, like this:

RAS Header - bytes 0-31: eight 4-byte signed integer values:

  1. magic (RAS magic). x59A66A95 This is a code to identify the file as a RAS file.
  2. width - image width in pixels. (when read into MacLispix, image height)
  3. height - image height in pixels.
  4. depth - pixel depth: 1,8,16,or 32 bits? (I've seen 8 and 24 bits. 24 bit data stored as 32 bit data). MacLispix does not read bit images.
  5. length - height * [width * bytes_per_pixel]. Note: round [] up to a multiple of 4.
  6. type - 0 - ?"RT Standard" ?
  7. maptype - 1 - denotes 256 bytes of red, green and blue each, in the map.
  8. maplength - 768 - = 3 * 256

PGT Header appended to the RAS header. Consists of display list and collection header.

Display List

Information on all graphics items that are overlayed on the image such as numbers, boxes and text.

  1. display_list_magic (4 bytes, signed) - x59A66A96
  2. number of display list nodes (4 bytes, signed)
  3. node - structure of 120 bytes. Following items are 4-byte int each except where noted.
    1. type
    2. color
    3. x
    4. y
    5. text (a location? for a label)
    6. font
    7. ... other stuff
  4. node
  5. ...

Collection Header

Image label. Distance calibration.

  1. collection_header_magic - x59A66A98
  2. version (8 bytes - double float?)
  3. name_length (4 bytes signed int)
  4. units_length (4 bytes signed int)
  5. cal_filename_length (4 bytes signed int)
  6. im->mag (8 bytes double float)
  7. im->units_per_pixel (8 bytes double float)
  8. * source has choices on version here.
  9. name - string, length given above (This is put in the note slot of the MacLispix window and displayed as the annotation to the image.)
  10. units - string, with length given above (Not yet used by MacLispix)
  11. cal_filname (Not yet used by MacLispix)



Display list node types:

0 - mark - spectrum analysis point locations.
1 - text
2 - box
3 - line
4 - pr (?)
5 - scale bar
6 - no type
7 - draggable type
8 - any type

* MacLispix does not dispatch on version choices.