I want to calculate statistics on a specifc spatial (and spectral) subset in a series of many registered images. Some data values, however, may be invalid (negative or zero) depending on the image. Without masking, my batch code is reallyl simple - something like ,
FOR i=0, nfiles-1 DO BEGIN
ENVI_OPEN_FILE, infiles[i], R_FID=fid
ENVI_DOIT, 'ENVI_STATS_DOIT', fid, DIMS=xdims, POS=xpos, MEAN=mean
ENDFOR
I'm not seeing an easy way to mask the invalid data before the ENVI_STATS_DOIT call. I suppose I could extract the data band by band, use WHERE to set the bad values to NaN, and then do the statistics myself with IDL calls, but that seems like an inelegant solution. Is there a batch-callable equivalent to the interactive mask building routines? Any other suggestions would certainly be appreciated.
Thanks, Barry
|