User's Guide

ANNOTEPS

Add annotation at arbitrary image locations using PostScipt fonts.

Function:

ANNOTEPS inserts horizontal or vertical text strings into an image. A number of different typeface families are supported, with arbitrary character size, regular or bold weight, and regular or oblique (italic) style. In principal, any typeface family may be used which is supported by Adobe's PostScript language for specifying raster printer output. However, the actual typefaces supported depend on the local installation (see Usernote 1).

Annotation may be placed on an existing image, the input image may be copied and then annotations applied, or a new image with only the annotations may be created. The location of each text string in the image may be specified in terms of any of the four corners of the block of text, the midpoints of any side, or the center of the block.

Parameters:

Subcommand -INPLACE:
Insert annotation into the input image, annotating the image in place. Subbanding is allowed but windowing is not.

IN
Input image. Image that the annotation is to be placed on. IN may be a single- or multi-band image and may contain BYTE, INTEGER*2, INTEGER*4, or REAL*4 pixel data. Subbanding is allowed but windowing is not.

Subcommand -INOUT:
Copy the input image and insert annotations into the output image. The original image thereby remains intact.

IN
Input image. The image to be copied and annotated. IN may be a singleor multi-band image and may contain BYTE, INTEGER*2, INTEGER*4, or REAL*4 pixel data. Subbanding and windowing are allowed.

OUT
Output image. The output image will be the same size as specified for the input image. If IN specifies a logical image comprising more than one image file and the input images do not all have the same data type, then if the data type of the output image is to be the same as the input images (ODTYPE = SAME), the output image will have the same data type as the first input image specified.

ODTYPE(SAME)
Output data type. The data type of the output image:

  SAME  Same as input 
  BYTE  BYTE
  I*2   INTEGER*2 
  I*4   INTEGER*4 
  R*4   REAL*4

Subcommand -GENIMG:
Generate a new image and insert annotation strings into it. The image specified by OUT is generated as a single-band image with a user-specified background value. The annotations are inserted into this image.

OUT
Output image.

ODTYPE(BYTE)
Output data type. The data type of the output image:

  BYTE  BYTE (default)
  I*2   INTEGER*2 
  I*4   INTEGER*4 
  R*4   REAL*4

NL
Number of output lines. The number of lines in the output image.

NS
Number of output samples. The number of samples per line in the output image.

Examples:

  1. LAS> annoteps-inplace in=myfile text=("this is image", "number one") linepos=(5 17) samppos=(100 100) align=tc typeface=times size=(12 20)

    All bands of image MYFILE are annotated. The first text string, "this is image", has the top-center of its text block at line 5, sample 100, and is in 12-point Times Roman type. The second string, "number one", has its top edge centered at line 17, sample 100, and is in 20-point Times Roman type. Both strings use default values of left-to-right horizontal orientation, regular style, regular weight, character grey value of 255, background value for the text block of 0, and transparency option of OPAQUE.

  2. LAS> annoteps-inout in=myfile out=mycopy text=("this adds annotation running from bottom to top to", "myfile", "and also from top to bottom" ) linepos=(40 40 40) samppos=(20 150 280) align=(tr bc tl) size=20 orient=(btot ltor ttob) style=(regular oblique regular) weight=(regular, bold, regular) chargrey=(0 100 0) backgrnd=255 transopt=t

    All bands of image MYFILE are copied to image MYCOPY which is then annotated. The first text string is oriented vertically, reading from bottom to top, with the top right corner of its text block at line 40, sample 150, and is in 20-point Courier type, the default type face. The second string runs from left to right, with the bottom center of its text block at line 40, sample 150, and is in 20-point CourierBoldOblique. The third string runs from top to bottom, with its top left corner at line 40, sample 280, and is in Courier type. The first and third text strings have grey levels of 0, while the second has a grey level of 100, and all three have a background value of 255. They are inserted into the image in "transparent" mode.

  3. LAS> annoteps-genimg out=scale_labels nl=20 ns=200 text=("0","20", "40", "60", "80", "100") linepos=(1 1 1 1 1 1) samppos=(50 75 100 125 150 175) align=tc size=12 typeface=helvetica chargrey=200 backgrnd=0

    This example creates a single-band image containing labels for a scale bar. The image is 20 lines by 200 samples, with the default background of 0 and default data type of BYTE. The six annotation strings are numeric values with the centers of their top edges all on the image line 1 and spaced horizontally at intervals of 25 samples. The labels are in 12-point Helvetica type, with the default REGULAR style and weight. All labels have the default horizontal orientation, with a character grey level of 200 and a background value of 0.

Description/Algorithm:

ANNOTEPS begins by reading the program arguments and associates type face, font size, style, weight, character and background grey levels, and transparency option with each annotation text string.

