Generates statistics for user-specified pixel values
PIXSTAT generates statistics for sets of user-specified pixels. The user selects the class values to be used from the first input band. The first band is the "template" or "mask" image. Whenever one of these user-selected class values is located in the first band the statistics selected by the user will be calculated for each of the subsequent bands. PIXSTAT will output a labeled table (LT) of the class values and statistics for each individual band of the input image. Optionally, PIXSTAT will generate a histogram listing of all image values by class value. The output will contain the class value, number of pixels for that class, pixel values and the number of these pixels.
- IN
- Input image. The input image must be BYTE, INTEGER*2, or INTEGER*4. Window and/or band options may be specified.
- OUTLT
- Output labeled table. The name of the output labeled table. It will contain the statistics calculated by PIXSTAT for the locations of the CLASSVAL pixels. This is nullable if an OUTFILE is selected.
- OUTFILE(--)
- Output file. The output file listing contains the class value, number of pixels in that class, pixel values and number of times these pixel values occur.
- CLASSVAL(--)
- Class value(s). The class value(s) being searched for in the first band. The pixel values at the locations of the CLASSVAL pixels are used for the collection of pixel values to be used in the statistics calculations. The default is the entire class value range in the first band.
- STATCALC(ALL)
- Statistics to be calculated. The statistics that will be calculated and stored in the labeled table. These statistics will be calculated using the values of the pixels at the locations of the CLASSVAL pixels in the first band. The statistics will be calculated for each of the bands. The standard deviation is the sample standard deviation. If the number of pixels in a class is an even number then the median is the average of the two middle numbers. The Median Absolute Deviation is the median of the series which contains the absolute values of MED minus each pixel value. (See User Note 4)
= MEAN: Mean and standard deviation = MAX: Maximum and minimum = MODE: Mode = MED: Median and Median absolute deviation about the median = ALL: All the above
- MASKVAL(--)
- Mask value(s). The pixel value that is used to designate masked areas or areas of bad data. There can be one mask value for each of the bands for which statistics will be calculated, the second through last bands. Pixels with these values are not used in the calculations.
The program generates the LT called LC in which the mean and standard deviation have been calculated for the pixels in each band of the image TM.RAW where the class value of 4 occurs in the image LAND.CLASS. A histogram listing is printed in a file called FOREST which will contain the class number 4, number of pixels in that class, pixel values, and the number of times that each pixel value was encountered in each band at all locations in TM.RAW that had a class value of 4.
The program creates the output Labeled Table called CLASS which contains all the statistics for images SPOT and SOILS where the pixel value for image TEMPLATE was a 1, 2 or 5.
PIXSTAT starts by retrieving the parameters input by the user and opening the input image(s). This input must be BYTE, INTEGER*2, or INTEGER*4. This first band is used as a template by the user to select the classes he/she wants to create statistics for on the remaining bands. PIXSTAT then starts to process the first image row-by-row searching for occurrences of the user-specified class values. When a value is found, the pixel values for this pixel in the other input bands is captured and stored for later use in the calculation of the statistics. The module captures these pixel values for each of the user-specified class values in the first band. Statistics are calculated for the pixels at each of these locations. If one class value is selected, then one set of statistics is generated for each band. If four class values are selected then four sets of statistics are produced. The module proceeds through the input bands, one at a time collecting pixel values for statistics calculations. When processing has been completed on each band, the defined calculations are performed, and placed in the output labeled table. It then loops to the next band. The fields of the labeled table are:
CLASS VALUE BAND STATISTIC1 STATISTIC2where the CLASS VALUE is a listing of the user-specified class values to process from the first band, the BAND is the band that the STATISTICS are calculated for, and the statistics are the user-selected statistics that PIXSTAT calculated.
Optional, if an output listing is desired the class value, number of pixels that correspond to that class, the pixel value, and the number of times that pixel value was encountered. It will look like:
CLASS VALUE PIXELS/CLASS PIXEL VALUE NUMBER OF PIXELS
A fatal error was encountered. The previous error message specifies the exact error.
An error occurred allocating dynamic memory. Either use fewer classes, a smaller range of values, or a computer with more memory.
An error was encountered while opening the output listing file. Verify that there is ample disk space and that you the proper permissions to write to the directory.
Either OUTFILE or OUTLT must be entered.
PIXSTAT does not allow the input image to be anything but BYTE, INTEGER*2, or INTEGER*4. Convert the input image and rerun the program.
The processing windows must be of the same size.
The input image must contain more than one band in order to calculate statistics.
The given input image pixel value is below expected minimum. The DDR should be edited to invalidate the min/max field.
The given input image pixel value is above expected maximum. The DDR should be edited to invalidate the min/max field.
MAD = median of {|(pixel[i] - MED)|} for i = 1 to N. N = the number of pixels in the class. Pixel[i] = the value of each individual pixel in the class. MED = the median pixel value for the class.