This topic describes how to compute various statistics in ENVI and how to view results in the Statistics View dialog. Statistics are reported as double-precision values.

See the following sections:

You can also write a script to compute raster statistics using the RasterStatistics task. Use the RasterHistogram task to compute a histogram.

Quick Stats


Quick Stats computes basic statistics and histograms for all bands. To also compute covariances, use the Compute Band Statistics in the Toolbox, described in the next section.

  1. In the Layer Manger or Data Manager, right-click an image file and select Quick Stats.
  2. ENVI calculates the statistics and displays them in the Statistics View. See View the Statistics Report for details on the Statistics View.

    Here are links to additional details:

    • You can import data from an ASCII file or spectral library using the Import drop-down list in the profile window.

    • The plot window controls and plot properties change the display and appearance of the plot.

    • You can export data using the Export drop-down list in the profile window.
    • The Material Identification Tool can be used with a profile or plot to compare an unknown spectrum with a spectral library of known spectra and rank the similarity between the two using a variety of common spectral similarity algorithms.

Compute Band Statistics


The Compute Band Statistics tool lets you compute basic statistics, histograms, and covariances for all bands.

  1. From the Toolbox, select Statistics > Compute Band Statistics. The Compute Statistics Input File dialog appears.
  2. In the Select Input File list, select the input file, and perform optional spatial and spectral subsetting, and/or masking.
  3. Click OK. The Compute Statistics Parameters dialog appears.
  4. Select the statistics to include in the report:
    • Basic Stats: Calculates basic statistics. Basic statistics are always calculated, so this option is always set. ENVI does not calculate statistics for any bands specified as bad bands in the image header file.
    • Histograms: Calculates the histogram of each band.
    • Covariance: Calculates the covariance matrix, the correlation matrix, eigenvalues, and eigenvectors. When enabled, the Covariance Image check box also appears. Enable the Covariance Image check box to return the covariance and correlation matrices, and the eigenvectors as images in the Layer Manager and Data Manager. The dimensions of the resulting images are nb by nb, where nb is the number of bands of the input data. The eigenvectors are associated with the rows in the output eigenvector image.
  5. Enable the Output to the Screen check box to display the statistics report in the Statistics View dialog.
  6. To save the output to an ENVI-format statistics file, enable the Output to a Statistics File check box and enter a filename in the Enter Output Stats Filename field. The default file extension for statistics files is .sta.
  7. To save the output to a text file, enable the Output to a Text Report File check box and enter a filename in the Enter Output Text Filename field.
  8. To change the data precision displayed in the output statistics report, click Report Precision. The Set Report Precision dialog appears.
    1. Set the number of digits to display after the decimal point in the Data Precision field.
    2. Use the Floating Report toggle button to set Normal or Scientific for the numbers in the ASCII report. Normal numbers are in decimal format (for example, 25.88). Scientific numbers are a single digit followed by a decimal value, the letter e, and the exponential power (for example, 2.588e+001).
  9. Click OK to calculate the statistics for the selected output and display them in the Statistics View. See View the Statistics Report for details on the Statistics View.

  10. Here are links to additional details:

    • You can import data from an ASCII file or spectral library using the Import drop-down list in the profile window.

    • The plot window controls and plot properties change the display and appearance of the plot.

    • You can export data using the Export drop-down list in the profile window.
    • The Material Identification Tool can be used with a profile or plot to compare an unknown spectrum with a spectral library of known spectra and rank the similarity between the two using a variety of common spectral similarity algorithms.

Class Statistics


You can compute pixel count and percentage per class, basic statistics, and histograms for all bands on classifications (including classification images, Raster Color Slices, and Scatter Plot classes).

You can also write a script to compute classification statistics using the TrainingClassificationStatistics task.

  1. In the Layer Manger, do one of the following:

    • Right-click the Classes folder and select Statistics for All Classes.
    • Right-click the Slices folder and select Statistics for All Color Slices.
    • Right-click a class or color slice and select Class Statistics.
    • Use the Ctrl or Shift key to select multiple classes or slices at once. Then select Class Statistics.
  2. ENVI calculates the statistics and displays them in the Statistics View. See View the Statistics Report for details on the Statistics View.

  3. Here are links to additional details:

    • You can import data from an ASCII file or spectral library using the Import drop-down list in the profile window.

    • The plot window controls and plot properties change the display and appearance of the plot.

    • You can export data using the Export drop-down list in the profile window.
    • The Material Identification Tool can be used with a profile or plot to compare an unknown spectrum with a spectral library of known spectra and rank the similarity between the two using a variety of common spectral similarity algorithms.

