DEFINE_MSGBLK_FROM_FILE $RSI/define_msgblk_from_file.pro
[Previous] [Next]
 NAME:
       DEFINE_MSGBLK_FROM_FILE

 PURPOSE:
       Read an IDL message file and use DEFINE_MSGBLK to
       load the message block it defines into IDL. Once this
       has been done, the errors can be issued via the MESSAGE procedure.

 CATEGORY:
       Error Handling.

 CALLING SEQUENCE:
       DEFINE_MSGBLK_FROM_FILE, filename

 INPUTS:
    filename:  Name of the message file to read.

 KEYWORDS:
    BLOCK: If present, specifies the name of the message block.
       Normally, this keyword is not specified, and an @IDENT
       line in the message file specifies the name of the block.

    IGNORE_DUPLICATE: Attempts to define a given message block more than
       once in the same IDL session usually cause DEFINE_MSGBLK to
       issue an error and stop execution of the IDL program. Specify
       IGNORE_DUPLICATE to cause DEFINE_MSGBLK to quietly ignore
       attempts to redefine a message block. In this case, no
       error is issued and execution continues. The original message
       block remains installed and available for use.

    PREFIX: If present, specifies a prefix string to be applied to
       the beginning of each message name in the message block.
       Normally, this keyword is not specified, and a @PREFIX
       line in the message file specifies the prefix string.

    VERBOSE: If set, causes DEFINE_MSGBLK_FROM_FILE to print
       informational messages to stdout describing the message
       block loaded.

 OUTPUTS:
       None.

 CALLS: ***
	DMFF_FIND_SPECIAL, STRSPLIT
 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       The specified message block has been loaded into IDL, as can
       be verified via the "HELP,/MESSAGE" command.

 MODIFICATION HISTORY:
       1 August 2000, AB, RSI


DEFROI $RSI/defroi.pro
[Previous] [Next]
 NAME:         DEFROI

 PURPOSE:  Define an irregular region of interest of an image
       using the image display system and the cursor/mouse.

 CATEGORY: Image processing.

 CALLING SEQUENCE:
   R = Defroi(Sx, Sy, X0, Y0)

 INPUTS:
   Sx, Sy = Size of image, in pixels.

 Optional Inputs:
   X0, Y0 = Coordinate of Lower left corner of image on display.
   If omitted, (0,0) is assumed.  Screen device coordinates.
   ZOOM = zoom factor, if omitted, 1 is assumed.

 OUTPUTS:
   Function result = vector of subscripts of pixels inside the region.
   Side effect: The lowest bit in which the write mask is enabled
   is changed.

 OPTIONAL OUTPUTS:
   Xverts, Yverts = Optional output parameters which will contain
       the vertices enclosing the region.

 KEYWORD Parameters:
   NOREGION = Setting NOREGION inhibits the return of the
       pixel subscripts.
   NOFILL = if set, inhibits filling of irregular region on completion.
   RESTORE = if set, original image on display is restored to its
       original state on completion.

 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   Display is changed if RESTORE is not set.

 RESTRICTIONS:
   Only works for interactive, pixel oriented devices with a
       cursor and an exclusive or writing mode.

 PROCEDURE:
   The exclusive or drawing mode is used to allow drawing and
   erasing objects over the original object.

   The operator marks the vertices of the region, either by
       dragging the mouse with the left button depressed or by
       marking vertices of an irregular polygon by clicking the
       left mouse button, or with a combination of both.
   The center button removes the most recently drawn points.
   Press the right mouse button when finished.
   When the operator is finished, the region is filled using
       the polyfill function, and the polyfillv function is used
       to compute the subscripts within the region.

 MODIFICATION HISTORY:  DMS, March, 1987.
   Revised for SunView, DMS, Nov, 1987.
       Added additional argument checking, SNG April, 1991
   Modified for devices without write masks: DMS, March, 1992.
       Uses exclusive or mode rather than write masks.
   Modified to preserve device mode, RJF, Nov 1997.
   Modified: CT, RSI, Aug 2000: Replace !err with !mouse.
       Replace /WAIT with /DOWN in CURSOR calls. Prevents multiple
       points from being erased.
   Modified: CT, RSI, Aug 2002: Use /WAIT for left mouse button,
       and /DOWN for middle button. Now you can draw a smooth curve
       and erase single points. # of points is now unlimited.
       Also, if less than 3 vertices, it keeps them rather than
       forcing user to start over.
   Modified: CT, RSI, June 2003: Better handling for smooth curves
       on Windows, where it erased points that were just drawn.


