Help for HISTGEN

PURPOSE:

HISTGEN computes the histogram, mean value, and standard deviation of the
input image.  These values are output to an IBIS histogram file which is
suitable for input to programs STRETCH and MASKV.

EXECUTION:
         HISTGEN  INP  OUT  user-parameters...
where
  INP is the input image (byte or halfword)
  OUT is the output histogram file in 32-bit integer data format.

OPERATION:

The histogram is first computed by reading the input image.  For byte data, the
histogram contains 256 DN levels ranging from 0 to 255.  For halfword data,
the histogram contains 64K DN levels ranging from -32768 to +32767.

The mean and standard deviation of the image is then computed from the resulting
histogram.

Prior to output, the histogram is modified so that the output histogram has a
DN range from 0 DN to MAXD DN (see MAXD parameter):
   All DN values less than zero are set to zero and
   All DN values greater than MAXD are set to MAXD.
Note, however, that the mean and standard deviation will reflect the full DN
range.

OUTPUT HISTOGRAM FILE FORMAT:

The histogram is output as an IBIS tabular file containing one column and
MAXD+4 rows.  The data is stored in INTEGER*4 format as follows:

    Column 1 = Number of DN levels in the histogram (=MAXD+1)
    Column 2 = 1000*meanDN
    Column 3 = 1000*standard-deviation
    Column 4 = Number of pixels at 0 DN or lower
    Column 5 = Number of pixels at 1 DN
    Column 6 = Number of pixels at 2 DN
      .
      .
      .
    Column MAXD+4 = Number of pixels at MAXD DN or higher

PROGRAM HISTORY:

Written by: John H. Reimer		June 10, 1981
Cognizant programmer: Gary Yagi, September 1989
Revisions:
 00-1-24  GMY  Add ILOW and IHIGH to call to HSUB (args no longer optional)
 99-7-25  GMY  Fix bug: Histogram was offset by 1 DN so that HIS(1) was HIS(0)
               Store mean and sigma as float in property label
               Update help file to document histogram file format (IBIS).
 95-8-22  AMS (CRI) As per FR87131 fixed to work with half format and maxd
               not specified. Now fits in single column.
 95-3-6   CRS (CRI) revised to create IBIS histogram file
 90-1-22  GMY  Float DN to fix integer overflow.
 89-9-12  GMY  Massive revisions to source code, help, and test files
		Fixed bug in MAXD parameter
 89-2-21  HBM  Calculated SIGMA in subroutine MAIN as floating
                    point to avoid a possible integer overflow
 89-2-6   CCM  Histogram data collection loop somewhat optimized
 85-8-20  JHR  CONVERT TO VICAR2
 84-3-28  CCA  PUT IN GLABEL AND SOME VICAR2
 83-4-1   LWK  adjust MAXD if output dataset too small


PARAMETERS:


INP

input image

OUT

output histogram file

SIZE

image size field

SL

starting line

SS

starting sample

NL

number of lines

NS

number of samples

MAXD

max. input DN

See Examples:


Cognizant Programmer: