	IMAGE TRANSFER & MANIPULATION FACILITY

	This describes the task IMG (image) which is much like PIP
only images are transfered and manipulted. IMG can be used with the
indirect command file processor to build powerful image processing codes.
IMG can be used in conjunction with the AT. processor to create movie loops,
recursive filters, demonstration packages or production image manipulation
programs. If the users system supports luanching of tasks from within
tasks, IMG can be used to xfer images and control displays from within a 
Fortran or assembly language program.
	This version expects UCB of block oriented devices to contain
number of bytes per raster line and number of raster lines per image.
Special cases are tested for in IMG as devices named CD:,BM:,and MT:.
CD: is color display 512x512 format bit & byte pixels.
BM: is bulk memory 512x512 format byte pixels.
MT: is standard TU-10 , MT11 tape .

	This version is for a Comtal Vision One= CD:.

	IMG is an installed task that is invoked with IMG<cr> or
	 IMG outfilename{/switches...}{=infilename}{/switches...}<cr>.

	IMG can currently honor as output or input files any named
disk file where the defaults are:
	SY:[curent UIC]IMAGE.IMG

	If the file names are not disk filenames then they can be
either of the bulk memory devices CD: (color display) or BM: (buffer
 memory) . These devices each have several units and each unit holds
 one image. An image is currently defined to be a group of 512. raster
lines with each line containing 512. pixel elements. Image data stores
 8 bits (byte) per pixel ; graphic data stores 1 bit per pixel.

	IMG uses UCB Characteristics Words to determine the size and
format of the image data. Word 4 is number of bytes per raster line.
Word 3 is number of raster lines per image. Word 2 is currently ignored.
Word 2 could be used to give number of bits per pixel and mapping from
16 bit PDP-11 words into display pixels.

	Example:Move an image from image 1 to image 2 in the COMTAL.
	>IMG IM1:=IM2:<cr>

	Example:Move an image file from disk to color display.
	>IMG IM1:=OLDIMAGE<cr>

	Files-11 devices are supported with raster lines filling one
disk sector, they are stored and retrieved using READ$, WRITE$ macro
directives. Unlabeled magnetic tape is supported using 512. byte 
records one raster line per record ,1st record is top of screen, 1st
byte is leftmost pixel.

Line printer graphics are supported, all images are 1st converted to 1
bit deep images before being spooled to the line printer as a file.
	Color line printer is supported, TRILOG COLORPLOT-100. It puts
512x512 image to 1024x1024 dots on 10"x10" page.

	Switches may be appended to both input and output file names.
Most switches are legal both for input and output , however their 
function may depend on the context of input or output.

The following are legal switches:

/BS		Byte Swap the data either on output or on input or both.
	input=byte swap data first thing then apply other switches
	output=byte swap last thing, before storing after others applied

/CV:n:m		ConVolver kernel over the input data using n as alpha
		and m as beta for a 3x3 convolution over entire matrix.
		the params n & m control the family of filters from low
		to high pass to Laplacian. This uses the Comtal 
		algorithm. The kernel is built as shown and normalized :
	input only

		1/n | 1/m | 1/n
	       ----------------
	        1/m |  1  | 1/m
	       ----------------
	        1/n | 1/m | 1/n


/KE:a:b:c:d:e:f:g:h:i	KErnel for 3x3 convolution use all 9 params to 
		build the actual convolution coeffients. The matrix is 
		normalized by dividing each coef by the absolute value
		of the sum of the signed coeficients. This filter can
		easily produce edge information in any direction or 
		effectivily smooth the image by averaging spatailly.
	input only
		a | b | c
	       -----------
	        d | e | f
	       -----------
	        g | h | i

/DS:n		DeSpiking filter, takes average of 8 nearest neighbors and
		compares with value of center point if they exceed the
		threshold then the center value is replaced with the average
		of the neighbors. The value n is the threshold value in percent
		,ie if abs(avg-center)/avg > n% then replace center with avg.

		The filter treats zeros as a special case. Zeros are not
		included in the average only non-zero pixels are used. The
		net effect is to make non-zeros fill in holes (zeros). 
		This "cleans" up noisy images.
	input only

