GENERAL PROGRAMS FOR PROCESSING MICROGRAPHS 
           -------------------------------------------

0. HEADER:
---------
      This is probably the simplest program of all.  It simply reads the header
information and prints it out.  Information in EXTRA locations is also 
displayed.

1. IMCON: 
--------
      Runs online with prompts.  This program converts from the format produced
by the densitometer microprocessor into MAP/IMAGE format with appropriate 
entries in the CELL, NXYZ, MXYZ, DMIN, DMAX, DMEAN and EXTRA locations of the
header.  It asks whether image is destined for Alliant or Vax since there are
REAL*4 entries in the header which each computer codes differently.  This 
program is THE interface to densitometry therefore is almost certain to require
alteration for installation at a different site.


2. LABEL:    Version 1.18	26-MAR-92    RH
---------
Runs online with prompts. This program is a general purpose program which
carries out a variety of useful manipulations.  The menu is given below.

       Available modes of operation are:

            -2: Change INTEGER*2/INTEGER*1 output format
            -1: Change REAL/INTEGER*2 output format
             0: Change Labels
             1: Select region
             2: Linear OD stretch  ( y = mx + b )
             3: Logrithmic  OD stretch ( y = aLOGx + b )
             4: Average adjacent pixels
             5: Output amplitudes or Intensities'
             6: Output Phases (degrees)
             7: Output REAL part of Complex value
             8: Output IMAGINARY part of Complex value
            99: More options, mainly for display purposes
                 1: VARIOUS 90 DEG TURNS AND MIRRORS
                 2: GEOMETRIC STRETCH ( y = m**X )
                 3: CUT OFF OVER - AND UNDERFLOWS
                 4: GET RID OF OUTLIERS BY INTERPOLATION

3. FFTRANS:
-----------

      This program will do 2 dimensional FFTs in either direction. The real-
space origin is at (1,1) and the origin of reciprocal space is at (1,NY/2+1). 
The fourier transform of an image NX, NY is NX/2+1,NY complex values.
Very large images (up to 8000 * 8000) are transformed using the disc based
routine BIGFFT. The switch point is now determined by the available working
set size. Small images are processed in core.  On the Alliant, everything is 
in core.  3-dimensional images are treated as image stacks, each section being
transformed independently; only single sections of large images may be used.

      Input stream IN input image or fourier transform
      Output stream OUT output fourier transform or image
                  No input parameters are required

4. TRNOUT:
----------

      Program to shift quadrant of FFT to produce suitable amplitude & phase
output for the line printer i.e. the transform is continuous across the
meridian. The output is log base 2 (amplitude) on a scale 0 to 9 and
phase is in 10 degree intervals coded A - Z 0 - 9
   At present can only put out central 129 columns about F(0,0).

      Data input stream 5:
      FMAX, IYMAX, XSHFT, YSHFT  (*)
      
      FMAX sets the level above which all amps are set to 9
      IYMAX  sets the number of Y lines output.  Maximum 256.
      XSHFT, YSHFT X & Y shift for phase origin in grid units

      Transform input on stream 1 (IN)

      Output amplitudes for TONE on stream 2 (OUT).  NL: if not required.


5. TRMASK:
----------

      Program for masking a fourier transform

      Data input stream 3:

      ISHAPE, IPIXEL  (*)
      	if ISHAPE = 1,2 : IH(I), IK(I), XC(I), YC(I), RAD(I)  		(*)
      	if ISHAPE = 3:    IH(I), IK(I), XC(I), YC(I), DELX(I), DELY(I)	(*)

      ISHAPE  if = 1 hard edge circular holes
              if = 2 soft edge circular holes gaussian weighted to EXP(-2) at edge
              if = 3 hard edge rectangular holes
      IPIXEL pixel size used in TONE display of transform (in 1/100 inch)
              if IPIXEL=0, XC etc taken to be transform steps
      IH, IK  indices of spot
      XC, YC  hole centre in mm on TONE output measured from F(0,0) X positive
              across page to right, Y positive up page, from pixel centre to 
              pixel centre.
      RAD     radius for circular holes in mm.
      DELX    half edge lengths for rectangular holes in mm.
      DELY     "   "   "

      Transform input on stream 1 		(IN)
      Output masked transform on stream 2 	(OUT)


6. INTERPO: General 2D reinterploation program - runs online with prompts.
----------


7. SPLINEFIT: Runs online with prompts, displaying on AED.
------------
   This program displays a filament (from an image file), fits a cubic spline 
to it, and then straightens it according to a choice of two different 
algorithms.   The first method "shears" the curved filament by generating
new slices with linear interpolation which are shifted with respect
to the original image.   The second method assumes a "normal mode of bending" 
where area elements on the inside of a curve are compressed while those on 
the outside are expanded.   It calculates the line of density normal to the 
spline curve (with bilinear interpolation), tilts them back to horizontal, and
shifts them with respect to the original image to generate a straight filament.
An output image file is created if desired.
    Uses Harwell Subroutine Library routines  VC03AD, and TG01BD.


8. BOXIM:
---------
(Largely obsolete, use IMDISP unless special reasons for using BOXIM
e.g. Large map)

