Hi All,
I'm getting a silly error when I try to inital a raster result after running a task. I'm currently using ENVI 5.3 + IDL 8.5.
Below is my code. The error happens after the first file in filelist, its the second one in the batch that hangs up on e.openraster().
The error is: % Attempt to call undefined method: 'IDL_LONG::OPENRASTER'. Very weird and a bit frustrating because it runs beauifully on the first image but bombs on the scecond, I have 50+ imgs to batch through this pro.
pro sieveClump
compile_opt IDL2
; start the application
e=ENVI(/HEADLESS)
if (e eq !null) then e = envi()
;directory definitions
idir = 'P:\DASA\RemoteSensing\GC_09_13_TAMRAM\TAMRAM01_Consistent\'
odir = 'E:\Output\'
;input list is classification image
filelist=File_Search(idir + '*TAMRAM01')
foreach file, filelist do begin
;get file base name
img = file_basename(file)
;out directory and file name
oNAME = odir + img
;output name
fMahal = oName + 'sc3x3r'
if (file_test(fMahal) eq 1) then file_delete, fMahal
mahal = e.openraster(file)
; Get the task from the catalog of ENVITasks
;
http://www.harrisgeospati...tionsievingtask.html
SievingTask=ENVITask('ClassificationSieving')
SievingTask.INPUT_RASTER = mahal
;min size for pix cluster
SievingTask.Minimum_size = 11
SievingTask.PIXEL_CONNECTIVITY = 4
SievingTask.Execute
; Get the clumping task
;https://www.harrisgeospatial.com/docs/enviclassificationclumpingtask.html
; ;sets a default 3x3 square kernal
d = replicate(1,3,3)
e = replicate(1,3,3)
ClumpingTask = ENVITask('ClassificationClumping')
ClumpingTask.INPUT_RASTER = SievingTask.OUTPUT_RASTER
ClumpingTask.DILATE_KERNEL = d ;default is 3x3
ClumpingTask.ERODE_KERNEL = e ;default is 3x3
ClumpingTask.OUTPUT_RASTER_URI = fMahal
ClumpingTask.Execute
mahal.close
;print final time
ftime = systime()
print, 'end ' + ftime
Endforeach
end