When you use Class Statistics from the Toolbox, you can compute covariance for all bands in a classification image, in addition to pixel count and percentage per class, basic statistics, and histograms.

  1. From the Toolbox, select Classification > Post Classification > Class Statistics. The Classification Input File dialog appears.
  2. In the Select Input File list, select the classification input file.
  3. Click OK. The Statistics Input File dialog appears.
  4. Select an input file from which to calculate the class statistics. This is usually the data file, which will be used for the areas identified in the classification image. You can also apply a mask to the calculation through the Select Mask Band, Build Mask, Spectral Subset buttons.
  5. Click OK. The Class Selection dialog appears.
  6. Select the class(es) to calculate statistics for.
  7. Click OK. The Compute Statistics Parameters dialog appears.
  8. Select the statistics to include in the report:
    • Basic Stats: Calculates basic statistics. Basic statistics are always calculated, so this option is always set. ENVI does not calculate statistics for any bands specified as bad bands in the image header file.
    • Histograms: Calculates the histogram of each band.
    • Covariance: Calculates the covariance matrix, the correlation matrix, eigenvalues, and eigenvectors. When enabled, the Covariance Image check box also appears. Enable the Covariance Image check box to return the covariance and correlation matrices, and the eigenvectors as images in the Layer Manager and Data Manager. The dimensions of the resulting images are nb by nb, where nb is the number of bands of the input data. The eigenvectors are associated with the rows in the output eigenvector image.
  9. Enable the Output to the Screen check box to display the statistics report in the Statistics View.
  10. To save the output to an ENVI-format statistics file, enable the Output to a Statistics File check box and enter a filename in the Enter Output Stats Filename field. The default file extension for statistics files is .sta.
  11. To save the output to a text file, enable the Output to a Text Report File check box and enter a filename in the Enter Output Text Filename field.
  12. To change the data precision displayed in the output statistics report, click Report Precision. The Set Report Precision dialog appears.
    1. Set the number of digits to display after the decimal point in the Data Precision field.
    2. Use the Floating Report toggle button to set Normal or Scientific for the numbers in the ASCII report. Normal numbers are in decimal format (for example, 25.88). Scientific numbers are a single digit followed by a decimal value, the letter e, and the exponential power (for example, 2.588e+001).
  13. Click OK to calculate the statistics for the selected output and display them in the Statistics View. See View the Statistics Report for details on the Statistics View.

  14. Here are links to additional details:

    • You can import data from an ASCII file or spectral library using the Import drop-down list in the profile window.

    • The plot window controls and plot properties change the display and appearance of the plot.

    • You can export data using the Export drop-down list in the profile window.
    • The Material Identification Tool can be used with a profile or plot to compare an unknown spectrum with a spectral library of known spectra and rank the similarity between the two using a variety of common spectral similarity algorithms.

Pixel Statistics


The Compute Pixel Statistics tool creates an image where each band represents a different statistic that was computed on a pixel-by-pixel basis from an input image. Using a four-band input image as an example, a given pixel value in an output Standard Deviation band is the standard deviation value computed across all four bands.

You can also write a script to compute pixel statistics using the PixelStatistics task.

  1. From the Toolbox, select Statistics > Compute Pixel Statistics. The Compute Pixel Statistics dialog appears.
  2. Select an input raster and perform optional spatial and spectral subsetting, and/or masking.
  3. Select the statistics to compute from the Products list. By default, all statistics will be computed. The options are Min (minimum), Max (maximum), Mean, Standard Deviation, Mean Absolute Deviation, Variance, Skewness, Kertosis, Sum, and Sum of Squares.
  4. Select a filename and location for the Output Pixel Statistics Raster.
  5. Enable the Preview check box to see a preview of the settings before you click OK to process the data. The preview is calculated only on the area in the view and uses the resolution level at which you are viewing the image. See Preview for details on the results. To preview a different area in your image, pan and zoom to the area of interest and re-enable the Preview option.
  6. Enable the Display result check box to display the output in the view when processing is complete. Otherwise, if the check box is disabled, the result can be loaded from the Data Manager.
  7. Click OK.

Region of Interest Statistics


Follow the steps below to compute and display statistics for regions of interest (ROIs).

You can also write a script to compute ROI statistics using the ROIStatistics task.

If an ROI includes pixels that are masked in the source image (i.e., they have a Data Ignore Value set), a "Mask Count" column reports the number of those ROI pixels that were omitted from the statistics computation. The "Mask Count" column is in the ROI Statistics dialog.

  1. Choose an option:

    • From the Region of Interest Tool menu bar, select Options > Compute Stats From ROIs. If only one ROI is open, the ROI Statistics Results window appears. If multiple ROIs are open, the Choose Regions dialog appears; select the ROIs to include in the report, then click OK.
    • In the Layer Manager, right-click the Regions of Interest folder and select Statistics for All ROIs to report the statistics for all open ROIs. The ROI Statistics Results window appears. Or, right-click a single ROI and select Statistics.
    • In the Region of Interest Tool toolbar, click the Compute Statistics button.
  2. ENVI calculates the statistics and displays them in the Statistics View. See View the Statistics Report for details on the Statistics View.

  3. Here are links to additional details:

    • You can import data from an ASCII file or spectral library using the Import drop-down list in the profile window.

    • The plot window controls and plot properties change the display and appearance of the plot.

    • You can export data using the Export drop-down list in the profile window.
    • The Material Identification Tool can be used with a profile or plot to compare an unknown spectrum with a spectral library of known spectra and rank the similarity between the two using a variety of common spectral similarity algorithms.

View the Statistics Report


The report section in the Statistics view displays the tabulated statistics for each band and (for classifications) class.

  • Select Locate Stat to change the information displayed in the report.
  • Click the Select All button, or click and drag, to select rows in the report table. To copy the selected data to the clipboard, click the Copy to Clipboard button.
  • Use the Report Precision drop-down list to change the precision of the information in the Statistics View. This option does not affect histogram precision. By default, the numbers display as decimal format, with 6 digits following the decimal value. You can change the number of decimal digits to 2, 4, or 8. You can also select Scientific Notation to display numbers as a single digit followed by a decimal value, the letter e, and the exponential power (for example, 2.588e+001).