FUNCTION show_image,images,bright,dark,max ; typical calling statement: ; p = show_image(images,2,1,500) ; This function takes in a vector of images, then subtracts one image (dark) ; from the other (bright) to provide dark subtraction. The values for bright ; and dark start with 1 for the first image. The resulting image ; (p) is scanned to limit all pixels to the value max or less. If max is set ; to -1, then the brightness values will not be truncated. This causes ; tvscl to stretch the image from 0 to max to highlight the low light level ; parts of the image. The image is then displayed in window 1, and a series ; of overlaid horizontal plots across the entire image are displayed in ; window 0. The plots show the brightness curve every 25 lines, starting ; at line number 35. The function will automatically scale to any size image ; array, and so can be used on the full CCD, any imager, any visible ; spectormeter, or any SA channel. ; The dark subtracted and brightness truncated image is then returned by the ; function s=size(images) ; find x and y dimensions of each image numx = s(2) numy = s(3) dark_current = 0l ; find average dark current, sum may be large number p=intarr(1,numx,numy) ; create output array. First dimension of 1 is unavoidable if max LE 0 then max = 4095 ; don't cut off if not specified p = images(bright-1,*,*) - images(dark-1,*,*) ;make first image 1, not 0 for i=0,numx-1 do for j=0,numy-1 do begin if p(0,i,j) GT max then p(0,i,j)=max ; truncate pixels that are too bright dark_current = dark_current + images(dark-1,i,j) ; sum up dark current endfor window,0,xsize=500,ysize=500 ; display brightness plots plot,p(0,*,10),yrange=[0,max],background=255,color=0,title=' Image with dark subtraction', $ xtitle=' Image X axes',ytitle='Raddiance' ; set plot scales for i=35,numy-1,25 do oplot,p(0,*,i),color=0 window,1,xsize=numx+1,ysize=numy+1 ; display image with requested stretch tvscl,p print,'Average dark current is ',(dark_current/(numx*numy)) return,p ; return dark subtracted, truncated image end FUNCTION read_files,directory ; typical calling statement: ; images = read_files('/opt2/Log/1Aug95bleedthrough/DB/Full') ; This function looks for all the disrsoft data files in the specified directory. ; It will then create an array (images), that will have one more dimension ; than the data in each data file. Thus if reading in ULV data sets, it will ; create a one dimensional array. For IR spectra, it will create a ; 2 dimensional array, and for images, a three dimensional array. The first ; index in any of these, will be the data set number (starting at 0), and the ; remaining index(es) will be elements within a given data set. It is not ; necessary to create the array images before calling this routine. The ; resulting array with all the data in that directory will be passed back by ; the function. No header information is kept. cd,directory, current = olddir ; save curent dir in olddir files=t_getfil(directory) s=size(files) ; find number of files to read in numfiles=s(1) d_read,files(0),h,p s=size(p) ; find size each data record if s(0) EQ 0 then begin ; if only single value, make array for number of files images=intarr(numfiles) for i=0,numfiles-1 do begin d_read,files(i),h,p images(i)=p ; save each data element in array endfor endif if s(0) EQ 1 then begin ; if vector of data, make 2 dim array images = intarr(numfiles,s(1)) for i=0,numfiles-1 do begin d_read,files(i),h,p images(i,*)=p ; save each data vector endfor endif if s(0) EQ 2 then begin ; if images, make 3 dim array images = intarr(numfiles,s(1),s(2)) for i=0,numfiles-1 do begin d_read,files(i),h,p images(i,*,*)=p ; save each image in array endfor endif cd,olddir ; return to original directory print,numfiles,' files read in from directory ',directory return,images end pro thumbnail,images ; typical calling sequence : ; dir = '/opt1/Log/bleedthru_1Aug95.1/DB/Full/' ; images = read_files(dir) ; thumbnail,images ; This procedure takes an array of images and opens a large window to show ; all the images at once. The images will run from left to right, and the ; rows will then run from top to bottom. s=size(images) ; find dimesnsions needed numi = s(1) ; number of images numx = s(2) ; size of x axis for each image numy = s(3) ; size of y axis for each image maxx = 1024 ; biggest window that can be displayed maxy = 768 scale = 1 ; reduction factor in to fit all images in while (fix(maxx*scale/numx)*fix(maxy*scale/numy) LT numi) do scale = scale + 1 ; find smallest reduction that allows showing all images display = intarr(maxx,maxy) rows = fix(maxy*scale/numy) ; find total number of rows of images columns = fix(maxx*scale/numx) ; total number of images in each row smallx = numx/scale ; x size of reduced images smally = numy/scale ; y size of reduced images spacex = (maxx - smallx*columns)/(columns - 1) ; spaces between images spacey = (maxy - smally*rows)/(rows - 1) for j = 1,rows do begin ; pack reduced images in larger array for i = 1,columns do begin if numi GT (j-1)*columns + i - 1 then $ for k=0,smallx-1 do for l=0,smally-1 do $ display(((smallx+spacex)*(i-1) + k), (maxy - (smally+spacey)*j + l)) = $ images((j-1)*columns + i - 1,k*scale,l*scale) endfor endfor window,10,xsize=maxx,ysize=maxy tvscl,display return end