I would like to use IDL to export multiple class images to a single .evf file. This is quite easy to do through the ENVI classic Raster to Vector tool, and I have the following code working well for exporting a single class to vector:
; input files
filevector = ["E:\2013img\DataCallSchenkGCNP\J1_30012_130526_200144_BLU"]
;3-1 is the number of files change to n-1 for any number
FOR j=0,1-1 DO BEGIN
files = filevector[j]
;open file
ENVI_OPEN_FILE, files, r_fid=refl_fid
if (refl_fid eq -1) then begin
envi_batch_exit
return
endif
ENVI_FILE_QUERY, refl_fid, ns=ns, nl=nl, nb=nb, data_type=data_type, fname=filename
pos=lindgen(nb)
dims=[-1L,0, ns-1, 0, nl-1]
outdirectory = 'E:\2013img\DataCallSchenkGCNP\J1_30012_130526_200144_BLUbound'
;VALUES are the class to vectorize
ENVI_DOIT, 'RTV_DOIT', FID=refl_FID, IN_MEMORY=0, DIMS=dims, pos=pos, VALUES=9, $
L_NAME=files+'vector', OUT_NAME=files+'vector.evf'
When I switch to VALUES=[4,5,6,9], I get a doit error saying, 'Attempt to subscript IN_MEMORY with LOOP is out of range.'
I have also tried flipping the IN_MEMORY flag to 1, and still get the same error.
Thanks.
EDIT
I found a work around.
By adding, the following lines of code before the raster to vector doit I was able to combine all the needed classes, then vectorize the single super class, in this case it would be [4]. May not be elegant but it works.
;** new list of classes with a key 'grouping class' defined
class_list = [0,1,2,3,4,4,4,4,8,9,4,4,4,4,4,4]
;doit to combine classes pre-vectorizaion. This runs crazy fast!
ENVI_DOIT, 'COM_CLASS_DOIT', COMB_LUT=class_list, DIMS=dims, FID=refl_fid, /IN_MEMORY, $
R_FID=comb_id, /REMOVE_EMPTY
|