Viewing contents of file '../idllib/astron/contrib/bhill/histscl.pro'
FUNCTION HISTSCL, Image, MINVAL=Minval, MAXVAL=Maxval, TOP=top
;+
; NAME:
; HISTSCL
;
; PURPOSE:
; Wrapper for IDL histogram equalization.
;
; CATEGORY:
; Image processing
;
; CALLING SEQUENCE:
; Result = HISTSCL( Image )
;
; INPUT POSITIONAL PARAMETERS:
; Image: Image to be scaled; can actually be any array.
;
; INPUT KEYWORD PARAMETERS:
; MINVAL: Minimum value for stretch. Default=min(Image)
; MAXVAL: Maximum value for stretch. Default=max(Image)
; TOP: Top value for output. Default=!D.table_size-1
;
; FUNCTION RESULT:
; Byte array with sqrt stretch. Negative and zero values are
; included nicely in the stretch range instead of being clipped.
;
; MODIFICATION HISTORY:
; Written by: RSH, RITSS, 29 August 2000
;-
IF n_params(0) LT 1 THEN BEGIN
print, 'CALLING SEQUENCE: Result=HISTSCL(Image)'
print, 'KEYWORD PARAMETERS: MINVAL, MAXVAL, TOP'
RETURN,-1
ENDIF
IF n_elements(minval) LT 1 THEN minval=min(image)
IF n_elements(maxval) LT 1 THEN maxval=max(image)
IF n_elements(top) LT 1 THEN top=!D.table_size-1
bin = double(maxval-minval)/top
i0 = min(image)
RETURN,hist_equal(image+i0,minv=minval+i0,maxv=maxval+i0,top=top)
END