pro tripletprinter,log ;PC version ; 2005.01.13 C See ;Triplet printer, print,'' print,'This program prints triplets from the current Log.' ;The program prints three triplets per page. ; (hopefully in azmithal order) cd,'',current=cdir & cd,cdir if n_params() eq 0 then Log=dialog_pickfile(/directory,path='c:\') ;check to see if tripletfiles.pro has been run on this log. file_ck=findfile(log+'Triplets2') if file_ck(0) eq '' then begin print,'' print,'Triplefiles.pro has not been run on this directory, please run it first!' print,Log goto,exit endif cd,Log+'Triplets2\jpeg' print,'' print,'The Test Log is: ',log wait,1 ;____________________________________________________________________________ ;List Files... files=t_getfil('*.*') s=size(files) nfiles=fix(s(1)) numfiles=sstr(nfiles) ;numfiles=short string (nfiles) if files(0) eq '' then begin & print,'No files found' & goto,exit & endif print,'The number of Triplets in this log is: ',sstr(nfiles),' (1 thru ',sstr(nfiles),')' print,'This will create about: ',sstr(nfiles/3+1),' pages of triplets. ',string(10b) array_sort,files ;sorts files in assending order ans='' read,'Do you want to limit the number of triplets printed? (y or n): ',ans a=1 ;a = first image printed b=nfiles ;b = last image printed again: if ans eq 'y' then read,'Which images do you want to print? (first,last): ',a,b if a lt 1 or b gt nfiles then begin print,'Sorry thats out of range, please try again...' goto,again endif ;____________________________________________________________________________ ;Initalize... auto=1 ;for auto=1 tvscl min=0 ;the tvscl min setting max=4095 ;the tvscl max setting ilast=0 ;ilast is the previous value of i space=1.5 ;x spacing in inches sf=0.2 ;scale factor (scales the size of the images on the page) missing_files=0 ;number of missing files ;____________________________________________________________________________ ;Loop that prints triplets ... set_plot,'ps' device,filename = Log+'PS\triplets.ps',/times, /PORTRAIT,/inches,bits_per_pixel=8 n=1 ;image-on-this-page counter j=1 ;page counter next_page: print,'Page ',sstr(j) for i=a-1,a+2 do begin ;i counts the images printed on this page file_no=(i+3*(j-1))-missing_files ;file_no=file being displayed if file_no ge b then goto,exit ;done read_jpeg,files(file_no),p ;actual_file_no=fix(strmid(files(file_no),3,4)) s=strsplit(files(file_no),'.',/extract) actual_file_no=fix(s(1)) print,'actual file no = ',actual_file_no check_for_missing_files: if actual_file_no-missing_files gt 3*file_no+1 then begin print,'Missing file at: ',file_no+1,actual_file_no,missing_files ;missing file missing_files=missing_files+1 i=i+1 ;images on this page if i gt a+2 then goto,page_skip ;next page... n=n+1 goto,check_for_missing_files endif ;set the image size, y offset, and x offset size=9.0*sf ;9 inches x scale factor yoff=0.5*sf ;1 inch from bottom xoff=0.0 ;0" from left ypos=0.15 ;p=rotate(p,2) ;just like DISR sees it ;if n le 18 then ypos=0.15 else ypos=4.0 ;sets the y position for each row ;if n gt 18 then set=6*space else set=0 ;resets to left margin for 2nd row tvscl,bytscl(p,min=min(p),max=2*mean(p),top=255),((n-1)/3*space)+xoff,ypos+yoff,xsize=size,/inches xyouts,(((n-1)/3*space)+xoff+.55*space)/9.5,(ypos+yoff+size/2)/7.,'#'+sstr(actual_file_no),/norm n=n+1 endfor page_skip: xyouts,0,0,'Images from '+log+': '+sstr(1+3*(j-1))+' thru '+sstr(3*j),/norm erase n=1 ;reset the image counter j=j+1 ;increment page counter goto,next_page ;____________________________________________________________________________ ;Done... exit: xyouts,0,0,'Images from '+log+': '+sstr(1+36*(j-1))+' thru '+sstr(b),/norm ;last page device,/close_file command='gsview32 '+Log+'PS\triplets.ps' spawn,command set_plot,'WIN' ;returns to X windows environment print,'Done' cd,cdir stop end