DENDRO_PLOT $RSI/dendro_plot.pro
[Previous] [Next]
 NAME:
   DENDRO_PLOT

 PURPOSE:
   Given a hierarchical tree cluster, as created by CLUSTER_TREE,
   the DENDRO_PLOT procedure draws a two-dimensional dendrite plot
   on the current direct graphics device.

 CALLING SEQUENCE:
   DENDRO_PLOT, Clusters, Linkdistance

 INPUTS:
   Clusters: A 2-by-(m-1) input array containing the cluster indices,
       where m is the number of items in the original dataset.
       This array is usually the result of the CLUSTER_TREE function.

   Linkdistance: An (m-1)-element input vector containing the distances
       between cluster items, as returned by the Linkdistance argument
       to the CLUSTER_TREE function.

 KEYWORD PARAMETERS:
   See the IDL Reference Manual for a description of the keywords.

 CALLS: ***
	DENDROGRAM
 EXAMPLE:
    ; Given a set of points in two-dimensional space.
    m = 20
    data = 7*RANDOMN(-1, 2, m)

    ; Compute the Euclidean distance between each point.
    distance = DISTANCE_MEASURE(data)

    ; Compute the cluster analysis.
    clusters = CLUSTER_TREE(distance, linkdistance, LINKAGE=2)

    DENDRO_PLOT, clusters, linkdistance, $
        POSITION=[0.08, 0.1, 0.48, 0.9], $
        XSTYLE=9, YSTYLE=9, $
        XTITLE='Leaf', YTITLE='Distance'

    DENDRO_PLOT, clusters, linkdistance, $
        ORIENTATION=1, /NOERASE, $
        POSITION=[0.56, 0.1, 0.96, 0.9], $
        XSTYLE=9, YSTYLE=9, $
        XTITLE='Distance', YTITLE='Leaf'

 MODIFICATION HISTORY:
   Written by:  CT, RSI, Sept 2003
   Modified:


DENDROGRAM $RSI/dendrogram.pro
[Previous] [Next]
 NAME:
   DENDROGRAM

 PURPOSE:
   Given a hierarchical tree cluster, as created by CLUSTER_TREE, the
   DENDROGRAM procedure constructs a dendrogram and returns a set of
   vertices and connectivity that can be used to visualize the dendrite plot.

 CALLING SEQUENCE:
   DENDROGRAM, Clusters, Linkdistance, Outverts, Outconn

 INPUTS:
   Clusters: A 2-by-(m-1) input array containing the cluster indices,
       where m is the number of items in the original dataset.
       This array is usually the result of the CLUSTER_TREE function.

   Linkdistance: An (m-1)-element input vector containing the distances
       between cluster items, as returned by the Linkdistance argument
       to the CLUSTER_TREE function.

 OUTPUTS:
   Outverts: Set this argument to a named variable which will contain
       the [2, *] array of floating-point vertices making up the
       dendrogram.

   Outconn: Set this argument to a named variable which will contain
       an output array of connectivity values.

 KEYWORD PARAMETERS:
   LEAFNODES: Set this keyword to a named variable in which to return
       a vector of integers giving the order of leaf nodes within the
       dendrogram. The LEAFNODES keyword is useful for labeling the
       nodes in a dendrite plot.


 CALLS: ***
	CLUSTER_REORDER, _CLUSTER_REORDER
 CALLED BY:
	DENDRO_PLOT
 EXAMPLE:
    ; Given a set of points in two-dimensional space.
    m = 20
    data = 7*RANDOMN(-1, 2, m)

    ; Compute the Euclidean distance between each point.
    distance = DISTANCE_MEASURE(data)

    ; Compute the cluster analysis.
    clusters = CLUSTER_TREE(distance, linkdistance, LINKAGE=2)

    ; Create the dendrogram.
    DENDROGRAM, clusters, linkdistance, outverts, outconn, $
        LEAFNODES=leafnodes

    PRINT, STRTRIM(leafnodes, 2)

 MODIFICATION HISTORY:
   Written by:  CT, RSI, Sept 2003
   Modified:


