pro tripletprinter,log ;PC version ; 2005.01.12 C See use \DB2 if it exits ;Thumbnail printer, last modified: 22Nov04 print,'' print,'This program prints triplets from the current Log.' ;The program prints three triplets per page. ; (hopefully in azmithal order) ;This version includes \DB2 (mike bushroe's images) cd,'',current=cdir & cd,cdir if n_params() eq 0 then Log=dialog_pickfile(/directory,path='c:\') ;check to see if Bushroe's processor has been run on this log. db='\DB' file_ck=findfile(log+'\DB2') if file_ck(0) ne '' then db='\DB2' ;i.e. \DB2 does exist ;;if file_ck(0) ne '' then begin ;i.e. \DB2 does exist ;;ans='n' ;;read,'Do you want to use the images in \DB2 (Bushroe Processed)? (y or n): ',ans ;;if ans eq 'y' then begin & print,'using \DB2' & db='\DB2' & endif else print,'using \DB' ;;endif cd,Log+db+'\Image' print,'' print,'The Test Log is: ',log ;____________________________________________________________________________ ;List Files... files=t_getfil('*.*') ;spawn,'lsf',files,/noshell 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 Images in this log is: ',sstr(nfiles),' (1 thru ',sstr(nfiles),')' print,'This will create about: ',sstr(nfiles/36+1),' pages of thumbnails. ',string(10b) array_sort,files ;sorts files in assending order ans='' read,'Do you want to limit the 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=.75 ;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\thumbnails.ps',/times,/landscape,/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+34 do begin ;i counts the images printed on this page file_no=(i+36*(j-1))-missing_files ;file_no=file being displayed ;print,'File No. = ',file_no+1 if file_no ge b then goto,exit ;done d_read,files(file_no),h,p actual_file_no=fix(strmid(files(file_no),3,4)) check_for_missing_files: if actual_file_no-missing_files gt file_no+1 then begin print,'Missing file at: ',file_no+1 ;missing file missing_files=missing_files+1 i=i+1 ;images on this page if i gt a+34 then goto,page_skip ;next page... n=n+1 goto,check_for_missing_files endif ;set the image size, y offset, and x offset based on image type, ;to position SLI on top, MRI in the middle, and HRI on the bottom... type=d_value(h,96) if type eq 21 then size=1.0*sf ;typ='MRI ' if type eq 21 then yoff=256/176.*sf ;typ='MRI ' if type eq 21 then xoff=0. ;typ='MRI ' if type eq 22 then size=128./160.*sf ;typ='SLI ' if type eq 22 then yoff=2*256/176.*sf ;typ='SLI ' if type eq 22 then xoff=(176-128)/(176.*2)*sf ;typ='SLI ' if type eq 23 then size=160/176.*sf ;typ='HRI ' if type eq 23 then yoff=0. ;typ='HRI ' if type eq 23 then xoff=(176-160)/(176.*2)*sf ;typ='HRI ' 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)-set+xoff,ypos+yoff,xsize=size,/inches xyouts,(((n-1)/3*space)-set+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+36*(j-1))+' thru '+sstr(36*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\thumbnails.ps' spawn,command set_plot,'WIN' ;returns to X windows environment print,'Done' cd,cdir end