There is no tool in ENVI to do this but a function could be written in IDL. I created a program many years ago that would run in ENVI Classic but it should still work in ENVI 5.x. You could try the below:
pro max_min_value, ev
compile_opt IDL2
;select input file and gather information
envi_select, fid=fid, dims=dims, pos=pos, title = 'Select an input file'
if (fid eq -1) then return
envi_file_query, fid, ns=ns, nl=nl, nb=nb, data_type=dt, interleave=interleave, $
xstart=xstart,ystart=ystart, fname=fname, dims=dims
inherit = envi_set_inheritance(fid, dims, /spatial)
;set the output name
base = widget_auto_base(title='Output file name')
wo = widget_outf(base, uvalue='outf', /auto)
result = auto_wid_mng(base)
if (result.accept eq 0) then return
out_name=result.outf
;open a file to write and initialize tiling
openw, unit, out_name, /get_lun
tile_id = envi_init_tile(fid, pos, num_tiles=num_tiles, $
interleave=(interleave > 1), xs=dims[1], xe=dims[2], $
ys=dims[3], ye=dims[4])
envi_report_init, ['Input file: '+fname,'Output file: '+out_name], $
title='Calculating Min/Max values...', base=base
envi_report_inc, base, num_tiles
;start process tiling
for i=0L, num_tiles-1 do begin
envi_report_stat, base, i, num_tiles, cancel=cancel
if cancel eq 1 then begin
envi_report_init, base=base, /finish
return
endif
data = envi_get_tile(tile_id, i)
maxdata = max(data, dimension=2, min=mindata)
maxdata=reform(maxdata, ns, 1, /overwrite)
mindata=reform(mindata, ns, 1, /overwrite)
writeu, unit, [[maxdata], [mindata]]
endfor
envi_report_init, base=base, /finish
free_lun, unit
envi_tile_done, tile_id
;create ENVI header for output
envi_setup_head, fname=out_name, ns=ns, nl=nl, nb=2, $
data_type=dt, offset=0, interleave=1, /write, /open, $
xstart=xstart+dims[1], ystart=ystart+dims[3], $
bnames=['Max value', 'Min value'], inherit=inherit
envi_tile_done, tile_id
end
|