DERIV $RSI/deriv.pro
[Previous] [Next]
 NAME:
	DERIV

 PURPOSE:
	Perform numerical differentiation using 3-point, Lagrangian 
	interpolation.

 CATEGORY:
	Numerical analysis.

 CALLING SEQUENCE:
	Dy = Deriv(Y)	 	;Dy(i)/di, point spacing = 1.
	Dy = Deriv(X, Y)	;Dy/Dx, unequal point spacing.

 INPUTS:
	Y:  Variable to be differentiated.
	X:  Variable to differentiate with respect to.  If omitted, unit 
	    spacing for Y (i.e., X(i) = i) is assumed.

 OPTIONAL INPUT PARAMETERS:
	As above.

 OUTPUTS:
	Returns the derivative.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 PROCEDURE:
	See Hildebrand, Introduction to Numerical Analysis, Mc Graw
	Hill, 1956.  Page 82.

 MODIFICATION HISTORY:
	Written, DMS, Aug, 1984.
	Corrected formula for points with unequal spacing.  DMS, Nov, 1999.


DERIVSIG $RSI/derivsig.pro
[Previous] [Next]
 NAME:
	DERIVSIG

 PURPOSE:
	This function computes the standard deviation of a derivative
       as found by the DERIV function, using the input variables of
	DERIV and the standard deviations of those input variables.

 CATEGORY:
	Numerical analysis.

 CALLING SEQUENCE:
	sigDy = Derivsig(sigy)		;sigma(Dy(i)/di), point spacing = 1.
	sigDy = Derivsig(X,Y,sigx,sigy) ;sigma(Dy/Dx), unequal point spacing.

 INPUTS:
	Y:	The variable to be differentiated. Omit if X is omitted.
	X:	The Variable to differentiate with respect to. If omitted,
		unit spacing is assumed for Y, i.e. X(i) = i.
       sigy:	The standard deviation of Y. (Vector if used alone in
		call, vector or constant if used with other parameters)
       sigx:	The standard deviation of X (either vector or constant).
		Use "0.0" if the abscissa is exact; omit if X is omitted.

 OPTIONAL INPUT PARAMETERS:
	As above.

 OUTPUTS:
	This function returns the standard deviation of the derivative.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 PROCEDURE:
	See Bevington, "Data Analysis and Reduction for the Physical
           Sciences," McGraw-Hill (1969), Chap 4.

 MODIFICATION HISTORY:
       Written by Richard Bonomo at the University of Wisconsin - Madison
       department of Electrical and Computer Engineering, July, 1991.
	"DERIV" written by DMS, Aug, 1984.


