Hello,
I have a routine that creates multiple threads, loads data, processes it and saves it. When I try to use ENVI_GET_SLICE I get the error message:
IDL_IDLBRIDGE Error: Attempt to call undefined procedure/function: 'PROCESSTHREAD'.
The strange thing is that the exact same code works if I delete or comment out the line containing ENVI_GET_SLICE. Without the ENVI_GET_SLICE section this code simply copies the data from the load directory to the save directory, and it works, I get no error message and the file is indeed copied.
The routine looks something like this:
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
in my workspace a file called main.pro:
pro main
fileName = 'exampleFile'
thread = OBJ_NEW('IDL_IDLBRIDGE')
command = "processThread, '"+fileName+"'"
thread->execute,command
end
in my IDL lib directory a file called processThread.pro:
pro processThread, fileName
;initialize envi
ENVI, /RESTORE_BASE_SAVE_FILES
ENVI_BATCH_INIT
;load file
envi_open_file, fileName, r_fid=fid
envi_file_query, fid, nb=numBands, dims=dims, wl=wl
allBands = lindgen(numBands)
numSamples = dims(2)+1
numLines = dims(4)+1
data=make_array(numSamples, numLines, numBands, /float)
for i = 0, numLines-1 do data(*,i,*) = envi_get_slice(fid=fid,line=i,pos=allBands,xs=0,xe=numSamples-1)
envi_file_mng, id=fid, /REMOVE
;processing would go here
;save the file
outName='exampleOutName'
envi_write_envi_file, data, out_name=outName, wl=wl, wavelength_units=1L, r_fid=fid
envi_file_mng, id=fid, /REMOVE
end
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Any ideas on what is happening?
|