LABeling program

Introduction

The program LAB provides capability for simple labeling of images analyzed using the IM package. This labeling is performed in a somewhat crude manner, with fixed font size, but it is intended to completely replace any need for using "rub-on" lettering on images and in this respect the program is most effective. In addition to basic lettering, the program also includes capability for arrows, scale bars, circles, and other special symbols. Source code is located in the label directory of the stm_data project disk. The program accepts commands from the keyboard, with the command format allowing abbreviations of 2 or 3 characters. Commands options are indicated with a slash (/) following the command name. The user is prompted by the program for arguments to the commands.

The LAB program is run in one of two modes: accepting commands from the keyboard (as described above), or with the commands placed into an ASCII file and this file is then passed to the program for execution. For example, the following command stream will input an image file from file img1.PGH (which is the standard output of the IM program), and write a string in the lower left-hand corner with information about the scale of the image:

in		;input file (input always comes from img1.PGM)
str		;start a new string
0,0		;location of new string (lower left corner of image)
0,255,1,32	;   black characters on white background 32 pixels high
sp		;   a space,
3		;   3 pixels wide
sc		;   thick bar for scale marker
47		;   47 pixels long
		;   a single character space
1		;   puts a character "1" in the string
0		;   puts a character "0" in the string
0		;   puts a character "0" in the string
		;   a single character space
ang		;   puts an angstrom symbol in the string
sp		;   a space,
3		;   3 pixels wide
di		;display the image
qu		;quit the program
The same set of commands could be placed in the file, e.g. 25may3.lab, and executed by the command:
im < 25may3.lab
This latter "batch" mode of execution is particularly useful for long and tedious command streams. Also, this mode should always be used when defining command sequences for figures that will be incorporated into publications, since the command file then serves as a record of all the labeling which was performed on the image.

Data Structures

All labeling of the LAB program is performed on a fixed size image measuring 512x512 pixels. Pixels are numbered 1 to 512 from left to right (x-direction, or column number), and 1 to 512 from bottom to top (y-direction, or row number). Locations of various symbols are specified using the corrdinates of the pixels. Strings are located relative to a pointer, with the lower left-hand corner of a character being located at the current pointer location.

Input/Output

The LAB program performs labeling on a file input by the IN command. This command inputs the file img1.PGM, which is always output by a previous execution of the IM program (when one DIsplays an image using IM, the file img.PGM is created and displayed, and a copy of this file is placed in img1.PGM). Output from the program is accomplished using the DIsplay command, which creates a file img.PGM and displays that file using the xv program. One can then use xv to create whatever other format of the image is desired.

Grey-scale Values

The LAB program employs user-specified grey-scale values for the various labels, with an 8-bit range used for the shade values. A value of 0 corresponds to black, and a value of 255 corresponds to white.

Command Summary


INput
Inputs file img1.PGM into the image data array.

DIsplay
Outputs image array into file img.PGM, and displays that file using xv.

OUtput/uim
Outputs the image in uim format, which can then be read into the VP program for subsequent processing.

STRing
arguments:	x,y (integer)
		char_shade, back_shade, min_back, max_back (integer)
Relocates the string pointer (sx,sy) to the position (x,y). Subsequent characters will be output with shade char_shade against a background with shade back_shade. The height of the background (min, max pixels) is specified by min_back and max_back. The next character will be located with its lower left corner positioned at (sx+1,sy+1). After writing the character, the string pointer's sx value is incremented the appropriate amount corresponding to the width of the particular character which was written. The action of writing an individual character is accomplished by issuing a command (which is generally given simply by the desired character itself). A list of all commands which write single characters is:
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,
1,2,3,4,5,6,7,8,9,0,
1b,2b,3b,4b,5b,6b,7b,8b,9b,
",(,),+,.,/,=,[,],-,',bs,ang,de,mu
The 1b,2b,... commands produce the numbers with a bar over them. The bs command produces a back slash. The ang, de, and mu commands produce the angstrom symbol, and the Greek letters delta and mu, respectively. Also, a blank space in the command line will produce a blank space 8 pixels wide in the string.

SCale
arguments:	length (integer)
Draws a thick bar, as part of a string, with length length which can serve as a scale indicator for the image size.

AXis
arguments:	theta (real)
Draws a small arrow, as part of a string, with orientation given by the angle theta counter-clockwise rotation relative to the horizontal.

LIne
arguments:	x1,y1,x2,y2 (real)
		thickness (integer)
		shade (integer)
Draws a line from coordinates (x1,y1) to (x2,y2), with thickness thickness and shade shade.

LIne/P
arguments:	x1,y1,length,theta (real)
		thickness (integer)
		shade (integer)
Draws a line using polar coordinates from (x1,y1) with length length and angle theta relative to the horizontal, and with thickness thickness and shade shade.

RArrow
arguments:	x1,y1,x2,y2 (real)
		thickness (integer)
		shade (integer)
Draws a right-going arrow with base at (x1,y1) and tip at (x2,y2), and with thickness thickness and shade shade.

RArrow/P
arguments:	x1,y1,length,theta (real)
		thickness (integer)
		shade (integer)
Draws a right-going arrow using polar coordinates with base at (x1,y1) with length length and angle theta relative to the horizontal, and with thickness thickness and shade shade.

LArrow
arguments:	x1,y1,x2,y2 (real)
		thickness (integer)
		shade (integer)
Draws a left-going arrow with tip at (x1,y1) and base at (x2,y2), and with thickness thickness and shade shade.

LArrow/P
arguments:	x1,y1,length,theta (real)
		thickness (integer)
		shade (integer)
Draws a left-going arrow using polar coordinates with tip at (x1,y1), length length, and angle theta relative to the horizontal, and with thickness thickness and shade shade.

DArrow
arguments:	x1,y1,x2,y2 (real)
		thickness (integer)
		shade (integer)
Draws a double arrow with points at both ends extending from (x1,y1) to (x2,y2), with thickness thickness and shade shade.

DArrow/P
arguments:	x1,y1,length,theta (real)
		thickness (integer)
		shade (integer)
Draws a double arrow using polar coordinates with tip at (x1,y1), length length, and angle theta relative to the horizontal, and with thickness thickness and shade shade.

CIrcle
arguments:	x0,y0,radius (real)
		thickness (integer)
		shade (integer)
Draws a circle, centered at (x0,y0), with thickness thickness and shade shade.