DETERM $RSI/determ.pro
[Previous] [Next]
 NAME:
       DETERM

 PURPOSE:
       This function computes the determinant of an N by N array.

 CATEGORY:
       Linear Algebra.

 CALLING SEQUENCE:
       Result = DETERM(A)

 INPUTS:
       A:      An N by N array of type: float, or double.

 KEYWORD PARAMETERS:
       CHECK:  If set to a non-zero value, A is checked for singularity.
               The determinant of a singular array is returned as zero if
               this keyword is set. Run-time errors may result if A is
               singular and this keyword is not set.

       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.
               For single-precision inputs, the default value is
               1.0e-6. For double-precision inputs, the default value
               is 1.0e-12.

 CALLS: ***
	COND
 CALLED BY:
	CRAMER
 EXAMPLE:
       Define an array (a).
         a = [[ 2.0,  1.0,  1.0], $
              [ 4.0, -6.0,  0.0], $
              [-2.0,  7.0,  2.0]]
       Compute the determinant.
         result = determ(a)
       Note:
            See CRAMER.PRO, in the same directory as this file, for
            an application of the determinant function.

 PROCEDURE:
       LU decomposition is used to represent the input array in
       triangular form. The determinant is computed as the product
       of diagonal elements of the triangular form. Row interchanges
       are tracked during the LU decomposition to ensure the correct
       sign, + or - .

 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 CHECK keyword to check for singular arrays.
                    Changed NR_LUDCMP to LUDC.
       Modified:    GGS, RSI, April 1996
                    Modified keyword checking and use of double precision.


DIALOG_READ_IMAGE $RSI/dialog_read_image.pro
[Previous] [Next]
 NAME:
   DIALOG_READ_IMAGE

 PURPOSE:
       This routine creates a GUI dialog for previewing and selecting
       images to read.

 CATEGORY:
       Input/Output

 CALLING SEQUENCE:
       Result = DIALOG_READ_IMAGE([Filename])

       Result is a 1 if Open was clicked, 0 if Cancel.

 INPUTS:
       [Filename] = a scalar string of the file to read.

 OPTIONAL KEYWORDS:

  BLUE - Vector which returns the blue palette (if any)

  DIALOG_PARENT - The widget ID of a widget that calls DIALOG_READ_IMAGE.
   When this ID is specified, a death of the caller results in the
       death of the DIALOG_READ_IMAGE dialog.

  FILE - Set this keyword to a named variable to contain the name of
   the selected file.

  FILTER_TYPE - Set this keyword to a scalar string containing the format
   type the dialog filter should begin with.  The default is
   "IMAGE_FILES".  The user can modify the filter unless the
   FIX_FILTER keyword is set.  Valid values are obtained from the
   list of supported image types returned from QUERY_IMAGE.  In
   addition, there are also 2 more special types: IMAGE_FILES, ALL_FILES.

  FIX_FILTER - When this keyword is set, only files that satisfy the filter
   can be selected.  The user has no ability to modify the filter
   and the filter is grayed out.

  GET_PATH = Set this keyword to a named variable in which the path of
   the selection is returned.

  GREEN - Vector which returns the green palette (if any)

  PATH - Set this keyword to a string that contains the initial path
   from which to select files.  If this keyword is not set,
   the current working directory is used.

  QUERY - Set this keyword to a named variable that will return the
   QUERY_IMAGE structure associated with the returned image.

  RED - Vector which returns the red palette (if any)

  TITLE - Set this keyword to a scalar string to be used for the dialog
   title.  If not specified, the default title is "Select Image File".

 OUTPUTS:
   This function returns the selected image array.

 CALLS: ***
	CONGRID, CW_FILESEL, DRI_BITMAP_DEFINE, DRI_CLEARWIN, DRI_DRAWWIN, DRI_EVENT
	DRI_READIMAGE, LOADCT, PATH_SEP, QUERY_IMAGE, READ_IMAGE, REVERSE, XMANAGER
 CALLED BY:
	IMPORT_IMAGE, XROI
 EXAMPLE:
       myImage = DIALOG_READ_IMAGE()

 MODIFICATION HISTORY:
   Written by: Scott Lasica, July, 1998
   Modified: CT, RDI, July 2000: Cleaned up the layout,
                  resize now works, added GET_PATH keyword.
                  Force to be MODAL, even if no DIALOG_PARENT.


