pro tr_scan_images, infil, dir=dir, sigma=sigma, nopause=nopause, $
		filter=filter
;+
;NAME: 
;	tr_scan_images
;PURPOSE:
;	Read and display a list of files - display the images
;	stretching +/- N sigma.  Useful for screening data for
;	health checks or finding data which is "lost"
;SAMPLE CALLING SEQUENCE:
;	tr_scan_images
;	tr_scan_images, sigma=3
;	tr_scan_images, file_arr
;	tr_scan_images, filter='*cmtest*.fits'
;	tr_scan_images, /nopause, dir='/td10/log/rawimage/970418'
;OPTIONAL INPUT:
;	file_arr- The files to display.  Default is to put up
;		  a widget with a list of input directories
;		  (a directory per day)
;OPTIONAL KEYWORD INPUT:
;	sigma 	- How to stretch the data for display. Default=1
;	dir	- The directory where to grab all fits images.
;	nopause	- If set, then do not pause between images.
;	filter	- The filename filter to be used to select
;		  files (Default = '*.fits')
;METHOD:
;	The file name is printed out, along with the avg and
;	standard deviation.
;HISTORY:
;	Written 30-Apr-97 by M.Morrison
;-
;
if (n_elements(sigma) eq 0) then sigma = 1.0
if (n_elements(filter) eq 0) then filter = '*.fits'
;
if (keyword_set(dir)) then ff = file_list(dir, filter)
if (keyword_set(infil)) then ff = infil
;
if (n_elements(ff) eq 0) then begin
    dirs = get_i0_dirs()
    ss = xmenu_sel(dirs)
    if (ss(0) eq -1) then return
    ff = file_list(dirs(ss), filter)
end
;
n = n_elements(ff)
if (ff(0) eq '') then n = 0
;
for i=0,n-1 do begin
    img = rfits( ff(i), h=h)
    idev = stdev(img, iavg)
    img2 = congrid(img, 512, 512) > (iavg-idev*sigma) < (iavg+idev*sigma)
    tvscl, img2
    print, ff(i), iavg, idev
    if (not keyword_set(nopause)) then pause
end
;
end