;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Name: ; hist_tot.pro ; ; Purpose: ; This program plots the histogram of an image or array. ; ; Inputs: ; The first input is the image of interest, the 2nd is a vector as derived by ; applying the MOMENT function to the image and the last two are the ; minimum and maximum values of the input image. ; ; Author: ; Vito Alberga ; ; Date: ; December 2000 ; ; Calling sequence: ; hist_tot, im, param, minim, maxim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pro hist_tot, im, param, minim, maxim ; Definition of the parameters to be used. mean = param[0] stdev = sqrt(param[1]) xran = (maxim - minim) ;meanran = abs(mean-stdev) ; Different cases to be considered. case 1 of (minim ge 0) AND (maxim le 1) : begin ; Typically for coherence images xtit = 'degree of coherence' xr = [0,1] x = findgen((maxim - minim)*101)*(1.0/100) bin = (1.0/100) end (minim ge 0) AND (maxim gt 1) : begin xtit = '' read, xtit, prompt = 'Choose a title for the x-axis: ' ;min_hist = 0 max_hist = (mean + 3*stdev) if (stdev le 1) then begin bin = (1.0/100) x = findgen(( (mean + 3*stdev) + abs(minim) )*101)*(1.0/100) $ - abs(minim) endif else begin x = findgen( (mean + 3*stdev) + abs(minim) ) - abs(minim) endelse end (minim lt 0) : begin xtit = '' read, xtit, prompt = 'Choose a title for the x-axis: ' min_hist = (mean - 3*stdev) max_hist = (mean + 3*stdev) if (stdev le 0.2) then begin bin = (1.0/100) x = findgen(( (mean + 3*stdev) + abs(mean - 3*stdev) )*101)*(1.0/100) $ - abs(mean - 3*stdev) endif else begin x = findgen( (mean + 3*stdev) + abs(mean - 3*stdev) ) $ - abs((mean - 3*stdev)) endelse end endcase ; Plotting of the histogram. plot, x, histogram(im, binsize = bin, max = max_hist, min = min_hist, /NAN), $ xstyle = 1, xrange = xr, $ ystyle = 1, $ ;yrange = [0, 2.5*10^5], xtitle = xtit, ytitle = '# of pixels' end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;