Use this procedure to write statistics data to an ENVI statistics file (.sta).

Syntax


ENVI_WRITE_STATISTICS, Filename [, COV=array] [, CPOS=array] [, DATA_TYPE=value] [, DMAX=array] [, DMIN=array] [, EVAL=array] [, EVEC=array], FID=file ID [, MEAN=array] [, STDV=array]

Arguments


Filename

This is the filename of the ENVI statistics file (.sta) to be written.

Keywords


COV

Set this keyword to specify the covariance for the image. COV is an [nb, nb] array, where nb is defined by CPOS. If you set COV, then you must also set EVAL and EVAC.

CPOS

Use this keyword to specify the array of band indices used to calculate COV, EVAL, and EVEC. The number of elements of CPOS define the nb for COV, EVAL, and EVEC and may be different than the number of bands defined by FID. The default is that COV, EVAL, and EVEC are calculated for all bands in the file defined by FID.

DATA_TYPE

Use this keyword to specify the image data type. This may be different that the data type in the file defined by FID. DATA_TYPE is used during any subsequent display of statistics by ENVI.

DMAX

Use this keyword to specify an array that contains the image maximums. DMAX is an [nb] array, where nb is equal to the number of bands in the file defined by FID.

DMIN

Use this keyword to specify an array that contains the image minimums. DMIN is an [nb] array, where nb is equal to the number of bands in the file defined by FID.

EVAL

Use this keyword to specify the eigenvalues for the image. EVAL is an [nb, nb] array, where nb is defined by CPOS. If you set EVAL, then you must also set COV and EVEC.

EVEC

Use this keyword to specify the eigenvectors for the image. EVEC is a [nb] array, where nb is defined by CPOS. If you set EVEC, then you must also set COV and EVAL.

FID

Use this keyword to specify a file ID for defining the overall number of bands in the statistics calculations. COV, EVAL, and EVEC use CPOS to save statistics for fewer than the total number of bands.

MEAN

Use this keyword to specify an array that contains the image mean. MEAN is a an [nb] array, where nb is equal to the number of bands in the file defined by FID.

STDV

Use this keyword to specify an array that contains the image standard deviation. STDV is an [nb] array, where nb is equal to the number of bands in the file defined by FID.

Example


This example computes the statistics for a file using ENVI_STATS_DOIT and outputs the result to an ENVI statistics file (.sta).

pos  = lindgen(nb)
;
; Call the doit
;
envi_stats_doit, fid=fid, pos=pos, dims=dims, $  
   dmin=dmin, dmax=dmax, mean=mean, stdv=stdv, $
   comp_flag=0, report_flag=1
;
; Save the results
;
envi_write_statistics, 'test.sta', fid=fid, $
   dmin=dmin, dmax=dmax, mean=mean, stdv=stdv

API Version


4.2