今天发现之前处理多波段裁剪的代码有点问题,现在更新一下:
批量对多波段影像进行掩膜处理的代码如下:
;README
;used for batch subset (loop pver all images)
;usage: function_subset(['img1.dat', 'img2.dat'], 'msk.dat', 'c:/data')
;requirement: ENVI/IDL 5.3 or higher
;reference: the reference book of envi/idl software
;coded by Yinxiacao
;date: April 8, 2020
FUNCTION function_subset, rasterpath, maskpath, respath
; COMPILE_OPT IDL2
; ;start the application
; e =ENVI()
; ;Initialize ENVI and send all errors
; ; andwarnings to the file batch.txt
; ENVI_BATCH_INIT, log_file='batch.txt'
datapath=FILE_SEARCH(rasterpath,'*.dat',count = count_all)
;loop over all files
FOR i=0,count_all-1 DO BEGIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;step1.LAYER_STACKING;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;