| rastoim | stsdas.sobsolete | rastoim |
rastoim -- Convert a rasterfile to an IRAF image.
rastoim rasfile outimage outcmap
Convert an eight-bit Sun rasterfile image to one or two IRAF (OIF or STF) images: a pixel image and an optional colormap image. These images may be used as input to the celco task (in the stsdas.vdisplay package) to obtain photographic hard copy. Most likely, the rasterfile format image would come from the capture of a workstation window.
Rasterfiles may be standard (RT_STANDARD) or byte-encoded (RT_BYTE_ENCODED)---either will be converted. Other rasterfile formats such as bitmaps (one bit rasterfiles) and 24 bit color rasterfiles (RGB separations) are neither recognized nor supported.
If the rasterfile contains a colormap and the outcmap parameter specifies a file name (i.e., it is not null), the colormap is written as an IRAF image. This output colormap is a two-dimensional image consisting of three lines and the number of pixels in the rasterfile colormap. The maximum range of colormap values (0:255) is scaled to the range 0:1 in the floating point output colormap image. No colormap file is created if the input rasterfile has no colormap or if the outcmap parameter is null.
The output short integer pixel image has the same dimensions as the rasterfile.
Rasterfiles have the origin (pixel 1,1) at the top left, while IRAF images have the origin at the lower left. To flip the image, use the flip parameter (the default is "yes").
Some explanatory text may be written to STDOUT if desired. The verbosity parameter specifies which information is written:
verbosity text --------- ---- 0 none 1 image size 2 image name, depth, colormap size 3 colormap valuesSome rasterfiles have short colormaps---that is, fewer than 256 colors. In this case, the output colormap will still have 256 colors, but the excess values will be zero (black), but this doesn't matter, since these colors should not be referenced in the image.
Optionally, the color palette (map) may be converted to gray values in the output image. In this case, no output colormap image is created. The gray values are computed from the RGB by the NTSC formula:
gray = 0.299*red + 0.587*green + 0.114*blue
This task should be fully portable. It does not depend on Sun libraries.
This is useful for flipping the image vertically since the origin of the rasterfiles is at the top left and the origin of the IRAF images is at the bottom left.
This overrides colormap output. If gray=yes and outcmap is not null, then a warning message is issued and no output colormap is created.
verbosity text --------- ---- 0 none 1 image size 2 image name, depth, colormap size 3 colormap values
1. Convert the rasterfile sun.ras to an IRAF image sun.imh and colormap file sun_cmap.imh:
pl> rastoim sun.ras sun.imh sun_cmap.imh
Does not handle all rasterfile types, particularly bitmaps and 24-bit color images.
imtool