DIALOG_WIZARD $RSI/itools/ui_widgets/dialog_wizard.pro
[Previous] [Next]
 NAME:
   DIALOG_WIZARD

 PURPOSE:
   This function implements the dialog wizard.

 CALLING SEQUENCE:
   Result = DIALOG_WIZARD()

 INPUTS:

 KEYWORD PARAMETERS:


 CALLS: ***
	DIALOG_WIZARD_BACK, DIALOG_WIZARD_CANCEL, DIALOG_WIZARD_EVENT
	DIALOG_WIZARD_HELP, DIALOG_WIZARD_NEXT, DIALOG_WIZARD_REALIZE
	DIALOG_WIZARD_SETNEXT, DIALOG_WIZARD_SETSCREENS, DIALOG_WIZARD_UPDATE
	IDLITLANGCATQUERY, XMANAGER
 CALLED BY:
	IDLitwdGridWizard, IDLitwdImportWizard, IDLitwdMapRegisterImage
	IDLitwdUnknownData
 MODIFICATION HISTORY:
   Written by: CT, RSI, September 2002.
   Modified:


DIALOG_WRITE_IMAGE $RSI/dialog_write_image.pro
[Previous] [Next]
 NAME:
	DIALOG_WRITE_IMAGE

 PURPOSE:
       This routine creates a GUI dialog for writing images.

 CATEGORY:
       Input/Output

 CALLING SEQUENCE:
       Result = DIALOG_WRITE_IMAGE, Image [,R,G,B]

		Result is a 1 if Save was clicked, 0 for Cancel.

 INPUTS:
       [Image] - The data array to be written to the image file.
	    R,G,B - Optional red,green,blue color vectors.

 OPTIONAL KEYWORDS:

  DIALOG_PARENT - The widget ID of a widget that calls DIALOG_WRITE_IMAGE.
	When this ID is specified, a death of the caller results in the
   death of the DIALOG_WRITE_IMAGE dialog.

  FILENAME - Set this keyword to a named variable to contain the name of the initial
   file selection.

  FIX_TYPE - When this keyword is set, only files that satisfy the type can be
   selected.  The user has no ability to modify the type and the type field
   is grayed out.

  NOWRITE - Set this keyword to prevent the dialog from writing the file when Save
            is clicked.  No data conversions will take place when the save type is chosen.

  OPTIONS - Set this keyword to a named variable to contain a structure of the chosen
            options by the user, including the filename and image type chosen.

  PATH - Set this keyword to a string that contains the initial path
	from which to select files.  If this keyword is not set,
	the current working directory is used.

  TITLE - Set this keyword to a scalar string to be used for the dialog
	title.  If not specified, the default title is "Save Image File".

  TYPE - Set this keyword to a scalar string containing the format type the
   Save as type field should begin with.  The default is "TIFF".  The user
   can modify the type unless the FIX_TYPE keyword is set.  Valid values
   are obtained from the list of supported image types returned from
   QUERY_IMAGE.

  WARN_EXIST - If set, the user is warned if a filename is chosen
      that matches an already existing file.

 OUTPUTS:
	None.

 CALLS: ***
	CW_FIELD, CW_FILESEL, DWI_EVENT, DWI_OPTIONS, DWI_OPTIONS_EVENT, QUERY_IMAGE
	WRITE_IMAGE, XMANAGER
 CALLED BY:
	IDLexViewGroup, xplot3d
 EXAMPLE:
       DIALOG_WRITE_IMAGE, myData

 MODIFICATION HISTORY:
 	Written by:	Scott Lasica, October, 1998
   CT, RSI, July 2000: Force to be modal, even if no parent.
             Added WARN_EXIST.
   CT, RSI, May 2004: Added JPEG2000 support. Add TIFF LZW back in.