/MO:a:n		MOdify the output file by reading it and merging it with
		the input file using the operator specified in the ascii
		character a. Sense is just like PDP-11 instructions
		Source goes to Destination modifing the Destination.
		The base value n (decimal value) is added to the result
		before the result is stored back as a byte value. This base
		is very useful for +,-,A to add a constant bias to the 
		result. The base when used in a subtraction of an image from 
		itself results in the loading of the base n as a CONSTANT.
		All manipulations are performed in 16 bit space when required
		and then stored back as 8 bit , ie. A for average.

		If a graphics image participates it is expanded to 8 bit
		image then modified then reduced back to 1 bit if needed.
				a=| for bit by bit OR of images
			NOTE: USE | NOT ! ,! IS GRABBED BY MCR
				a=& for bit by bit AND of images
				a=+ for addition of images
					n = base added
				a=- for subtraction of images
					n = base added
				a=* for multiplication of images
					n = base added
				a=A for averaging the images
					n = base added
				a=X for exclusive ORing 
				a=E for only keeping bytes where they
			are the same in both images else clear them.
				a=> for only keeping bytes where they
			are the LESS THAN in one image else clear .
				a=< for only keeping bytes where they
			are the GREATER THAN in one image else clear .
				a=R Replace  any non-zero pixel from input
			into the output image. Like a PIXEL OR not a bit
			OR as described above.
	input=no effect


/BY:n:m		BYte value to be used with data. On input if only n
		is given then only input data of that value passes 
		thru to the output device all other values are set
		to zero. On input if both n & m are given then only
		values between them are passed, ie. n<= x <= m.

		On output only the n value is used, it is used when
		converting 1 bit graphic input data to 8 bit image
		output data. The zero values in input remain zero on
		output; the 1 bit on data in input are converted to 
		the value of n for output.

/FL:n:m		FiLe, allow multiple images in one mag tape.
		Valid for magnetic tape only.
		May be altered to be valid for disk files as well.

	input=switch would allow them to be sequentially displayed
		to the same output device. n starting file number,
		m the ending file number .
		If m is not present read only the one file.
		if n is not present start at the first image in the file
	output=skip n files on mag tape.
	output only=skip n files on mag tape.

/RW		Rewind magnetic tape, valid for magnetic tape only.
	input=rewind first
	output=rewind first
	output only=rewind first

/AP	****** not working as of 6-DEC-79 *******
		APpend the input file to the exsisting output file
		this creates concatenated output files on files-11
		devices that can be read back individually or as
		movies.
	input only

/SP		VALID FOR PRINTRONIX line printer 6-dec-79

		SPool the image, reduced to 1 bit deep graphics, to the
		line printer. Display as a 512. x 512. dot matrix with
		dots appearing where image pixel values meet criteria.
		The file produced is readable by standard spooler and has
		the extension DMP if none is specified, so the file is 
		automatically deleted after printing.
	input=no effect
	output=is valid only when used as output to files-11 file

/CP:n		VALID FOR TRILOG COLORPLOT-100 6-dec-79

		CURRENTLY DOES NOT SPOOL because ours in on LP1: and
		RSX-11M 3.1 cant spool to lp1: and lp0: . V3.2 will
		permit spooling.
		Currently directly prints on LP1:, making 3 passes over 
		the same page printing in yellow,magenta, & cyan. It uses
		a 17 hue default color mapping table VIOLET > RED. IT maps
		1-255 into 17 hues and zero to no print=white. Data is read
		from input file 3 times (slow) but produces results.

		Argument n not used, produce standard color plot

		Argument n (-3 to +3) can explicitly control number of colors
		actually printed. 1=yellow only,2=yellow/magenta,3=y,m,&c
		-1=yellow only,-2=yellow,magenta-no overplot=2 color seperation
		-3=all three colors on seperate pages - 3 color seperation.

