This is a utility routine to perform linear scaling (similar to BYTSCL)
on image arrays. If differs from BYTSCL only in that a user-specified
percentage of pixels can be clipped from the image histogram, prior to
scaling. By default, two percent of the pixels are clipped. Clipping
occurs at both ends of the image histogram.
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Coyote's Guide to IDL Programming: http://www.idlcoyote.com
scaledImage = CLIPSCL(image, clipPercent)
image: The image to be scaled. Written for 2D images, but arrays
of any size are treated alike.
clipPercent: The percent of image clipping. Optional argument is set
to 2 by default. Must be value between 0 and 49. Clipping
occurs from both ends of image histogram, so a clip of 2
linearly scales approximately 96% of the image histogram.
Clipping percents are approximations only, and depend
entirely on the distribution of pixels in the image. For
interactive scaling, see XSTRETCH.
NEGATIVE: If set, the "negative" of the result is returned.
OMAX: The output image is scaled between OMIN and OMAX. The
default value is 255.
OMIN: The output image is scaled between OMIN and OMAX. The
default value is 0.
THRESHOLD: A two-element array containing the image thresholds for clipping.
scaledImage: The output, scaled into the range OMIN to OMAX. A byte array.
LoadCT, 0 ; Gray-scale colors.
image = cgDemoData(22) ; Load image.
TV, ClipScl(image, 4)
Requires SCALE_VECTOR from the Coyote Library:
Written by: David W. Fanning, 6 September 2007.
Not sure what this program was doing, but not what I thought. I've reworked
the algorithm to scale the data appropriately. 25 Oct 2011. DWF.