BOXIM cuts out a specified area from a standard format image file.  It is usual
first to TONE the file from which a circular or polygonal area can be marked 
off.   A mean density is calculated from the edge points of the box.
For a circular area the edge coordinates are calculated line by line
to determine whether or not a point lies inside or outside the area.
For a polygonal area a line is constructed from each point vertically
upwards; if it crosses an even number of box sides it lies outside.   If not 
it lies inside and has the mean density subtracted from it thus 'floating' the
new image. (For points close to a box side the slope of the line from the point
to vertex 1 of the box side is calculated and compared with the slope of the 
box side).  Finally the new image is moved to the bottom left hand corner of 
the new box and the rest of the array is padded with zeroes.


      Data input stream unit 5:
      NXPAD, NYPAD, IPIXEL, NOVERT   (*)
      OX, OY    (*)
            For a circular box (NOVERT = 0) :
      	      CX, CY, RAD    (*)
            For a polygonal box (NOVERT > 0):
      	      PX(I), PY(I)  (*)

      NXPAD 	new padded box size e.g. 512 512 
      NYPAD 
      IPIXEL  	pixel size of input file
      NOVERT  	0 for circular box.Number of vertices for polygonal box
      			(up to 20)
      OX, OY	coordinates in mm. of new phase origin.If set to 0.0 0.0 centre
               		of image assumed
      CX, CY, RAD coordinates of centre of box and radius all measured in mm.
                 	 origin bottom left hand corner. 
      PX, PY  X and Y coordinates of vertices which must go in circluar
      		(clockwise or anticlockwise) order. THey are measured in mm. 
      		origin bottom left hand corner.NOVERT of these records.

Input stream IN    densitometered input file
Output stream OUT    new boxed output file

      EXAMPLE command file

      $BOXIM IN PY42165.DAT OUT PY42165.OUT
      $GO 
      256 256 1 6
      40. 40.
      40. 10.
      20. 30.
      20. 50.
      40. 70.
      60. 50.
      60. 30.


9. BOXIMAGE:
------------
     Simple boxing program to create circular or polygonal box with no change 
     in image size.  This makes it quite suitable for the FFT cross-
     correlation method.
         Input original image on stream 1 (IN)
         Output boxed image on stream 2 (OUT)
     derived from BOXIM (27-AUG-82)

	1.	NOVERT		  -number of vertices, 0 for circular box (*)
	2.	OX,OY		  -phase origin position                  (*)
	3a.	CX,CY,RAD1,2,3,4  -centre coords and radii if circle      (*)
				   :note four radii are for a tapered toroidal
				   :mask. A simple circle would have RAD1,2=0
				   :and rad3,4 equal to the required radius.
   or	3b.	PX(I),PY(I)	  -coords of vertices if polygon          (*)
				   :note origin is (0,0) at lower left corner.

   NOTE : Specify points in image wrt origin (0,0) in bottom left corner.
          Therefore the middle of a 1024x1024 image is (512,512).

   IMPORTANT NOTE : This program does not float the image, but replaces
			densities outside box by the average along the
			inside perimeter.



10. IMEDIT:
----------
       Run online with prompts.  Allows recalculation of DMIN,DMAX,DMEAN, as
well as CELL changes, etc.   Use to dump specified area of image to screen
or printer.

11. MEDIAN:
----------

12. ENHANCE:
-----------

13. IMEXCHANGE:
--------------
 Convert image between binary (CCP4 format) & formatted
                Modified version of mapexchange, by Phil Evans
                Modified to process images, by Rameen Beroukhim, 9/91
  Input file:
     IMIN (stream 1)
                input image, formatted (ascii) or binary CCP4 format.
                The program reads the first line of the image to
                determine automatically whether the file is formatted
                or not.
  Output file:
     IMOUT(stream 2)
               output image: this will be formatted if the input
               image is binary & vice versa



14. REMORIG:
-----------
	Remove origin peak in transform in order to correct slowly
	varying background in image.  Uses inverted cosine bell
	with elliptical shape specified by:
		IXZERO   X zero for filter in X steps
		IYZERO   Y zero for filter in Y steps
	   Input transform on stream 1 (IN)
	   Output weighted transform on stream 2 (OUT)
		READ(5,*) IXZERO,IYZERO
		WRITE(6,1020) IXZERO,IYZERO
1020		FORMAT(///'  Elliptical region removed has semi-axes :',2I5)



15. TAPEREDGE:
-------------
     Simple program to taper edges of a rectangular image so that there are
     no sharp discontinuities which make the Fourier tranform contain spikes.
         Input original image on stream 1 (IN)
         Output featheredged image on stream 2 (OUT)

      	-------------------INPUT-------------------
	CARD 1:IAVER,ISMOOTH,ITAPER
	CARD 2:JAVER,JSMOOTH,JTAPER
       		IAVER,JAVER:depths of strips parallel to x & y over which 
      			averaging takes place.
		ISMOOTH,JSMOOTH:for each pixel running average calculated 
      			over area defined by (-ISMOOTH to ISMOOTH) x (IAVER).
      			(Similarly for JSMOOTH)
       		ITAPER,JTAPER:depth over which tapering takes place.