/YY:n:m		YY defines the Y raster line at which the transfer is 
		to start (n) and optionally the (m) value at which it
		is to end.
	input=starting raster line 0 is top of screen
	output=ending raster line
	output only=no effect

/YI:n		YI the Y raster line increment used between raster line
		transfers. This n may be positive or negative. If not
		given the default is +1 with images incrmenting down
		the screen from the top raster line. If n is greater
		than 1 then an image decimation or replication is
		effected. If YI is on the input side then the image
		is decimated by n, ie if n is 2 then every other raster
		line is used on input. If Yi is on the output side then
		a replication is performed, ie. if n is 2 then the input
		raster line is displayed 2 times to the output device.

		If n is negative then the display begins at the bottom 
		and increments up the screen by the value of n.
	output only=no effect

/NL:n		Number of Lines to transfer from input to output, switch
		may appear on either side but not both.This switch
		contorls number of times thru transfer loop.





xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EXAMPLES:

IMG>RE:=GR:			;xfer green color mem to red mem

IMG>BM:=IM2:			;xfer image 2 to bulk memory 0.

IMG>RED=RE:			;xfer red table to disk file RED.IMG

IMG>FM1:=function.img			;load a function memory from file

IMG>MT0:/RW				;rewind mt0:

IMG>IM1:=MT0:/FL:3:9/RW			;rewind then, xfer files 3 to 9 to IM1: 
					;from mt0: using unlabeled tape.

IMG>MT:/RW=IM2:,IM1:			;xfer IM2: and IM1: to mt0:
					;this creates unlabeled tape
					;with an EOF between images

IMG>FREDDY=GR1:				;save GR1: to disk file FREDDY.IMG
					;the 1 bit graphics are expanded
					;to 8 bit images before being saved

****************** /AP - no worky ************************************
IMG>file/AP=IM2:,IM3:			;append IM2:&IM3: to exsisting
					;disk file

IMG>IM1:/mo:-:56=IM1:			;subtract IM1: from IM1: and add in
					;a base of 56, this sets all of 
					;IM1: to 56.

IMG>IM3:/MO:A:100=IM1:/BS		;byteswap IM1: then add to IM3: and
					;divide result by 2 then add in 100
					; for each byte of result to be 
					;stored back in IM3:

IMG>/CP=IM2:/DS				;PRINT on COLOR printer the image 2
					;after having DeSpiked the image 2
					;data before going to printer.
					;IM2: data uneffected in execution.

IMG>/SP=IM1:/BY:128:255			;print as dots every pixel in
					;IM1: that has value 128<=x<=255
					;this goes to std B/W printer

IMG>SAM/MO:R=GR1:			;get 1 bit graphics data to values
					;of 0 and 128 ,then replace in file
					;SAM.IMG all pixels that were set 
					; on in the graphics.
**************************************************************

	Future Enhancements 
/LD:a		LoaD IMG internal translation table from the input file
		The table is 256 words,low byte is actually stored.
		Argument a defines which table is loaded.
			a=C	Cyan ribbon print values
			a=Y	Yellow ribbon print values
			a=M     Magenta ribbon values
			a=I	Input translation table
			a=O	Output translation table
			a-not given load translation memory table
				used in /TR switch below.

/TR		TRanslate byte values of input via the internal translation
		table. This table is loaded in a seperate command previously
		Therefore IMG must be resident between /LD and subsequent
		/TR uses. /TR may be applied to input or output or both.
		/TR on input uses table loaded with /LD or LD:I
		/TR on output uses table loaded with /LD:O
		If no table loaded then 1:1 mapping occurs, ie. value in
		is value out.
		/-TR use the complement of the table value I or O.

/AS:x:y		AScii characters string to image from the file
		 or device specified upper left corner is x,y if given. 

/XX:n		starting X column number for transfers.

/XI:n		X column increment between pixels similar to YI.

/NE:n		Number of elements per raster line transfer , similar
		to /NL for lines.

/HI		Histogram the data in the image and output it to 
		a record oriented device,ie TI: or LP:.


end of image documentation.

