pro EmImageMovie,log ;Created 12 Mar 02 by Chuck See ;This program dispalys EEM Images ;This is the rapid fire version cd,'',current=cdir & cd,cdir ;establishes cdir as current directory if n_params() eq 0 then log = cdir ;test for # of input parameters cd,log+'/DB/Image' spawn,'lsf',files,/noshell nfiles=count_files() low=-1 ;sets the low end of the image display to the min of the images high=-1 ;sets the high end of the image display to the max of the images ;again: ;beginning of overall loop ;command='' ;read,'Command (? for list): ',command ;case command of ; '?' : print,string(10b), $ ; '? creates this list r sets image streach range', $ ; 'q quits the program ', $ ; 'return continues the program',string(10b) ; '' : goto,continue ; 'q' : goto,exit ; 'r' : begin ; read,'Input image streach range (min,max; -1,-1 for tvscl): ',low,high ; if low eq -1 then low=min(pix) ; if high eq -1 then high=max(pix) ; tvscl,bytscl(pix,min=low,max=high,top=255) ; exposure=d_value(h,36) ; print,'Set # ',sstr(i),' Max = ',sstr(max(pix)),' Ave = ',sstr(mean(pix)), $ ; ' Min = ',sstr(min(pix)),' Exposure = ',sstr(exposure),' ms' ; end ;endcase ;goto,again ;;if command eq '?' then print, $ ;; '? creates this list r sets image streach range', string(10b),$ ;; 'q quits the program ', string(10b),$ ;; 'return continues the program' ;;if command eqif command eq 'q' then goto,exit ;;if command eq 'r' then begin ;; read,'Input image streach range (min,max; -1,-1 for tvscl): ',low,high ;; goto,continue ;;endif ;continue: ;To create output image files in /users/csee/ESOC/... ;fileflag='' ;read,'Do you want to create output files? (y on n): ',fileflag first=0 Print,'The test log is: ',log Print,string(10B),'There are ',sstr(nfiles),' image files in this directory (',sstr(nfiles/3),' sets).' ;Read,'Which Sets do you want to view? (first,last): ',first,last last=nfiles set=strarr(nfiles,3) ;_________________________________________________________________________ ;Create list of image sets... ;group images by time stamps (MRI, SLI, & HRI)... ;takes each file and compares its time to the time of each set, if none match, ;another set is created. k=0 ;sets 'used' counter for i=0,nfiles-1 do begin time1=strmid(files(i),13,13) for j=0,(nfiles/3)+1 do begin time2=strmid(set(j,0),13,13) ;the time of the first file in set(j) if time1 eq time2 then begin ;add this file to the matching set if set(j,1) eq '' then set(j,1)=files(i) else set(j,2)=files(i) goto,next_file endif endfor set(k,0)=files(i) ;if none of the times match, create a new set k=k+1 next_file: endfor ;order sets, MRI, SLI, HRI... ; j=set counter, k=twice through counter, & i=sub-set file index for j=0,(nfiles/3)+1 do begin for k=0,1 do for i=0,1 do if fix(strmid(set(j,i),2,5)) ge fix(strmid(set(j,i+1),2,5)) then begin temp=set(j,i) set(j,i)=set(j,i+1) set(j,i+1)=temp endif endfor ;read sets ;window,0 ;For nimage=0,(nfiles/3)+1 do begin pix=fltarr(464,256) m=0 for i=first,last/3+10 do begin for n=0,2 do begin ;for each image (MRI, SLI, HRI) if set(i,n) eq '' then goto,next_image ;skip incomplete sets d_read,set(i,n),h0,p0 s=size(p0) case s(1) of 176: pix(0:175,*)=p0 ;MRI 128: pix(176:303,*)=p0 ;SLI 160: if s(2) eq 256 then pix(304:463,*)=p0 else pix(304:463,128:255)=p0 ;HRI endcase next_image: endfor low=min(pix) high=2*mean(pix) tvscl,bytscl(pix,min=low,max=high,top=255) exposure=d_value(h0,36) print,'Set # ',sstr(i),' Max = ',sstr(max(pix)),' Ave = ',sstr(mean(pix)), $ ' Min = ',sstr(min(pix)),' Exposure = ',sstr(exposure),' ms' ;wait,1 ;endfor ;(on nimgaes) ; ans='' ; read,'Do you want to subtract a reference? ',ans ; if ans eq 'y' then begin ; pix2=fltarr(464,256) ; read,'Which set? ',m ; for n=0,2 do begin ; d_read,set(m,n),h0,p0 ; s=size(p0) ; case s(1) of ; 176: pix2(0:175,*)=p0 ; 128: pix2(176:303,*)=p0 ; 160: pix2(304:463,*)=p0 ; endcase ; ;b=bytscl(pix2,min=min(pix),max=max(pix)) ; endfor ; ;stop ; b=pix-pix2 ;b(464,256) ; ;b(where(b lt 0))=0 ;cuts off negative numbers ; for ic=0,0 do begin ; ;plot,pix(200,*) ;print column ; ;plot,pix(*,200) ;print row ; ;for iy=6,255 do for ix=6,463 do if b(ix,iy) ge mean(b(ix-6:ix,iy-6:iy))+800 then b(ix,iy)=mean(b(ix-6:ix,iy-6:iy)) ; ;for iy=6,255 do for ix=6,463 do if pix(ix,iy) ge mean(pix(ix-6:ix,iy-6:iy))+600 then pix(ix,iy)=mean(pix(ix-6:ix,iy-6:iy)) ; ;for iy=6,255 do for ix=6,463 do if pix2(ix,iy) ge mean(pix2(ix-6:ix,iy-6:iy))+600 then pix2(ix,iy)=mean(pix2(ix-6:ix,iy-6:iy)) ; ;for iy=3,255 do for ix=3,463 do if b(ix,iy) ge min(b(ix-3:ix,iy-3:iy))+1000 then b(ix,iy)=b(ix-1,iy) ; ;b(175:303,160:255)=smooth(b(175:303,160:255),5) ; ;pix2(175:303,160:255)=smooth(pix2(175:303,160:255),5) ; erase ; print,'Set=',i ; ;tvscl,b<1000 ; tv,bytscl(b,max=max(b),top=255) ; if fileflag eq 'y' then begin ; write_gif,'/users/csee/ESOC/DISR_EM_Image_'+sstr(i)+'.gif',bytscl(b,max=1200.,top=255) ; write_jpeg,'/users/csee/ESOC/DISR_EM_Image_'+sstr(i)+'.jpg',bytscl(b,max=1200.,top=255) ; write_bmp,'/users/csee/ESOC/DISR_EM_Image_'+sstr(i)+'.bmp',bytscl(b,max=1200.,top=255) ; endif ; endfor ; ans='' ; read,'Hit return to continue',ans ; endif endfor ;goto,again exit: cd,cdir ;stop end