dicomex_net_startup $RSI/dicomex/dicomex_net_startup.pro
[Previous] [Next]
 NAME:
   dicomex_net_startup

 PURPOSE:
   This displays a dialog asking the user to choose in which mode to
   start the dicomex_net routine.

 CALLING SEQUENCE:
   dicomex_net_startup

 INPUTS:
   NONE

 KEYWORD PARAMETERS:
   NONE

 CALLS: ***
	DICOMEX_NET, DICOMEX_NET_STARTUP_EVENT, XDISPLAYFILE, XMANAGER, get_screen_size
 MODIFICATION HISTORY:
   Written by:  AGEH, RSI, January 2005


DIGITAL_FILTER $RSI/digital_filter.pro
[Previous] [Next]
 NAME:
   DIGITAL_FILTER

 PURPOSE:
   Compute the coefficients of a non-recursive, digital
   filter.  Highpass, lowpass, bandpass and bandstop
   filters may be constructed with this function.

 CATEGORY:
   Signal processing.

 CALLING SEQUENCE:
   Coeff = DIGITAL_FILTER(Flow, Fhigh, A, Nterms)  ;To get coefficients.

   Followed by:

   Yout  = CONVOL(Yin, Coeff)  ;To apply the filter.

 INPUTS:
   Flow:   The lower frequency of the filter as a fraction of the Nyquist
       frequency.

   Fhigh:  The upper frequency of the filter as a fraction of the Nyquist
       frequency.

   A:  The size of Gibbs phenomenon wiggles in -db.  50 is a good
       choice.

   Nterms: The number of terms in the filter formula.  The order
       of filter.

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
       The following conditions are necessary for various types of
       filters:

       No Filtering:   Flow = 0, Fhigh = 1.
       Low Pass:   Flow = 0, 0 < Fhigh < 1.
       High Pass:  0 < Flow < 1, Fhigh =1.
       Band Pass:  0 < Flow < Fhigh < 1.
       Band Stop:  0 < Fhigh < Flow < 1.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

 KEYWORDS:
   Double: Set this keyword to use double-precision arithmetic.

 OUTPUTS:
   Returns a vector of coefficients with (2*nterms + 1) elements.

 CALLS: ***
	REVERSE
 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   None.

 PROCEDURE:
   This function returns the coefficients of a non-recursive,
   digital filter for evenly spaced data points.  Frequencies are
   expressed in terms of the Nyquist frequency, 1/2T, where T
   is the time between data samples.

 MODIFICATION HISTORY:
   DMS, April, 1985.
   Adapted from:
   "Digital Filters", Robert Walraven,
   Proceedings of the Digital Equipment User's Society, Fall, 1984.
   Department of Applied Science,
   University of California, Davis, CA 95616.

   CT, RSI, Dec 2001: Add DOUBLE keyword.
       Convert 1-element inputs to scalars.


DISSOLVE $RSI/dissolve.pro
[Previous] [Next]
 NAME:
	DISSOLVE

 PURPOSE:
	A digital "dissolve" effect for images.  Copies the pixels (arranged
	into square tiles) from the image to the display in pseudo-random
	order.

 CATEGORY:
	Image display.

 CALLING SEQUENCE:
	DISSOLVE, Image

 INPUTS:
	Image:	The image to be displayed.  It is assumed that the image is
		already scaled.  Byte-valued images display most rapidly.

 OPTIONAL INPUT PARAMETERS:
	None.

 KEYWORD PARAMETERS:
	SIZ:	Size of square tile.  The default is 32 x 32 pixels.

	X0, Y0: The X and Y offsets of the lower-left corner of the image on 
		screen.  The defaults are X0 = 0 and Y0 = 0.

	DELAY:	The wait between displaying tiles.  The default is 0.01 secs.

	ORDER:	The Image display order:  	0 = default = bottom up.
						1 = top-down.

 OUTPUTS:
	No explicit outputs.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	The image is written to the screen.

 RESTRICTIONS:
	None, but the effect is dependent upon the speed of the
	machine/display.

 PROCEDURE:
	An integer pseudo-random number generator is used to decide
	which tile to display.  The algorithm is taken from "Graphics Gems",
	Andrew Glassner, ed., Academic Press, 1990, Page 221.

 MODIFICATION HISTORY:
	DMS, Sept, 1990.


