I am building an IDL script to calculate several co-occurrence texture measures and keep getting this error:
% Attempt to subscript METHOD with is out of range.
% Execution halted at: TEXTURE_COOCCUR_DOIT 311
% ENVI_DOIT 3130
% $MAIN$
The input file is a single band of SAR intensity data. Note that when I use an example code from ENVIPROGRAMGENERATOR or for example the online manual for the ADAPTIVE_FILTER, the examples work find but when I change to Texture_Cooccur_Doit and replicate all the syntax it fails.
***PROGRAM***
pro MGH_texture
compile_opt IDL2
on_error, 2
; General error handler
Catch, error
if (error ne 0) then begin
Catch, /CANCEL
if obj_valid(envi) then $
envi.ReportError, "Error: " + !error_state.msg
message, /RESET
return
endif
e=envi(/current)
if e eq !null then begin
e=envi()
must_exit = 1B
endif else must_exit = 0B
envi, /restore_base_save_files
; Launch the application
e = ENVI()
infile = envi_pickfile(title='Select one input files')
if (infile[0] eq '') then return
f_count = n_elements(infile)
base = widget_auto_base(title='Output parameters')
wo = widget_outf(base, uvalue='outd', /auto, /directory, default=' ', $
prompt='Select output DIRECTORY')
; open input file and gather necessary parameters
infile = e.OpenRaster(infile)
FID = ENVIRasterToFID(infile)
envi_file_query, FID, ns=ns, nl=nl, r_fid = fid, dims=dims, nb=nb
; run the Co-Occurance Texture program
envi_doit, 'Texture_Cooccur_DoIt', $
FID=fid, $
R_fid=R_fid, $
dims=dims, $
Method=1, $
direction=[1,1], $
pos=Lindgen(nb), $
KX=3, $
KY=3, $
G_levels=64, $
out_Bname ='variance', $
out_name = 'test.dat'
;clean up / close memory files
envi_file_mng, id=fid, /remove
print, 'Done: ', systime()
end
|