;;========================================= ;;merge two files(Ha and CaII) into a file ;;========================================= base_dir='E:\fiss_png_2013' ;finalfolder='one' folder=[20130818] folder=strtrim(folder,2) set_plot,'z' for i=0,n_elements(folder)-1 do begin print,'===========================================' print,'folder=',folder(i) print,'===========================================' subfolder=file_basename(file_search(base_dir+path_sep()+folder(i)+path_sep()+'*')) for j=0, n_elements(subfolder)-1 do begin print,'===========================================' print,'subfolder=',subfolder(j) print,'===========================================' totaldirec=base_dir+path_sep()+folder(i)+path_sep()+subfolder(j) savedirec=totaldirec;+path_sep()+finalfolder if not file_test(savedirec) then file_mkdir,savedirec f1=file_search(totaldirec+path_sep()+'*A1.png',count=c1) g1=file_search(totaldirec+path_sep()+'*B1.png',count=c2) if c1 eq c2 then begin for k=0,n_elements(f1)-1 do begin img1=read_png(f1(k),rc1,gc1,bc1) img2=read_png(g1(k),rc2,gc2,bc2) dim=size(img1) nx=dim(2) ny1=dim(3) ny2=(size(img2))(3) ny=ny1+ny2 device,set_resolution=[nx, ny], set_pixel_depth=24 tv,img1,0,ny2,/true tv,img2,0,0,/true s=tvrd(/true) write_png,savedirec+path_sep()+file_basename(f1(k),'.png')+'B1.png',s,rc1,gc2,bc2 print,folder+'-'+subfolder+' of ' +strtrim(k+1,2)+'/'+strtrim(n_elements(f1),2)+' processed' endfor ;;k, converge two into one endif ;; c1 eq c2 file_delete,f1 file_delete,g1 endfor ;;j, subfolder endfor ;;i, folder(days) end