User's Guide

PIXCOUNT

Generates a pixel count listing, and a histogram if LISTOPT is selected as `both'.

Function:

Generates a histogram or pixel count listing. The mean, mode, median, and standard deviation are also calculated and printed. The input image data type may be BYTE, INTEGER*2, INTEGER*4, or REAL*4 and may be a single- or multi-band image.

Parameters:

Subcommand -NOBCKGRD:
No backgrounding option. Each pixel value is included.

IN
Input image. The input image may be BYTE, INTEGER*2, INTEGER*4, or REAL*4 data. Window and/or band options may be specified.

	
NOTE:  The current maximum number of different pixel 
       values allowed in an INTEGER*4 or REAL*4 image 
       is 16,384.  If there are more unique values in
       the image than 16,384, they are scaled into
       the appropriate bins.

PRINT(TERM)
Output destination. The destination of the output.


  = TERM:      Terminal.  Output is sent to the
               user's terminal.
  = LP:        Line printer.  Output is sent to
               the printer defined by $PRINTER.
  = Filename:  User-supplied filename.  Output
               is sent to the user-supplied file
               with the extension ".prt".

LISTOPT(BOTH)
List option. The type of listing to be output. The type of histogram is controlled by the HISTTYPE parameter.


  = PIXEL:  Pixel count.  Only a pixel count is sent 
            to the specified destination.
  = BOTH:   Histogram and pixel count.  A histogram 
            and pixel count are sent to the specified 
            destination.

HISTTYPE(DIST)
Histogram type. The type of histogram to be generated.


  = DIST: Distributional histogram.
  = CUM:  Cumulative histogram.

NBINS(--)
Number of bins. Allows the user to request the number of bins desired rather than making a histogram bin for each unique input pixel value.

NELMTS(--)
Number of elements. Number of occurrences for each asterisk.

NSIGDIG(--)
Number of significant digits. The number of digits to break REAL*4 data into from the right of the decimal point. In other words, if a 3 is entered, then the accuracy for the histogram is out to .001 and nothing beyond.

HISTFORM(LIN)
Histogram format. The histogram format to be used for output to a file or printer.


  = LOG:  Logarithmic.  Output the histogram in a 
          logarithmic format, where the Y axis is linear 
          and the X axis is logarithmic.
  = LIN:  Linear.  Output the histogram in a linear 
          format, where the Y axis is linear and the 
          X axis is linear by a scale factor.

LISTFLG(NO)
List flag. A summary histogram generated from 36 bins is printed on one page of output. LISTFLG is ignored if PRINT = TERM only. This summary histogram is generated in addition to the normal histogram.

  = YES: List a summary histogram.  A summary 
         histogram is created and sent to the file 
         or line printer as specified in PRINT.
  = NO:  Do not list a summary histogram.  A summary
	 histogram is not created.
Subcommand -BCKGRD:
Backgrounding option. Pixel values equal to the mask value are not included.

IN
Input image. The input image may be BYTE, INTEGER*2, INTEGER*4, or REAL*4 data. Window and/or band options may be specified.

	
NOTE:  The current maximum number of different pixel 
       values allowed in an INTEGER*4 or REAL*4 image 
       is 16,384.  If there are more unique values in
       the image than 16,384, they are scaled into
       the appropriate bins.

PRINT(TERM)
Output destination. The destination of the output.


  = TERM:      Terminal.  Output is sent to the
               user's terminal.
  = LP:        Line printer.  Output is sent to
               the printer defined by $PRINTER.
  = Filename:  User-supplied filename.  Output
               is sent to the user-supplied file
               with the extension ".prt".

LISTOPT(BOTH)
List option. The type of listing to be output. The type of histogram is controlled by the HISTTYPE parameter.


  = PIXEL:  Pixel count.  Only a pixel count is sent 
            to the specified destination.
  = BOTH:   Histogram and pixel count.  A histogram 
            and pixel count are sent to the specified 
            destination.

HISTTYPE(DIST)
Histogram type. The type of histogram to be generated.


  = DIST: Distributional histogram.
  = CUM:  Cumulative histogram.

NBINS(--)
Number of bins. Allows the user to request the number of bins desired rather than making a histogram bin for each unique input pixel value.

NELMTS(--)
Number of elements. Number of occurrences for each asterisk.

NSIGDIG(--)
Number of significant digits. The number of digits to break REAL*4 data into from the right of the decimal point. In other words, if a 3 is entered, then the accuracy for the histogram is out to .001 and nothing beyond.

MASKVAL(-- )
Mask value(s). The pixel value or range of values that is used to designate masked areas or areas of bad data. Pixels within this value range are not used in the calculations.

HISTFORM(LIN)
Histogram format. The histogram format to be used for output to a file or printer.


  = LOG:  Logarithmic.  Output the histogram in a 
          logarithmic format, where the Y axis is linear 
          and the X axis is logarithmic.
  = LIN:  Linear.  Output the histogram in a linear 
          format, where the Y axis is linear and the 
          X axis is linear by a scale factor.

LISTFLG(NO)
List flag. A summary histogram generated from 36 bins is printed on one page of output. LISTFLG is ignored if PRINT = TERM only. This summary histogram is generated in addition to the normal histogram.

  = YES: List a summary histogram.  A summary 
         histogram is created and sent to the file 
         or line printer as specified in PRINT.
  = NO:  Do not list a summary histogram.  A summary
	 histogram is not created.

Examples:

  1. LAS> pixcount-nobckgrd in=mss print=lp histtype=cum listflg=yes

    A cumulative histogram is created for the entire input image MSS and printed on the line printer with a summary histogram as the first page.

  2. LAS> pixcount-bckgrd in="mckinley(4 1 9 512)" listopt=pixel maskval=(20-40)

    A listing of pixel values for samples 1 through 512 of lines 4 through 12 of input image MCKINLEY is output to the terminal. Pixel values between the mask value range of 20 through 40 are not included.

  3. LAS> pixcount-bckgrd in="phoenix(1 20 2 10:3)" print=(term,file) nbins=5 nelmts=100 nsigdig=2

    A distributional histogram consisting of five bins is stored in a file and displayed at the terminal for samples 20 through 29 of lines 1 and 2 of the third band of image PHOENIX.

Description/Algorithm:

If the input image is BYTE, INTEGER*2, or INTEGER*4 data with values -32768 < x < 32767 (INTEGER*4 data within INTEGER*2 range is processed as INTEGER*2 data), it is processed using the following algorithm:

An array of 65536 elements (indices from -32768 to 32767) is initialized to zero. When calling the support function the middle of this array is sent. This array counts the number of pixels with a given value. Each line of the input image is histogrammed. After the entire band is processed, if the back-grounding subcommand has been specified, the mask value of the histogram array is replaced with a zero. The mean, mode, median, and standard deviation are calculated. The histogram or pixel count listing is then printed.

If the input image is INTEGER*4 (not within INTEGER*2 range) or REAL*4 data, it is processed using the following algorithm:

An array dimensioned 2x16384 is initialized to zero. This array counts the number of pixels with a given value range. If a pixel value is not equal to the mask value when the backgrounding option has been selected, the value is placed in the first column of the array. The number of elements with that pixel value is placed in the second column of the array. The mean, mode, median, and standard deviation are calculated. The histogram or pixel count listing is then printed.

The histogram for the terminal is formatted as follows:

The range of occurrences is calculated and divided into 15 equal intervals. The number of occurrences in each of these intervals is calculated and printed to the left-hand side of the screen. The mode of the number of occurrences is then calculated and divided by star field width (60 for BYTE and INTEGER*2, 55 for INTEGER*4 and REAL*4) to obtain the scale--1 * = mode of number of occurrences / field width. This is printed to the left-hand side of the screen below the range. The range of data is then histogrammed, fractionally or cumulatively, according to the calculated scale. If the number of occurrences is not a multiple of the scale, it is truncated to the nearest multiple. Finally, the minimum pixel value, maximum pixel value, mean, mode, median, and standard deviation of the image is printed across the bottom of the screen.

The histogram for a file or the printer is formatted as follows:

The specified number of bins is checked. If the number of bins is greater than the number of different pixel values or the default value (null) was specified, each pixel value is histogrammed in the following manner: The scale is calculated--mode of array / 85 for BYTE or INTEGER*2, and mode of array / 80 for INTEGER*4 or REAL*4. A heading is printed. Then for each pixel value, the following are printed to the line printer: (1) the value, (2) the number of occurrences, (3) the ratio of number of occurrences to total number of pixels in the image window, expressed as a percentage, (4) the accumulative percentage, and (5) the number of stars calculated, fractionally or cumulatively, according to the scale. The mean, mode, median, and standard deviation of the image window is printed at the bottom of the page.

If the specified number of bins is a valid number, the following method is used. A new histogram is created by calculating the range of occurrences and dividing by the number of specified bins in order to find the interval size for each bin. The number of occurrences in each bin of the calculated interval size is accumulated and stored in a new array. The scale is calculated--new mode of new histogram array / 85 for BYTE and INTEGER*2, and new mode of new histogram array / 80 for INTEGER*4 or REAL*4. A heading is printed which is followed by a line of data for each bin, specifically: (1) the range of the bin, (2) the number of occurrences in the range, (3) the ratio of number of occurrences to total number of pixels in the image window, expressed as a percentage, (4) the accumulative percentage, and (5) the number of stars calculated, fractionally or cumulatively, according to the scale. The mean, mode, median, and standard deviation of the image window is printed at the bottom of the page.

The summary histogram is generated from 36 bins and printed to either the file or printer as specified in PRINT. A summary histogram is not created if PRINT = TERM only.

The pixel count listing for the file, printer, or terminal is formatted as follows:

The heading is printed. Then, for each pixel value, the following are printed: (1) the value, (2) the number of occurrences, and (3) the ratio of number of occurrences to total number of pixels in the image window. The mean, mode, median, and standard deviation are printed at the bottom of the page.

Nonfatal Error Messages:

  1. [pixcount-real] Data type is REAL*4 and NSIG equals 0

    NSIG will be reset to 1. For real data NSIG should be larger than zero.

  2. [pixcount-warn] Nonfatal error encountered

    The message that is displayed immediately preceding this message is the specific error that was encountered from a library routine. Processing continues.

  3. [pixcount-mask] Unable to read mask value

    This message indicates that an invalid mask value was attempted to be read from user input parameters. Valid mask values are all real values. Reenter mask values, and try again.

Fatal Error Message:

  1. [pixcount-fatal] Fatal error encountered

    A fatal error was encountered during processing. The error message that is displayed immediately preceding this message is the error that was encountered from a library routine.

  2. [pixcount-mask] Error retrieving MASKVAL

    An error was encountered retrieving MASKVAL. Each entry in MASKVAL should contain a single value or a range of values separated by a "-".

  3. [pixcount-open] Error opening <xxxxx> file

    The possible problems for this error to occur are: file exists for output file, or filename incorrect for infile, or file permissions not set for read/write access.

  4. [pixcount-alloc] Error allocating memory

    The dynamic allocation of memory failed. Possibly from out of memory. To try again try freeing up some resources.

User Notes:

  1. If INTEGER*4 data with values outside the -32768 to 32767 range or REAL*4 data is input, processing time may be considerably slower than for BYTE or INTEGER*2 data. This is due to the larger number of comparisons that may be made while searching the histogram array.

  2. If the user specifies a larger number of bins than there are number of pixel values, each pixel value is histogrammed. The result is the same as if the user had specified the default value for NBINS.