ANNOTEPS then creates two sets of temporary files, one for processing horizontal text strings and a separate set for vertical text strings. For each orientation, the program first writes a temporary file containing PostScript commands to create the strings. The program invokes the ImageMagick "convert" program to convert the PostScript specifications to a temporary raster image containing the text blocks, in a second temporary file. ANNOTEPS scans this raster image to determine the minimum rectangular bounding box for each rasterized string, adds a background border to it if OPAQUE mode is specified, and determines the starting line and pixel at which the rasterized text block is to be inserted into the output image.

ANNOTEPS then reads the input image, if any is specified, inserts the horizontal and vertical text blocks at their specified locations, and writes out the annotated image. All temporary files are deleted.

Nonfatal Error Messages:

  1. [informational] Not computing new minimum/maximum for image -- use LAS program MINMAX if min/max needed

    For subcommand INPLACE, the user may wish to retain the original values of minimum and maximum for the actual image data if the values of CHARGREY and/or BACKGRND are outside the range of the image data. Program MINMAX can be used to compute the minimum and maximum of the annotated image if desired.

  2. [annoteps-nullstr] Text string NNN is all blanks -- ignoring it

    Text string number NNN contains only blanks. ANNOTEPS cannot create a text block for it. Program PIXFILL can be used to insert a block of uniform grey level into an image.

  3. [annoteps-overflw] Grey level value range exceeds maximum (is less than minimum) for type XXXX -- value reduced (increased) to DDDD.

    The value specified for CHARGREY or BACKGRND was outside the range of values supported by the image data type XXXX, and was adjusted accordingly to the value specified by DDDD.

    Fatal Error Messages:

  1. [annoteps-fatal] Fatal error encountered

    An error condition was encountered which prevented further processing. The nature of the error is specified by the preceding message(s).

  2. [annoteps-malloc] Memory allocation error

    ANNOTEPS was unable to allocate memory needed for buffers, etc. Unless image is exceptionally large, this is probably a system error; please notify LAS administrator.

  3. [annoteps-diffwin] Mismatched input windows

    The sizes of the images in a logical input image set are not the same or the windows specified for them are different. Use correct window specifications.

  4. [annoteps-inplwin] Windowing not allowed for subcommand INPLACE

    The values of LINEPOS and SAMPPOS should be specified relative to the entire input image for subcommand INPLACE; accordingly, window specifications are not supported.

  5. [annoteps-fewpos] Too few values for LINEPOS or SAMPPOS

    The number of values specified for LINEPOS or SAMPPOS is less than the number of text strings specified by TEXT. There must be one pair of LINEPOS and SAMPPOS values for each string.

  6. [annoteps-tmpopen] Error opening temporary file XXXX

    The program could not open the temporary file named XXXX. Check that the user has write access to the current working directory. Otherwise, there may be a system problem -- please notify the LAS administrator.

  7. [annoteps-conv] Error converting XXXX to raster

    The file XXXX containing PostScript specifications could not be converted. Check that the ImageMagick program "convert" is in the directories specified by the user's PATHNAME variable and that the local versiion of convert supports the specified typeface(s). See User Note 1.

  8. [annoteps-readtmp] Error reading from temporary file XXXX

    An error occurred while reading from the specified temporary file. Please notify the LAS administrator.

  9. [annoteps-outside] Text string NNN extends outside image window: upper left corner (line, sample) = (DDD,DDD); lower right corner = (DDD, DDD)

    The block needed to enclose the rasterized text for string number NNN will extend outside the specified image window using the specified values of LINEPOS, SAMPPOS, and ALIGN. Adjust these values to move the block sufficiently to bring its corners inside the image window, or use a shorter text string.

  10. [annoteps-tmpren] Error renaming temporary file XXXX to YYYY

    An error occurred when the program attemped to rename the temporary rasterized text file created by ImageMagick "convert" from XXXX to YYYY. Notify the LAS administrator.

  11. [annoteps-imgopen] Error opening XXXX for input (output)

    An error occurred when trying to open an image file for input or output. The cause may be explained by a preceding message. Make sure the input image file exists and that user has read access to it, and that the user has write access to the directory specified for the output file.

User Notes:

  1. The type faces available at a particular site which could be supported by ANNOTEPS may be determined by executing the command "xlsfonts | grep -v '.*-.*-'". However, the actual name strings must be included in the header file annoteps.h when the exectable is built. Check with the local LAS administrator if problems are encountered.

  2. A text string consisting solely of blanks will be ignored.

  3. If two or more text blocks (including padding around text) overlap in the output image, the block(s) which occur first in the list of values for parameter TEXT will be overwritten by block(s) which occur later in the list.