dear all,
as the subject says...i am trying to use the morph_doit in envi_batch mode. i have got images, containing pixel values of 0 and 1. now, i want to do the opening filter with a kernel of 3 and 2 cycles. my script:
pro opening_filter2
compile_opt STRICTARR
;
; First restore all the base save files.
;
envi, /restore_base_save_files
;
; Initialize ENVI and send all errors
; and warnings to the file batch.txt
;
ENVI_INIT, /batch_mode
input_path = "/inpath"
output_path = "/outpath"
;envi_batch_init, log_file='batch.txt'
;
; Open the input file
;
; open file
image = ENVI_PICKFILE($
TITLE='Pick a image(s)',$
FILTER='inpath*.img', /MULTIPLE_FILE)
num_image = n_elements(image)
for f=0, num_image-1 do begin
ENVI_OPEN_FILE, image[f] , r_fid=fid
if (fid eq -1) then begin
envi_batch_exit
return
endif
;
; Set the POS keyword to process all
; spectral data. Output the result
; to disk.
;
ENVI_FILE_QUERY, fid, dims=dims, nb=nb, geo_points=geo_points, nl=nl, ns=ns
pos = lindgen(nb)
out_file = FILE_BASENAME(image[f],'.img')
out_name = output_path+'/'+out_file+'_open.img'
kernel = fltarr(3,3)+1.
value = kernel
method = 2
cycles = 2
print, 'Filtering...'
ENVI_DOIT, 'morph_doit', fid=fid, pos=pos, dims=dims, method=method, kernel=kernel, value=value, cycles=cycles, gray=1, out_name=out_name, r_fid=r_fid
ENVI_SETUP_HEAD, fname=out_name, ns=ns, nl=nl, nb=1, interleave=0, geo_points=geo_points, data_type=1, /WRITE
;
; Exit ENVI
;
endfor
envi_batch_exit
end
running the script there is no error massage, but when i want to have a lock at the image, it contains only pixel values of 1 (maybe, this results of the kernel? what does the +1. mean? i got the script from the envi help). so...what is wrong...if i do the same in envi, i got different pixel values (0 and 1).
thanks a lot!!!
|