This is, what i've done so far. The file is compilable and gives no error massage, but nothing happens. What is wrong? It seems to run over.
Can anybody help me?
pro detect_test
text=' '
rows=0
cols=0
bands=0
n_classes=0
x=0.0
compile_opt STRICTARR
;Open input files
file_sig = 'infile1.img'
file_ia = 'infile2.img'
OPENR, lun_sig, file_sig, /GET_LUN
OPENR, lun_ia, file_ia, /GET_LUN
READF, lun_sig
READF, lun_ia
outfile = 'outfile.img'
GET_LUN, unit
out_lun=unit
OPENW, out_lun, outfile
ENVI, /restore_base_save_files
ENVI_INIT, /batch_mode
ENVI_OPEN_FILE, file_sig, r_fid=file_fid_sig
ENVI_FILE_QUERY, file_fid_sig, ns=cols_sig, nl=rows_sig, nb=band_sig, data_type=dt_sig
pos_sig=LINDGEN(band_sig)
PRINT, cols_sig, rows_sig
ENVI_OPEN_FILE, file_ia, r_fid=file_fid_ia
ENVI_FILE_QUERY, file_fid_ia, ns=cols_ia, nl=rows_ia, nb=band_ia, data_type=dt_ia
pos_ia=LINDGEN(band_ia)
PRINT, cols_ia, rows_ia
IF((rows_sig NE rows_ia) OR (cols_sig NE cols_ia)) THEN BEGIN
PRINT, 'Bilder passen nicht zusammen!!'
STOP
ENDIF
DIMS=[-1L, 0, cols_sig-1, 0, rows_sig-1]
sig=ENVI_GET_DATA(fid=file_fid_sig, dims=dims, pos=pos_sig)
angle=ENVI_GET_DATA(fid=file_fid_ia,dims=dims,pos=pos_ia)
thresh=FLTARR(cols_sig, rows_sig)
FOR f=0, rows_ia-1 DO BEGIN
; IF(f mod 10 eq 0) THEN print, f
FOR g=0, cols_ia-1 DO BEGIN
IF(angle[g,f] LT 20) THEN BEGIN
a15_20 = where(sig[g,f] GT 0.570014)
b15_20 = where((sig[g,f] LT 0.570014) AND (sig[g,f] GT 0.514403))
c15_20 = where(sig[g,f] LT 0.514403)
ENDIF
IF(angle[g,f] LT 25)AND(angle[g,f] GT 20) THEN BEGIN
a20_25 = where(sig[g,f] GT 0.510586)
b20_25 = where((sig[g,f] LT 0.510586) AND (sig[g,f] GT 0.399364))
c20_25 = where(sig[g,f] LT 0.399364)
ENDIF
IF(angle[g,f] GT 25) THEN BEGIN
a25_30 = where(sig[g,f] GT 0.460427)
b25_30 = where((sig[g,f] LT 0.460427) AND (sig[g,f] GT 0.293594))
c25_30 = where(sig[g,f] LT 0.293594)
ENDIF
ENDFOR
ENDFOR
thresh[a15_20]=1
thresh[a20_25]=1
thresh[a25_30]=1
thresh[b15_20]=0.5
thresh[b20_25]=0.5
thresh[b25_30]=0.5
thresh[c15_20]=0
thresh[c20_25]=0
thresh[c25_30]=0
WRITEU, out_lun, thresh
FREE_LUN, lun_sig
FREE_LUN, lun_ia
FREE_LUN, out_lun
end
|