Labeling Images

Introduction

These commands provide capability for simple labeling of images. Labeling with text characters is performed in a somewhat crude manner, with fixed font size. In addition, the routine includes capability for arrows, scale bars, circles, and other special symbols. Within the IM program, labeling commands are given as part of a special command stream, which begins with either of the commands:

LAbel or LAbel/c
and ends with the command:
QUit
The possible use of the '/c' option on the LAbel command is to handle color images. By default, the images are assumed to be gray-scale, in which case linear interpolation of gray levels is sometimes used in the labeling. With the '/c' option, this linear interpolation is not used (since it doesn't make sense given the lookup table used for the colors). All commands occurring between the beginning and ending commands are interpreted as labeling commands. For example, the following command stream will write a string in the lower left-hand corner of the image with information about the scale of the image:

la		;start labeling command stream
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
qu		;quit the labeling command stream
In the above example the str command in the second line locates the cursor and sets up a background area for the string, as described in the Command section below. Additionally, the first call to str inputs the font table. This table is contained in the file 'font2.fnt', and that file must be present in the working directory (i.e. the same directory containing your raw data file). This file is NOT needed if you just draw lines, arrows, or other symbols, but if any text is included in your labels (preceded by a str command) then this file must be present in the working directory.

Data Structures

As for the IM program as a whole, all labeling in this routine 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 coordinates 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.

Grey-scale (shade) Values

This routine 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


AntiDot
arguments:	x0,y0,radius (real)
		shade (integer)
Draws an anti-dot (shading exterior part of dot) centered at location x0,y0 with specified radius and shade.

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.

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

CRoss
arguments:	x,y,length,theta (real)
		thickness (integer)
		shade (integer)
Draws an cross at location x,y with length length and angle theta relative to the horizontal, and with specified thickness and 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 specified thickness and 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 specified thickness and shade.

DOt
arguments:	x0,y0,radius (real)
		shade (integer)
Draws an dot centered at location x0,y0 with specified radius and shade.

ELlipse
arguments:	x0,y0,radius (real)
		thickness (integer)
		eccentricity,angle (integer)
		shade (integer)
Draws an ellipse, with one focus at x0,y0, and with specified eccentricity, angle (CCW relative to the horizontal), thickness and shade.

ELlipse/CR
arguments:	x0,y0,radius (real)
		thickness (integer)
		eccentricity,angle (integer)
		shade (integer)
Same as above, but in addition does a cross-sectional cut of the image so that the data along the ellipse is stored in the data array of the program. The origin of the angular scale for this cut is always the horizontal (even for nonzero angular rotation of the ellipse).

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 specified thickness and shade.

LArrow/P
arguments:	x1,y1,length,theta (real,real,integer,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 specified thickness and shade.

LIne
arguments:	x1,y1,x2,y2 (real)
		thickness (integer)
		shade (integer)
Draws a line from coordinates x1,y1 to x2,y2, with specified thickness and 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 specified thickness and shade.

PAttern/1
arguments:	nsym (integer)
                xmid,ymid,dist,angle (real)
                type (integer)
                length (real)
                thickness (integer)
                shade (integer)
Draws a pattern of symbols according to value of nsym (1=single symbol, 2=two opposite symbols, 3=triangle, 4=square, 6=hexagon) of type type (1=dot, 2=circle, 3=cross, 4=x-mark) on coordinate system with origin xmid,ymid. The location of the starting symbol relative to that origin is specificed in polar coordinates by dist,angle.The symbol is drawn with length or radius of length and thickness thickness (the latter not used for a dot symbol), and with gray scale shade

PAttern/2
arguments:	nsym (integer)
                xmid,ymid,dist1,angle1 (real)
                dist2,angle2 (real)
                type (integer)
                length (real)
                thickness (integer)
                shade (integer)
Draws a pattern of symbols according to value of nsym (1=single symbol, 2=two opposite symbols, 3=triangle, 4=square, 6=hexagon) of type type (1=dot, 2=circle, 3=cross, 4=x-mark) on coordinate system with origin xmid,ymid. A secondary origin is specified in polar coordinates by dist1,angle1, and the location of the starting symbol relative to that secondary origin is specificed in polar coordinates by dist2,angle2. The symbol is drawn with length or radius of length and thickness thickness (the latter not used for a dot symbol), and with gray scale 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 specified thickness and shade.

RArrow/P
arguments:	x1,y1,length,theta (real,real,integer,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 specified thickness and shade.

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.

SQuare
arguments:	x0,y0,length (real,real,integer)
		thickness (integer)
		shade (integer)
Draws a square, centered at x0,y0, with side length length and specified thickness and shade.

STRing
arguments:	x,y (integer)
		char_shade, back_shade, min_back, max_back (integer)
Relocates the string pointer 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,
",(,),+,.,/,=,[,],-,',\,ang,de,mu
The 1b,2b,... commands produce the numbers with a bar over them. 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.

SYmbol
arguments:	xmid,ymid (real)
                x1,y1 (real)
                x2,y2 (real)
                b1,b2 (real)
                type (integer)
                length (real)
                thickness (integer)
                shade (integer)
Draws a symbol of type type (1=dot, 2=circle, 3=cross, 4=x-mark) on coordinate system with origin xmid,ymid. Basis vectors relative to that origin are specificed by x1,y1 and x2,y2, and the symbol is located at positions b1,b2 in terms of those basis vectors. The symbol is drawn with length or radius of length and thickness thickness (the latter not used for a dot symbol), and with gray scale shade

SYmbol/P
arguments:	xmid,ymid (real)
                dist1,angle1 (real)
                dist2,angle2 (real)
                b1,b2 (real)
                type (integer)
                length (real)
                thickness (integer)
                shade (integer)
Draws a symbol of type type (1=dot, 2=circle, 3=cross, 4=x-mark) on coordinate system with origin xmid,ymid. Basis vectors relative to that origin are specificed in polar coordinates by dist1,angle1 and dist2,angle2, and the symbol is located at positions b1,b2 in terms of those basis vectors. The symbol is drawn with length or radius of length and thickness thickness (the latter not used for a dot symbol), and with gray scale shade

XMark
arguments:	x,y,length,theta (real)
		thickness (integer)
		shade (integer)
Draws an xmark at location x,y with length length and angle theta relative to the horizontal, and with specified thickness and shade. NOTE: This routine is not completely implemented; the rotation of the xmark by angle theta does not work, and the xmark symbol itself is not well formed for the case of large thickness.