DIST $RSI/dist.pro
[Previous] [Next]
 NAME:
	DIST

 PURPOSE:
	Create a rectangular array in which each element is proportional
	to its frequency.  This array may be used for a variety
	of purposes, including frequency-domain filtering and
	making pretty pictures.

 CATEGORY:
	Signal Processing.

 CALLING SEQUENCE:
	Result = DIST(N [, M])

 INPUTS:
	N = number of columns in result.
	M = number of rows in result.  If omitted, N is used to return
		a square array.

 OUTPUTS:
	Returns an (N,M) floating array in which:

	R(i,j) = SQRT(F(i)^2 + G(j)^2)   where:
		 F(i) = i  IF 0 <= i <= n/2
		      = n-i  IF i > n/2
		 G(i) = i  IF 0 <= i <= m/2
		      = m-i  IF i > m/2

 CALLED BY:
	TIME_TEST, test_lj [1], test_lj [2], test_lj [3], test_lj [4], test_lj [5]
	test_lj [6], test_lj [7], test_lj [8], test_pcl [1], test_pcl [2], test_pcl [3]
	test_pcl [4], test_pcl [5], xobjview
 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 PROCEDURE:
	Straightforward.  The computation is done a row at a time.

 MODIFICATION HISTORY:
	Very Old.
 	SMR, March 27, 1991 - Added the NOZERO keyword to increase efficiency.
				(Recomended by Wayne Landsman)
	DMS, July, 1992.  - Added M parameter to make non-square arrays.
   CT, RSI, March 2000: Changed i^2 to i^2. to avoid overflow.


DISTANCE_MEASURE $RSI/distance_measure.pro
[Previous] [Next]
 NAME:
   DISTANCE_MEASURE

 PURPOSE:
   Compute the pairwise distance between a set of items.

 CATEGORY:
   Statistics.

 CALLING SEQUENCE:
   Result = DISTANCE_MEASURE(Array)

 INPUTS:
   Array: An n-by-m array representing the coordinates
       (in an n-dimensional space) of m items. For example,
       a set of m points in a two-dimensional Cartesian space
       would be passed in as a 2-by-m array.

 OUTPUTS:
   The Result is a vector of m*(m-1)/2 elements containing the
       distance matrix in compact form. Given a distance between
       two items, D(i,j), the distances within Result are
       returned in the order:
       [D(0, 1),  D(0, 2), ..., D(0, m-1), D(1, 2), ..., D(m-2, m)].
   If keyword MATRIX is set then the distance matrix is not returned
       in compact form, but is instead returned as an m-by-m
       symmetric array with zeroes along the diagonal.

 KEYWORD PARAMETERS:
   DOUBLE: Set this keyword to perform computations using
       double-precision arithmetic and to return a double-precision
       result. Set DOUBLE=0 to use single-precision for computations
       and to return a single-precision result.
       The default is /DOUBLE if Array is double precision,
       otherwise the default is DOUBLE=0.

   MATRIX: Set this keyword to return the distance matrix as
       an m-by-m symmetric array. If this keyword is not set
       then the distance matrix is returned in compact vector form.

   MEASURE: Set this keyword to an integer giving the distance measure
       (the metric) to use. Possible values are:
           MEASURE=0 (the default): Euclidean distance. The Euclidean
               distance is defined as Sqrt(Total((Xi - Yi)^2)).
           MEASURE=1: CityBlock (Manhattan) distance.
               The CityBlock distance is defined as Total(Abs(Xi - Yi)).
           MEASURE=2: Chebyshev distance. The Chebyshev
               distance is defined as Max(Abs(Xi - Yi)).
           MEASURE=3: Correlative distance. The correlative distance is
               defined as Sqrt((1-r)/2), where r is the correlation
               coefficient between two items.
           MEASURE=4: Percent disagreement. This distance is defined
               as (Number of Xi ne Yi)/n, and is useful for
               categorical data.
       This keyword is ignored if POWER_MEASURE is set.

   POWER_MEASURE: Set this keyword to a scalar or a two-element vector
       giving the parameters p and r to be used in the power distance,
       defined as (Total(Abs(Xi - Yi)^p)^(1/r).
       If POWER_MEASURE is a scalar then the same value is used for both
       p and r (this is also known as the Minkowski distance).
       Note that POWER_MEASURE=1 is the same as the CityBlock distance,
       while POWER_MEASURE=2 is the same as Euclidean distance.

 CALLS: ***
	CORRELATE, DISTANCE_MEASURE_INDICES
 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)

    i1 = [0,0,0,0,0,0, 1,1,1,1,1, 2,2,2,2, 3,3,3, 4,4, 5]
    i2 = [1,2,3,4,5,6, 2,3,4,5,6, 3,4,5,6, 4,5,6, 5,6, 6]
    PRINT, 'Item#  Item#  Distance'
    PRINT, TRANSPOSE([[i1],[i2],[distance]]), $
    format='(I3, I7, F10.2)'

 MODIFICATION HISTORY:
   Written by:  CT, RSI, Sept 2003
   Modified:


