logo资料库

IDL实现遥感影像批处理.doc

第1页 / 共2页
第2页 / 共2页
资料共2页,全文预览结束
IDL 实现批处理 'resize' : BEGIN ;img files files = *((*pState).inputFiles) ; progressbar = Obj_New('progressbar',$ xsize=300,$ ysize=30,$ Color='red', Text='Loop Iteration 0') ; Place the progress bar on the display. progressbar -> Start per = 100./N_ELEMENTS(files) FOR i=0,N_ELEMENTS(files)-1 DO BEGIN ; progressbar -> Update, 1, Text='processing...' ENVI_OPEN_FILE, files[i], r_fid=fid ; query the file and define the output file variables ENVI_FILE_QUERY,fid,dims=dims,ns=ns,nl=nl,nb=nb t_fid=LONARR(nb)+fid pos=LINDGEN(nb) ;output file Widget_Control, (*pState).outPath,get_value= outfiledir out_name = outfiledir+'resize_'+file_baseName(files[i]) ;open the evf file Widget_Control, (*pState).evfPath,get_value= evf_fname evf_id=ENVI_EVF_OPEN(evf_fname) ;get the vector information ENVI_EVF_INFO,evf_id,num_recs=num_recs,data_type=data_type,projection=projection,$ layer_name=layer_name FOR j=0,num_recs-1 DO BEGIN record=ENVI_EVF_READ_RECORD(evf_id,j) ENDFOR ; Get record info (assuming one record in EVF)
record=ENVI_EVF_READ_RECORD(evf_id,0) xMap=record[0,*] yMap=record[1,*] ;Convert record to xy pixel coordinates of the image to be subsetted ENVI_CONVERT_FILE_COORDINATES,fid,xf,yf,xMap,yMap ;Prepare the subset dimensions dims[0]=-1L dims[1]=MIN(xf)-1 dims[2]=MAX(xf)-1 dims[3]=MIN(yf)-1 dims[4]=MAX(yf)-1 ;Use copyfile_doit to copy input file with new dimensions ENVI_DOIT,'cf_doit',fid=t_fid,pos=pos,dims=dims,remove=0,out_name=out_name,r_fid=r_fid progressbar -> Update, per*i, Text='processing...'+StrTrim(String(per*i),2)+'%' envi_file_mng, id=fid, /remove ENDFOR progressbar -> Destroy END
分享到:
收藏