Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes


top cgSDevScl

Utilities, Graphics

result = cgSDevScl(image [, EXCLUDE=numeric] [, MULTIPLIER=float] [, /NEGATIVE] [, OMAX=byte] [, OMIN=byte] [, THRESHOLD=float])

This is a utility routine to perform standard deviation scaling on image arrays. The user defines a multiple of the standard deviation and this is used with the standard deviation of the pixels in the image to create a threshold for linear scaling. Use the EXCLUDE keyword to exclude a particular value from the standard deviation calculation.


image in required type=numeric

The image array that is to be scaled.


EXCLUDE in optional type=numeric

Set this keyword to a value in the image array that is to be excluded from the standard deviation calculation. Normally, this would be the backgroud value of the image, if there is a background.

MULTIPLIER in optional type=float default=2.0

The standard deviation of the image pixels is computed and then multiplied by the multiplier factor to produce upper and lower thresholds for the linear scaling of the image by subtracting or adding this value to the mean value of the image. The image is linearly scaled between these two threshold values.

NEGATIVE in optional type=boolean

Set this keyword to return the "negative" or reverse of the image scaling.

OMAX in optional type=byte default=255

Normally, the image is scaled into the range of 0 to 255. Setting the OMIN and OMAX keywords can change this scaling.

OMIN in optional type=byte default=0

Normally, the image is scaled into the range of 0 to 255. Setting the OMIN and OMAX keywords can change this scaling.

THRESHOLD out optional type=float

A two-element array that contains the minimum and maximum thresholds, respectively, that were calculated for the scaling.


To display an image with standard deviation scaling:

image = cgDemoData(5) cgDisplay, 256*3, 256 !P.Multi = [0,3,1] cgImage, image cgImage, SDevScl(image) cgImage, SDevScl(image, Exclude=0) !P.Multi = 0

Author information



David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: Coyote's Guide to IDL Programming:


Copyright (c) 2012, Fanning Software Consulting, Inc.


Change History:

Written by: David W. Fanning, 5 June 2012. Renamed cgSDevScl from SDevScl. 27 Mar 2015. DWF.

File attributes

Modification date: Fri Mar 27 07:46:15 2015
Lines: 164
Docformat: rst rst