DOC_LIBRARY $RSI/doc_library.pro
[Previous] [Next]
 NAME:
	DOC_LIBRARY

 PURPOSE:
	Extract the documentation template of one or more IDL modules
	(procedures or functions).  This command provides a standard interface
	to the operating-system specific DL_DOS, DL_UNIX, and
	DL_VMS procedures.

 CATEGORY:
	Help, documentation.

 CALLING SEQUENCE:
	DOC_LIBRARY		;For prompting.

	DOC_LIBRARY, Name 	;Extract documentation for procedure Name using
				the current !PATH.

 INPUTS:
	Name:	The string containing the name of the procedure.
		Under Unix, Name may be "*" to get information on all routines.

 KEYWORDS:
	PRINT:	If set, this keyword sends the output of DOC_LIBRARY to the
		default printer.  Under Unix, if PRINT is a string, it is
		interpreted as a shell command used for output with
		the documentation from DOC_LIBRARY providing standard input
		(i.e. PRINT="cat > junk").

 UNIX KEYWORDS:
   DIRECTORY:	The directory to search.  If omitted, the current directory
		and !PATH are used.

	MULTI:	If set, this flag allows printing of more than one file if the
		requested module exists in more than one directory in the path
		and the current directory.

 VMS KEYWORDS:
	FILE:	If this keyword is set, the output is left in the file
		"userlib.doc", in the current directory.

	PATH:	An optional directory/library search path.  This keyword uses
		the same format and semantics as !PATH.  If omitted, !PATH is
		used.

 OUTPUTS:
	Documentation is sent to the standard output unless /PRINT
	is specified.

 CALLS: ***
	DL_DOS, DL_MAC, DL_UNIX, DL_VMS
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Output is produced on terminal or printer.

 RESTRICTIONS:
	The DIRECTORY and MULTI keywords are ignored under VMS. The
	FILE and PATH keywords are ignored under Unix.

 EXAMPLE:
	To obtain documentation for the User's Library function DIST, enter:
		DOC_LIBRARY, 'DIST'

	For a graphical interface to DOC_LIBRARY, see the procedure XDL.

 MODIFICATION HISTORY:
	Written, DMS, Sept, 1982.
	Added library param, Jul 1987.
	Unix version, DMS, Feb, 1988.
	New VMS version, DMS, Dec. 1989
	Wrapper procedure to call the correct version
		under Unix and VMS, AB, Jan 1990
       Added support for DOS, SNG, Dec, 1990
	Added support for Macintosh, DJE, Nov, 1994