Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


ENVI_STATS_DOIT

ENVI_STATS_DOIT

This routine has been replaced by ENVIRasterStatisticsTask.

Use ENVI_STATS_DOIT to calculate statistics of a data file and optionally display the results or write the results to a file. The calculated statistics include covariance, data maximum, data minimum, eigenvalues, eigenvectors, histograms, mean, and standard deviation.

Syntax


ENVI_DOIT, 'ENVI_STATS_DOIT', CANCEL=variable, COMP_FLAG={0 | 1 | 2} [, COV=variable], DIMS=array [, DMAX=variable] [, DMIN=variable] [, EVAL=variable] [, EVEC=variable], FID=file ID [, HIST=variable] [, /INTERRUPT], M_FID=file ID, M_POS=long integer [, MEAN=variable] [, /OUTPUT_IMAGE], POS=array [, PREC=array] [, R_FID=variable] [, REP_NAME=string] [, REPORT_FLAG={0 | 1 | 2}] [, STA_NAME=string] [, STDV=variable] [, /TO_SCREEN] [, XFAC=floating point] [, YFAC=floating point]

Keywords


CANCEL

Use this keyword to specify a named variable that returns the status of the Cancel button. A returned value of 1 indicates the Cancel button was pressed. A value of 0 is returned otherwise.

COMP_FLAG

Set this keyword equal to a bit value indicating the computations to perform. The bit values are combined with an OR logical operator to perform the requested calculations. The first bit is ignored. You must set additional bits to calculate histograms and to calculate convariance, eigenvalues, and eigenvectors. The definition of the bits used in COMP_FLAG are as follows:

  • Bit 0 (COMP_FLAG=1): Enables the calculation of maximum, minimum, mean, and standard deviation
  • Bit 1 (COMP_FLAG=2): Enables the calculation of histograms
  • Bit 2 (COMP_FLAG=4): Enables the calculation of covariance, eigenvalues, and eigenvectors
  • Bit 3 to 15: Not used

If you only want maximum, minimum, mean, and standard deviation, then you should set COMP_FLAG to 1. Otherwise, set COMP_FLAG based on your preference to compute histograms (bit 1) or covariance, eigenvalues, and eigenvectors (bit 2). For example, to calculate all the available statistics (maximum, minimum, mean, standard deviation, histograms, covariance, eigenvalues, and eigenvectors), set COMP_FLAG=7.

COV (optional)

Use this keyword to specify a named variable that contains the returned covariance matrix. You must set bit 2 in COMP_FLAG (i.e., COMP_FLAG=4) to generate the covariance matrix.

DIMS

The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims

DMAX (optional)

Use this keyword to specify a named variable that contains the array of data maximums, one for each band position.

DMIN (optional)

Use this keyword to specify a named variable that contains the array of data minimums, one for each band position.

EVAL (optional)

Use this keyword to specify a named variable that contains the eigenvalues. You must set bit 2 in COMP_FLAG (i.e., COMP_FLAG=4) to generate the eigenvalues.

EVEC (optional)

Use this keyword to specify a named variable that contains the eigenvector. You must set bit 2 in COMP_FLAG (i.e., COMP_FLAG=4) to generate the eigenvectors.

FID

The file ID (FID) is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by any routine used to open or select a file. Often, the FID is returned from the keyword R_FID in the ENVIRasterToFID routine. Files are processed by referring to their FIDs. If you work directly with the file in IDL, the FID is not equivalent to a logical unit number (LUN).

HIST (optional)

Use this keyword to specify a named variable that contains the histogram array. You must set bit 1 in COMP_FLAG (i.e., COMP_FLAG=2) to generate the histogram output.

INTERRUPT (optional)

Set this keyword to allow processing interrupts using the Cancel button.

M_FID

Use this keyword to specify the file ID of the mask file. This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. M_FID is a long integer with a value greater than 0. An invalid file ID has a value of -1.

