[Previous]
[Next]
NAME:
C_CORRELATE
PURPOSE:
This function computes the cross correlation Pxy(L) or cross
covariance Rxy(L) of two sample populations X and Y as a function
of the lag (L).
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = C_correlate(X, Y, Lag)
INPUTS:
X: An n-element vector of type integer, float or double.
Y: An n-element vector of type integer, float or double.
LAG: A scalar or n-element vector, in the interval [-(n-2), (n-2)],
of type integer that specifies the absolute distance(s) between
indexed elements of X.
KEYWORD PARAMETERS:
COVARIANCE: If set to a non-zero value, the sample cross
covariance is computed.
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
EXAMPLE
Define two n-element sample populations.
x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57]
y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95]
Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 7
lag = [-5, 0, 1, 5, 6, 7]
result = c_correlate(x, y, lag)
The result should be:
[-0.428246, 0.914755, 0.674547, -0.405140, -0.403100, -0.339685]
PROCEDURE:
See computational formula published in IDL manual.
REFERENCE:
INTRODUCTION TO STATISTICAL TIME SERIES
Wayne A. Fuller
ISBN 0-471-28715-6
MODIFICATION HISTORY:
Written by: GGS, RSI, October 1994
Modified: GGS, RSI, August 1995
Corrected a condition which excluded the last term of the
time-series.
- GGS, RSI, April 1996
Simplified CROSS_COV function. Added DOUBLE keyword.
Modified keyword checking and use of double precision.
- W. Biagiotti, Advanced Testing Technologies
Inc., Hauppauge, NY, July 1997, Moved all
constant calculations out of main loop for
greatly reduced processing time.
CT, RSI, September 2002. Further speed improvements, per W. Biagiotti.
Now handles large vectors and complex inputs.
[Previous]
[Next]
NAME:
CALDAT
PURPOSE:
Return the calendar date and time given julian date.
This is the inverse of the function JULDAY.
CATEGORY:
Misc.
CALLING SEQUENCE:
CALDAT, Julian, Month, Day, Year, Hour, Minute, Second
CALLED BY:
TIMEGEN
See also: julday, the inverse of this function.
INPUTS:
JULIAN contains the Julian Day Number (which begins at noon) of the
specified calendar date. It should be a long integer.
OUTPUTS:
(Trailing parameters may be omitted if not required.)
MONTH: Number of the desired month (1 = January, ..., 12 = December).
DAY: Number of day of the month.
YEAR: Number of the desired year.
HOUR: Hour of the day
Minute: Minute of the day
Second: Second (and fractions) of the day.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Accuracy using IEEE double precision numbers is approximately
1/10000th of a second.
MODIFICATION HISTORY:
Translated from "Numerical Recipies in C", by William H. Press,
Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling.
Cambridge University Press, 1988 (second printing).
DMS, July 1992.
DMS, April 1996, Added HOUR, MINUTE and SECOND keyword
AB, 7 December 1997, Generalized to handle array input.
AB, 3 January 2000, Make seconds output as DOUBLE in array output.
[Previous]
[Next]
NAME:
CALENDAR
PURPOSE:
Display a calandar for a month or an entire year using IDL's
plotting subsystem. This IDL routine imitates the Unix cal
command.
CATEGORY:
Misc.
CALLING SEQUENCE:
CALENDAR
CALENDAR, YEAR
CALENDAR, MONTH, YEAR
INPUTS:
If called without arguments, CALENDAR draws a calendar for the
current month.
MONTH: The number of the month for which a calandar is
desired (1 is January, 2 is February, ..., 12 is December).
YEAR: The number of the year for which a calendar should be
drawn. If YEAR is provided without MONTH, a calendar
for the entire year is drawn.
OPTIONAL INPUT PARAMETERS:
None.
OUTPUTS:
The specified calandar is drawn on the current graphics device.
CALLS: ***
CAL_INFO, DRAW_CAL, JULDAY
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
MODIFICATION HISTORY:
AB, September, 1988
CT, RSI, September 2002: Fix for Gregorian Reform in 1582.
[Previous]
[Next]
; Canny
;
; Purpose:
; This function implements the Canny edge detection algorithm
;
; Parameters:
; IMAGE - A 2D image
;
; Keywords:
; HIGH - The high value to be used during edge detection. Given as
; a factor of the histgram of the magnitude array. Input
; range : [0 - 1]
;
; LOW - The low value to be used during edge detection. Given as a
; factor of the HIGH value. Input range : [0 - 1]
;
; SIGMA - The sigma value to be used when creating the gaussian kernel.
;
CALLS: ***
CANNY_FOLLOW, CANNY_GAUSSIAN, CANNY_SECTOR, CANNY_TRACK
[Previous]
[Next]
NAME:
CDF_EXISTS
PURPOSE:
Test for the existence of the CDF library
CATEGORY:
File Formats
CALLING SEQUENCE:
Result = CDF_EXISTS()
INPUTS:
None.
KEYWORD PARAMETERS:
None.
OUTPUTS:
Returns TRUE (1) if the CDF data format library is
supported. Returns FALSE(0) if it is not.
CALLS: ***
CDF_INQUIRE
EXAMPLE:
IF cdf_exists() EQ 0 THEN Fail,"CDF not supported on this machine"
MODIFICATION HISTORY
Written by: Joshua Goldstein, 12/8/92
[Previous]
[Next]
NAME:
CHISQR_CVF
PURPOSE:
This function computes the cutoff value (v) such that:
Probability(X > v) = p
where X is a random variable from the Chi-square distribution
with (df) degrees of freedom.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = chisqr_cvf(P, DF)
INPUTS:
P: A non-negative scalar, in the interval [0.0, 1.0], of type
float or double that specifies the probability of occurance
or success.
DF: A positive scalar of type integer, float or double that
specifies the degrees of freedom of the Chi-square distribution.
CALLS: ***
BISECT_PDF, CHISQR_PDF
EXAMPLE:
Compute the cutoff value (v) such that Probability(X > v) = 0.100
from the Chi-square distribution with (DF = 3) degrees of freedom.
The result should be 6.25139
result = chisqr_cvf(0.100, 3)
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
[Previous]
[Next]
NAME:
CHISQR_PDF
PURPOSE:
This function computes the probabilty (p) such that:
Probability(X <= v) = p
where X is a random variable from the Chi-square distribution
with (df) degrees of freedom.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = chisqr_pdf(V, DF)
INPUTS:
V: A scalar of type integer, float or double that specifies
the cutoff value.
DF: A positive scalar of type integer, float or double that
specifies the degrees of freedom of the Chi-square distribution.
EXAMPLES:
Compute the probability that a random variable X, from the Chi-square
distribution with (DF = 3) degrees of freedom, is less than or equal
to 6.25. The result should be 0.899939
result = chisqr_pdf(6.25, 3)
Compute the probability that a random variable X, from the Chi-square
distribution with (DF = 3) degrees of freedom, is greater than 6.25.
The result should be 0.100061
result = 1 - chisqr_pdf(6.25, 3)
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
CALLS: ***
IGAMMA
CALLED BY:
CHISQR_CVF, CTI_TEST, IDLitwdCurveFitting, KW_TEST, XSQ_TEST
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
CT, RSI, March 2000: changed call from igamma_pdf to igamma
CT, RSI, July 2001: Increase # of iterations to 300.
CT, RSI, Dec 2004: Remove restriction on # of iterations.
Just use the IGAMMA default.
[Previous]
[Next]
NAME:
CIR_3PNT
PURPOSE:
This procedure returns the radius and center of a circle,
given 3 points on the circle. This is analogous to finding
the circumradius and circumcircle of a triangle; the center
of the circumcircle is the point at which the three perpendicular
bisectors of the triangle formed by the points meet.
CATEGORY:
Analytical geometry.
CALLING SEQUENCE:
CIR_3PNT, X, Y, R, X0, Y0
INPUTS:
X: A three-element vector containing the X-coordinates of the points.
Y: A three-element vector containing the Y-coordinates of the points.
OUTPUTS:
R: The radius of the circle. The procedure returns 0.0 if the points
are co-linear.
X0, Y0: The coordinates of the center of the circle. The procedure
returns 0.0 if the points are co-linear.
CALLED BY:
VORONOI
PROCEDURE:
Derived from Glasser, ed. Graphics Gems, Volume 1, Page 22.
EXAMPLE:
X = [1.0, 2.0, 3.0]
Y = [1.0, 2.0, 1.0]
CIR_3PNT, X, Y, R, X0, Y0
Print, 'The radius is: ', R
Print, 'The center of the circle is at: ', X0, Y0
MODIFICATION HISTORY:
Written by: DMS, RSI, Nov, 1992.
SJL, Nov, 1997. - Formatting.
Modified: CT, RSI, August 2002. Corrected abs(c) test.
Also don't stomp on input vars.
[Previous]
[Next]
NAME:
CLUST_WTS
PURPOSE:
This function computes the weights (the cluster centers) of an
M-column, N-row array, where M is the number of variables and
N is the number of observations or samples. The result is an
M-column, N_CLUSTERS-row array of cluster centers.
CATEGORY:
Statistics
CALLING SEQUENCE:
Result = Clust_wts(Array)
INPUTS:
Array: An M-column, N-row array of type float or double.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
N_CLUSTERS: Use this keyword to specify the number of cluster
centers. The default is to compute N cluster centers.
N_ITERATIONS: Use this keyword to specify the number of iterations
in computing the cluster centers. The default is to
use 20 iterations.
VARIABLE_WTS: An M-element vector of variable weights. The elements
of this vector are used to give greater or lesser
importance to each variable (each column) in determining
the cluster centers. The default is to give all variables
equal weighting using a value of 1.0.
EXAMPLE: See the documentation for CLUSTER.
REFERENCE:
CLUSTER ANALYSIS (Third Edition)
Brian S. Everitt
ISBN 0-340-58479-3
MODIFICATION HISTORY:
Written by: GGS, RSI, June 1996
Adapted from an algorithm written by Robb Habbersett
of Los Alamos National Laboratory.
[Previous]
[Next]
NAME:
CLUSTER
PURPOSE:
This function computes the classification of an M-column, N-row
array, where M is the number of variables and N is the number of
observations or samples. The classification is based upon a cluster
analysis of sample-based distances. The result is a 1-column, N-row
array of cluster number assignments that correspond to each sample.
CATEGORY:
Statistics
CALLING SEQUENCE:
Result = Cluster(Array, Weights)
INPUTS:
Array: An M-column, N-row array of type float or double.
Weights: An array of weights (the cluster centers) computed using
the CLUST_WTS function. The dimensions of this array vary
according to keyword values.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
N_CLUSTERS: Use this keyword to specify the number of clusters.
The default is based upon the row dimension of the
Weights array.
EXAMPLE:
Define an array with 4 variables and 10 observations.
array = $
[[ 1.5, 43.1, 29.1, 1.9], $
[24.7, 49.8, 28.2, 22.8], $
[30.7, 51.9, 7.0, 18.7], $
[ 9.8, 4.3, 31.1, 0.1], $
[19.1, 42.2, 0.9, 12.9], $
[25.6, 13.9, 3.7, 21.7], $
[ 1.4, 58.5, 27.6, 7.1], $
[ 7.9, 2.1, 30.6, 5.4], $
[22.1, 49.9, 3.2, 21.3], $
[ 5.5, 53.5, 4.8, 19.3]]
Compute the cluster weights.
IDL> Weights = Clust_Wts(array)
Compute the classification of each sample.
IDL> result = CLUSTER(array, weights)
Print each sample (each row) of the array and its corresponding
cluster assignment.
IDL> for k = 0, N_ELEMENTS(result)-1 do PRINT, $
IDL> array(*,k), result(k), FORMAT = '(4(f4.1, 2x), 5x, i1)'
REFERENCE:
CLUSTER ANALYSIS (Third Edition)
Brian S. Everitt
ISBN 0-340-58479-3
MODIFICATION HISTORY:
Written by: GGS, RSI, June 1996
Adapted from an algorithm written by Robb Habbersett
of Los Alamos National Laboratory.
[Previous]
[Next]
NAME:
CLUSTER_TREE
PURPOSE:
This function computes the hierarchical clustering for a set of
m items in an n-dimensional space.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = CLUSTER_TREE(Pairdistance, Linkdistance)
INPUTS:
Pairdistance: An input vector containing the pairwise distance matrix
in compact form, usually created by the DISTANCE_MEASURE function.
Given a set of m items, with the distance between items i and j
denoted by D(i, j), Pairdistance should be an m*(m-1)/2 element
vector, ordered as:
[D(0, 1), D(0, 2), ..., D(0, m-1), D(1, 2), ..., D(m-2, m)].
OUTPUTS:
Linkdistance: Set this argument to a named variable in which the
cluster distances will be returned as an (m-1)-element single
or double-precision vector. Each element of Linkdistance
corresponds to the distance between the two items of the
corresponding row in Result. If Pairdistance is double precision
then Linkdistance will be double precision, otherwise Linkdistance
will be single precision.
The Result is a 2-by-(m-1) integer array containing the cluster
indices. Each row of Result contains the indices of the two
items that were clustered together. The distance between the
two items is contained in the corresponding element of the
Linkdistance output argument.
KEYWORD PARAMETERS:
DATA: If LINKAGE=3 (centroid), then the DATA keyword must be
set to the array of original data as input to the
DISTANCE_MEASURE function. The data array is necessary
for computing the centroid of newly-created clusters.
Note - DATA does not need to be supplied if LINKAGE is not equal to 3.
LINKAGE: Set this keyword to an integer giving the method used to
link clusters together. Possible values are:
LINKAGE=0 (the default): Use single linkage (nearest neighbor).
The distance between two clusters is defined as the
smallest distance between items in the two clusters.
This method tends to string items together and is useful
for non-homogeneous clusters.
LINKAGE=1: Use complete linkage (furthest neighbor).
The distance between two clusters is defined as the
largest distance between items. This method is useful
for homogeneous, compact, clusters but is not useful
for long chain-like clusters.
LINKAGE=2: Use weighted pairwise average. The distance between
two clusters is defined as the average distance for all
pairs of objects between each cluster, weighted by the
number of objects in each cluster. This method works
fairly well for both homogeneous clusters and for
chain-like clusters.
LINKAGE=3: Use weighted centroid. The distance between two
clusters is defined as the distance between the centroids
of each cluster. The centroid of a cluster is the average
position of all the subclusters, weighted by the number of
objects in each subcluster.
MEASURE: If LINKAGE=3 (centroid), then set this keyword to an
integer giving the distance measure (the metric) to use.
Possible values are:
MEASURE=0 (the default): Euclidean distance.
MEASURE=1: CityBlock (Manhattan) distance.
MEASURE=2: Chebyshev distance.
MEASURE=3: Correlative distance.
MEASURE=4: Percent disagreement.
For consistent results, the MEASURE value should match the
value used in the original call to DISTANCE_MEASURE.
This keyword is ignored if LINKAGE is not equal to 3,
or if POWER_MEASURE is set.
Note - See DISTANCE_MEASURE for a detailed description of
the various metrics.
POWER_MEASURE: If LINKAGE=3 (centroid), then set this keyword to a
scalar or a two-element vector giving the parameters p and r
to be used in the power distance metric.
If POWER_MEASURE is a scalar then the same value is used for both
p and r.
For consistent results, the POWER_MEASURE value should match the
value used in the original call to DISTANCE_MEASURE.
This keyword is ignored if LINKAGE is not equal to 3.
Note - See DISTANCE_MEASURE for a detailed description of
the power distance metric.
CALLS: ***
CLUSTER_TREE_CENTROID, CLUSTER_TREE_DISTANCE, CORRELATE
EXAMPLE:
; Given a set of points in two-dimensional space.
data = [ $
[1, 1], $
[1, 3], $
[2, 2.2], $
[4, 1.75], $
[4, 4], $
[5, 1], $
[5.5, 3]]
; Compute the Euclidean distance between each point.
distance = DISTANCE_MEASURE(data)
; Now compute the cluster analysis.
clusters = CLUSTER_TREE(distance, linkdistance)
PRINT, 'Item# Item# Distance'
PRINT, [clusters, TRANSPOSE(linkdistance)], $
FORMAT='(I3, I7, F10.2)'
REFERENCE:
Portions of the linkage code were adapted from:
"The C Clustering Library",
Michiel de Hoon, Seiya Imoto, Satoru Miyano
The University of Tokyo, Institute of Medical Science,
Human Genome Center.
MODIFICATION HISTORY:
Written by: CT, RSI, August 2003
Modified:
[Previous]
[Next]
NAME:
CMYK_CONVERT
PURPOSE:
Convert from CMYK to RGB and vice versa.
The CMYK_CONVERT procedure uses the following method to convert
from CMYK to RGB:
R = (255 - C) (1 - K/255)
G = (255 - M) (1 - K/255)
B = (255 - Y) (1 - K/255)
To convert from RGB to CMYK the following method is used:
K = minimum of (R, G, B)
C = 255 [1 - R/(255 - K)] (if K=255 then C=0)
M = 255 [1 - G/(255 - K)] (if K=255 then M=0)
Y = 255 [1 - B/(255 - K)] (if K=255 then Y=0)
In both cases the CMYK and RGB values are assumed to be in
the range 0 to 255.
Note: There is no single method that is used for CMYK/RGB conversion.
The method used by CMYK_CONVERT is the simplest, and, depending
upon printing inks and screen colors, may not be optimal in
all situations.
CALLING SEQUENCE:
CMYK_CONVERT, C, M, Y, K, R, G, B [, /TO_CMYK]
INPUTS:
C,M,Y,K: To convert from CMYK to RGB, set these arguments to scalars
or arrays containing the CMYK values in the range 0-255.
To convert from RGB to CMYK (with /TO_CMYK set) set these arguments
to named variables which will contain the converted values.
R,G,B: To convert from CMYK to RGB, set these arguments to named
variables which will contain the converted values.
To convert from RGB to CMYK (with /TO_CMYK set) set these
arguments to scalars or arrays containing the RGB values.
KEYWORD PARAMETERS:
TO_CMYK: If this keyword is set, then the values contained within
the RGB arguments will be converted to CMYK.
The default is to convert from CMYK to RGB.
MODIFICATION HISTORY:
Written by: CT, RSI, August 2004
Modified:
[Previous]
[Next]
NAME:
COLORMAP_APPLICABLE
PURPOSE:
Determine whether the current visual class supports the use of a colormap,
and if so, whether colormap changes affect pre-displayed Direct Graphics
or if the graphics must be redrawn to pick up colormap changes.
CATEGORY:
Direct Graphics, Color.
CALLING SEQUENCE:
result = COLORMAP_APPLICABLE(redrawRequired)
INPUTS:
None.
Keyword Inputs:
None.
OUTPUTS:
The function returns a long value of 1 if the current visual class allows
modification of the color table, and 0 otherwise.
redrawRequired: Set this to a named variable to retrieve a value
indicating whether the visual class supports automatic
updating of graphics. The value will be 0 if the
graphics are updated automatically or 1 if the graphics
must be redrawn to pick up changes to the colormap.
CALLED BY:
CW_ANIMATE, CW_CLR_INDEX, CW_RGBSLIDER, XLOADCT, XPALETTE, XPCOLOR
EXAMPLE:
To determine whether to redisplay an image after a colormap change:
result = COLORMAP_APPLICABLE(redrawRequired)
IF ((result GT 0) AND (redrawRequired GT 0)) THEN BEGIN
my_redraw
ENDIF
MODIFICATION HISTORY:
Written August 1998, ACY
[Previous]
[Next]
NAME:
COMFIT
PURPOSE:
This function fits the paired data {X(i), Y(i)} to one of six common
types of appoximating models using a gradient-expansion least-squares
method. The result is a vector containing the model parameters.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = COMFIT(X, Y, A)
INPUTS:
X: An n-element vector of type integer, float or double.
Y: An n-element vector of type integer, float or double.
A: A vector of initial estimates for each model parameter. The length
of this vector depends upon the type of model selected.
KEYWORD PARAMETERS:
EXPONENTIAL: If set to a non-zero value, the parameters of the
exponential model are computed. Y = a0 * a1^x + a2.
GEOMETRIC: If set to a non-zero value, the parameters of the
geometric model are computed. Y = a0 * x^a1 + a2.
GOMPERTZ: If set to a non-zero value, the parameters of the
Gompertz model are computed. Y = a0 * a1^(a2*x) + a3.
HYPERBOLIC: If set to a non-zero value, the parameters of the
hyperbolic model are computed. Y = 1./(a0 + a1*x)
LOGISTIC: If set to a non-zero value, the parameters of the
logistic model are computed. Y = 1./(a0 * a1^x + a2)
LOGSQUARE: If set to a non-zero value, the parameters of the
logsquare model are computed.
Y = a0 + a1*alog10(x) + a2 * alog10(x)^2
SIGMA: Use this keyword to specify a named variable which
returns a vector of standard deviations for the computed
model parameters.
WEIGHTS: An n-element vector of weights. If the WEIGHTS vector
is not specified, an n-element vector of 1.0s is used.
YFIT: Use this keyword to specify a named variable which
returns n-element vector of y-data corresponding to the
computed model parameters.
CALLS: ***
CURVEFIT, EXP_FUNC, GEO_FUNC, GOM_FUNC, HYP_FUNC, LOGSQ_FUNC, LOG_FUNC
EXAMPLE:
Define two n-element vectors of paired data.
x = [2.27, 15.01, 34.74, 36.01, 43.65, 50.02, 53.84, 58.30, 62.12, $
64.66, 71.66, 79.94, 85.67, 114.95]
y = [5.16, 22.63, 34.36, 34.92, 37.98, 40.22, 41.46, 42.81, 43.91, $
44.62, 46.44, 48.43, 49.70, 55.31]
Define a 3-element vector of initial estimates for the logsquare model.
a = [1.5, 1.5, 1.5]
Compute the model parameters of the logsquare model, a(0), a(1), & a(2).
result = comfit(x, y, a, sigma = sigma, yfit = yfit, /logsquare)
The result should be the 3-element vector:
[1.42494, 7.21900, 9.18794]
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
MODIFICATION HISTORY:
Written by: GGS, RSI, September 1994
[Previous]
[Next]
NAME:
COMPLEXROUND
PURPOSE:
This function rounds a complex scalar or array.
CATEGORY:
Numerical Analysis.
CALLING SEQUENCE:
Result = Complexround(z)
INPUTS:
Z: A complex scalar or array.
RESTRICTIONS:
The input argument must be complex.
PROCEDURE:
This function rounds the real and imaginary components of the
complex input argument. If Z is double-precision complex then
the result is also double-precision complex.
EXAMPLE:
;Define a complex array.
z = [[complex(1.245, 3.880), complex( 1.245, -3.880)], $
[complex(1.499, 5.501), complex(-1.355, -2.115)]]
;Round it.
result = complexround(z)
MODIFICATION HISTORY:
Written by: GGS, RSI, September 1992
Modified: GGS, RSI, September 1994
Added support for double-precision complex inputs.
Uses IDL's intrinsic ROUND function.
CT, RSI, March 2000: Fixed double-precision.
[Previous]
[Next]
NAME:
COND
PURPOSE:
This function computes the condition number of an N by N array.
CATEGORY:
Complex Linear Algebra.
CALLING SEQUENCE:
Result = COND(A)
INPUTS:
A: An N by N real or complex array.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
LNORM: Set this keyword to indicate which norm to use for the computation.
The possible values are:
LNORM=0 Use the L(Infinity) norm (maximum absolute row sum norm).
LNORM=1 Use the L(1) norm (maximum absolute column sum norm).
For LNORM=0 or 1 the array A must be square.
LNORM=2 Use the L(2) norm (spectral norm), defined as
the largest singular value, computed from SVD.
If LNORM is not specified then LNORM=0 is used.
CALLS: ***
NORM
CALLED BY:
DETERM
EXAMPLE:
Define a complex array (a).
a = [[complex(1, 0), complex(2,-2), complex(-3,1)], $
[complex(1,-2), complex(2, 2), complex(1, 0)], $
[complex(1, 1), complex(0, 1), complex(1, 5)]]
Compute the condition number of the complex array (a) using
double-precision complex arithmetic.
result = cond(a, /double)
PROCEDURE:
This function returns the condition number of an N x N real or
complex array A.
For LNORM=0 or 1, the condition number is norm(A)*norm(A_inverse).
If A is real and A_inverse is invalid (due to the singularity of A
or floating-point errors in the invert function), the condition
number is returned as a -1. If A is complex and A_inverse is invalid
(due to the singularity of A), calling COND results in floating-
point errors.
For LNORM=2, the condition number is defined as the ratio of the
largest to smallest singular values, computed using SVD.
If the smallest singular value is zero, then Infinity is returned.
For LNORM=2 the array A cannot be complex.
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
CRC Concise Encyclopedia of Mathematics
Eric W. Weisstein
ISBN 0-8493-9640-9
MODIFICATION HISTORY:
Written by: GGS, RSI, April 1992
Modified: GGS, RSI, February 1994
Accepts complex inputs. Added DOUBLE keyword.
Modified: GGS, RSI, November 1994
Added support for double-precision complex inputs.
Changed NR_INVERT to INVERT.
Modified: GGS, RSI, April 1996
Modified keyword checking and use of double precision.
Modified: CT, RSI, May 2001
Added LNORM keyword.
Allows L(1), L(2), L(Infinity) norm to be used. L(2) uses SVDC.
Modified: CT, RSI, July 2003
Change SVDC to LA_SVD so complex input is allowed for L(2)
Modified: CT, RSI, Jan 2005: Use double precision for internal
calculations, to avoid problems with huge integer inputs.
[Previous]
[Next]
NAME:
CONGRID
PURPOSE:
Shrink or expand the size of an array by an arbitrary amount.
This IDL procedure simulates the action of the VAX/VMS
CONGRID/CONGRIDI function.
This function is similar to "REBIN" in that it can resize a
one, two, or three dimensional array. "REBIN", however,
requires that the new array size must be an integer multiple
of the original size. CONGRID will resize an array to any
arbitrary size (REBIN is somewhat faster, however).
REBIN averages multiple points when shrinking an array,
while CONGRID just resamples the array.
CATEGORY:
Array Manipulation.
CALLING SEQUENCE:
array = CONGRID(array, x, y, z)
INPUTS:
array: A 1, 2, or 3 dimensional array to resize.
Data Type : Any type except string or structure.
x: The new X dimension of the resized array.
Data Type : Int or Long (greater than or equal to 2).
OPTIONAL INPUTS:
y: The new Y dimension of the resized array. If the original
array has only 1 dimension then y is ignored. If the
original array has 2 or 3 dimensions then y MUST be present.
z: The new Z dimension of the resized array. If the original
array has only 1 or 2 dimensions then z is ignored. If the
original array has 3 dimensions then z MUST be present.
KEYWORD PARAMETERS:
CENTER: If this keyword is set, shift the interpolation so that points
in the input and output arrays are assumed to lie at the midpoint
of their coordinates rather than at their lower-left corner.
INTERP: If set, causes linear interpolation to be used.
Otherwise, the nearest-neighbor method is used.
CUBIC: If specified and non-zero, "Cubic convolution"
interpolation is used. This is a more
accurate, but more time-consuming, form of interpolation.
CUBIC has no effect when used with 3 dimensional arrays.
If this parameter is negative and non-zero, it specifies the
value of the cubic interpolation parameter as described
in the INTERPOLATE function. Valid ranges are -1 <= Cubic < 0.
Positive non-zero values of CUBIC (e.g. specifying /CUBIC)
produce the default value of the interpolation parameter
which is -1.0.
MINUS_ONE:
If set, will prevent CONGRID from extrapolating one row or
column beyond the bounds of the input array. For example,
If the input array has the dimensions (i, j) and the
output array has the dimensions (x, y), then by
default the array is resampled by a factor of (i/x)
in the X direction and (j/y) in the Y direction.
If MINUS_ONE is present (AND IS NON-ZERO) then the array
will be resampled by the factors (i-1)/(x-1) and (j-1)/(y-1).
OUTPUTS:
The returned array has the same number of dimensions as the original
array and is of the same data type. The returned array will have
the dimensions (x), (x, y), or (x, y, z) depending on how many
dimensions the input array had.
CALLED BY:
CW_PALETTE_EDITOR, DIALOG_READ_IMAGE, H5_BROWSER, MESH_OBJ, PROJECT_VOL, SLICER3
SLIDE_IMAGE, cw_itoperationpreview, idlgrcolorbar__define [1]
idlgrcolorbar__define [2], idlgrcolorbar__define [3]
idlgrcolorbar__define [4], idlgrcolorbar__define [5]
idlgrcolorbar__define [6], idlgrcolorbar__define [7]
idlgrcolorbar__define [8], idlitopresample__define
idlitvislineprofile3d__define [1], idlitvislineprofile3d__define [2]
idlitvismapgrid__define [1], idlitvismapgrid__define [2]
idlitvispolyline__define [1], idlitvispolyline__define [2]
idlitvisvolume__define [10], idlitvisvolume__define [11]
idlitvisvolume__define [12], idlitvisvolume__define [13]
idlitvisvolume__define [14], idlitvisvolume__define [15]
idlitvisvolume__define [16], idlitvisvolume__define [17]
idlitvisvolume__define [18], idlitvisvolume__define [19]
idlitvisvolume__define [1], idlitvisvolume__define [2]
idlitvisvolume__define [3], idlitvisvolume__define [4]
idlitvisvolume__define [5], idlitvisvolume__define [6]
idlitvisvolume__define [7], idlitvisvolume__define [8]
idlitvisvolume__define [9]
PROCEDURE:
IF the input array has three dimensions, or if INTERP is set,
then the IDL interpolate function is used to interpolate the
data values.
If the input array has two dimensions, and INTERP is NOT set,
then the IDL POLY_2D function is used for nearest neighbor sampling.
If the input array has one dimension, and INTERP is NOT set,
then nearest neighbor sampling is used.
EXAMPLE:
; vol is a 3-D array with the dimensions (80, 100, 57)
; Resize vol to be a (90, 90, 80) array
vol = CONGRID(vol, 90, 90, 80)
MODIFICATION HISTORY:
DMS, Sept. 1988.
DMS, Added the MINUS_ONE keyword, Sept. 1992.
Daniel Carr. Re-wrote to handle one and three dimensional arrays
using INTERPOLATE function.
DMS, RSI, Nov, 1993. Added CUBIC keyword.
SJL, Nov, 1997. Formatting, conform to IDL style guide.
CT, RSI, April 2001. Added /CENTER keyword. Correct POLY_2D interp.
[Previous]
[Next]
NAME:
COORD2TO3
PURPOSE:
Return 3D data coordinates given the normalized X and Y screen
coordinates and one of the three data coordinates.
CATEGORY:
Geometry / Graphics.
CALLING SEQUENCE:
Result = COORD2TO3(Mx, My, Dim, D0 [, PTI])
INPUTS:
Mx, My: The normalized X and Y screen coordinates.
Dim: A parameter used to specify which data coordinate is fixed.
Use 0 for a fixed X data coordinate, 1 for a fixed Y data
coordinate, or 2 for a fixed Z data coordinate.
D0: The value of the fixed data coordinate.
OPTIONAL INPUT PARAMETERS:
PTI: The inverse of !P.T. If this parameter is not supplied,
or set to 0, COORD2TO3 computes the inverse. If this routine
is to be used in a loop, the caller should supply PTI for
highest efficiency.
KEYWORD PARAMETERS:
None.
OUTPUTS:
Returns a 3-element vector containing the 3D data coordinates.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
A valid 3D transform must exist in !P.T or PTI.
The axis scaling variables, !X.S, !Y.S and !Z.S must be valid.
PROCEDURE:
The intersection of the plane determined by data coordinates
Dim and D0 and the screen coordinate line (Mx, My, 0),
(Mx, My, 1) is computed.
EXAMPLE:
To return the data coordinates of the mouse, fixing the
data Z value at 10, enter the commands:
CURSOR, X, Y, /NORM ;Get the normalized mouse coords.
P = COORD2TO3(X, Y, 2, 10.0)
MODIFICATION HISTORY:
DMS, 9/91.
[Previous]
[Next]
NAME:
CORRELATE
PURPOSE:
This function computes the linear Pearson correlation coefficient
of two vectors or the Correlation Matrix of an M x N array.
Alternatively, this function computes the covariance of two vectors
or the Covariance Matrix of an M x N array.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = Correlate(X [,Y])
INPUTS:
X: A vector or an M x N array of type integer, float or double.
Y: A vector of type integer, float or double. If X is an M x N
array, this parameter should not be supplied.
KEYWORD PARAMETERS:
COVARIANCE: If set to a non-zero value, the sample covariance is
computed.
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
CALLS: ***
COV_MTRX, CRR_MTRX
CALLED BY:
CLUSTER_TREE, DISTANCE_MEASURE, M_CORRELATE, PCOMP, P_CORRELATE
RESTRICTIONS:
If X is an M x N array, then Y should not be supplied;
Result = Correlate(X)
EXAMPLES:
Define the data vectors.
x = [65, 63, 67, 64, 68, 62, 70, 66, 68, 67, 69, 71]
y = [68, 66, 68, 65, 69, 66, 68, 65, 71, 67, 68, 70]
Compute the linear Pearson correlation coefficient of x and y.
result = correlate(x, y)
The result should be 0.702652
Compute the covariance of x and y.
result = correlate(x, y, /covariance)
The result should be 3.66667
Define an array with x and y as its columns.
a = [transpose(x), transpose(y)]
Compute the correlation matrix.
result = correlate(a)
The result should be [[1.000000, 0.702652]
[0.702652, 1.000000]]
Compute the covariance matrix.
result = correlate(a, /covariance)
The result should be [[7.69697, 3.66667]
[3.66667, 3.53788]]
PROCEDURE:
CORRELATE computes the linear Pearson correlation coefficient of
two vectors. If the vectors are of unequal length, the longer vector
is truncated to the length of the shorter vector. If X is an M x N
array, M-columns by N-rows, the result will be an M x M array of
linear Pearson correlation coefficients with the iTH column and jTH
row element corresponding to the correlation of the iTH and jTH
columns of the M x N array. The M x M array of linear Pearson
correlation coefficients (also known as the Correlation Matrix) is
always symmetric and contains 1s on the main diagonal. The Covariance
Matrix is also symmetric, but is not restricted to 1s on the main
diagonal.
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
MODIFICATION HISTORY:
Written by: DMS, RSI, Sept 1983
Modified: GGS, RSI, July 1994
Added COVARIANCE keyword.
Included support for matrix input.
New documentation header.
Modified: GGS, RSI, April 1996
Included support for scalar and unequal length vector
inputs. Added checking for undefined correlations and
support of IEEE NaN (Not a Number).
Added DOUBLE keyword.
Modified keyword checking and use of double precision.
CT, RSI, Sept 2003: Force correlations to be in the range -1 to +1,
except for NaN values. Also force values on diagonal to be 1.
CT, RSI, Dec 2004: Improve handling for DOUBLE=0, and for complex input.
[Previous]
[Next]
NAME:
CRAMER
PURPOSE:
This function solves an n by n linear system of equations
using Cramer's rule.
CATEGORY:
Linear Algebra.
CALLING SEQUENCE:
Result = CRAMER(A, B)
INPUTS:
A: An N by N array of type: float, or double.
B: An N-element vector of type: float, or double.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
ZERO: Use this keyword to set the value of floating-point
zero. A floating-point zero on the main diagonal of
a triangular matrix results in a zero determinant.
A zero determinant results in a 'Singular matrix'
error and stops the execution of CRAMER.PRO.
For single-precision inputs, the default value is
1.0e-6. For double-precision inputs, the default value
is 1.0e-12.
CALLS: ***
DETERM
EXAMPLE:
Define an array (a).
a = [[ 2.0, 1.0, 1.0], $
[ 4.0, -6.0, 0.0], $
[-2.0, 7.0, 2.0]]
And right-side vector (b).
b = [3.0, 10.0, -5.0]
Compute the solution of the system, ax = b.
result = cramer(a, b)
PROCEDURE:
CRAMER.PRO uses ratios of column-wise permutations of the array (a)
to calculate the solution vector (x) of the linear system, ax = b.
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
MODIFICATION HISTORY:
Written by: GGS, RSI, February 1994
Modified: GGS, RSI, November 1994
Added support for double precision results.
Modified: GGS, RSI, April 1996
Modified keyword checking and use of double precision.
[Previous]
[Next]
Create_Cursor
Purpose:
Given a string array representing a 16x16 window cursor, this
function returns an Image array (a vector of 16 long integers).
Using keywords, you can optionally return
a Mask array (16x16 byte), and a 2-element Hotspot vector.
These can then be passed to IDLgrWindow::SetCurrentCursor.
CALLS: ***
Cvttobm, REVERSE
CALLED BY:
_idlitmanipulator__define
Example:
strArray = [ $
' . ', $
' .#. ', $
' .##.. ', $
' .$####. ', $
' .##..#. ', $
' .#. .#. ', $
' . .#. ', $
' . .#. ', $
' .#. .#. ', $
' .#. .#. ', $
' .#. .#. ', $
' .#. .#. ', $
' .#.....#. ', $
' .#####. ', $
' ..... ', $
' ']
The "image" consists of the # or $ character.
The "hotspot" is a 2-element vector giving the location
of the $ character. If there is no '$' then [0,0] is returned.
The "mask" consists of any non-space characters.
image = CREATE_CURSOR(strArray, HOTSPOT=hotspot, MASK=mask)
oWin->SetCurrentCursor, IMAGE=image, HOTSPOT=hotspot, MASK=mask
[Previous]
[Next]
NAME:
CREATE_VIEW
PURPOSE:
This procedure sets the various system variables required to
define a coordinate system and a 3-D view. This procedure
builds the system viewing matrix (!P.T) in such a way that the
correct aspect ratio of the data is maintained even if the
display window is not square.
CREATE_VIEW also sets the "Data" to "Normal" coordinate
conversion factors (!X.S, !Y.S, and !Z.S) so that center of
the unit cube will be located at the center of the display
window.
CATEGORY:
Viewing.
CALLING SEQUENCE:
CREATE_VIEW
INPUTS:
None.
KEYWORD PARAMETERS:
XMIN: The minimum data value on the X axis.
The default is (0.0).
Data type : Any scalar numeric value.
XMAX: The maximum data value on the X axis.
The default is (1.0).
Data type : Any scalar numeric value.
YMIN: The minimum data value on the Y axis.
The default is (0.0).
Data type : Any scalar numeric value.
YMAX: The maximum data value on the Y axis.
Data type : Any scalar numeric value.
The default is (1.0).
ZMIN: The minimum data value on the Z axis.
The default is (0.0).
Data type : Any scalar numeric value.
ZMAX: The maximum data value on the Z axis.
The default is (1.0).
Data type : Any scalar numeric value.
AX: The orientation (X rotation) of the view.
The default is (0.0).
Data type : Float or Double.
AY: The orientation (Y rotation) of the view.
The default is (0.0).
Data type : Float or Double.
AZ: The orientation (Z rotation) of the view.
The default is (0.0).
Data type : Float or Double.
WINX: The X size, in pixels, of the window that the
view is being set up for.
The default is (640).
Data type : Long.
WINY: The Y size, in pixels, of the window that the
view is being set up for.
The default is (512).
Data type : Long.
ZOOM: The view zoom factor. If zoom is a single
value then the view will be zoomed equally in
all 3 dimensions. If zoom is a 3 element vector
then the view will be scaled zoom(0) in X,
zoom(1) in Y, and zoom(2) in Z.
The default is (1.0). When used with the Z
buffer, be sure not to allow the transformed Z
coordinates outside the range of 0 to 1, which may
occur if ZOOM is larger than 1.0.
Data type : Float or Double, or Fltarr(3) or Dblarr(3)
ZFAC: Use this keyword to expand or contract the view
in the Z dimension.
The default is (1.0).
Data type : Float or Double.
PERSP: The perspective projection distance. A value of
(0.0) indicates an isometric projection (NO per-
spective).
The default is (0.0).
Data type : Float or Double.
RADIANS: Set this keyword to a non-zero value if the values
passed to AX, AY, and AZ are in radians.
The default is degrees.
Data type : Int.
CALLS: ***
T3D
SIDE EFFECTS:
This procedure sets the following IDL system variables :
!P.T, !P.T3D, !P.Position, !P.Clip, !P.Region
!X.S, !X.Style, !X.Range, !X.Margin
!Y.S, !Y.Style, !Y.Range, !Y.Margin
!Z.S, !Z.Style, !Z.Range, !Z.Margin
PROCEDURE:
This procedure sets the 4x4 system viewing matrix (!P.T) by
calling T3D with the following parameters :
; Reset (!P.T) to the identity matrix.
T3D, /RESET
; Translate the center of the unit cube to the origin.
T3D, TRANSLATE=[(-0.5), (-0.5), (-0.5)]
; Zoom the view.
T3D, SCALE=ZOOM
; Scale the view to preserve the correct aspect ratio.
xrange = xmax - xmin
yrange = ymax - ymin
zrange = (zmax - zmin) * zfac
max_range = xrange > yrange > zrange
T3D, SCALE=([xrange, yrange, zrange] / max_range)
; Rotate the view.
T3D, ROTATE=[0.0, 0.0, AZ]
T3D, ROTATE=[0.0, AY, 0.0]
T3D, ROTATE=[AX, 0.0, 0.0]
; Define a perspective projection (if any).
IF (p_proj) THEN T3D, PERSPECTIVE=PERSP
; Compensate for the aspect ratio of the display window.
T3D, SCALE=[xfac, yfac, 1.0]
; Translate the unit cube back to its starting point.
T3D, TRANSLATE=[(0.5), (0.5), (0.5)]
EXAMPLE:
Set up a view to display an iso-surface from volumetric data.
; Create some data.
vol = FLTARR(40, 50, 30)
vol(3:36, 3:46, 3:26) = RANDOMU(s, 34, 44, 24)
FOR i=0, 10 DO vol = SMOOTH(vol, 3)
; Generate the iso-surface.
SHADE_VOLUME, vol, 0.2, polygon_list, vertex_list, /LOW
; Set up the view.
; Note that the subscripts into the Vol array range from
; 0 to 39 in X, 0 to 49 in Y, and 0 to 29 in Z. As such,
; the 3-D coordinates of the iso-surface (vertex_list) may
; range from 0.0 to 39.0 in X, 0.0 to 49.0 in Y,
; and 0.0 to 29.0 in Z. Set XMIN, YMIN, and ZMIN to
; zero (the default), and set XMAX=39, YMAX=49, and ZMAX=29.
WINDOW, XSIZE=600, YSIZE=400
CREATE_VIEW, XMAX=39, YMAX=49, ZMAX=29, AX=(-60.0), AZ=(30.0), $
WINX=600, WINY=400, ZOOM=(0.7), PERSP=(1.0)
; Display the iso surface in the specified view.
img = POLYSHADE(polygon_list, vertex_list, /DATA, /T3D)
TVSCL, img
MODIFICATION HISTORY:
Written by: Daniel Carr. Wed Sep 2 16:40:47 MDT 1992
Modified the way the view is compensated for the data aspect ratio.
Daniel Carr. Tue Dec 8 17:53:54 MST 1992
DLD, April, 2000. Update for double precision.
[Previous]
[Next]
NAME:
CREATEPROPSHEET
PURPOSE:
Put the cw_itpropertysheet in the right panel
INPUTS:
BASE: (required) widget ID of the left base
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITCOMPONENTTREE, CW_ITPROPERTYSHEET, CW_ITTREEVIEW_SETSELECT, CW_PANES [1]
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, IDLITWDBROWSER_CALLBACK
IDLITWDBROWSER_CREATEPROPSHEET, IDLITWDBROWSER_CREATETREE
IDLITWDBROWSER_EVENT, IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, XMANAGER
cw_ittreeview, cw_panes [2]
[Previous]
[Next]
NAME:
CREATETREE
PURPOSE:
Put the cw_ittreeview in the left panel
INPUTS:
BASE: (required) widget ID of the left base
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITCOMPONENTTREE, CW_ITPROPERTYSHEET, CW_ITTREEVIEW_SETSELECT, CW_PANES [1]
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, IDLITWDBROWSER_CALLBACK
IDLITWDBROWSER_CREATEPROPSHEET, IDLITWDBROWSER_CREATETREE
IDLITWDBROWSER_EVENT, IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, XMANAGER
cw_ittreeview, cw_panes [2]
[Previous]
[Next]
NAME:
CROSSP
PURPOSE:
Evaluate the vector or cross-product of vectors v1 and v2.
CATEGORY:
Vector mathematics.
CALLING SEQUENCE:
Result = CROSSP(v1, v2)
INPUTS:
v1, v2: Three-element vectors.
OUTPUTS:
Returns a 3-element, floating-point vector.
CALLED BY:
CW_ARCBALL, CW_LIGHT_EDITOR, EXTRACT_SLICE, IDLexModelManip, MAP_PROJ_INIT
SLICER3, STREAMLINE, TRACKBALL, idlitvislight__define [1]
idlitvislight__define [2], idlitvislight__define [3]
idlitvislight__define [4], idlitvislight__define [5]
idlitvislight__define [6], map_set
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Vectors must have 3 elements.
PROCEDURE:
v1 X v2 = | i j k | = (b1c2 - b2c1)i + (c1a2-c2a1)j + (a1b2-a2b1)k
| a1 b1 c1 |
| a2 b2 c2 |
MODIFICATION HISTORY:
Written, DMS, Aug, 1983;
[Previous]
[Next]
NAME:
CRVLENGTH
PURPOSE:
This function computes the length of a curve with a tabular
representation, y(i) = F(x(i)).
CATEGORY:
Numerical Analysis
CALLING SEQUENCE:
Result = Crvlength(X, Y)
INPUTS:
X: An N-element vector (N >= 3) of type float or double. These
values must be specified in ascending order. Duplicate x values
will result in a warning message.
Y: An N-element vector of type float or double.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
CALLS: ***
INT_TABULATED, UNIQ
RESTRICTIONS:
Data that is highly oscillatory requires a sufficient number
of samples for an accurate curve length computation.
EXAMPLE:
Define a 21-element vector of X-values.
x = [-2.00, -1.50, -1.00, -0.50, 0.00, 0.50, 1.00, 1.50, 2.00, $
2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50, 6.00, 6.50, $
7.00, 7.50, 8.00]
Define a 21-element vector of Y-values.
y = [-2.99, -2.37, -1.64, -0.84, 0.00, 0.84, 1.64, 2.37, 2.99, $
3.48, 3.86, 4.14, 4.33, 4.49, 4.65, 4.85, 5.13, 5.51, $
6.02, 6.64, 7.37]
Compute the length of the curve.
result = CRVLENGTH(x, y)
The result should be:
14.8115
MODIFICATION HISTORY:
Written by: GGS, RSI, March 1996
[Previous]
[Next]
NAME:
CTI_TEST
PURPOSE:
This function constructs a "contingency table" from an array of
observed frequencies and tests the hypothesis that the rows and
columns are independent using an extension of the chi-squared
goodness-of-fit test. The result is a two-element vector contain-
ing the chi-squared test statistic X2 and probability of obtaining
a value of X2 or greater.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = CTI_TEST(OBFREQ)
INPUTS:
OBFREQ: An array of c-columns and r-rows of type integer, float
or double containing observed frequencies.
KEYWORD PARAMETERS:
COEFF: Use this keyword to specify a named variable which returns
the Coefficient of Contingency. A non-negative scalar,
in the interval [0.0, 1.0], which measures the degree
of dependence within a contingency table. The larger the
value of COEFF, the greater the degree of dependence.
CORRECTED: If set to a nonzero value, the "Yate's Correction for
Continuity" is used to compute the chi-squared test
statistic, X2. The Yate's correction always decreases the
magnitude of the chi-squared test statistic, X2. In general,
this keyword should be set for small sample sizes.
CRAMV: Use this keyword to specify a named variable which returns
Cramer's V. A non-negative scalar, in the interval [0.0, 1.0],
which measures the degree of dependence within a contingency
table.
DF: Use this keyword to specify a named variable which returns
the degrees of freedom used to compute the probability of
obtaining the value of the chi-squared test statistic or
greater. DF = (r - 1) * (c - 1) where r and c are the
number of rows and columns of the contingency table,
respectively.
EXFREQ: Use this keyword to specify a named variable which returns
an array of c-columns and r-rows containing expected
frequencies. The elements of this array are often refered
to as the "cells" of the expected frequencies. The expected
frequency of each cell is computed as the product of row
and column marginal frequencies divided by the overall
total of observed frequencies.
RESIDUAL: Use this keyword to specify a named variable which returns
an array of c-columns and r-rows containing signed differences
between corresponding cells of observed frequencies and
expected frequencies.
CALLS: ***
CHISQR_PDF
EXAMPLE:
Define the 5-column and 4-row array of observed frequencies.
obfreq = [[748, 821, 786, 720, 672], $
[ 74, 60, 51, 66, 50], $
[ 31, 25, 22, 16, 15], $
[ 9, 10, 6, 5, 7]]
Test the hypothesis that the rows and columns of "obfreq" contain
independent data at the 0.05 significance level.
result = cti_test(obfreq, coeff = coeff)
The result should be the two-element vector [14.3953, 0.276181].
The computed value of 0.276181 indicates that there is no reason to
reject the proposed hypothesis at the 0.05 significance level.
The Coefficient of Contingency returned in the parameter "coeff"
(coeff = 0.0584860) also indicates the lack of dependence between
the rows and columns of the observed frequencies. Setting the
CORRECTED keyword returns the two-element vector [12.0032, 0.445420]
and (coeff = 0.0534213) resulting in the same conclusion of
independence.
PROCEDURE:
CTI_TEST constructs a "contingency table" from a 2-dimensional
input array of observed frequencies and applies the principles of
the chi-squared goodness-of-fit test to determine the independence
of the rows and columns. For small sample sizes, a correction for
absolute differences between observed and expected frequencies may
be applied by setting the CORRECTED keyword.
REFERENCE:
PROBABILITY and STATISTICS for ENGINEERS and SCIENTISTS (3rd edition)
Ronald E. Walpole & Raymond H. Myers
ISBN 0-02-424170-9
MODIFICATION HISTORY:
Written by: GGS, RSI, August 1994
[Previous]
[Next]
NAME:
CURVEFIT
PURPOSE:
Non-linear least squares fit to a function of an arbitrary
number of parameters. The function may be any non-linear
function. If available, partial derivatives can be calculated by
the user function, else this routine will estimate partial derivatives
with a forward difference approximation.
CATEGORY:
E2 - Curve and Surface Fitting.
CALLING SEQUENCE:
Result = CURVEFIT(X, Y, Weights, A, SIGMA, FUNCTION_NAME = name, $
ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)
INPUTS:
X: A row vector of independent variables. This routine does
not manipulate or use values in X, it simply passes X
to the user-written function.
Y: A row vector containing the dependent variable.
Weights: A row vector of weights, the same length as Y.
For no weighting,
Weights(i) = 1.0.
For instrumental (Gaussian) weighting,
Weights(i)=1.0/sigma(i)^2
For statistical (Poisson) weighting,
Weights(i) = 1.0/y(i), etc.
For no weighting, set Weights to an undefined variable.
A: A vector, with as many elements as the number of terms, that
contains the initial estimate for each parameter. IF A is double-
precision, calculations are performed in double precision,
otherwise they are performed in single precision. Fitted parameters
are returned in A.
KEYWORDS:
FITA: A vector, with as many elements as A, which contains a zero for
each fixed parameter, and a non-zero value for elements of A to
fit. If not supplied, all parameters are taken to be non-fixed.
FUNCTION_NAME: The name of the function (actually, a procedure) to
fit. IF omitted, "FUNCT" is used. The procedure must be written as
described under RESTRICTIONS, below.
ITMAX: Maximum number of iterations. Default = 20.
ITER: The actual number of iterations which were performed
TOL: The convergence tolerance. The routine returns when the
relative decrease in chi-squared is less than TOL in an
interation. Default = 1.e-3.
CHI2: The value of chi-squared on exit (obselete)
CHISQ: The value of reduced chi-squared on exit
NODERIVATIVE: IF this keyword is set THEN the user procedure will not
be requested to provide partial derivatives. The partial
derivatives will be estimated in CURVEFIT using forward
differences. IF analytical derivatives are available they
should always be used.
DOUBLE = Set this keyword to force the calculation to be done in
double-precision arithmetic.
STATUS: Set this keyword to a named variable in which to return
the status of the computation. Possible values are:
STATUS = 0: The computation was successful.
STATUS = 1: The computation failed. Chi-square was
increasing without bounds.
STATUS = 2: The computation failed to converge in ITMAX
iterations.
YERROR: The standard error between YFIT and Y.
OUTPUTS:
Returns a vector of calculated values.
A: A vector of parameters containing fit.
OPTIONAL OUTPUT PARAMETERS:
Sigma: A vector of standard deviations for the parameters in A.
Note: if Weights is undefined, then you are assuming that
your model is correct. In this case, SIGMA is multiplied
by SQRT(CHISQ/(N-M)), where N is the number of points
in X and M is the number of terms in the fitting function.
See section 15.2 of Numerical Recipes in C (2nd ed) for details.
CALLED BY:
COMFIT, GAUSS2DFIT, GAUSS2_FUNCT, GAUSSFIT, idlitopcurvefitting__define
COMMON BLOCKS:
NONE.
SIDE EFFECTS:
None.
RESTRICTIONS:
The function to be fit must be defined and called FUNCT,
unless the FUNCTION_NAME keyword is supplied. This function,
(actually written as a procedure) must accept values of
X (the independent variable), and A (the fitted function's
parameter values), and return F (the function's value at
X), and PDER (a 2D array of partial derivatives).
For an example, see FUNCT in the IDL User's Libaray.
A call to FUNCT is entered as:
FUNCT, X, A, F, PDER
where:
X = Variable passed into CURVEFIT. It is the job of the user-written
function to interpret this variable.
A = Vector of NTERMS function parameters, input.
F = Vector of NPOINT values of function, y(i) = funct(x), output.
PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
PDER(I,J) = DErivative of function at ith point with
respect to jth parameter. Optional output parameter.
PDER should not be calculated IF the parameter is not
supplied in call. IF the /NODERIVATIVE keyword is set in the
call to CURVEFIT THEN the user routine will never need to
calculate PDER.
PROCEDURE:
Copied from "CURFIT", least squares fit to a non-linear
function, pages 237-239, Bevington, Data Reduction and Error
Analysis for the Physical Sciences. This is adapted from:
Marquardt, "An Algorithm for Least-Squares Estimation of Nonlinear
Parameters", J. Soc. Ind. Appl. Math., Vol 11, no. 2, pp. 431-441,
June, 1963.
"This method is the Gradient-expansion algorithm which
combines the best features of the gradient search with
the method of linearizing the fitting function."
Iterations are performed until the chi square changes by
only TOL or until ITMAX iterations have been performed.
The initial guess of the parameter values should be
as close to the actual values as possible or the solution
may not converge.
EXAMPLE: Fit a function of the form f(x) = a * exp(b*x) + c to
sample pairs contained in x and y.
In this example, a=a(0), b=a(1) and c=a(2).
The partials are easily computed symbolicaly:
df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0
Here is the user-written procedure to return F(x) and
the partials, given x:
pro gfunct, x, a, f, pder ; Function + partials
bx = exp(a(1) * x)
f= a(0) * bx + a(2) ;Evaluate the function
IF N_PARAMS() ge 4 THEN $ ;Return partials?
pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(f))]]
end
x=findgen(10) ;Define indep & dep variables.
y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
Weights=1.0/y ;Weights
a=[10.0,-0.1,2.0] ;Initial guess
yfit=curvefit(x,y,Weights,a,sigma,function_name='gfunct')
print, 'Function parameters: ', a
print, yfit
end
MODIFICATION HISTORY:
Written, DMS, RSI, September, 1982.
Does not iterate IF the first guess is good. DMS, Oct, 1990.
Added CALL_PROCEDURE to make the function's name a parameter.
(Nov 1990)
12/14/92 - modified to reflect the changes in the 1991
edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
Mark Rivers, U of Chicago, Feb. 12, 1995
- Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
These make the routine much more generally useful.
- Removed Oct. 1990 modification so the routine does one iteration
even IF first guess is good. Required to get meaningful output
for errors.
- Added forward difference derivative calculations required for
NODERIVATIVE keyword.
- Fixed a bug: PDER was passed to user's procedure on first call,
but was not defined. Thus, user's procedure might not calculate
it, but the result was THEN used.
Steve Penton, RSI, June 1996.
- Changed SIGMAA to SIGMA to be consistant with other fitting
routines.
- Changed CHI2 to CHISQ to be consistant with other fitting
routines.
- Changed W to Weights to be consistant with other fitting
routines.
_ Updated docs regarding weighing.
Chris Torrence, RSI, Jan,June 2000.
- Fixed bug: if A only had 1 term, it was passed to user procedure
as an array. Now ensure it is a scalar.
- Added more info to error messages.
- Added /DOUBLE keyword.
CT, RSI, Nov 2001: If Weights is undefined, then assume no weighting,
and boost the Sigma error estimates according to NR Sec 15.2
Added YERROR keyword.
CT, RSI, May 2003: Added STATUS keyword.
Added FITA keyword (courtesy B. LaBonte)
CT, RSI, August 2004: Added ON_ERROR, 2
[Previous]
[Next]
NAME:
CV_COORD
PURPOSE:
Converts 2-D and 3-D coordinates between the RECTANGULAR, POLAR,
CYLINDRICAL, and SPHERICAL coordinate systems.
CATEGORY:
Graphics
CALLING SEQUENCE:
Coord = CV_COORD()
KEYWORD PARAMETERS:
FROM_RECT:
A vector of the form [x, y] or [x, y, z], or a (2, n) or
(3, n) array containing rectangular coordinates to convert.
FROM_POLAR:
A vector of the form [angle, radius], or a (2, n) array of
polar coordinates to convert.
FROM_CYLIN:
A vector of the form [angle, radius, z], or a (3, n) array
of cylindrical coordinates to convert.
FROM_SPHERE:
A vector of the form [longitude, latitude, radius], or a
(3, n) array of spherical coordinates to convert.
TO_RECT: If set, then rectangular coordinates are returned.
TO_POLAR: If set, then polar coordinates are returned.
TO_CYLIN: If set, then cylindrical coordinates are returned.
TO_SPHERE: If set, then spherical coordinates are returned.
DEGREES: If set, then the input (and output) coordinates are in
degrees (where applicable). Otherwise, the angles are
in radians.
DOUBLE: Set this keyword to force the computation to be done in
double-precision arithmetic.
OUTPUTS:
This function returns the converted coordinate(s) based on which of
the "TO_" keywords is used :
TO_RECT : If the input coordinates were polar, then a vector
of the form [x, y] or a (2, n) array is returned.
Otherwise, a vector of the form [x, y, z], or a
(3, n) array is returned.
TO_POLAR : A vector of the form [angle, radius], or a (2, n)
array is returned.
TO_CYLIN : A vector of the form [angle, radius, z], or a (3, n)
array is returned.
TO_SPHERE : A vector of the form [longitude, latitude, radius],
or a (3, n) array is returned.
If the value passed to the "FROM_" keyword is double precision, then
all calculations are performed in double precision and the returned
value is double precision. Otherwise, single precision is used.
If none of the "FROM_" keywords are specified then 0 is returned.
If none of the "TO_" keywords are specified then the input coordinates
are returned.
CALLED BY:
MESH_OBJ
PROCEDURE:
When converting from spherical to polar coordinates, the points
are first projected along the z axis to the x-y plane to get 2-D
rectangular coordinates. The 2-D rectangular coordinates are
then converted to polar.
EXAMPLE:
; Convert from spherical to cylindrical coordinates.
sphere_coord = [[45.0, -60.0, 10.0], [0.0, 0.0, 0.0]]
rect_coord = CV_COORD(From_Sphere=sphere_coord, /To_Cylin, /Degrees)
; Convert from rectangular to polar coordinates.
rect_coord = [10.0, 10.0]
polar_coord = CV_COORD(From_Rect=rect_coord, /To_Polar)
MODIFICATION HISTORY:
Written by: Daniel Carr, Thu Mar 31 14:42:58 MST 1994
CT, RSI, August 2000: Fixed double-precision checks, added /DOUBLE.
[Previous]
[Next]
NAME: Cvttobm
PURPOSE:
Converts a byte array in which each byte represents one pixel
into a bitmap byte array in which each bit represents one
pixel. This is useful when creating bitmap labels for buttons
created with the WIDGET_BUTTON function.
Bitmap byte arrays are monochrome; by default, CVTTOBM converts
pixels that are darker than the median value to black and pixels
that are lighter than the median value to white. You can supply
a different threshold value via the THRESHOLD keyword.
Most of IDL's image file format reading functions (READ_BMP,
READ_PICT, etc.) return a byte array which must be converted
before use as a button label. Note that there is one exception
to this rule; the READ_X11_BITMAP routine returns a bitmap
byte array that needs no conversion before use.
CATEGORY:
Widgets, button bitmaps
CALLING SEQUENCE:
bitmap = Cvttobm(array [,THRESHOLD = Threshold])
INPUTS:
array - A 2-dimensional pixel array, one byte per pixel
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
THRESHOLD - A byte value (or an integer value between 0 and 255)
to be used as a threshold value when determining if
a particular pixel is black or white. If not specified,
the threshold is calculated to be the average of the
input array.
OUTPUTS:
bitmap - bitmap byte array, in which each bit represents one pixel
OPTIONAL OUTPUTS:
None
CALLS: ***
REVERSE
CALLED BY:
create_cursor
COMMON BLOCKS:
None
SIDE EFFECTS:
None
RESTRICTIONS:
None
PROCEDURE:
1. Creates mask from input array, where values are 0/1 based on threshold.
2. Calculates the size of the output array.
3. Calculates the bitmap array from byte array based on mask.
EXAMPLE:
IDL> image=bytscl(dist(100))
IDL> base=widget_base(/column)
IDL> button=widget_button(base,value=Cvttobm(image))
IDL> widget_control,base,/realize
MODIFICATION HISTORY:
Created: Mark Rehder, 10/96
Modified: Lubos Pochman, 10/96
CT, RSI, Sept 2003: Added ON_ERROR.
[Previous]
[Next]
NAME:
CW_ANIMATE
PURPOSE:
This widget displays an animated sequence of images using
X-windows Pixmaps. This is a compound widget, based on the
XINTERANIMATE procedure, with the following advantages:
- It can be included in other applications.
- Multiple copies can be run simultaneously.
The speed and direction of the display can be adjusted using
the widget interface.
CATEGORY:
Image display, compound widgets.
CALLING SEQUENCE:
To initially create:
widget = CW_ANIMATE(PARENT, SIZEX, SIZEY, NFRAMES)
To reinitialize when another animation is loaded:
CW_ANIMATE_INIT, ANIMATEBASE, SIZEX, SIZEY, NFRAMES
To load a single image:
CW_ANIMATE_LOAD, WIDGET, IMAGE = IMAGE, FRAME = FRAME_INDEX
To load a single image that is already displayed in an existing window:
CW_ANIMATE_LOAD, WIDGET, FRAME = FRAME_INDEX, $
WINDOW = [WINDOW_NUMBER [, X0, Y0, SX, SY]]
(This technique is much faster than reading back from the window.)
To display the animation after all the images have been loaded:
CW_ANIMATE, WIDGET [, RATE]
To get a copy of the vector of Pixmaps being used by the widget.
If this routine is called, the widget does not destroy the pixmaps
when it is destroyed. The user can then provide them to a later
call to CW_ANIMATE to re-use them while skipping the Pixmap creation
and rendering step:
CW_ANIMATE_GETP, widget, PIXMAPS
INPUTS:
CW_ANIMATE:
PARENT: The ID of the parent widget.
SIZEX: The width of the displayed image.
SIZEY: The height of the displayed image.
NFRAMES: The number of frames in the animation sequence.
CW_ANIMATE_INIT:
ANIMATEBASE: The ID of the base animation widget.
SIZEX: The width of the displayed image.
SIZEY: The height of the displayed image.
NFRAMES: The number of frames in the animation sequence.
CW_ANIMATE_LOAD:
WIDGET: The ID of the widget (as created with CW_ANIMATE)
into which the image should be loaded.
CW_ANIMATE_RUN:
WIDGET: The ID of the widget (as created with CW_ANIMATE)
into which the image should be loaded.
RATE: A value between 0 and 100 that represents the
speed of the animation as a percentage of the
maximum display rate. The fastest animation has
a value of 100 and the slowest has a value of 0.
The default animation rate is 100.
STOP: If this keyword is set, the animation is stopped.
NFRAMES: Specifies the number of frames to animate, must
<= the number specified in CW_ANIMATE().
KEYWORD PARAMETERS:
CW_ANIMATE:
PIXMAPS: This keyword provides the new widget with a vector
of pre-existing pixmap (off screen window) IDs.
This vector is usually obtained from a call to
CW_ANIMATE_GETP applied to a previous animation
widget.
UVALUE: A user supplied value to be stored in the widget's
user value field.
UNAME: A user supplied string name to be stored in the
widget's user name field.
NO_KILL: If NOT set, an "End Animation" button is added to the
animation base. If set the button is not added.
OPEN_FUNC: A user supplied string that specifies a callback
function name. When a value is specified for this
keyword, an "Open..." pushbutton is added to the
window. When the "Open..." pushbutton is clicked
the OPEN_FUNC function is called to load new
animation data.
INFO_FILE: A filename containing text to be displayed by
XDISPLAYFILE when user selects the help button.
CW_ANIMATE_INIT:
PIXMAPS: This keyword provides the new widget with a vector
of pre-existing pixmap (off screen window) IDs.
This vector is usually obtained from a call to
CW_ANIMATE_GETP applied to a previous animation
widget.
CW_ANIMATE_LOAD:
CYCLE: If set, cycle. Normally, frames are displayed
going either forward or backwards. If CYCLE is
set, reverse direction after the last frame in
either direction is displayed.
FRAME: The frame number to be loaded. This is a value
between 0 and NFRAMES. If not supplied, frame 0
is loaded.
IMAGE: The image to be loaded.
ORDER: Set this keyword to display images from the top
down instead of the default bottom up. This keyword
is only used when loading images with the IMAGE
keyword.
TRACK: If set, the frame slider tracks the current frame.
Default is not to track.
WINDOW: When this keyword is specified, an image is copied
from an existing window to the animation pixmap.
When using X windows, this technique is much faster
than reading from the display and then loading with
the IMAGE keyword.
The value of this parameter is either an IDL window
number (in which case the entire window is copied),
or a vector containing the window index and the
rectangular bounds of the area to be copied. For
CALLED BY:
XINTERANIMATE
example:
WINDOW = [Window_Number, X0, Y0, Sx, Sy]
XOFFSET: The horizontal offset, in pixels from the left of
the frame, of the image in the destination window.
YOFFSET: The vertical offset, in pixels from the bottom of
the frame, of the image in the destination window.
OUTPUTS:
No explicit outputs.
CALLS: ***
COLORMAP_APPLICABLE, CW_ANIMATE_CLN, CW_ANIMATE_EV, CW_ANIMATE_GETP
CW_ANIMATE_INIT, CW_ANIMATE_LOAD, CW_ANIMATE_RUN, CW_BGROUP, INITBITMAPBUTTONS
MPEG_CLOSE, MPEG_PUT, MPEG_SAVE, SETBITMAPBUTTONS, XDISPLAYFILE, XLOADCT
SIDE EFFECTS:
If the widget is realized before calls to CW_ANIMATE_LOAD, the frames
are displayed as they are loaded. This provides the user with an
indication of how things are progressing.
When the widget is destroyed, it destroys the pixmaps used in the
animation, unless they were previously obtained via CW_ANIMATE_GETP
and the KILL_ANYWAY keyword was not set.
The only event returned by this widget indicates that the user
has pressed the DONE button. The parent application should use
this as a signal to kill the animation widget via WIDGET_CONTROL.
RESTRICTIONS:
If more than one animation widget is running at a time, they
will fight for resources and run slower.
PROCEDURE:
When initialized, this procedure creates pixmaps containing the
frames of the animation sequence. Once the images are loaded,
they are displayed by copying the images from the pixmap or buffer
to the visible draw widget.
EXAMPLE:
Assume the following event handler procedure exists:
PRO EHANDLER, EV
WIDGET_CONTROL, /DESTROY, EV.TOP
end
Enter the following commands to open the file ABNORM.DAT (a series
of images of a human heart) and load the images it contains into
an array H:
OPENR, 1, FILEPATH('abnorm.dat', SUBDIR = 'images')
H = BYTARR(64, 64, 16)
READU, 1, H
CLOSE, 1
H = REBIN(H, 128, 128, 16)
Create an instance of the animation widget at load the frames:
base = widget_base()
animate = CW_ANIMATE(base, 128, 128, 16)
WIDGET_CONTROL, /REALIZE, base
for i=0,15 do CW_ANIMATE_LOAD, animate, FRAME=i, IMAGE=H[*,*,I]
Start the animation:
CW_ANIMATE_RUN, animate
XMANAGER, "CW_ANIMATE Demo", base, EVENT_HANDLER = "EHANDLER"
Pressing the DONE button kills the application.
MODIFICATION HISTORY:
AB, June 1992 Heavily based on the XINTERANIMATE procedure.
SR, September 1992 Fixed a problem when a paused animation's
frame selection was moved and the resulting
frame change ended up in another animation.
SR, November 1992 Fixed a problem when a single paused animation
would fail when the frame selection slider
event tried to set do a bad drawing window.
DMS/AB, March, 1993 Got rid of state caching. Got rid of
XMANAGER background tasks in favor of new
"WIDGET_CONTROL,timer=" feature.
ACY, October 1993 Set RETAIN=2 for draw widget to prevent
clipping by an overlapping window when
loading frames.
DMS, Dec, 1993 Added STOP and NFRAMES keywords to CW_ANIMATE_RUN.
Added KILL_ANYWAY keyword to CW_ANIMATE_GETP.
WSO, Jan, 1995 Added OPEN_FUNC keyword and updated UI.
ACY, Jan, 1997 Added INFO_FILE keyword to allow user-supplied
files for help text
JLP, Jan, 2000 Allow TrueColor images as input to CW_ANIMATE_LOAD.
[Previous]
[Next]
NAME:
CW_ARCBALL
PURPOSE:
CW_ARCBALL is a compound widget for intuitively specifying
three-dimensional orientations.
CATEGORY:
Widget, 3d graphics
CALLING SEQUENCE:
Widget_id = CW_ARCBALL(Parent)
INPUTS:
PARENT: The ID of the parent widget.
KEYWORD PARAMETERS:
FRAME: If set, draws a frame around the widget.
The default is FRAME=0.
LABEL: A string containing the widget's label.
VALUE: An initial value for the 3 x 3 rotation matrix. This
must be a valid rotation matrix (no translation or
perspective) where: transpose(value) = inverse(value).
This can be the upper-left corner of !P.T after executing
the command T3D, /RESET, ROTATE=[x,y,z]. The default
is the identity matrix.
UVALUE: The initial user value for the widget.
UNAME: The initial user name for the widget.
SIZE: The size of the square drawable area containing the arcball,
in pixels. Default size = 192.
UPDATE: If set, the widget will send an event each time
the mouse button is released after a drag operation.
Otherwise, an event is only sent when the Update
button is pressed.
COLORS: A 6-element array containing the color indices to be used.
Colors(0) = View axis color
Colors(1) = object axis color,
Colors(2) = XZ plane +Y side (body top) color,
Colors(3) = YZ plane (fin) color,
Colors(4) = XZ plane -Y side (body bottom),
Colors(5) = background color.
Default value = [ 1,7,2,3,7,0], which yields good colors
with the TEK_COLOR table.
(white, yellow, red, green, yellow, black).
RETAIN: Retain parameter for window, 0 = none, 1 = server's default,
2 = use backing store. default = 1.
OUTPUTS:
The ID of the widget is returned.
CALLS: ***
ARCBALL_ARC, ARCBALL_AXIS_ARC, ARCBALL_CONSTRAIN, CROSSP, CW_ARCBALL_DRAW
CW_ARCBALL_EVENT, CW_ARCBALL_GET, CW_ARCBALL_HELP, CW_ARCBALL_SET, QUATERNION_M3
XMANAGER
SIDE EFFECTS:
Events are generated as described above. The current graphics window
is changed.
RESTRICTIONS:
This widget can generate any rotation about any axis.
Not all rotations are compatible with the IDL SURFACE
procedure, which is restricted to rotations that project the
object Z axis parallel to the view Y axis.
PROCEDURE:
This widget is based on "ARCBALL: A User Interface for
Specifying Three-Dimensional Orientation Using a Mouse", by Ken
Shoemake, Computer Graphics Laboratory, University of Pennsylvania,
Philadelphia, PA 19104. "In Arcball, human factors and mathematical
fundamentals come together exceptionally well."
The user drags a simulated track-ball with the mouse to interactively
obtain arbitrary rotations. Sequences of rotations may be cascaded.
The rotations may be unconstrained (about any axis), constrained to
the view X, Y, or Z axes, or to the object's X, Y, or Z axis.
Use the call:
WIDGET_CONTROL, id, /SET_VALUE
to draw the arcball after the widget is initially realized.
Also, the SET_VALUE entry will set the widget's value to the
given 3x3 rotation matrix and redraw the widget.
The WIDGET_CONTROL, id, GET_VALUE=v
call returns the current 3x3 rotation matrix.
EXAMPLE:
See the procedure ARCBALL_TEST, contained in this file.
To test CW_ARCBALL:
.RUN cw_arcball
ARCBALL_TEST
MODIFICATION HISTORY:
DMS, RSI, September, 1993. Written
ACY, RSI, January, 1994. Correct test on initial value.
DLD, RSI, August, 2000. Handle expose events for draw area,
and initialize colors properly for devices using
decomposed color.
[Previous]
[Next]
NAME:
CW_BGROUP
PURPOSE:
CW_BGROUP is a compound widget that simplifies creating
a base of buttons. It handles the details of creating the
proper base (standard, exclusive, or non-exclusive) and filling
in the desired buttons. Events for the individual buttons are
handled transparently, and a CW_BGROUP event returned. This
event can return any one of the following:
- The Index of the button within the base.
- The widget ID of the button.
- The name of the button.
- An arbitrary value taken from an array of User values.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_BGROUP(Parent, Names)
To get or set the value of a CW_BGROUP, use the GET_VALUE and
SET_VALUE keywords to WIDGET_CONTROL. The value of a CW_BGROUP
is:
-----------------------------------------------
Type Value
-----------------------------------------------
normal None
exclusive Index of currently set button
non-exclusive Vector indicating the position
of each button (1-set, 0-unset)
-----------------------------------------------
INPUTS:
Parent: The ID of the parent widget.
Names: A string array, containing one string per button,
giving the name of each button.
KEYWORD PARAMETERS:
BUTTON_UVALUE: An array of user values to be associated with
each button and returned in the event structure.
COLUMN: Buttons will be arranged in the number of columns
specified by this keyword.
EVENT_FUNCT: The name of an optional user-supplied event function
for buttons. This function is called with the return
value structure whenever a button is pressed, and
follows the conventions for user-written event
functions.
EXCLUSIVE: Buttons will be placed in an exclusive base, with
only one button allowed to be selected at a time.
FONT: The name of the font to be used for the button
titles. If this keyword is not specified, the default
font is used.
FRAME: Specifies the width of the frame to be drawn around
the base.
IDS: A named variable into which the button IDs will be
stored, as a longword vector.
LABEL_LEFT: Creates a text label to the left of the buttons.
LABEL_TOP: Creates a text label above the buttons.
MAP: If set, the base will be mapped when the widget
is realized (the default).
NONEXCLUSIVE: Buttons will be placed in an non-exclusive base.
The buttons will be independent.
NO_RELEASE: If set, button release events will not be returned.
RETURN_ID: If set, the VALUE field of returned events will be
the widget ID of the button.
RETURN_INDEX: If set, the VALUE field of returned events will be
the zero-based index of the button within the base.
THIS IS THE DEFAULT.
RETURN_NAME: If set, the VALUE field of returned events will be
the name of the button within the base.
ROW: Buttons will be arranged in the number of rows
specified by this keyword.
SCROLL: If set, the base will include scroll bars to allow
viewing a large base through a smaller viewport.
SET_VALUE: The initial value of the buttons. This is equivalent
to the later statement:
WIDGET_CONTROL, widget, set_value=value
SPACE: The space, in pixels, to be left around the edges
of a row or column major base. This keyword is
ignored if EXCLUSIVE or NONEXCLUSIVE are specified.
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
XOFFSET: The X offset of the widget relative to its parent.
XPAD: The horizontal space, in pixels, between children
of a row or column major base. Ignored if EXCLUSIVE
or NONEXCLUSIVE are specified.
XSIZE: The width of the base.
X_SCROLL_SIZE: The width of the viewport if SCROLL is specified.
YOFFSET: The Y offset of the widget relative to its parent.
YPAD: The vertical space, in pixels, between children of
a row or column major base. Ignored if EXCLUSIVE
or NONEXCLUSIVE are specified.
YSIZE: The height of the base.
Y_SCROLL_SIZE: The height of the viewport if SCROLL is specified.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
CW_BGROUP_EVENT, CW_BGROUP_GETV, CW_BGROUP_SETV
CALLED BY:
ANNOTATE, BINARY_TEMPLATE, CW_ANIMATE, CW_DEFROI, CW_FORM, CW_LIGHT_EDITOR, CW_ZOOM
IDLitwdMapRegisterImage, IDLitwdVolMenu, PREF_MIGRATE, XLOADCT, XPALETTE, XPCOLOR
XVAREDIT
SIDE EFFECTS:
This widget generates event structures with the following definition:
event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }
The SELECT field is passed through from the button event. VALUE is
either the INDEX, ID, NAME, or BUTTON_UVALUE of the button,
depending on how the widget was created.
RESTRICTIONS:
Only buttons with textual names are handled by this widget.
Bitmaps are not understood.
MODIFICATION HISTORY:
15 June 1992, AB
7 April 1993, AB, Removed state caching.
6 Oct. 1994, KDB, Font keyword is not applied to the label.
10 FEB 1995, DJC fixed bad bug in event procedure, getting
id of stash widget.
11 April 1995, AB Removed Motif special cases.
[Previous]
[Next]
NAME:
CW_CLR_INDEX
PURPOSE:
CW_CLR_INDEX is a compound widget for the selection of a color
index. A horizontal color bar is displayed. Clicking on the bar sets
the color index.
CATEGORY:
Compound Widgets
CALLING SEQUENCE:
Widget = CW_CLR_INDEX(Parent)
INPUTS:
Parent: ID of the parent widget.
KEYWORD PARAMETERS:
COLOR_VALUES: A vector of color indices containing the colors to
be displayed in the color bar. If omitted, NCOLORS
and START_COLOR specify the range of color indices.
EVENT_FUNCT: The name of an optional user-supplied event function.
This function is called with the return value structure
whenever a button is pressed, and follows the conventions ; for user-written event functions.
FRAME: If set, a frame will be drawn around the widget.
LABEL: A text label that appears to the left of the color bar.
NCOLORS: The number of colors to place in the color bar.
The default = !D.N_COLORS.
START_COLOR: The starting color index, placed at the left of the bar.
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
VALUE: The index of the color index initially selected. The
default is the START_COLOR.
XSIZE: The width of the color bar in pixels. The default =192.
YSIZE: The height of the color bar in pixels. The default = 12.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
COLORMAP_APPLICABLE, CW_COLOR_INDEXE, CW_COLOR_INDEXG, CW_COLOR_INDEXS
CALLED BY:
ANNOTATE
SIDE EFFECTS:
This widget generates event structures with the following definition:
Event = { CW_COLOR_INDEX, ID: base, TOP: ev.top, HANDLER: 0L, VALUE: c}
Value is the color index selected.
PROCEDURE:
Standard Compound widget. Use WIDGET_CONTROL, SET_VALUE and GET_VALUE
to change/read the widget's value.
EXAMPLE:
A = WIDGET_BASE(TITLE='Example', /COLUMN)
B = CW_CLR_INDEX(A, LABEL='Color:')
MODIFICATION HISTORY:
DMS, June, 1993. Written.
TAC, Oct, 1993. Changed name to cw_clr_index
DLD, Aug, 2000. Add handling for expose events.
Add VALUE keyword.
Add handling for TrueColor devices.
[Previous]
[Next]
NAME:
CW_COLORSEL
PURPOSE:
CW_COLORSEL is a compound widget that displays all the colors
in the current colormap and allows the user to select the color
indices via the mouse or with sliders.
CATEGORY:
Compund widgets.
CALLING SEQUENCE:
widget = CW_COLORSEL(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
FRAME: If set, a frame is drawn around the widget.
UVALUE: The user value for the widget.
UNAME: The user value for the widget.
XOFFSET: The X offset position
YOFFSET: The Y offset position
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
CSEL_EVENT, CSEL_GET_VALUE, CSEL_MVMARK, CSEL_NEW_COLORS, CSEL_REALIZE
CSEL_SETSLIDERS, CSEL_SET_VALUE, CT_LUMINANCE
CALLED BY:
XPALETTE
SIDE EFFECTS:
This widget generates event structures containing a field named
VALUE, which contains the colormap index selected by the user.
PROCEDURE:
The COLORSEL widget displays all the colors in the current
colormap in a 16x16 (320x320 pixels) grid. To select a color
index, the user moves the mouse pointer over the desired
color square and presses any mouse button. Alternatively, the
color index can be selected by moving one of the three sliders
provided around the grid.
WIDGET_CONTROL, SET_VALUE=index can be used to set the current
color index.
WIDGET_CONTROL, SET_VALUE=-1 informs the widget to initialize
itself and redraw. It should be called when any of the
following happen:
- The widget needs redrawing.
- The brightest or darkest color has changed.
WIDGET_CONTROL, GET_VALUE=var can be used to retrieve the
current color index.
MODIFICATION HISTORY:
March 30, 1992, AB
Removed the relevant code from XPALETTE.PRO and modified
it to create this reusable widget cluster.
September 4, 1992, SR
Fixed a bug where the value of the xslider was calculated
as negative and WIDGET_CONTROL, SET_VALUE failed.
7 April 1993, AB, Removed state caching.
October 20, 1993, KDB
Changed return value in function CSEL_GET_VALUE
from state.cur_idx to ret
23 May 1994, AB
Added NOTIFY_REALIZE routine to eliminate the need
to call "WIDGET_CONTROL, SET_VALUE=-1" when the widget
is realized.
29 Nov 2000, DD
Force all visuals to honor indexed colors; temporarily set
DEVICE, DECOMPOSED=0 as needed. Also, maintain a backing
store for the display of the color ramp.
[Previous]
[Next]
NAME:
CW_DEFROI
PURPOSE:
Widget to define a region of interest within a widget drawable.
CATEGORY:
Regions of interest, graphics.
CALLING SEQUENCE:
Result = CW_DEFROI(draw)
INPUTS:
Draw = id of drawable to draw the region. The drawable should
have both MOTION and BUTTON events enabled.
KEYWORD PARAMETERS:
IMAGE_SIZE = the size of the underlying array, expressed
as a two element vector: [columns, rows]. Default =
drawable size / zoom.
OFFSET = offset of lower left corner of image within the
drawable. Default = [0,0].
ORDER = if set, return inverted subscripts, as if the array
were output from top to bottom.
RESTORE = Set to restore the drawable to its previous appearance
on exit. Otherwise, the regions remain on the drawable.
ZOOM = if the image array was expanded (via REBIN for example)
specify this two element vector containing the expansion
factor in X and Y. Default = [1,1]. Must be integer.
OUTPUTS:
Result = subscripts of points within the region[s] defined.
If no region was defined, a scalar -1 is returned.
CALLS: ***
CW_BGROUP, CW_DEFROI_DRAW, CW_DEFROI_EVENT, CW_DEFROI_NMODE, REVERSE
COMMON BLOCKS:
None.
SIDE EFFECTS:
The regions are drawn within the drawable. Set the RESTORE
keyword to undo the damage.
RESTRICTIONS:
This is a MODAL widget. No other widget applications will be
responsive while this widget is in use.
PROCEDURE:
Complicated.
EXAMPLE:
To obtain the average of the counts of a region within a drawable:
Assume A = the array of interest, n columns, m rows, and that
it is displayed in drawable D, at offset X=20, Y=100, and zoomed
with a factor of 2:
TV, REBIN(A, M*2, N*2), 20, 100 ;Display the image
q = CW_DEFROI(D, ZOOM=[2,2], OFFSET=[20,100], IMAGE_SIZE=[m,n])
if q(0) ne -1 then print,'Average = ', total(a(q))/n_elements(q)
MODIFICATION HISTORY:
DMS, RSI, December, 1993. Written.
[Previous]
[Next]
NAME:
CW_DICE
PURPOSE:
CW_DICE is a compound widget that implements a single die.
This widget uses a button with a bitmap label.
The primary purpose of this compound widget is to serve as
a full example of a realistic compound widget for the IDL
User's Guide.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_DICE(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
TUMBLE_CNT: The widget simulates the tumbling of a dice by
changing the bitmap on the dice several times before
settling down to a final value. The number of "tumbles"
is specified by the TUMBLE_CNT keyword. The default is 10.
TUMBLE_PERIOD: The amount of time in seconds between each tumble
of the dice. The default is .05 seconds.
UVALUE: The user value for the widget.
UNAME: The user name for the widget.
OUTPUTS:
The ID of the created widget is returned.
COMMON BLOCKS
CW_DICE_BLK: Used to store dice faces, and the current
random number generator seed for the CW_DICE class.
CALLS: ***
CW_DICE_EVENT, CW_DICE_GET_VAL, CW_DICE_ROLL, CW_DICE_SET_VAL
SIDE EFFECTS:
This widget generates event structures containing an extra
field named VALUE giving the final value resulting from a dice roll.
Such events are only sent when the user presses the dice button.
PROCEDURE:
The CW_DICE widget consists of a single pushbutton that
displays its current dice value as a bitmask. If the user presses
the button, it tumbles for a moment and then the new value is
displayed and an event is issued.
The current value of the dice is available via the
WIDGET_CONTROL,GET_VALUE command.
The current value can be set by issuing the
WIDGET_CONTROL, SET_VALUE command. If the requested value is
outside the range [1,6], then the dice tumbles to a new value
as if the user had pressed the button, but no event is issued.
MODIFICATION HISTORY:
24 October 1993, AB, RSI
16 April 1996, RPM, RSI - Fixed name of WIDGET_TIMER event.
Fixed check of dice value range.
[Previous]
[Next]
NAME:
cw_dicomex_config
PURPOSE:
This widget a UI front end to an underlying dicomex config object.
The UI presented allows the user to edit the local user config file
or the system config file.
This compound widget will make a callback when the save btn is pressed
if a callback routine has been specified. The callback allows the
parent to update any widgets that use the config file values.
CALLING SEQUENCE:
ID = CW_DICOMEX_CONFIG(WID [,/SYSTEM_CONFIGURATION] [,CALLBACKROUTINE=name])
INPUTS:
WID - Widget ID of the parent
KEYWORD PARAMETERS:
SYSTEM_CONFIGURATION - If set, display the system configuration, otherwise
display the local configuration
CALLBACKROUTINE - Set to the name of the routine to be called when
the Save button is pressed.
CALLS: ***
CW_DICOMEX_AENEW_MODE, CW_DICOMEX_BTNACCEPTANY_EVENT
CW_DICOMEX_BTNAEDELETE_EVENT, CW_DICOMEX_BTNAENEW_EVENT
CW_DICOMEX_BTNCANCEL_EVENT, CW_DICOMEX_BTNECHO_EVENT
CW_DICOMEX_BTNSAVE_EVENT, CW_DICOMEX_BTNSERVICESTATUS_EVENT
CW_DICOMEX_BTNSTARTSERVICE_EVENT, CW_DICOMEX_BTNSTOPSERVICE_EVENT
CW_DICOMEX_CBAENAMES_EVENT, CW_DICOMEX_CBAENECHO_EVENT
CW_DICOMEX_CBAENQR_EVENT, CW_DICOMEX_CBAENSSCP_EVENT
CW_DICOMEX_CBAENSSCU_EVENT, CW_DICOMEX_CBECHONODES_EVENT
CW_DICOMEX_CFG_GET_VALUE, CW_DICOMEX_CFG_KILL_EVENT
CW_DICOMEX_CFG_REALIZE_NOTIFY_EVENT, CW_DICOMEX_CFG_SET_VALUE
CW_DICOMEX_RELOAD, CW_DICOMEX_RELOAD_AES, CW_DICOMEX_SAVE_AE
CW_DICOMEX_STD_AEN_NAME_CHECK, CW_DICOMEX_TXTCBAEEDIT_EVENT
CW_DICOMEX_WBTNSSCPDIRBROWSE_EVENT, CW_DICOMEX_WTXTGENERIC_EVENT
MODIFICATION HISTORY:
Written by: LFG, RSI, October 2004
Modified by: AGEH, RSI, December 2004 Tweaked code, added comments.
[Previous]
[Next]
NAME:
cw_dicomex_query
PURPOSE:
This widget a UI front end to an underlying dicomex config object.
This UI allows the user to perform dicom queries and dicom retrieves.
CALLING SEQUENCE:
ID = CW_DICOMEX_QUERY(WID)
INPUTS:
WID - Widget ID of the parent
KEYWORD PARAMETERS:
NONE
NOTES:
query_model
0 = patient_root
1 = study_root
2 = patient_study_only
query_level
0 = patient
1 = study
2 = series
3 = image
CALLS: ***
CW_DICOMEX_ALREADYEXISTSPATIENT, CW_DICOMEX_ALREADYEXISTSSERIES
CW_DICOMEX_ALREADYEXISTSSTUDY, CW_DICOMEX_BTNBUILD_EVENT
CW_DICOMEX_BTNQUERY_EVENT, CW_DICOMEX_BTNRETRIEVE_EVENT
CW_DICOMEX_CBQUERY_EVENT, CW_DICOMEX_CBRETRIEVE_EVENT
CW_DICOMEX_CREATEPATSTRUCT, CW_DICOMEX_CREATEQFSTRUCT
CW_DICOMEX_CREATEQUERYXMLFILE, CW_DICOMEX_CREATESERIESSTRUCT
CW_DICOMEX_CREATESTUDYSTRUCT, CW_DICOMEX_CREATE_NODE_STRUCT
CW_DICOMEX_DLQUERIES_EVENT, CW_DICOMEX_GETQUERY, CW_DICOMEX_LOADPATPAT
CW_DICOMEX_LOADPATSTUD, CW_DICOMEX_LOADPATSTUDSER, CW_DICOMEX_LOAD_TABLE
CW_DICOMEX_QFBTNAPPLY_EVENT, CW_DICOMEX_QFBTNCANCEL_EVENT
CW_DICOMEX_QFBTNCLEAR_EVENT, CW_DICOMEX_QFBTNHELP_EVENT
CW_DICOMEX_QFBTNOK_EVENT, CW_DICOMEX_QFFIELDSTATE, CW_DICOMEX_QFGETQFVALUES
CW_DICOMEX_QFRADPATIENTLVL_EVENT, CW_DICOMEX_QFRADPATIENTMODEL_EVENT
CW_DICOMEX_QFRADSERIESLVL_EVENT, CW_DICOMEX_QFRADSTUDYLVL_EVENT
CW_DICOMEX_QFRADSTUDYMODEL_EVENT, CW_DICOMEX_QFUI_EVENT
CW_DICOMEX_QRUI_KILL_EVENT, CW_DICOMEX_QR_CALLBACK
CW_DICOMEX_QR_REALIZE_NOTIFY_EVENT, CW_DICOMEX_QR_TREE_NODE_EVENT
CW_DICOMEX_QUERY_SET_VALUE, CW_DICOMEX_QUERY_UI_DISABLE
CW_DICOMEX_QUERY_UI_ENABLE, CW_DICOMEX_RESTOREQUERYXMLFILE
CW_DICOMEX_SAVEQUERY, CW_DICOMEX_SAVEQUERY_ADDTAG, CW_DICOMEX_SETQFVALUES
CW_DICOMEX_SETQUERYPROPERTIES, CW_DICOMEX_TABLE_RESULTS_EVENT
DICOMEX_GETCONFIGFILEPATH, FILEPATH, STRSPLIT
MODIFICATION HISTORY:
Written by: LFG, RSI, August 2004
Modified by: AGEH, RSI, December 2004 Tweaked code, added comments.
[Previous]
[Next]
NAME:
cw_dicomex_stor_scu
PURPOSE:
This widget a UI front end to an underlying dicomex storage scu object.
This UI allows the user to push dicom files to another dicom node.
CALLING SEQUENCE:
ID = CW_DICOMEX_STOR_SCU(WID)
INPUTS:
WID - Widget ID of the parent
KEYWORD PARAMETERS:
NONE
CALLS: ***
CW_DICOMEX_BTNSELDIR_EVENT, CW_DICOMEX_BTNSENDFILES_EVENT
CW_DICOMEX_BTNSENDPATFILES_EVENT, CW_DICOMEX_CBSENDTO_EVENT
CW_DICOMEX_CREATE_FILE_INFO_STRUCT, CW_DICOMEX_FILL_IN_FILE_INFO
CW_DICOMEX_SCUI_CALLBACK, CW_DICOMEX_SCUI_KILL_EVENT
CW_DICOMEX_SCUI_REALIZE_NOTIFY_EVENT, CW_DICOMEX_SC_TREE_NODE_EVENT
CW_DICOMEX_STORSCU_SET_VALUE, CW_DICOMEX_STOR_UI_DISABLE
CW_DICOMEX_STOR_UI_ENABLE, FILEPATH, IDLFFDICOMEX::GETVALUEDEFAULT
MODIFICATION HISTORY:
Written by: LFG, RSI, October 2004
Modified by: AGEH, RSI, December 2004 Tweaked code, added comments.
[Previous]
[Next]
NAME:
CW_FIELD
PURPOSE:
This widget cluster function manages a data entry field widget.
The field consists of a label and a text widget. CW_FIELD's can
be string fields, integer fields or floating-point fields. The
default is an editable string field.
CATEGORY:
Widget Clusters.
CALLING SEQUENCE:
Result = CW_FIELD(Parent)
INPUTS:
Parent: The widget ID of the widget to be the field's parent.
KEYWORD PARAMETERS:
EVENT_FUNC: The name of an optional user-supplied event function
for events. This function is called with the return
value structure whenever the slider value is changed, and
follows the conventions for user-written event
functions.
TITLE: A string containing the text to be used as the label for the
field. The default is "Input Field:".
VALUE: The initial value in the text widget. This value is
automatically converted to the type set by the STRING,
INTEGER, and FLOATING keywords described below.
UVALUE: A user value to assign to the field cluster. This value
can be of any type.
UNAME: A user supplied string name to be stored in the
widget's user name field.
FRAME: The width, in pixels, of a frame to be drawn around the
entire field cluster. The default is no frame.
RETURN_EVENTS: Set this keyword to make cluster return an event when a
<CR> is pressed in a text field. The default is
not to return events. Note that the value of the text field
is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
command is used.
ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
contents of a text field have changed.
COLUMN: Set this keyword to center the label above the text field.
The default is to position the label to the left of the text
field.
ROW: Set this keyword to position the label to the left of the text
field. This is the default.
XSIZE: An explicit horizontal size (in characters) for the text input
area. The default is to let the window manager size the
widget. Using the XSIZE keyword is not recommended.
YSIZE: An explicit vertical size (in lines) for the text input
area. The default is 1.
STRING: Set this keyword to have the field accept only string values.
Numbers entered in the field are converted to their string
equivalents. This is the default.
FLOATING: Set this keyword to have the field accept only floating-point
values. Any number or string entered is converted to its
floating-point equivalent.
INTEGER: Set this keyword to have the field accept only integer values.
Any number or string entered is converted to its integer
equivalent (using FIX). For example, if 12.5 is entered in
this type of field, it is converted to 12.
LONG: Set this keyword to have the field accept only long integer
values. Any number or string entered is converted to its
long integer equivalent (using LONG).
FONT: A string containing the name of the X Windows font to use
for the TITLE of the field.
FIELDFONT: A string containing the name of the X Windows font to use
for the TEXT part of the field.
NOEDIT: Normally, the value in the text field can be edited. Set this
keyword to make the field non-editable.
OUTPUTS:
This function returns the widget ID of the newly-created cluster.
CALLS: ***
CW_FIELD_EVENT, CW_FIELD_EXPONENT, CW_FIELD_FLOAT, CW_FIELD_GET, CW_FIELD_INT
CW_FIELD_SET, CW_FIELD_VALIDATE, CW_FIELD_VALUE
CALLED BY:
BINARY_TEMPLATE, CW_FILESEL, DIALOG_WRITE_IMAGE, XPALETTE, XROI
COMMON BLOCKS:
None.
PROCEDURE:
Create the widgets, set up the appropriate event handlers, and return
the widget ID of the newly-created cluster.
EXAMPLE:
The code below creates a main base with a field cluster attached
to it. The cluster accepts string input, has the title "Name:", and
has a frame around it:
base = WIDGET_BASE()
field = CW_FIELD(base, TITLE="Name:", /FRAME)
WIDGET_CONTROL, base, /REALIZE
MODIFICATION HISTORY:
Written by: Keith R. Crosley June 1992
KRC, January 1993 -- Added support for LONG
integers.
AB, 7 April 1993, Removed state caching.
JWG, August 1993, Completely rewritten to make
use of improved TEXT widget functionality
ACY, 25 March, 1994, fix usage of FRAME keyword
KDB, May 1994, Initial value =0 would result
in a null text field. Fixed
keyword check.
CT, RSI, March 2001: Pass keywords directly into WIDGET_BASE,
without assigning default values, since the defaults are
handled by WIDGET_BASE. Avoids assigning defaults if user passes
in undefined variables.
CT, RSI, July 2001: Fix bug in previous mod. If user passes in a
numeric VALUE but forgets to set the /FLOAT, we still need
to convert to a string before passing onto WIDGET_TEXT.
[Previous]
[Next]
NAME:
CW_FILESEL
PURPOSE:
This is a compound widget for file selection.
CATEGORY:
Input/Output
CALLING SEQUENCE:
Result = CW_FILESEL(Parent)
INPUTS:
Parent - The widget ID of the parent.
OPTIONAL KEYWORDS:
FILENAME
Set this keyword to have the initial filename filled in the filename text area.
FILTER - Set this keyword to an array of strings determining the
filter types. If not set, the default is "All Files". All
files containing the chosen filter string will be displayed
as possible selections. "All Files" is a special filter
which returns all files in the current directory. A single
filter "field" may have several filters separated by a comma.
CALLS: ***
CWFILESEL_ATTOP, CWFILESEL_EVENT, CWFILESEL_FIXPATH, CWFILESEL_GET_VALUE
CWFILESEL_KILL, CWFILESEL_REALIZE, CWFILESEL_SET_VALUE, CW_FIELD
CW_FILESEL_CONTINUE, CW_FILESEL_DIRHELP, CW_FILESEL_GETDIRS, FILENAME_PATH_SEP
FILEPATH, PATH_SEP, QUERY_IMAGE
CALLED BY:
DIALOG_READ_IMAGE, DIALOG_WRITE_IMAGE
Example: FILTER=['All Files', '.txt', '.jpg,.jpeg']
FIX_FILTER - If set, the user can not change the file filter.
FRAME - If set, a frame is drawn around the widget.
IMAGE_FILTER - If set, the filter "Image Files" will be added to the
list of filters. If set, and FILTER is not set,
"Image Files" will be the only filter displayed. Valid
image files are determined from QUERY_IMAGE.
MULTIPLE - If set, the file selection list will allow multiple
filenames to be selected. The filename text area will not
be editable in this case. MULTIPLE and SAVE are exclusive
keywords.
PATH - Set this keyword to the initial path the widget is to start
in. The default is the current directory.
SAVE - If set, the dialog will change to a file saving interface.
The "Open" button changes to "Save" and the "Filter" dialog
is named "Save as:". SAVE and MULTIPLE are exclusive keywords.
UVALUE - The "user value" to be assigned to the widget.
UNAME - The "user name" to be assigned to the widget.
WARN_EXIST - If set, the user is warned if a filename is chosen
that matches an already existing file. This is useful in
routines that save to a file.
OUTPUTS:
This function returns its Widget ID.
EXAMPLE:
fileSel = CW_FILESEL(myBase)
Using CW_FILESEL
The widget has a string value that is the currently-selected filename:
WIDGET_CONTROL, fileSel, GET_VALUE=filename
To set the filename, use the command:
WIDGET_CONTROL, fileSel, SET_VALUE=string
MODIFICATION HISTORY:
Written by: Scott Lasica, July, 1998
CT, RSI, July 2000: Minor rewrite. Change dir sorting on Windows.
Added WARN_EXIST.
[Previous]
[Next]
NAME:
CW_FORM
PURPOSE:
CW_FORM is a compound widget that simplifies creating
small forms which contain text, numeric fields, buttons,
lists and droplists. Event handling is also simplified.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_FORM([Parent,] Desc)
INPUTS:
Parent: The ID of the parent widget. Omitted for a top level
modal widget.
Desc: A string array describing the form. Each element of the
string array contains two or more comma-delimited fields. The
character '\' may be used to escape commas that appear within fields.
To include the backslash character, escape it with a second
backslash. Field names are case insensitive.
The fields are defined as follows:
Field 1: Depth: the digit 0, 1, 2, or 3. 0 continues the current
level, 1 begins a new level, 2 denotes the last element of the
current level, and 3 both begins a new level and is the last entry of
the current level. Nesting is used primarily with row or column
bases for layout. See the example below.
Field 2: Item type: BASE, BUTTON, DROPLIST, FLOAT, INTEGER, LABEL, LIST,
or TEXT.
The items return the following value types:
BUTTON - For single buttons, 0 if clear, 1 if set.
For multiple buttons, also called button groups, that are
exclusive, the index of the currently set button is returned.
For non-exclusive button groups, the value is an array
with an element for each button, containing 1
if the button is set, 0 otherwise.
DROPLIST, LIST - a 0 based index indicating which item is selected.
FLOAT, INTEGER, TEXT - return their respective data type.
Field 3: Initial value. Omitted for bases.
For BUTTON and DROPLIST items, the value field contains one
or more item names, delimited by the | character.
For FLOAT, INTEGER, LABEL, and TEXT items the value field contains the
initial value of the field.
Fields 4 and following: Keywords or Keyword=value pairs that specify
optional attributes or options. Keywords are case insensitive
and an optional leading '/' character is discarded.
Possibilities include:
COLUMN If present, specifies column layout for bases or multiple
buttons.
EXCLUSIVE If present makes an exclusive set of buttons. The
default is nonexclusive.
EVENT=<name> specifies the name of a user-written event function that
is called whenever the element is changed. The function
is called with one parameter, the event structure. It may
return an event structure or zero to indicate that no
further event processing is desired.
FONT=<font name> If present, the font for the item is specified.
FRAME: If present, a frame is drawn around the item. May be used
with all items.
LABEL_LEFT=<label> annotate a button or button group with a label
placed to the left of the buttons. Valid with BUTTON,
DROPLIST, FLOAT, INTEGER, LIST and TEXT items.
LABEL_TOP=<label> annotate a button or button group with a label
placed at the top of the buttons. Valid with BUTTON,
DROPLIST, FLOAT, INTEGER, LIST and TEXT items.
LEFT, CENTER, or RIGHT Specifies alignment of label items.
QUIT If present, when the user activiates this entry when it
is activated as a modal widget, the form is destroyed
and its value returned as the result of CW_FORM. For non-
modal form widgets, events generated by changing this item
have their QUIT field set to 1.
ROW If present, specifies row layout for bases or multiple
buttons.
SET_VALUE Sets the initial value of button groups or droplists.
TAG=<name> the tag name of this element. The widget's value
is a structure corresponding to the form. Each form item
has a corresponding tag-value pair in the widget's value.
Default = TAGnnn, where nnn is the index of the item
in the Desc array.
WIDTH=n Specifies the width, in characters, of a TEXT, INTEGER,
or FLOAT item.
KEYWORD PARAMETERS:
COLUMN: If set the main orientation is vertical, otherwise
horizontal.
IDS: A named variable into which the widget id of
each widget corresponding to an element
in desc is stored.
TITLE: The title of the top level base. Not used
if a parent widget is supplied.
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
OUTPUTS:
If Parent is supplied, the result is the ID of the base containing
the form. If Parent is omitted, the form is realized as a modal
top level widget. The function result is then a structure containing
the value of each field in the form when the user finishes.
This widget has a value that is a structure with a tag/value pair
for each field in the form. WIDGET_CONTROL, id, GET_VALUE=v may
be used to read the current value of the form. WIDGET_CONTROL, id,
SET_VALUE={ Tagname: value, ..., Tagname: value} sets the values
of one or more tags.
CALLS: ***
CW_BGROUP, CW_FORM_APPEND, CW_FORM_BUILD, CW_FORM_EVENT, CW_FORM_GETV
CW_FORM_LABEL, CW_FORM_MODAL_EVENT, CW_FORM_PARSE, CW_FORM_SETV, STRSPLIT
XMANAGER
SIDE EFFECTS:
Widgets are created.
RESTRICTIONS:
EXAMPLES:
**** Define a form, with a label, followed by two vertical button
groups one non-exclusive and the other exclusive, followed by a text
field, and an integer field, followed lastly by OK and Done buttons.
If either the OK or Done buttons are pressed, the form is exited.
; String array describing the form
desc = [ $
'0, LABEL, Centered Label, CENTER', $
; Define a row base on a new depth. All elements until a depth
; of two are included in the row.
'1, BASE,, ROW, FRAME', $
'0, BUTTON, B1|B2|B3, LABEL_TOP=Nonexclusive:, COLUMN, ' + $
'TAG=bg1, ' + $
'SET_VALUE=[1\, 0\, 1]', $ ; set first and third buttons
; This element terminates the row.
'2, BUTTON, E1|E2|E2, EXCLUSIVE,LABEL_TOP=Exclusive,COLUMN, ' + $
'TAG=bg2, ' + $
'SET_VALUE=1', $ ; set second button
'0, TEXT, , LABEL_LEFT=Enter File name:, WIDTH=12, TAG=fname', $
'0, INTEGER, 0, LABEL_LEFT=File size:, WIDTH=6, TAG=fsize', $
'1, BASE,, ROW', $
'0, BUTTON, OK, QUIT,FONT=*helvetica-medium-r-*-180-*,TAG=OK', $
'2, BUTTON, Cancel, QUIT']
To use the form in a modal manner:
a = CW_FORM(desc, /COLUMN)
help, /st,a
When the form is exited, (when the user presses the OK or Cancel buttons),
the following structure is returned as the function's value:
BG1 INT Array(3) (Set buttons = 1, else 0)
BG2 INT 1 (Exclusive: a single index)
FNAME STRING 'test.dat' (text field)
FSIZE LONG 120 (integer field)
OK LONG 1 (this button was pressed)
TAG8 LONG 0 (this button wasn't)
Note that if the Cancel button is pressed, the widget is exited with
the OK field set to 0.
*****************
To use CW_FORM inside another widget:
a = widget_base(title='Testing')
b = cw_form(a, desc, /COLUMN)
WIDGET_CONTROL, a, /real
xmanager, 'Test', a
In this example, an event is generated each time the value of
the form is changed. The event has the following structure:
ID LONG <id of CW_FORM widget>
TOP LONG <id of top-level widget>
HANDLER LONG <internal use>
TAG STRING 'xxx' ; name of field that changed
VALUE INT xxx ; new value of changed field
QUIT INT 0 ; quit flag
The event handling procedure (in this example, called TEST_EVENT), may use
the TAG field of the event structure to determine which field
changed and perform any data validation or special actions required.
It can also get and set the value of the widget by calling
WIDGET_CONTROL.
A simple event procedure might be written to monitor the QUIT field
of events from the forms widget, and if set, read and save the
widget's value, and finally destroy the widget.
To set or change a field within the form from a program, use a the
WIDGET_CONTROL procedure:
WIDGET_CONTROL, b, SET_VALUE={FNAME: 'junk.dat'}
This statement sets the file name field of this example.
MODIFICATION HISTORY:
January, 1995. DMS, Written.
June, 1996. MLR, allowed SET_VALUE to be specified in the
description string for DROPLIST widgets.
[Previous]
[Next]
NAME:
CW_FSLIDER
PURPOSE:
The standard slider provided by the WIDGET_SLIDER() function is
integer only. This compound widget provides a floating point
slider.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_FSLIDER(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
DRAG: Set this keyword to zero if events should only
be generated when the mouse is released. If it is
non-zero, events will be generated continuously
when the slider is adjusted. Note: On slow systems,
/DRAG performance can be inadequate. The default
is DRAG=0.
EDIT: Set this keyword to make the slider label be
editable. The default is EDIT=0.
EVENT_FUNC: The name of an optional user-supplied event function
for events. This function is called with the return
value structure whenever the slider value is changed, and
follows the conventions for user-written event
functions.
FORMAT: Provides the format in which the slider value is
displayed. This should be a format as accepted by
the STRING procedure. The default is FORMAT='(G13.6)'
FRAME: Set this keyword to have a frame drawn around the
widget. The default is FRAME=0.
MAXIMUM: The maximum value of the slider. The default is
MAXIMUM=100.
MINIMUM: The minimum value of the slider. The default is
MINIMUM=0.
SCROLL Sets the SCROLL keyword to the WIDGET_SLIDER underlying
this compound widget. Unlike WIDGET_SLIDER, the
value given to SCROLL is taken in the floating units
established by MAXIMUM and MINIMUM, and not in pixels.
SUPPRESS_VALUE: If true, the current slider value is not displayed.
The default is SUPPRESS_VALUE=0.
TITLE: The title of slider. (The default is no title.)
UVALUE: The user value for the widget.
UNAME: The user name for the widget.
VALUE: The initial value of the slider
VERTICAL: If set, the slider will be oriented vertically.
The default is horizontal.
XSIZE: For horizontal sliders, sets the length.
YSIZE: For vertical sliders, sets the height.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
CW_FSLIDER_KILL_NOTIFY, FSLIDER_CHECK_VALUE, FSLIDER_GET_VALUE
FSLIDER_INT2VALUE, FSLIDER_SET_VALUE, FSLIDER_VALUE2INT, FSLIDE_EVENT
CALLED BY:
CW_LIGHT_EDITOR, CW_RGBSLIDER
SIDE EFFECTS:
This widget generates event structures containing a field
named value when its selection thumb is moved. This is a
floating point value.
PROCEDURE:
WIDGET_CONTROL, id, SET_VALUE=value can be used to change the
current value displayed by the widget. Optionally, the
value supplied to the SET_VALUE keyword can be a three
element vector consisting of [value, minimum, maximum]
in order to change the minimum and maximum values as
well as the slider value itself.
WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current
value displayed by the widget. The maximum and minimum
values of the slider can also be obtained by calling the
FSLIDER_GET_VALUE function directly (rather than the standard
usage through the WIDGET_CONTROL interface) with the optional
keyword MINMAX:
sliderVals = FSLIDER_GET_VALUE(id, /MINMAX)
When called directly with the MINMAX keyword, the return
value of FSLIDER_GET_VALUE is a three element vector
containing [value, minimum, maximum].
MODIFICATION HISTORY:
April 2, 1992, SMR and AB
Based on the RGB code from XPALETTE.PRO, but extended to
support color systems other than RGB.
5 January 1993, Mark Rivers, Brookhaven National Labs
Added EDIT keyword.
7 April 1993, AB, Removed state caching.
28 July 1993, ACY, set_value: check labelid before setting text.
3 October 1995, AB, Added SCROLL keyword.
15 July 1998, ACY, Added ability to set and get minimum and maximum.
24 July 2000, KDB, Fixed scroll keyword modification.
March 2001, CT, RSI: Add double precision. Store value internally,
separate from either scrollbar value or text label value.
[Previous]
[Next]
NAME:
cw_itDataLevel
PURPOSE:
This function implements a compound widget that allows the
user to select data "levels" against a density plot background
for the given data object.
An example of typical usage is to select an iso value from a
volume to generate an isosurface.
CALLING SEQUENCE:
Result = CW_ITDATALEVEL(Parent, ToolUI)
INPUTS:
Parent: The widget ID of the parent base.
ToolUI: The UI Object for the tool
KEYWORD PARAMETERS
COLORS - A 3xn array of RGB colors. This specifies the color used to
draw each of the NLEVELS data level lines in the widget. If there
are fewer colors than levels, the colors are reused. If COLORS is
not specified, the colors Red, Green, Blue, Yellow, Magenta, and Cyan
are used.
COLUMN - Set this keyword to a nonzero value to indicate that
the text fields (representing the editable data level values) are
to be organized in a column. By default, they are organized in
a row.
DATA_OBJECT - A reference to the data object for which data level values
are to be editable.
DATA_RANGE - A two-element vector representing the range for the
data. If this keyword is not provided, the data range is automatically
computed from the data object.
INITIAL_VALUES - A vector of NLEVELS data values representing
the intial level values. By default, the initial values are
evenly distributed within the range of values of the given data object.
LEVEL_NAMES - A vector of strings representing the names to be
assicated with each level. The default is the empty string
for each level.
NLEVELS - The number of data level values to be editable.
NO_HISTOGRAM - Turn on to keep the data histogram from showing.
PALETTE_OBJECT - Palette data to display. (optional)
TITLE - A string representing the title for the compound widget.
(This is useful if the compound widget is to appear within a parent
tab base.)
UVALUE - User value.
VERTICAL - If set, the level lines move along the Y axis instead of X.
XSIZE, YSIZE - The size in pixels of the density plot window. The default
is 256x128.
CALLS: ***
CW_ITDATALEVEL_EVENT, CW_ITDATALEVEL_GETVALUE, CW_ITDATALEVEL_KILLNOTIFY
CW_ITDATALEVEL_PREPEVENT, CW_ITDATALEVEL_SETDATA, CW_ITDATALEVEL_SETPLOT
CW_ITDATALEVEL_SETPOSITIONS, CW_ITDATALEVEL_SETVALUE
CW_ITDATALEVEL_TRIMZEROES, CW_ITDATALEVEL_UPDATEPLOT, IDLITGETRESOURCE
IDLITLANGCATQUERY
CALLED BY:
IDLitwdSubVolume, cw_itMultiDataLevel
SIDE EFFECTS:
This compound widget generates events.
The CW_ITDATALEVEL event structure has the following form:
{ CW_ITDATALEVEL, ID: id, TOP: top, HANDLER: handler,
LEVEL_VALUES: levelValues, MOTION: motion, TEXT: text }
LEVEL_VALUE: - A vector of NLEVELS data values (representing the
data values at each level).
MOTION - True if event is triggered while user is currently manipulating
the interface. Useful for parent widgets that do not
need to analyze these intermediate events.
TEXT - True if event is trigger by user text entry
[Previous]
[Next]
NAME:
cw_itmenu
PURPOSE:
This function implements the compound widget for an iTools menu.
CALLING SEQUENCE:
Result = CW_ITMENU(Parent, UI, Target)
INPUTS:
Parent: The widget ID of the parent for the new menu.
The parent must be either a base widget or a button widget.
If Parent is a button widget, then the parent button widget
must either:
1. Have the MENU keyword set.
2. Have as its parent a base widget with the MBAR keyword set.
UI: The object reference of the IDLitUI object associated with the iTool.
Target: Set this argument to a string containing the relative or full
identifier of the tool container from which to construct the menu.
KEYWORD PARAMETERS:
CONTEXT_MENU: Set this keyword to create a context menu instead of a
standard pulldown menu. In this case the Parent must be one of
the following widget types: WIDGET_BASE, WIDGET_DRAW,
WIDGET_TEXT, WIDGET_LIST, WIDGET_PROPERTYSHEET, WIDGET_TABLE,
WIDGET_TEXT or WIDGET_TREE.
Note: If a context menu is created then the ACCELERATOR property is
ignored for all contained items.
All other keywords (such as UNAME, UVALUE, etc.) are passed
on to the menu.
CALLS: ***
CW_ITMENU_ADDITEM, CW_ITMENU_ADDMENU, CW_ITMENU_CALLBACK, CW_ITMENU_EVENT
IDLITBASENAME, IDLITLANGCATQUERY
CALLED BY:
CW_ITWINDOW, IDLitwdTool, cw_ittreeview
MODIFICATION HISTORY:
Written by: CT, RSI, March 2002
Modified: CT, May 2004: Renamed.
Changed Target from keyword to argument.
[Previous]
[Next]
NAME:
cw_itMultiDataLevel
PURPOSE:
This function implements a compound widget that allows the
user to select data levels against a density plot background
for each of the multiple data objects provided.
CALLING SEQUENCE:
Result = CW_ITMULTIDATALEVEL(Parent, ToolUI)
INPUTS:
Parent: The widget ID of the parent base.
oUI: The UI Object for the tool
KEYWORD PARAMETERS:
COLORS - A 3xn array of RGB colors. This specifies the color used to
draw each of the NLEVELS data level lines in the widget. If there
are fewer colors than levels, the colors are reused. By default,
the colors Red, Green, Blue, Yellow, Magenta, and Cyan are used.
COLUMN - Set this keyword to a nonzero value to indicate that
the text fields (representing the editable data level values) are
to be organized in a column. By default, they are organized in
a row.
DATA_LABEL - A string representing the label to be used next to
the droplist that lists the data objects. By default, no label
is used.
DATA_USE_INDEX - Set this keyword to a nonzero value if the data
objects are to be listed by index in the droplist. By default,
data objects are listed by name.
DATA_OBJECTS - An array of IDLitData objects representing the data
objects for which data level values are to be editable.
DATA_RANGE - A vector representing the range for to be used for
each of the data objects. If this keyword is not provided, the data
range is automatically computed for each data objects.
INITIAL_VALUES - An array of [NLEVELS, N_ELEMENTS(DATA_OBJECTS)]
data values representing the initial level values per data
object. By default, the initial values are evenly distributed
within the range of values per given data object.
LEVEL_NAMES - A vector of strings representing the names to be
assicated with each level. The default is the empty string
for each level.
NLEVELS - The number of data level values to be editable per data object.
PALETTE_OBJECTS An array of IDLitData objects containing palette data.
If provided, there should be a palette object for each data object.
UVALUE - User value.
XSIZE, YSIZE - The size in pixels of the density plot window. The default
is 256x128.
CALLS: ***
CW_ITMULTIDATALEVEL_EVENT, CW_ITMULTIDATALEVEL_GETVALUE
CW_ITMULTIDATALEVEL_KILLNOTIFY, CW_ITMULTIDATALEVEL_PREPEVENT
CW_ITMULTIDATALEVEL_SETVALUE, IDLITLANGCATQUERY, cw_itDataLevel
CALLED BY:
IDLitwdDataBottomTop, IDLitwdImgMenu, IDLitwdIsovalues
SIDE EFFECTS:
This compound widget generates events.
The CW_ITMULTIDATALEVEL event structure has the following form:
{ CW_ITMULTIDATALEVEL, ID: id, TOP: top, HANDLER: handler,
DATA_ID: dataID, APPLY_ALL: applyAll, LEVEL_VALUES: levelValues, $
MOTION: motion }
DATA_ID: - the index of the data object for which the data level
values have changed. The index corresponds to the array of data
objects passed in the DATA_OBJECTS parameter for this widget.
If only one data object was passed in, this field will
always be zero. It is also the index of the data object
currently selected in the drop down menu.
APPLY_ALL: - True if the user has the "Apply All" checkbox checked.
In this situation, all of the values in LEVEL_VALUES possibly have
changed.
LEVEL_VALUES: - An array of [NLEVELS, N_ELEMENTS(DATA_OBJECTS)] data values
(representing the data values at each level for each data object).
If APPLY_ALL is false, then the level data at [*, DATA_ID] are the values
that have changed.
MOTION - True if event is triggered while user is currently manipulating
the interface. Useful for parent widgets that do not
need to analyze these intermediate events.
TEXT - True if event is triggered by user entering data in the text
widgets.
[Previous]
[Next]
NAME:
cw_itoperationpreview
PURPOSE:
This function implements the compound widget for a Preview window.
CALLING SEQUENCE:
Result = cw_itoperationpreview(Parent, Tool)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
Tool: Set this argument to the object reference for the IDL Tool.
KEYWORD PARAMETERS:
CALLS: ***
CONGRID, CW_ITOPERATIONPREVIEW_CALLBACK, CW_ITOPERATIONPREVIEW_EVENT
CW_ITOPERATIONPREVIEW_KILLNOTIFY, CW_ITOPERATIONPREVIEW_REALIZE
CW_ITOPERATIONPREVIEW_UPDATEDRAW, FILEPATH, IDLITLANGCATQUERY, LOADCT
CALLED BY:
IDLitwdConvolKernel, IDLitwdOperationPreview
MODIFICATION HISTORY:
Written by: CT, RSI, Oct 2003
Modified:
[Previous]
[Next]
NAME:
CW_ITPANEL
PURPOSE:
This function implements the compound widget for tool control panels
CALLING SEQUENCE:
Result = CW_ITPANEL(Parent, UI)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
oUI: User interface object.
KEYWORD PARAMETERS:
ORIENTATION: The panel orientation.
0=on the left, 1=on the right.
OUTPUT:
ID of the newly created widget
CALLS: ***
CW_ITPANEL_ADDPANEL, CW_ITPANEL_CALLBACK, CW_ITPANEL_CLEANUP, CW_ITPANEL_EVENT
CW_ITPANEL_MAKEBUTTON, CW_ITPANEL_RESIZE, FILEPATH, IDLITGETRESOURCE
IDLITLANGCATQUERY
CALLED BY:
IDLitwdTool
MODIFICATION HISTORY:
Written by: RSI, February 2003
Modified:
[Previous]
[Next]
NAME:
cw_itpropertypreview
PURPOSE:
This function implements the compound widget for a Preview window.
CALLING SEQUENCE:
Result = cw_itpropertypreview(Parent, Tool)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
Tool: Set this argument to the object reference for the IDL Tool.
KEYWORD PARAMETERS:
CALLS: ***
CW_ITPROPERTYPREVIEW_CALLBACK, CW_ITPROPERTYPREVIEW_EVENT
CW_ITPROPERTYPREVIEW_KILLNOTIFY, CW_ITPROPERTYPREVIEW_REALIZE
CW_ITPROPERTYPREVIEW_SETVALUE, CW_ITPROPERTYPREVIEW_UPDATEDRAW
IDLITLANGCATQUERY
CALLED BY:
IDLitwdMapRegisterImage, IDLitwdPropertyPreview
MODIFICATION HISTORY:
Written by: CT, RSI, Oct 2003
Modified:
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET
PURPOSE:
This function implements the compound widget for the IT property sheet.
CALLING SEQUENCE:
Result = CW_ITPROPERTYSHEET(Parent)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
KEYWORD PARAMETERS:
OUTPUT:
ID of the newly created widget
CALLS: ***
CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_KILLNOTIFY
CW_ITPROPERTYSHEET_RESIZE, CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CREATEPROPSHEET, CREATETREE, CW_ITPROPERTYSHEET_CALLBACK
CW_ITPROPERTYSHEET_EVENT, CW_ITPROPERTYSHEET_GETVALUE
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLITWDBROWSER_EVENT, IDLITWDBROWSER_SET_EVENT
IDLitwdBrowser, IDLitwdBrowserPrefs, IDLitwdBrowserPrefs_EVENT
IDLitwdConvolKernel, IDLitwdImportWizard, IDLitwdMacroEditor
IDLitwdMapRegisterImage, IDLitwdOperationPreview, IDLitwdPropertyPreview
IDLitwdPropertySheet, IDLitwdStyleEditor
MODIFICATION HISTORY:
Written by: CT, RSI, March 2002
Modified:
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_CALLBACK
PURPOSE:
Callback routine
INPUTS:
WPROP: (required) widget ID of the propertysheet
STRID: not used
MESSAGEIN: string message name
COMPONENT: identifier of object(s)
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_EVENT, CW_ITPROPERTYSHEET_GETVALUE
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_EVENT, CW_ITPROPERTYSHEET_GETVALUE
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_EVENT
PURPOSE:
Sets the current object reference
INPUTS:
EVENT: (required) widget event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_GETVALUE
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_GETVALUE
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLitwdStyleEditor
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_GETVALUE
PURPOSE:
Retrieve the current object reference
INPUTS:
ID: (required) widget ID of the propertysheet
KEYWORD PARAMETERS:
None
OUTPUTS:
current object reference
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_KILLNOTIFY, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_KILLNOTIFY
PURPOSE:
Sets the current object reference
INPUTS:
ID: (required) widget ID of the propertysheet
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_RESIZE
CW_ITPROPERTYSHEET_SETVALUE
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_RESIZE
PURPOSE:
Handle resize requests
INPUTS:
ID: (required) widget ID of the propertysheet
DELTAX[Y]: (required) change in X[Y] size of the widget base
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_KILLNOTIFY
CW_ITPROPERTYSHEET_SETVALUE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_KILLNOTIFY
CW_ITPROPERTYSHEET_SETVALUE
[Previous]
[Next]
NAME:
CW_ITPROPERTYSHEET_SETVALUE
PURPOSE:
Sets the current object reference
INPUTS:
ID: (required) widget ID of the propertysheet
IDCOMPONENT: (required) Idenfitier of the object
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_KILLNOTIFY
CW_ITPROPERTYSHEET_RESIZE, IDLITLANGCATQUERY
CALLED BY:
CW_ITPROPERTYSHEET, CW_ITPROPERTYSHEET_CALLBACK, CW_ITPROPERTYSHEET_EVENT
CW_ITPROPERTYSHEET_GETVALUE, CW_ITPROPERTYSHEET_KILLNOTIFY
CW_ITPROPERTYSHEET_RESIZE
[Previous]
[Next]
NAME:
cw_itStatusBar
PURPOSE:
This function implements the status bar compound widget for the
IT window.
CALLING SEQUENCE:
Result = CW_ITSTATUS(Parent, ToolUI)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
ToolUI: The UI Object for the tool
KEYWORD PARAMETERS:
XSIZE: Width of the widget.
CALLS: ***
CW_ITSTATUSBAR_CALLBACK, CW_ITSTATUSBAR_RESIZE, IDLITLANGCATQUERY
CALLED BY:
IDLitwdTool
MODIFICATION HISTORY:
Modified:
[Previous]
[Next]
NAME:
CW_ITTOOLBAR
PURPOSE:
This function implements the compound widget for an iTools toolbar.
CALLING SEQUENCE:
Result = CW_ITTOOLBAR(Parent, UI, Target)
INPUTS:
Parent: The widget ID of the parent base for the new toolbar.
UI: The object reference of the IDLitUI object associated with the iTool.
Target: Set this argument to a string containing the relative or full
identifier of the tool container from which to construct the toolbar.
KEYWORD PARAMETERS:
EXCLUSIVE: Set this keyword to create a toolbar with exclusive buttons,
where only one button may be depressed, and remains depressed until
another button is selected. The default is to create a pushbutton
toolbar.
ROW: Set this keyword to number of button rows within the toolbar.
The default is one row.
All other keywords (such as FRAME, TRACKING_EVENTS, etc.)
are passed on to the toolbar base.
CALLS: ***
CW_ITTOOLBAR_BUILD, CW_ITTOOLBAR_CALLBACK, CW_ITTOOLBAR_EVENT
CW_ITTOOLBAR_GETBITMAPFILE, FILEPATH, IDLITBASENAME, IDLITLANGCATQUERY
CALLED BY:
IDLitwdImgMenu, IDLitwdTool, IDLitwdToolbar [1], IDLitwdToolbar_Destroy
idlitwdtoolbar [2]
MODIFICATION HISTORY:
Written by: CT, RSI, March 2002
Modified: CT, July 2003: Fixed docs, removed useless GROUP_LEADER.
Modified: CT, May 2004: Changed Target from keyword to argument.
[Previous]
[Next]
NAME:
cw_ittreeview
PURPOSE:
This function implements the compound widget for the IT treeview.
CALLING SEQUENCE:
Result = cw_ittreeview(Parent)
CALLS: ***
CW_ITTREEVIEW_ADDLEVEL, CW_ITTREEVIEW_ADDLEVELINTERNAL
CW_ITTREEVIEW_CALLBACK, CW_ITTREEVIEW_DESTROYITEM
CW_ITTREEVIEW_DESTROYLEVEL, CW_ITTREEVIEW_EVENT, CW_ITTREEVIEW_GETNODENAME
CW_ITTREEVIEW_GETPARENT, CW_ITTREEVIEW_GETSELECT, CW_ITTREEVIEW_GETVALUE
CW_ITTREEVIEW_GETVISDATA, CW_ITTREEVIEW_KILLNOTIFY
CW_ITTREEVIEW_REBUILDLEVEL, CW_ITTREEVIEW_RESIZE, CW_ITTREEVIEW_SETSELECT
CW_ITTREEVIEW_SETVALUE, IDLITBASENAME, IDLITGETRESOURCE, IDLITLANGCATQUERY
cw_itmenu
CALLED BY:
CREATEPROPSHEET, CREATETREE, IDLITWDBROWSER_EVENT, IDLITWDBROWSER_SET_EVENT
IDLitwdBrowser, IDLitwdMacroEditor, IDLitwdStyleEditor
[Previous]
[Next]
NAME:
CW_ITUPDOWNFIELD
PURPOSE:
Compound widget for an up/down (spinner) field.
CALLING SEQUENCE:
Result = CW_ITUPDOWNFIELD(wParent)
INPUTS:
KEYWORD PARAMETERS:
EVENT STRUCTURE:
When the field is modified (either directly) or by the
up/down buttons, the following event is returned:
{CW_ITUPDOWN, ID: id, TOP: top, $
HANDLER: handler, VALUE: value}
CALLS: ***
CW_ITUPDOWNFIELD_DOWN, CW_ITUPDOWNFIELD_GETVALUE, CW_ITUPDOWNFIELD_SETVALUE
CW_ITUPDOWNFIELD_TRIMZEROES, CW_ITUPDOWNFIELD_UP, CW_ITUPDOWNFIELD_UPDOWN
CW_ITUPDOWNFIELD_VALUE, FILEPATH
CALLED BY:
IDLitwdCurveFitting, IDLitwdRotateByAngle
MODIFICATION HISTORY:
Written by: CT, RSI, Jan 2003
Modified:
[Previous]
[Next]
NAME:
CW_ITWINDOW
PURPOSE:
This function implements the compound widget for the IT window.
CALLING SEQUENCE:
Result = CW_ITWINDOW(Parent, Tool)
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
Tool: Set this argument to the object reference for the IDL Tool.
KEYWORD PARAMETERS:
CALLS: ***
CW_ITWINDOW_CALLBACK, CW_ITWINDOW_EVENT, CW_ITWINDOW_REALIZE
CW_ITWINDOW_RESIZE, CW_ITWINDOW_SETCONTEXTMENU, IDLITBASENAME
IDLITLANGCATQUERY, cw_itmenu
CALLED BY:
IDLitwdTool
MODIFICATION HISTORY:
Written by: CT, RSI, March 2002
Modified:
[Previous]
[Next]
FILE:
cw_light_editor.pro
NAME:
CW_LIGHT_EDITOR
PURPOSE:
CW_LIGHT_EDITOR is a compound widget that provides widgets to
adjust light properties.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_LIGHT_EDITOR(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
DIRECTION_DISABLED: Set to disable direction modification
DRAG_EVENTS=dragEvents: Set to enable drag event
HIDE_DISABLED: Set to disable hide modification
LIGHT: One or more light references to edit
LOCATION_DISABLED: Set to disable location modification
TYPE_DISABLED: Set to disable type modification
UNAME The "user name" to be assigned to the widget.
XRANGE: X Range to display location graphic
XSIZE: X size of draw widget
YRANGE: Y Range to display location graphic
YSIZE: Y size of draw widget
ZRANGE: Z Range to display location graphic
_EXTRA: keywords passed onto widget base
OUTPUTS:
The ID of the created widget is returned.
PROCEDURES:
cw_Light_Editor_Get: Get light editor compound widget properties.
cw_Light_Editor_Set: Set light editor compound widget properties.
cw_Light_Editor_Cleanup: Destroy any heap used by the compound widget.
CALLS: ***
CROSSP, CW_BGROUP, CW_FSLIDER, CW_LE_GETPIXELSIZEINDATASPACE, CW_LE_GETVIEW
CW_LE_GETVIEWVOLUMERANGE, CW_LE_GET_SELECTION, CW_LE_GROW, CW_LE_HANDLEEVENTS
CW_LE_MAKECONE, CW_LE_NOTIFYREALIZE, CW_LE_SETDISCRETEDIRECTION
CW_LE_SETDISCRETELOCATION, CW_LE_SETGRAPHICDIRECTION
CW_LE_SETGRAPHICLOCATION, CW_LE_SETLIGHT, CW_LE_SETVIEW, CW_LE_SET_SELECTION
CW_LE_UPDATEDRAW, CW_LIGHT_EDITOR_CLEANUP, CW_LIGHT_EDITOR_GET
CW_LIGHT_EDITOR_SET, IDENTITY, SCREENTODATA
SIDE EFFECTS:
Sets properties on lights.
RESTRICTIONS:
An assumption is made that the lights are located within the view
volume. The cw_lighteditor will not allow the lights to be moved
outside the view volume.
It's also expected that the lights are contained within a view.
This light editor can only operate on isotropic space. If the lights
are in anisotropic space, the light location and direction graphics
may not perform as expected.
Note that the axes displayed for manipulating the light location
do not necessarily reflect any actual axes the user may have in their
scene. They only reflect the data range passed in through the
*RANGE keywords.
MODIFICATION HISTORY:
Feb. 1999, WSO, Created.
[Previous]
[Next]
NAME:
CW_ORIENT
PURPOSE:
This compound widget provides a means to interactively adjust the
three dimensional drawing transformation (!P.T). The compound
widget only returns events when !P.T has been altered.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_ORIENT(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
AX: The initial rotation in the X direction. If not set, the
default is 30 degrees.
AZ: The initial rotation in the Z direction. If not set, the
default is 30 degrees.
FRAME: If set, a frame will be drawn around the widget. The
default is FRAME=0.
TITLE: The title of the widget. (Default is no title.)
UVALUE: The user value of the widget.
UNAME: The user name of the widget.
XSIZE: Determines the width of the widget. The default is 100.
YSIZE: Determines the height of the widget. The default is 100.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
CW_ORIENT_EVENT, CW_PDMENU, DRAWBOX, T3D
COMMON BLOCKS:
CW_OR_PRIVATE: Private to this module.
SIDE EFFECTS:
This widget generates event structures each time a modification
to the orientation is made. This widget also resets !P.T to
reflect the changed orientation.
MODIFICATION HISTORY:
August 7, 1992, SMR
7 April 1993, AB, Removed state caching.
[Previous]
[Next]
NAME:
CW_PALETTE_EDITOR
PURPOSE:
CW_PALETTE_EDITOR is a compound widget for the modification of color
palette vectors.
CATEGORY:
Compound Widgets
CALLING SEQUENCE:
Widget = CW_PALETTE_EDITOR(Parent)
INPUTS:
Parent: ID of the parent widget.
KEYWORD PARAMETERS:
DATA: A 3x256 byte array containing the initial color values
for Red, Green and Blue channels. The value supplied
can also be a 4x256 byte array containing the initial
color values and the optional Alpha channel. The value
supplied can also be an IDLgrPalette object reference.
If an IDLgrPalette object reference is supplied it is
used internally and is not destroyed on exit. If an
object reference is supplied the ALPHA keyword to the
CW_PALETTE_EDITOR_SET routine can be used to supply
the data for the optional Alpha channel.
FRAME: If set, a frame will be drawn around the widget.
HISTOGRAM: A 256 element byte vector containing the values for
the optional histogram curve.
HORIZONTAL: Set this keyword for a horizontal layout for the
compound widget. This consists of the controls
to the right of the display area. The default
is a vertical layout with the controls below the
display area.
SELECTION: A two element vector defining the starting and ending
point of the selection region. The default is [0,255].
UNAME: Set this keyword to a string that can be used to identify
the widget. You can associate a name with each widget in
a specific hierarchy, and then use that name to query the
widget hierarchy and get the correct widget ID.
To query the widget hierarchy, use the WIDGET_INFO function
with the FIND_BY_UNAME keyword. The UNAME should be unique
to the widget hierarchy because the FIND_BY_UNAME keyword
returns the ID of the first widget with the specified name.
UVALUE: The "user value" to be assigned to the widget. Each widget
can contain a user-specified value of any data type and
organization. This value is not used by the widget in any
way, but exists entirely for the convenience of the IDL
programmer. This keyword allows you to set this value when
the widget is first created. If UVALUE is not present, the
widget's initial user value is undefined.
XSIZE: The width of the drawable area in pixels. The default width
is 256.
YSIZE: The height of the drawable area in pixels. The default
height is 256.
OUTPUTS:
The ID of the created widget is returned.
CALLED BY:
IDLitwdPaletteEditor, XROI
PROCEDURE:
Standard Compound widget. Use WIDGET_CONTROL, SET_VALUE and GET_VALUE
to change/read the widget's value. The value supplied to the SET_VALUE
keyword can be any of the three types described by the DATA keyword.
The value returned by the GET_VALUE keyword is a 3x256 or 4x256 array
containing the color vectors and the optional alpha channel if it is
in use.
CALLS: ***
CONGRID, CW_PALEDIT_BUILDEVENTPALETTEMODIFIED
CW_PALEDIT_BUILDEVENTSELECTIONMOVED, CW_PALEDIT_CHECKDATA
CW_PALEDIT_CLEANUP, CW_PALEDIT_COLORSPACEHANDLER, CW_PALEDIT_CURVESDISPLAYED
CW_PALEDIT_CURVESEDITABLE, CW_PALEDIT_DISPLAYDATAVALS
CW_PALEDIT_DISPLAYMODIFYBUTTONHANDLER, CW_PALEDIT_DRAGSETLOC
CW_PALEDIT_DRAGSETWIDTH, CW_PALEDIT_DRAWHANDLER, CW_PALEDIT_EDITMODEHANDLER
CW_PALEDIT_EDITPREDEFINED, CW_PALEDIT_EVENT, CW_PALEDIT_GETCOLORVECTORDATA
CW_PALEDIT_GETDATACOORDSFROMVIEWPORT, CW_PALEDIT_GETPALETTEDATA
CW_PALEDIT_GETPOLYLINEDATA, CW_PALEDIT_GETVALUE, CW_PALEDIT_GETVIEWPORTSIZE
CW_PALEDIT_GETXDATAOFVIEWPORTMINMAX, CW_PALEDIT_GETXVIEWPORTLOC
CW_PALEDIT_GETXVIRTSIZE, CW_PALEDIT_INIT, CW_PALEDIT_MODIFYBYBARREL
CW_PALEDIT_MODIFYBYCURVETYPE, CW_PALEDIT_MODIFYBYINDEX
CW_PALEDIT_MODIFYBYSEGMENT, CW_PALEDIT_MODIFYBYSLIDE
CW_PALEDIT_MODIFYBYSTRETCH, CW_PALEDIT_NOTIMPLEMENTED
CW_PALEDIT_NULLEVENTHANDLER, CW_PALEDIT_OPERATEBUTTONHANDLER
CW_PALEDIT_SCALEFROMDATASPACE, CW_PALEDIT_SCALETODATASPACE
CW_PALEDIT_SETALLDATA, CW_PALEDIT_SETCOLORVECTORDATA
CW_PALEDIT_SETPALETTEDATA, CW_PALEDIT_SETPOLYLINEDATA, CW_PALEDIT_SETVALUE
CW_PALEDIT_SETXVIEWPORTLOC, CW_PALEDIT_SETXVIRTSIZE, CW_PALEDIT_SETYVIRTSIZE
CW_PALEDIT_ZOOMBUTTONHANDLER, CW_PALEDIT_ZOOM_1TO1, CW_PALEDIT_ZOOM_BYFACTOR
CW_PALEDIT_ZOOM_TOSELECTION, CW_PALETTE_EDITOR_GET, CW_PALETTE_EDITOR_SET
LOADCT, REVERSE, SELECTIONSETLOC
SIDE EFFECTS:
Palette Editor Events:
This widget generates several types of event structures. There are
variations of the palette editor event structure depending on the
specific event being reported. All of these structures contain the
standard three fields (ID, TOP, and HANDLER).
The different palette editor event structures are described below.
Selection Moved
This is the type of structure returned when one of the drag handles
that define the selection region is moved by a user.
event = { CW_PALETTE_EDITOR_SM, $
ID: state.wCWPalEdTop, $
TOP: wAppTop, $
HANDLER: handler, $
SELECTION: [state.sel_x1, state.sel_x2] $
}
SELECTION indicates a two element vector defining the starting and
ending point of the selection region of color indexes.
Palette Edited
This is the type of structure returned when the user has modified the
color palette.
event = { CW_PALETTE_EDITOR_PM, $
ID: state.wCWPalEdTop, $
TOP: wAppTop, $
HANDLER: handler $
}
The value of the palette editor will need to be retrieved (i.e.,
WIDGET_CONTROL, GET_VALUE) in order to determine the extent of the
actual user modification.
UTILITY ROUTINES
CW_PALETTE_EDITOR_GET: Get palette editor compound widget properties.
CALLING SEQUENCE:
CW_PALETTE_EDITOR_GET, widgetID
INPUTS:
widgetID: The widget ID of the CW_PALETTE_EDITOR compound widget.
KEYWORD PARAMETERS:
ALPHA: A 256 element byte array containing the Alpha channel.
HISTOGRAM: A 256 element byte array containing the histogram curve.
CW_PALETTE_EDITOR_SET: Set palette editor compound widget properties.
CALLING SEQUENCE:
CW_PALETTE_EDITOR_SET, widgetID
INPUTS:
widgetID: The widget ID of the CW_PALETTE_EDITOR compound widget.
KEYWORD PARAMETERS:
ALPHA: A 256 element byte array containing the Alpha channel
or the scalar value zero to remove the alpha curve
from the display.
HISTOGRAM: A 256 element byte array containing the histogram curve
or the scalar value zero to remove the histogram from
the display.
EXAMPLE:
A = WIDGET_BASE(TITLE='Example', /COLUMN)
B = CW_PALETTE_EDITOR(A, ....
MODIFICATION HISTORY:
ACY, April, 1999. Written.
[Previous]
[Next]
NAME:
CW_PANES
PURPOSE:
Create a two panel widget with a slider bar between the panels
and methods for exposing both or only one of the two panels.
Any widget, including bases and compound widgets, can be used
to populate the two panels. Panel visiblity and slider
position can be changed via the mouse or programatically.
CATEGORY:
Compound Widgets.
CALLING SEQUENCE:
WidgetID = CW_PANES(parent)
INPUTS:
PARENT: (required) Parent widget ID.
KEYWORD PARAMETERS:
LEFT_CREATE_PRO: (required) Name of procedure for populating
the left pane.
RIGHT_CREATE_PRO: (required) Name of procedure for populating
the right pane.
LEFT_EVENT_PRO (LEFT_EVENT_FUNC): (required) Name of event
handling procedure (or function) for the left pane.
RIGHT_EVENT_PRO (RIGHT_EVENT_FUNC): (required) Name of event
handling procedure (or function) for the right pane.
TOP_EVENT_PRO (TOP_EVENT_FUNC): (required) Name of event
handling procedure (or function) for the top level base.
LEFT_XSIZE: X size of the left base.
LEFT_YSIZE: Y size of the left base.
RIGHT_XSIZE: X size of the right base.
RIGHT_YSIZE: Y size of the right base.
VISIBLE: 1: left pane visible, 2: right pane visible, 3: both
panes visible.
MARGIN: Minimum visible width of any visible pane.
UVALUE: uvalue for tlb.
UNAME: uname for tlb.
GROUP_LEADER: widget ID of optional group leader
OUTPUTS:
The ID of the created widget.
CALLS: ***
CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_DRAW_SLIDER_BAR
CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, get_screen_size
CALLED BY:
CREATEPROPSHEET, CREATETREE, CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITWDBROWSER_EVENT
IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, IDLitwdStyleEditor
SIDE EFFECTS:
This widget generates event structures with the following definitions:
When a resize event of the top level base occurs an event
structure should be created and sent to 'cw_panes_event' as
follows:
eventStruct = {CW_PANES_RESIZE, ID:0l, TOP:0l, HANDLER:0l,
deltaX:0l, deltaY:0l}
void = CALL_FUNCTION('cw_panes_event',eventStruct)
The deltaX and deltaY will be recalculated and a
CW_PANES_RESIZE event will be then sent to the event handlers
of each pane.
Note: because all the event handlers of cw_panes are
functions, it is possible that the events could percolate back
to the top level base.
When the left or right arrow buttons are clicked, the top
level base will receive an event with the following structure:
{CW_PANES_SET_VALUE, ID:0l, TOP:0l, HANDLER:0l ,value:0}
Note: it is up to the event handler of the top level base to
change the value of the cw_panes base with the following call:
Widget_control, cw_panes_base, set_value=event.value
When the visibility of a pane changes the top level base will
receive an event with the following structure:
{CW_PANES_TOP_RESIZE, ID:0l, TOP:0l, HANDLER:0l, $
deltaX:0l, deltaY:0l}
PROCEDURE:
Use WIDGET_CONTROL, SET_VALUE and GET_VALUE to change/read the
widget's value. Set set_ and get_ procedures for details.
EXAMPLE:
MODIFICATION HISTORY:
AGEH, January, 2003. Original.
----------------------------------------
+
NAME:
CW_PANES_LEFT_BUTTON
PURPOSE:
Event handler when the left arrow button is clicked
INPUTS:
EVENT: (required) a widget_event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
None
[Previous]
[Next]
See top of file for documention on main routine
CALLS: ***
CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_DRAW_SLIDER_BAR
CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, get_screen_size
CALLED BY:
CREATEPROPSHEET, CREATETREE, CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITWDBROWSER_EVENT
IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, IDLitwdStyleEditor
[Previous]
[Next]
NAME:
CW_PANES_DASHED_BAR
PURPOSE:
Resize the dashed bar used during slider bar movement
INPUTS:
DRAW1: (required) the widget ID of the first dashed bar base
DRAW2: (required) the widget ID of the first dashed bar base
YSIZE: (required) the new y size of the base
XSIZE: the x size of the base
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_DRAW_SLIDER_BAR
CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_DRAW_SLIDER_BAR
CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL, CW_PANES_LINE_EVENT
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_DISPLAY_SLIDER_BAR
PURPOSE:
Updates the display of the arrows or sliderbar
INPUTS:
WDRAW: (required) a widget ID
ARRAY: (required) a byte array containing the three different
views the slider bar can take
INDEX: (required) an integer specifying which view of the
slider bar to display. 0 - normal view (active, gray
background), 1 - inactive, 2 - highlighted
FACE: (required) an RGB triplet specifying the colour to be
used for the background gray colour of the bar
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT
CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER, _IDLitsys_GetSystem, cw_panes [2]
get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT
CW_PANES_GET, CW_PANES_KILL, CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT
CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON, CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_DRAW_SLIDER_BAR
PURPOSE:
Updates the display of the arrows or sliderbar
INPUTS:
TLB: (required) the widget ID of the top level base
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_EVENT
CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER, _IDLitsys_GetSystem, cw_panes [2]
get_screen_size
CALLED BY:
CREATEPROPSHEET, CREATETREE, CW_PANES [1], CW_PANES_DASHED_BAR
CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITWDBROWSER_EVENT
IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, IDLitwdStyleEditor, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_EVENT
PURPOSE:
Handle resize events from the top level base.
INPUTS:
EVENT: (required) a widget_event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
Returns the input event
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_GET, CW_PANES_KILL, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CREATEPROPSHEET, CREATETREE, CW_PANES [1], CW_PANES_DASHED_BAR
CW_PANES_DISPLAY_SLIDER_BAR, CW_PANES_DRAW_SLIDER_BAR, CW_PANES_GET
CW_PANES_KILL, CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITWDBROWSER_EVENT
IDLITWDBROWSER_SET_EVENT, IDLitwdBrowser, IDLitwdStyleEditor, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_GET
PURPOSE:
Returns the value of the widget
INPUTS:
ID: (required) the widget ID of the cw_panes base
KEYWORD PARAMETERS:
None
OUTPUTS:
A long int vector:
[current visible state, left base widget ID, right base widget ID]
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_KILL, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_KILL, CW_PANES_LINE_EVENT
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_KILL
PURPOSE:
Cleanup
INPUTS:
ID: (required) a widget ID
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_LEFT_BUTTON
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_LINE_EVENT
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_LINE_EVENT
PURPOSE:
Handles moving of slider bar and of sending resize events to
the children of the two sides.
INPUTS:
EVENT: (required) a widget_event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LEFT_BUTTON, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_NULL_EVENT
PURPOSE:
Allow events to percolate up, if needed
INPUTS:
EVENT: (required) a widget_event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
Returns the event that was passed in
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON
CW_PANES_SET, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_REALIZE_LINE
PURPOSE:
Creates the slider bar
INPUTS:
WDRAW: (required) a widget ID
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_RIGHT_BUTTON, CW_PANES_SET
cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_RIGHT_BUTTON
PURPOSE:
Event handler when the right arrow button is clicked
INPUTS:
EVENT: (required) a widget_event structure
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT
CW_PANES_REALIZE_LINE, CW_PANES_SET, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE, CW_PANES_SET
cw_panes [2]
[Previous]
[Next]
NAME:
CW_PANES_SET
PURPOSE:
Sets the value of the widget
INPUTS:
ID: (required) the widget ID of the cw_panes base
ARRAY: (required) a scalar or 2 element vector of integers
Array[0] : visibility : 0=no change, 1=show only left pane,
2=show only right pane, 3=show both panes
Array[1] : position of slider in device units
KEYWORD PARAMETERS:
None
OUTPUTS:
None
CALLS: ***
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LEFT_BUTTON, CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT
CW_PANES_REALIZE_LINE, CW_PANES_RIGHT_BUTTON, IDLITLANGCATQUERY, XMANAGER
_IDLitsys_GetSystem, cw_panes [2], get_screen_size
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, cw_panes [2]
[Previous]
[Next]
NAME:
CW_PDMENU
PURPOSE:
CW_PDMENU is a compound widget that simplifies creating
pulldown menus. It has a simpler interface than the XPDMENU
procedure, which it is intended to replace. Events for the
individual buttons are handled transparently, and a CW_PDMENU
event returned. This event can return any one of the following:
- The Index of the button within the base.
- The widget ID of the button.
- The name of the button.
- The fully qualified name of the button. This allows
different sub-menus to contain buttons with the same
name in an unambiguous way.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_PDMENU(Parent, Desc)
INPUTS:
Parent: The ID of the parent widget.
Desc: An array of strings or structures. Each element contains
a menu description with two fields, a flag field, and
the name of the item. If a structure, each element
is defined as follows:
{ CW_PDMENU_S, flags:0, name:'' }
The name tag gives the name of button. The flags
field is a two-bit bitmask that controls how the button is
interpreted:
Value Meaning
-------------------------------------------
0 This button is neither the beginning
nor the end of a pulldown level.
1 This button is the root of a
sub-pulldown menu. The sub-buttons
start with the next button.
2 This button is the last button at the
current pulldown level. The next button
belongs to the same level as the current
parent button.
If none or empty string is specified as a
the name, the button is not created, but
the next button belongs to the upward level.
3 This button is the root of a sub-pulldown
menu, but it is also the last entry of
the current level.
4 Same as 0, above, except that this button will
be preceeded by a separator as with the SEPARATOR
keyword to WIDGET_BUTTON.
5 Same as 1, above, except that this button will
be preceeded by a separator.
6 Same as 2, above, except that this button will
be preceeded by a separator.
7 Same as 3, above, except that this button will
be preceeded by a separator.
If Desc is a string, each element contains the flag field
followed by a backslash character, followed by the menu item's
contents. See the example below.
EVENT PROCEDURES: An event procedure may be specified for an
element and all its children, by including a third field
in Desc, if Desc is a string array. Events for buttons without
an event procedure, are dispatched normally.
See the example below.
KEYWORD PARAMETERS:
CONTEXT_MENU: if constructing a context menu pulldown, set this
keyword. In this case, the parent must be the
widget id of a context menu base, returned by
WIDGET_BASE(..., /CONTEXT_MENU).
DELIMITER: The character used to separate the parts of a
fully qualified name in returned events. The
default is to use the '.' character.
FONT: The name of the font to be used for the button
titles. If this keyword is not specified, the
default font is used.
HELP: If MBAR is specified and one of the buttons on the
menubar has the label "help" (case insensitive) then
that button is created with the /HELP keyword to
give it any special appearance it is supposed to
have on a menubar. For example, Motif expects
help buttons to be on the right.
IDS: A named variable into which the button IDs will
be stored as a longword vector.
MBAR: if constructing a menu-bar pulldown, set this
keyword. In this case, the parent must be the
widget id of the menu bar of a top-level base,
returned by WIDGET_BASE(..., MBAR=mbar).
RETURN_ID: If present and non-zero, the VALUE field of returned
events will be the widget ID of the button.
RETURN_INDEX: If present and non-zero, the VALUE field of returned
events will be the zero-based index of the button
within the base. THIS IS THE DEFAULT.
RETURN_NAME: If present and non-zero, the VALUE field of returned
events will be the name of the selected button.
RETURN_FULL_NAME: If present and non-zero, the VALUE field of returned
events will be the fully qualified name of the
selected button. This means that the names of all
the buttons from the topmost button of the pulldown
menu to the selected one are concatenated with the
delimiter specified by the DELIMITER keyword. For
example, if the top button was named COLORS, the
second level button was named BLUE, and the selected
button was named LIGHT, the returned value would be
COLORS.BLUE.LIGHT
This allows different submenus to have buttons with
the same name (e.g. COLORS.RED.LIGHT).
UVALUE: The user value to be associated with the widget.
UNAME: The user name to be associated with the widget.
XOFFSET: The X offset of the widget relative to its parent.
YOFFSET: The Y offset of the widget relative to its parent.
OUTPUTS:
The ID of the top level button is returned.
CALLS: ***
CW_PDMENU_BUILD, CW_PDMENU_EVENT
CALLED BY:
ANNOTATE, CW_ORIENT, XMNG_TMPL, XSURFACE
SIDE EFFECTS:
This widget generates event structures with the following definition:
event = { ID:0L, TOP:0L, HANDLER:0L, VALUE:0 }
VALUE is either the INDEX, ID, NAME, or FULL_NAME of the button,
depending on how the widget was created.
RESTRICTIONS:
Only buttons with textual names are handled by this widget.
Bitmaps are not understood.
EXAMPLE:
The following is the description of a menu bar with two buttons,
"Colors" and "Quit". Colors is a pulldown containing the colors
"Red", "Green", Blue", "Cyan", and "Magenta". Blue is a sub-pulldown
containing "Light", "Medium", "Dark", "Navy", and "Royal":
; Make sure CW_PDMENU_S is defined
junk = { CW_PDMENU_S, flags:0, name:'' }
; The description
desc = [ { CW_PDMENU_S, 1, 'Colors' }, $
{ CW_PDMENU_S, 0, 'Red' }, $
{ CW_PDMENU_S, 0, 'Green' }, $
{ CW_PDMENU_S, 5, 'Blue\BLUE_EVENT_PROC' }, $
{ CW_PDMENU_S, 0, 'Light' }, $
{ CW_PDMENU_S, 0, 'Medium' }, $
{ CW_PDMENU_S, 0, 'Dark' }, $
{ CW_PDMENU_S, 0, 'Navy' }, $
{ CW_PDMENU_S, 2, 'Royal' }, $
{ CW_PDMENU_S, 4, 'Cyan' }, $
{ CW_PDMENU_S, 2, 'Magenta\MAGENTA_EVENT_PROC' }, $
{ CW_PDMENU_S, 2, 'Quit' } ]
The same menu may be defined as a string by equating the Desc parameter
to the following string array:
desc =[ '1\Colors' , $
'0\Red' , $
'0\Green' , $
'5\Blue\BLUE_EVENT_PROC' , $
'0\Light' , $
'0\Medium' , $
'0\Dark' , $
'0\Navy' , $
'2\Royal' , $
'4\Cyan' , $
'2\Magenta\MAGENTA_EVENT_PROC' , $
'2\Quit' ]
The following small program can be used with the above description
to create the specified menu:
base = widget_base()
menu = cw_pdmenu(base, desc, /RETURN_FULL_NAME)
WIDGET_CONTROL, /REALIZE, base
repeat begin
ev = WIDGET_EVENT(base)
print, ev.value
end until ev.value eq 'Quit'
WIDGET_CONTROL, /DESTROY, base
end
Note that independent event procedures were specified for
the multiple Blue buttons (blue_event_proc), and the Magenta button
(magenta_event_proc).
MODIFICATION HISTORY:
18 June 1992, AB
16 Jan 1995, DMS, Added MBAR keyword, event procedures,
and menu descriptor strings.
2 July 1995, AB, Added HELP keyword.
3 September 1996, LP, Added button-less end of current level
[Previous]
[Next]
NAME:
CW_RGBSLIDER
PURPOSE:
CW_RGBSLIDER is a compund widget that provides three sliders for
adjusting color values. The RGB, CMY, HSV, and HLS color systems
can all be used. No matter which color system is in use,
the resulting color is always supplied in RGB, which is the
base system for IDL.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_RGBSLIDER(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
COLOR_INDEX: If set, display a small rectangle with the
selected color, using the given index.
The color is updated as the values are changed.
CMY: If set, the initial color system used is CMY.
DRAG: Set to zero if events should only be generated when
the mouse button is released. If this keyword is set,
events will be generated continuously when the sliders
are adjusted. Note: On slow systems, /DRAG performance
can be inadequate. The default is DRAG=0.
FRAME: If set, a frame will be drawn around the widget. The
default is FRAME=0 (no frame drawn).
GRAPHICS_LEVEL: Set to 2 to use RGB graphics.
Set to 1 for Direct graphics (default).
If set to 2 a small rectangle with the RGB passed
in through the VALUE keyword is displayed.
This color swatch is updated as the color value is changed.
HSV: If set, the initial color system used is HSV.
HLS: If set, the initial color system used is HLS.
LENGTH: The length of the sliders. The default = 256.
RGB: If set, the initial color system used is RGB.
This is the default.
UVALUE: The user value for the widget.
UNAME: The user name for the widget.
VALUE: The RGB value for the color swatch.
VERTICAL: If set, the sliders will be oriented vertically.
The default is VERTICAL=0 (horizontal sliders).
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
COLORMAP_APPLICABLE, CW_FSLIDER, CW_RGB_CHNG_CS, CW_RGB_EVENT, CW_RGB_GET_VAL
CW_RGB_INIT, CW_RGB_SET_DRAW, CW_RGB_SET_VAL
CALLED BY:
XPALETTE, XPCOLOR, XROI
SIDE EFFECTS:
This widget generates event structures containing a three fields
named 'R', 'G', and 'B' containing the Red, Green, and Blue
components of the selected color.
Specifying the COLOR_INDEX keyword or the GRAPHIC_LEVEL keyword
set to 2 have the side effect of displaying a draw widget
with the represented color. Note that these are, in general,
mutually exclusive. If you are using the Object graphics
system, it's recommended that you set the GRAPHICS_LEVEL
keyword to two (COLOR_INDEX keyword is ignored in this case)
and pass in the initial RGB value through
the VALUE keyword. If you are using Direct graphics (and
want to display the color swatch) it's recommended to
set the COLOR_INDEX keyword to the initial color index,
set GRAPHICS_LEVEL keyword to one (default), and pass in the
initial RGB value through the VALUE keyword.
PROCEDURE:
The CW_RGBSLIDER widget has the following controls:
Color System Selection: A droplist which allows the user
to change between the supported color systems.
Color adjustment sliders: Allow the user to select a new color
value.
By adjusting these controls, the user selects color values which
are reported via the widget event mechanism.
MODIFICATION HISTORY:
April 1, 1992, AB
Based on the RGB code from XPALETTE.PRO, but extended to
support color systems other than RGB.
7 April 1993, AB, Removed state caching.
10 May 1994, DMS, Added Color_index param to display color.
Feb. 1999, WSO, Added VALUE and GRAPHICS_LEVEL features.
Aug. 2000, DLD, Provided improved support for display on devices
using decomposed color.
[Previous]
[Next]
NAME:
CW_TMPL
PURPOSE:
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
widget = CW_TMPL(parent)
INPUTS:
PARENT - The ID of the parent widget.
KEYWORD PARAMETERS:
UVALUE - Supplies the user value for the widget.
UNAME - Supplies the user name for the widget.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
TMPL_EVENT, TMPL_GET_VALUE, TMPL_SET_VALUE
COMMON BLOCKS:
None.
SIDE EFFECTS:
PROCEDURE:
WIDGET_CONTROL, id, SET_VALUE=value can be used to change the
current value displayed by the widget.
WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current
value displayed by the widget.
MODIFICATION HISTORY:
[Previous]
[Next]
NAME:
CW_TREESTRUCTURE
PURPOSE:
This function implements a compound widget for the treeview
of an IDL structure with nested substructures.
CALLING SEQUENCE:
Result = CW_TREESTRUCTURE(Parent [, VALUE=value])
RETURN VALUE:
The result is the widget ID of the newly-created widget.
INPUTS:
Parent: Set this argument to the widget ID of the parent base.
KEYWORD PARAMETERS:
VALUE = Set this keyword to a structure to be traversed.
If VALUE has a tag "_NAME" which is a scalar string, then
this will be used for the tree label.
If VALUE has a tag "_ICONTYPE" which is a scalar string,
then this will be used as the name of a bitmap file to
be used for the icon.
If a tag within VALUE contains another structure, then
a new branch is constructed and the substructure is
traversed.
Note: If the tagname for the tag containing the structure
is "_DATA" then a new branch is not constructed.
This allows you to skip tags while traversing.
All keywords to WIDGET_TREE except FUNC_GET_VALUE and PRO_SET_VALUE
are passed on to the tree widget.
Keywords to WIDGET_CONTROL and WIDGET_INFO:
The widget ID returned by CW_TREESTRUCTURE is the ID of the
WIDGET_TREE root. This means that many keywords to the WIDGET_CONTROL
and WIDGET_INFO routines that affect or return information on
WIDGET_TREE can be used.
In addition, you can use the GET_VALUE and SET_VALUE keywords to
WIDGET_CONTROL to retrieve or set the structure value.
The GET_VALUE keyword returns the structure corresponding to the
current selection within the widget tree. This structure contains
only those tags and substructures at the selected level and below.
If nothing is selected then a scalar zero is returned.
The SET_VALUE keyword adds a structure to the tree at the root level.
If SET_VALUE is not a structure variable then the tree is emptied.
Widget Events Returned by the CW_TREESTRUCTURE Widget:
The CW_TREESTRUCTURE widget returns WIDGET_TREE_SEL and
WIDGET_TREE_EXPAND events.
CALLS: ***
CW_TREESTRUCTURE_ADDLEVEL, CW_TREESTRUCTURE_GETVALUE
CW_TREESTRUCTURE_SETVALUE, FILEPATH, READ_BMP
CALLED BY:
H5_BROWSER
MODIFICATION HISTORY:
Written by: CT, RSI, June 2002
Modified:
[Previous]
[Next]
NAME:
CW_ZOOM
PURPOSE:
This compound widget displays two images: an original image
in one window and a portion of the original image in another.
The user may select the center of the zoom region, the zoom scale,
the interpolation style, and the method of indicating the zoom center.
CATEGORY:
Compound widgets.
CALLING SEQUENCE:
Widget = CW_ZOOM(Parent)
INPUTS:
Parent: The ID of the parent widget.
KEYWORD PARAMETERS:
FRAME: If set, a frame will be drawn around the widget. The
default is FRAME=0 (no frame).
MAX: The maximum zoom scale, which must be greater than
or equal to 1. The default = 20.
MIN: The minimum zoom scale, which must be greater than
or equal to 1. The default = 1.
RETAIN: Controls the setting for backing store for both windows.
If backing store is provided, a window which was obscured
will be redrawn when it becomes exposed. Set RETAIN=0 for
no backing store. Set RETAIN=1 to "request backing store
from server" (this is the default). Set RETAIN=2 for IDL
to provide backing store.
SAMPLE: Set to zero for bilinear interpolation, or to a non-zero
value for nearest neighbor interpolation. Bilinear
interpolation gives higher quality results, but requires
more time. The default is SAMPLE=0 (bilinear interpolation).
SCALE: The initial integer scale factor to use for the zoomed image.
The default is SCALE=4. The scale must be greater than or
equal to 1.
TRACK: Set to zero if the zoom window should be updated only when
the mouse button is pressed. Set to a non-zero value if the
zoom window should be updated continuously as the cursor
is moved across the original image. Note: On slow systems,
/TRACK performance can be inadequate. The default is TRACK=0.
UVALUE: The user value for the widget.
UNAME: The user name for the widget.
XSIZE: The width of the window (in pixels) for the original image.
The default is 500.
YSIZE: The height of the window (in pixels) for the original image.
The default is 500.
X_SCROLL_SIZE: The width of the visible part of the original image.
This may be smaller than the actual width controlled
by the XSIZE keyword. The default is 0, for no
scroll bar.
Y_SCROLL_SIZE: The height of the visible part of the original image.
This may be smaller than the actual height controlled
by the YSIZE keyword. The default is 0, for no
scroll bar.
X_ZSIZE: The width of the window for the zoomed image.
The default is 250.
Y_ZSIZE: The height of the window for the zoomed image.
The default is 250.
OUTPUTS:
The ID of the created widget is returned.
CALLS: ***
CW_BGROUP, DRAW_ZOOM, ZOOM_EVENT, ZOOM_GET_VALUE, ZOOM_SET_VALUE
SIDE EFFECTS:
When the "Report Zoom to Parent" button is pressed, this widget
will generate an event structure containing several data fields.
x_zsize, y_zsize: size of the zoomed image
x0, y0: lower left corner in original image
x1, y1: upper right corner in original image
This event is a report to the parent that allows retrieval of the
zoomed image using WIDGET_CONTROL.
PROCEDURE:
WIDGET_CONTROL, id, SET_VALUE=value can be used to change the
original, unzoomed image displayed by the widget.
The value may not be set until the widget has been
realized.
WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current
zoomed image displayed by the widget.
MODIFICATION HISTORY:
June 30, 1992, ACY
7 April 1993, AB, Removed state caching.
13 June, 1994, ACY, Save window and set to zoom prior to erase
Add byte conversion in set_value
23 November, 1994, ACY, add code to handle cases in which the
set_value image is larger or smaller than the
original image. Also remove scaling on display
operation (only scale the image when it is set.)