Hi Mahmoud,
Not sure that ENVI can do it, but ENVI+IDL can.
pro oif_example
compile_opt IDL2
envi, /restore_base_save_files
envi_select, fid=i_fid,dims=dims,pos=pos, $
title='OIF calculation Input File'
if (i_fid[0] eq -1) then return
envi_file_query, i_fid, ns=ns, nl=nl, nb=nb, data_type=data_type, $
dims=dims, bname=bname
if nb ge 3 and n_elements(pos) ge 3 then begin
envi_doit, 'envi_stats_doit', fid=i_fid, pos=pos, $
dims=dims, comp_flag=4, stdv=stdv, cov=cov
ncomb=fix(factorial(n_elements(pos))/(factorial(3)*factorial(n_elements(pos)-3)))
oif_struct = replicate(create_struct('BandCombination', '','OIF', 0.0),ncomb)
index=0
for i=0, n_elements(pos)-1 do begin
for j=0, n_elements(pos)-1 do begin
for k=0, n_elements(pos)-1 do begin
if (i lt j) and (i lt k) and (j lt k) then begin
oif_struct[index].(0)=bname[pos[i]]+'|'+bname[pos[j]]+'|'+bname[pos[k]]
oif_struct[index].(1)=(stdv[i]+stdv[j]+stdv[k])/(cov[i,j]/(stdv[i]*stdv[j])+cov[i,k]/(stdv[i]*stdv[k])+cov[j,k]/(stdv[j]*stdv[k]))
index=index+1
endif
endfor
endfor
endfor
endif
mes=string((oif_struct[reverse(sort(oif_struct.(1)))])[0].(0))
Result = dialog_message(mes, /INFORMATION)
for str=0,ncomb-1 do begin
print, (oif_struct[reverse(sort(oif_struct.(1)))])[str]
endfor
end
|