I find the solution, when you define the input variable should consider the folder
filelist = file_search('c:\test','*.txt')
Please help me answering if ENVI has FLAASH to introduce like an API in IDL
Tks
; Add the extension to the toolbox. Called automatically on ENVI startup.
pro PRUEBA_extensions_init
; Set compile options
compile_opt IDL2
; Get ENVI session
e = ENVI(/CURRENT)
; Add the extension to a subfolder
e.AddExtension, 'PRUEBA', 'PRUEBA', PATH=''
end
; ENVI Extension code. Called when the toolbox item is chosen.
pro PRUEBA
; Set compile options
compile_opt IDL2
; General error handler
CATCH, err
if (err ne 0) then begin
CATCH, /CANCEL
if OBJ_VALID(e) then $
e.ReportError, 'ERROR: ' + !error_state.msg
MESSAGE, /RESET
return
endif
;Get ENVI session
;e = ENVI(/CURRENT)
;******************************************
; Insert your ENVI Extension code here...
;******************************************
e = envi(/headless)
;Instantiate the ENVITask, set constant parameters.
task = ENVITask('RadiometricCalibration')
task.CALIBRATION_TYPE = 'Radiance'
;Find all the files with .txt extensions in a directory.
CD = 'C:'
;search_dir = '../test'
filelist = file_search('c:\test','*.txt')
PRINT, '# IMAGENES ENCONTRADAS:',N_ELEMENTS(file_search('c:\test','*.txt'))
;Set a base for your output files that will be appended to.
outbase = 'C:\test\T'
;Open the raster, set parameters, and execute the task.
foreach element, filelist, index do begin
raster = e.OpenRaster(element)
OLIBands = raster[0]
task.input_raster = OLIBands
task.output_raster_uri = outbase + strtrim(index, 2)
task.Execute
endforeach
end
|