M_POS

Use this keyword to specify the band position of the mask band. M_POS is a long integer with a value greater than or equal to 0.

MEAN (optional)

Use this keyword to specify a named variable that contains the array of data means, one for each band position.

OUTPUT_IMAGE (optional)

Set this keyword to save the covariance matrix, correlation matrix, and eigenvectors to an image. The R_FID keyword can be used to access the file ID of the resulting image.

You must calculate covariance (COMP_FLAG=4 or greater) to generate this output image. If you do not set COMP_FLAG keyword to 4 or greater, the OUTPUT_IMAGE keyword is ignored.

POS

Use this keyword to specify an array of band positions, indicating the band numbers on which to perform the operation. This keyword indicates the spectral subset of bands to use in processing. POS is an array of long integers, ranging from 0 to the number of bands minus 1. Specify bands starting with zero (Band 1=0, Band 2=1, etc.) For example, to process only Bands 3 and 4 of a multi-band file, POS=[2, 3].

POS is typically used with individual files. The example code below illustrates the use of POS for a single file with four bands of data:

  pos=[0,1,2,3]
              
envi_doit, 'envi_stats_doit', dims=dims, fid=fid, pos=pos, $
              
comp_flag=3, dmin=dmin, dmax=dmax, mean=mean, stdv=stdv, hist=hist

But what if you need to create an output file consisting of data from different bands, each from different files? Library routines such as CF_DOIT and ENVI_LAYER_STACKING_DOIT can accomplish this, but they use the POS keyword differently. Suppose you have four files, test1, test2, test3, and test4, with corresponding FIDs of fid1, fid2, fid3, and fid4, respectively. In the following example, you want Band 3 from test1 in the first position, Band 2 from test2 in the second position, Band 6 from test3 in the third position, and Band 4 from test4 in the fourth position. The code should be as follows:

  fid_array = [fid1,fid2,fid3,fid4]
              
pos=[2,1,5,3]
              
envi_doit, 'cf_doit', dims=dims, fid=fid_array
              
out_name='test_composite_file'

PREC (optional)

Use this keyword to specify the format for numbers printed in statistics reports. PREC is a two-element array of long integers with the following definitions:

  • PREC[0]: Set to the desired number of digits to be printed after the decimal point.
  • PREC[1]: Set to 0 to specify fixed-point notation or 1 to specify scientific (exponential) notation.

R_FID (optional)

Use this keyword to specify a named variable that holds the file ID for the output image containing the covariance matrix, correlation matrix, and eigenvectors. The proper bit must be set in COMP_FLAG in order to save this image.

REP_NAME (optional)

Use this keyword to specify the output report filename.

REPORT_FLAG (optional)

Set this keyword to a bit value indicating the type of output reports desired. Combine the bit values with an AND logical operator to get the desired reports.

  • Bit 0 (REPORT_FLAG=1): Basic statistics
  • Bit 1 (REPORT_FLAG=2): Generate histogram report (default)
  • Bit 2 (REPORT_FLAG=4): Generate covariance report
  • Bits 3 to 15: Not used

If REPORT_FLAG=0, no output report is generated.

STA_NAME (optional)

Use this keyword to specify the filename for the output statistics. You can view these files using the View Statistics File tool.

STDV (optional)

Use this keyword to specify a named variable that contains the array of data standard deviations, one for each band position.

TO_SCREEN (optional)

Set this keyword to print the report to the screen. This report presents all of the plot and text information in a single dialog on the screen.

XFAC (optional)

Use this keyword to specify a x skip factor for computing statistics. XFAC is a floating-point value greater than or equal to 1.0 (default). For example, to compute statistics using every 10th pixel, set XFAC=10.0.

YFAC (optional)

Use this keyword to specify a y skip factor for computing statistics. YFAC is a floating-point value greater than or equal to 1.0 (default). For example, to compute statistics using every 10th pixel, set YFAC=10.0.



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us