R_CORRELATE $RSI/r_correlate.pro
[Previous] [Next]
 NAME:
       R_CORRELATE

 PURPOSE:
       This function computes Spearman's (rho) or Kendalls's (tau) rank
       correlation of two n-element vectors. The result is a two-element
       vector containing the rank correlation coefficient and the two-sided
       significance level of its deviation from zero.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = R_correlate(X, Y)

 INPUTS:
       X:    An n-element vector of type integer, float or double.

       Y:    An n-element vector of type integer, float or double.

 KEYWORD PARAMETERS:
 KENDALL:    If set to a nonzero value, Kendalls's (tau) rank correlation
             is computed. By default, Spearman's (rho) rank correlation is
             computed.

       D:    Use this keyword to specify a named variable which returns the
             sum-squared difference of ranks. If the KENDALL keyword is set
             to a nonzero value, this parameter is returned as zero.

      ZD:    Use this keyword to specify a named variable which returns the
             number of standard deviations by which D deviates from its null-
             hypothesis expected value. If the KENDALL keyword is set to a
             nonzero value, this parameter is returned as zero.

   PROBD:    Use this keyword to specify a named variable which returns the
             two-sided significance level of ZD. If the KENDALL keyword is
             set to a nonzero value, this parameter is returned as zero.

 EXAMPLE
       Define two n-element vectors of tabulated data.
         x = [257, 208, 296, 324, 240, 246, 267, 311, 324, 323, 263, 305, $
              270, 260, 251, 275, 288, 242, 304, 267]
         y = [201, 56, 185, 221, 165, 161, 182, 239, 278, 243, 197, 271, $
              214, 216, 175, 192, 208, 150, 281, 196]

       Compute Spearman's (rho) rank correlation of x and y.
         result = r_correlate(x, y, d = d, zd = zd, probd = probd)
       The result should be the two-element vector:
         [0.835967, 4.42899e-06]
       The keyword parameters should be returned as:
         d = 218.000, zd = -3.64390, probd = 0.000268542

       Compute Kendalls's (tau) rank correlation of x and y.
         result = r_correlate(x, y, /kendall)
       The result should be the two-element vector:
         [0.624347  0.000118732]

 REFERENCE:
       Numerical Recipes, The Art of Scientific Computing (Second Edition)
       Cambridge University Press
       ISBN 0-521-43108-5

 CALLS: ***
	IBETA, IDL_CRANK
 MODIFICATION HISTORY:
       Written by:  GGS, RSI, Aug 1994
                    R_CORRELATE is based on the routines spear.c and kendl1.c
                    described in section 14.6 of Numerical Recipes, The Art
                    of Scientific Computing (Second Edition), and is used by
                    permission.
       CT, RSI, March 2000: removed redundant betacf, ibeta functions


R_TEST $RSI/r_test.pro
[Previous] [Next]
 NAME:
       R_TEST

 PURPOSE:
       This function tests the hypothesis that a binary sequence (a 
       sequence of 1s and 0s) represents a "random sampling". This
       test is based on the "theory of runs" and is often refered to
       as the Runs Test for Randomness. The result is a two-element
       vector containing the nearly-normal test statistic Z and the 
       one-tailed probability of obtaining a value of Z or greater.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = R_test(X)

 INPUTS:
       X:    An n-element vector of type integer, float or double.
             Elements not equal to 0 or 1 are removed and the length
             of X is correspondingly reduced.

 KEYWORD PARAMETERS:
       R:    Use this keyword to specify a named variable which returns
             the number of runs (clusters of 0s and 1s) in X.       

      N0:    Use this keyword to specify a named variable which returns
             the number of 0s in X.

      N1:    Use this keyword to specify a named variable which returns
             the number of 1s in X.

 CALLS: ***
	GAUSS_PDF
 EXAMPLE:
       Define a vector of 1s and 0s.
         x = [0,1,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1]

       Test the hypothesis that x represents a random sampling against the 
       hypothesis that it does not represent a random sampling at the 0.05 
       significance level.
         result = r_test(x, r = r, n0 = n0, n1 = n1)

       The result should be the 2-element vector:
         [2.26487, 0.0117604]
       The keyword parameters should be returned as:
         r = 22.0000, n0 = 16.0000, n1 = 14.0000 

       The computed probability (0.0117604) is less than the 0.05
       significance level and therefore we reject the hypothesis that x
       represents a random sampling. The results show that there are too 
       many runs, indicating a non-random cyclical pattern.

 PROCEDURE:
       R_TEST computes the nonparametric Runs Test for Randomness. A 
       "run" is a cluster of identical symbols within a sequence of two
       distinct symbols. The binary sequence (x) defined in EXAMPLE has 
       22 runs (or clusters). The first run contains one 0, the second 
       run contains two 1s, the third run contains one 0, and so on.
       In general, the randomness hypothesis will be rejected if there
       are lengthy runs of 0s or 1s or if there are alternating patters
       of many short runs.

 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


RANKS $RSI/ranks.pro
[Previous] [Next]
 NAME:
       RANKS

 PURPOSE:
       This function computes the magnitude-based ranks of a sample 
       population X. Elements of identical magnitude "ties" are ranked 
       according to the mean of the ranks that would otherwise be assigned.
       The result is a vector of ranks equal in length to X.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = Ranks(X)

 INPUTS:
       X:    An n-element vector of type integer, float or double.
             The elements of this vector must be in ascending order
             based on their magnitude.

 EXAMPLE:
       Define an n-element sample population.
         x = [-0.8, 0.1, -2.3, -0.6, 0.2, 1.1, -0.3, 0.6, -0.2, 1.1, -0.7, $
              -0.2, 0.6, 0.4, -0.1, 1.1, -0.3, 0.3, -1.3, 1.1]

       Allocate a two-column, n-row array to store the results.
         array = fltarr(2, n_elements(x))

       Sort the sample population and store in the 0th column of ARRAY.
         array[0, *] = x[sort(x)]

       Compute the ranks of the sorted sample population and store in the 
       1st column of ARRAY.
         array[1, *] = ranks[x[sort(x)]]

       Display the sorted sample population and corresponding ranks with a 
       two-decimal format.
         print, array, format = '(2(5x, f5.2))'
       
       The result should be:
         -2.30      1.00
         -1.30      2.00
         -0.80      3.00
         -0.70      4.00
         -0.60      5.00
         -0.30      6.50
         -0.30      6.50
         -0.20      8.50
         -0.20      8.50
         -0.10     10.00
          0.10     11.00
          0.20     12.00
          0.30     13.00
          0.40     14.00
          0.60     15.50
          0.60     15.50
          1.10     18.50
          1.10     18.50
          1.10     18.50
          1.10     18.50

 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, November 1994


RDPIX $RSI/rdpix.pro
[Previous] [Next]
 NAME:
	RDPIX

 PURPOSE:
	Interactively display the X position, Y position, and pixel value
	of the cursor.

 CATEGORY:
	Image display.

 CALLING SEQUENCE:
	RDPIX, Image [, X0, Y0]

 INPUTS:
	Image:	The array that represents the image being displayed.  This
		array may be of any type.  Rather reading pixel values from
		the display, they are taken from this parameter, avoiding
		scaling difficulties.

 OPTIONAL INPUT PARAMETERS:
	X0, Y0:	The location of the lower-left corner of the image area on
		screen.  If these parameters are not supplied, they are
		assumed to be zero.

 OUTPUTS:
	None.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	The X, Y, and value of the pixel under the cursor are continuously
	displayed.

 RESTRICTIONS:
	None.

 PROCEDURE:
	Instructions are printed and the pixel values are printed as the
	cursor is moved over the image.

	Press the left or center mouse button to create a new line of output,
	saving the previous line.

	Press the right mouse button to exit the procedure.

 MODIFICATION HISTORY:
	DMS, Dec, 1987.
	Rob Montgomery (rob@hao.ucar.edu), 9/21/92;
		Correct indices for case of !order = 1


READ_ASCII $RSI/read_ascii.pro
[Previous] [Next]
 NAME:
   READ_ASCII

 PURPOSE:
   Read data from an ASCII file into IDL.

 CATEGORY:
   Input/Output.

 CALLING SEQUENCE:
   data = READ_ASCII(file)

 INPUTS:
   file          - Name of file to read.

 INPUT KEYWORD PARAMETERS:
   record_start      - 1st sequential "record" (see DESCRIPTION) to read.
               Default = 0 (the first record of the file).
   num_records   - Number of records to read.
               Default = 0 = Read up to and including the last record.

   template      - ASCII file template (e.g., generated by function
               ASCII_TEMPLATE) describing attributes of the file
               to read.  Specific attributes contained in the
               template may be overridden by keywords below.
               Default = (see the keywords below).

   data_start    - Number of lines of header to skip.
               Default (if no template) = 0L.
   delimiter     - Character that delimits fields.
               Default (if no template) = '' = use fields(*).loc.
   missing_value     - Value to replace any missing/invalid data.
               Default (if no template) = !VALUES.F_NAN.
   comment_symbol    - String identifying comments
               (from comment_symbol to the next end-of-line).
               Default (if no template) = '' = no comments.

    [Note:  The 'fields' keyword has not been implemented yet.]
   fields        - Descriptions of the data fields, formatted as
                           an array of structures containing the tags:
                              name  = name of the field (string)
                              type  = type of field as returned by SIZE (long)
                              loc   = offset from the beginning of line to
                                      the start of the field (long)
                              group = sequential group the field is in (int)
               Default (if no template) =
                              {name:'field', type:4L, loc:0L, group:0}.

   verbose       - If set, print runtime messages.
               Default = Do not print them.

 OUTPUT KEYWORD PARAMETERS:
   header        - The header read (string array of length
               data_start).  If no header, empty string returned.

   count         - The number of records read.

 OUTPUTS:
   The function returns an anonymous structure, where each field in
   the structure is a "field" of the data read (see DESCRIPTION).
   If no records are read, 0 is returned.

 CALLS: ***
	QUERY_ASCII, RA_CHECK_FILE, RA_GET_NEXT_RECORD, RA_GUESS_COLUMNS
	RA_PARSE_COLUMN_VALUES, RA_PARSE_DELIM_VALUES, RA_READ_FROM_TEMPL, RA_STRINGIT
	RA_VALID_TEMPLATE, READ_ASCII_CREATE_STRUCT, UNIQ
 CALLED BY:
	IMPORT_ASCII
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   See DESCRIPTION.

 DESCRIPTION:
   ASCII files handled by this routine consist of an optional header
   of a fixed number of lines, followed by columnar data.  Files may
   also contain comments, which exist between a user-specified comment
   string and the corresponding end-of-line.

   One or more rows of data constitute a "record."  Each data element
   within a record is considered to be in a different column, or "field."
   Adjacent fields may be "grouped" into multi-column fields.
   The data in one field must be of, or promotable to, a single
   type (e.g., FLOAT).

 EXAMPLES:
   ; Using default file attributes.
   data = READ_ASCII(file)

   ; Setting specific file attributes.
   data = READ_ASCII(file, DATA_START=10)

   ; Using a template to define file attributes.
   data = READ_ASCII(file, TEMPLATE=template)

   ; Using a template to define file attributes,
   ; and overriding some of those attributes.
   data = READ_ASCII(file, TEMPLATE=template, DATA_START=10)

   ; Using the ASCII_TEMPLATE GUI to generate a template in place.
   data = READ_ASCII(file, TEMPLATE=ASCII_TEMPLATE(file))

    [Note:  The 'fields' keyword has not been implemented yet.]
   ; An example defining fields by hand.
   fields = REPLICATE({name:'', type:0L, loc:0L, group:0}, 2, 3)
   num = N_ELEMENTS(fields)
   fields(*).name  = 'field' + STRTRIM(STRING(INDGEN(num) + 1), 2)
   fields(*).type  = REPLICATE(4L, num)
   fields(*).loc   = [0L,10L, 0L,15L, 0L,12L]
   fields(*).group = INDGEN(num)
   data = READ_ASCII(file, FIELDS=fields)

    [Note:  The 'fields' keyword has not been implemented yet.]
   ; Another example defining fields by hand.
   void = {sMyStructName, name:'', type:0L, loc:0L, group:0}
   fields = [ [ {sMyStructName, 'frog', (SIZE(''))(1),  0L, 0},   $
                {sMyStructName, 'bird', (SIZE(0 ))(1), 15L, 1} ], $
              [ {sMyStructName, 'fish', (SIZE(0.))(1),  0L, 2},   $
                {sMyStructName, 'bear', (SIZE(0D))(1), 15L, 3} ], $
              [ {sMyStructName, 'boar', (SIZE(0B))(1),  0L, 4},   $
                {sMyStructName, 'nerd', (SIZE(OL))(1), 15L, 5} ]  ]
   data = READ_ASCII(file, FIELDS=fields)

 DEVELOPMENT NOTES:

   - See ???,xxx in the code.

   - Error check input 'delimiter' to be a string (not a byte).

   - Implement the 'fields' keyword.

 MODIFICATION HISTORY:
   AL & RPM, 8/96 - Written.
   PCS, 3/99 - Deploy STRTOK and other new commands.  Gain some speed.
   CT, Aug 2003: Free up temp pointers if an error occurs.


READ_BINARY $RSI/read_binary.pro
[Previous] [Next]
 NAME:
       READ_BINARY

 PURPOSE:
       Load contents of a binary file into IDL.

 CATEGORY:
       Input/Output.

 CALLING SEQUENCE:
       result = READ_BINARY([file])

 INPUTS:
       FILE: The filename or logical unit number of a file to be read.
           If a logical unit number is supplied, it must be open
           on a file for reading. If no FILE argument is supplied,
           READ_BINARY will call DIALOG_PICKFILE to prompt the user to
           select a file for reading.

 INPUT KEYWORD PARAMETERS:
       TEMPLATE: A template structure describing the file to be read.
           A template can be created using BINARY_TEMPLATE.

           Keyword TEMPLATE cannot be used simultaneously with keywords
           DATA_START, HEADER, DATA_TYPE, DATA_DIMS or ENDIAN.

       DATA_START: Where to begin reading in a file.  This value is
           as an offset, in bytes, that will be applied to the
           initial position in the file.  Default is 0.

       DATA_TYPE: IDL typecode of the data to be read.  See
           documentation for the IDL SIZE command for a listing
           of typecodes.  Default is 1 (IDL's BYTE typecode).

       DATA_DIMS: A scalar, or array of up to eight elements specifying
           the size of the data to be read and returned.  For example,
           DATA_DIMS=[512,512] specifies that a 2D, 512 by 512 array be
           read and returned.  DATA_DIMS=0 specifies that a single,
           scalar value be read and returned.  Default is -1, which,
           if a TEMPLATE is not supplied that specifies otherwise,
           indicates that READ_BINARY will read to end-of-file and
           store the result in a 1D array.

       ENDIAN: 'big', 'little' or 'native'.  Specifies the byte ordering
           of the file to be read.  If the computer running Read_Binary
           uses byte ordering that is different than that of the file,
           Read_Binary will swap the order of bytes in multi-byte
           data types read from the file.  Default: 'native' == perform
           no byte swapping.

 OUTPUTS:
       Function Read_Binary returns data read from the specified file.
       If keyword TEMPLATE is used, Read_Binary returns a structure with
       fields specified by the template.

 CALLS: ***
	RB_DIM_STR, RB_EXPRESSION_IS_VALID, RB_IS_INTEGRAL, RB_ROUTINES
	RB_TEMPLATE_IS_VALID, RB_TEMPLATE_IS_VALID_INTERNAL, REVERSE
	SWAP_ENDIAN_INPLACE, UNIQ
 CALLED BY:
	IMPORT_BINARY
 SIDE EFFECTS:
       If a logical unit number is given for the file argument, the
       current position of a file opened for reading on that logical
       unit number is advanced.

 RESTRICTIONS:
       Note: variables used in this routine are prefixed with "rb_".
       This is to avoid conflicts with template-specified expressions
       or field names.  Templates having field names, offset expressions
       dimension expressions or verify value expressions containing
       the character sequence "rb_" or "bt_" are not allowed.

       READ_BINARY does not have functionality to read strings, but
       strings can be read as an arrays of bytes, and then converted
       via IDL's STRING command.

 EXAMPLES:

       To select a file and read all of it as a simple, "raw" vector
       of bytes...

           result = READ_BINARY()

       To read 149600 bytes from a file, and display as an image...

           datafile = FILEPATH('hurric.dat', SUBDIR=['examples', 'data'])
           TVSCL, READ_BINARY(datafile, DATA_DIMS=[440, 340])

       or...

           GET_LUN, lun
           OPENR, lun, FILEPATH('hurric.dat', SUBDIR=['examples', 'data'])
           TVSCL, REFORM(READ_BINARY(lun), 440, 340)
           CLOSE, lun
           FREE_LUN, lun

 MODIFICATION HISTORY
       PCS, 6/1999 - Written.


READ_BMP $RSI/read_bmp.pro
[Previous] [Next]
 NAME:
	READ_BMP

 PURPOSE:
 	This function reads a Microsoft Windows Version 3 device
	independent bitmap file (.BMP).

 CATEGORY:
   	Input/Output

 CALLING SEQUENCE:
   	Result = READ_BMP(File [, R, G, B [, IHDR]])

 INPUTS:
 	File: The full path name of the bitmap file to read.

 OUTPUTS:
	This function returns a byte array containing the image
	from the bitmap file. In the case of 4-bit or 8-bit images,
	the dimensions of the resulting array are [biWidth, biHeight];
	for 16 and 24-bit decomposed color images the dimensions are
	[3, biWidth, biHeight].
	Dimensions are taken from the BITMAPINFOHEADER of the file.
	NOTE: for 24 bit images, unless the RGB keyword is supplied,
	color interleaving is blue, green, red;
	i.e. result[0,i,j] = blue, result[1,i,j] = green, etc.

 OPTIONAL OUTPUTS:
   	R, G, B:  Color tables from the file. There 16 elements each for
		  4 bit images, 256 elements each for 8 bit images. Not
		  defined or used for 16 and 24 bit images.
  	Ihdr:	  A structure containing BITMAPINFOHEADER from file.
		  Tag names are as defined in the MS Windows Programmer's
		  Reference Manual, Chapter 7.

 KEYWORDDS:
	RGB:	If this keyword is supplied, and a 16 or 24-bit image is read,
		color interleaving of the result is R, G, B, rather than BGR.
		Result[0,i,j] = red, Result[1,i,j] = green, and
		Result[2,i,j] = blue.
 CALLS: ***
	SWAP_ENDIAN
 CALLED BY:
	CW_TREESTRUCTURE, READ_IMAGE, idlitmanipvisrangepan__define
	idlitmanipvisrangezoom__define
 SIDE EFFECTS:
   	IO is performed.

 RESTRICTIONS:
   	DOES NOT HANDLE: 1 bit deep images, or compressed images.
   	Is not fast for 4 bit images. Works best on images where the
   	number of bytes in each scan-line is evenly divisible by 4.

 PROCEDURE:
   	Straightforward. Will work on both big endian and little endian
	machines.

 EXAMPLE:
   	TV, READ_BMP('c:\windows\party.bmp', r, g, b) 	;Read & display image
   	TVLCT, r, g, b              			;Load it's colors

 MODIFICATION HISTORY:
   DMS, RSI.   March 1993.   	Original version.
   DMS, RSI.   May, 1993.	Now works on all machines...
   DMS, RSI.   Nov, 1996	Added support for 16-bit RGB and RGB keyword.
   CT, RSI, Aug 2003: Fix bug in error code if unable to open file.


READ_DICOM $RSI/read_dicom.pro
[Previous] [Next]
 NAME:
	READ_DICOM

 PURPOSE:
 	This function reads an image from a DICOM format file using
	the IDLffDICOM object interface.

 CATEGORY:
   	Input/Output

 CALLING SEQUENCE:
   	Result = READ_DICOM(File)

 INPUTS:
 	File: The full path name of the file to read.
       [Red, Green, Blue] = Vectors which return the color palette
                            (if any)

 OPTIONAL KEYWORDS:
       IMAGE_INDEX - Set this keyword to the index of the image to
                     read from the file.

       DICOMEX - Set this keyword to zero to force the use of the
                 IDLffDicom object regardless of the availability of
                 IDLffDicomEX.

 OUTPUTS:
	This function returns a 2D array containing the image data
	from the file.

 KEYWORDS:
	None

 CALLS: ***
	READDICOMGETFIRSTBEFORE
 CALLED BY:
	READ_IMAGE
 SIDE EFFECTS:
   	IO is performed.

 RESTRICTIONS:
       Only uncompressed data format is supported (as per current DICOM obj).

 EXAMPLE:

 MODIFICATION HISTORY:
   RJF, RSI.   Sep, 1998. Original version.
   RJF, RSI.   Jan, 1999. Filter searches by sequence value.
   AGEH, RSI, February, 2005: Use IDLffDicomEx object if licensed.


READ_GIF $RSI/read_gif.pro
[Previous] [Next]
 NAME:
       READ_GIF

 PURPOSE:
       Read the contents of a GIF format image file and return the image
       and color table vectors (if present) in the form of IDL variables.

 CATEGORY:
       Input/Output.

 CALLING SEQUENCE:
       READ_GIF, File, Image [, R, G, B]

 INPUTS:
       File:   Scalar string giving the name of the rasterfile to read

 Keyword Inputs:
       CLOSE = if set, closes any open file and returns if the MULTIPLE images
               per file mode was used.  This keyword is used
               without additional parameters.

       MULTIPLE = if set, read files containing multiple images per
               file.  Each call to READ_GIF returns the next image,
               with the file remaining open between calls.  The File
               parameter is ignored after the first call.  Reading
               past the last image returns a scalar value of -1 in IMAGE, and
               closes the file.  When reading the 2nd and subsequent
               images, R, G, and B are not returned.

 OUTPUTS:
       Image:  The 2D byte array to contain the image.


 OPTIONAL OUTPUT PARAMETERS:
     R, G, B:  The variables to contain the Red, Green, and Blue color vectors
               if the rasterfile containes colormaps.

 CALLED BY:
	READ_IMAGE
 SIDE EFFECTS:
       None.

 CALLS: ***
	GIFREADBYTE
 COMMON BLOCKS:
       READ_GIF_COMMON.
 RESTRICTIONS:
       This routine only reads in the first image in a file (the format
       allows many). Local colormaps are not supported.
       Only 8 bit images are supported.

       The Graphics Interchange Format(c) is the Copyright property
       of CompuServ Incorporated.  GIF(sm) is a Service Mark property of
       CompuServ Incorporated.

 EXAMPLE:
       To open and read the GIF image file named "foo.gif" in the current
       directory, store the image in the variable IMAGE1, and store the color
       vectors in the variables R, G, and B, enter:

               READ_GIF, "foo.gif", IMAGE1, R, G, B

       To load the new color table and display the image, enter:

               TVLCT, R, G, B
               TV, IMAGE1

 MODIFICATION HISTORY:
       Written June 1992, JWG
       Added GIF89a and interlaced format, Jan, 1995, DMS.
       Added MULTIPLE and CLOSE, Aug, 1996.
 	August, 2000  KDB
	 - Fixed issues with multiple image files that contain
	   images of differing sizes. 
	 - Cleaned up the formatting and added comments.
	 - Removed junk reads used to skip data and made
	   use of point_lun (save some memory cycles).


READ_IMAGE $RSI/read_image.pro
[Previous] [Next]
 NAME:
	READ_IMAGE

 PURPOSE:
       The READ_IMAGE function reads the image contents of a file and
       returns the image in an IDL variable. If the image contains a
       palette it can be returned as well in three IDL variables.
       READ_IMAGE returns the image in the form of a 2D array (for
       grayscale images) or a (3, n, m) array (for true-color images.
       READ_IMAGE can read most types of image files supported by IDL.
       See QUERY_IMAGE for a list of supported formats.

 CATEGORY:
       Input/Output

 CALLING SEQUENCE:
       Result = READ_IMAGE(Filename [, Red, Green, Blue])

 INPUTS:
	Filename: A scalar string containing the name of the file to read.

 OUTPUTS;
       Red: A named variable to receive the red channel of the color
            table if a colortable exists.

       Green: A named variable to receive the green channel of the color
            table if a colortable exists.

       Blue: A named variable to receive the blue channel of the color
            table if a colortable exists.

 OPTIONAL KEYWORDS:

       IMAGE_INDEX - Set this keyword to the index of the image to read
                     from the file.  The default is 0, the first image.

 OUTPUTS:
	This function returns the selected image array. The default
       is 0, the first image.

 CALLS: ***
	QUERY_IMAGE, READ_BMP, READ_DICOM, READ_GIF, READ_JPEG2000, READ_PPM, READ_SRF
 CALLED BY:
	DIALOG_READ_IMAGE
 EXAMPLE:
       myImage = READ_IMAGE()

 MODIFICATION HISTORY:
 	Written by:	Scott Lasica, July, 1998
   CT, RSI, April 2004: Added JPEG2000 support.


READ_INTERFILE $RSI/read_interfile.pro
[Previous] [Next]
 NAME:
   READ_INTERFILE

 PURPOSE:
   Simplistic Interfile (v3.3) reader. Can only read a series
   of images containing byte,int,long,float or double data where
   all images have the same height and with.  Result is returned
   in a 3-D array.

 CATEGORY:
   Input/Output.

 CALLING SEQUENCE:
   READ_INTERFILE, File, Data

 INPUTS:
   File: Scalar string containing the name of the Interfile
     to read.  Note: if the Interfile has a header file and
     a data file, this should be the name of the header
     file (also called the administrative file).

 OUTPUTS:
   Data: A 3-D array of data as read from the file.  Assumed to be
   a series of 2-D images.

 CALLS: ***
	GETIFSYM, GETPATH, INTER_FIXED, INTER_INT, INTER_MAKEINFO, INTER_READDATA
	INTER_READHDR, INTER_STR
 RESTRICTIONS:
   This is a simplistic reader.  It does not get additional
   keyword information above and beyond what is needed to read
   in the image data.  If any problems occur reading the file,
   READ_INTERFILE prints a message and stops.

   If the data is stored in on a bigendian machine and read on
   a littleendian machine (or vice versa) the order of bytes in
   each pixel element may be reversed, requiring a call to
   BYTEORDER

 PROCEDURE:
   Generates keyword table and initializes it on the fly.
   Read in administrative data.
   Read in binary data.
   Clean up keyword processing information.

 EXAMPLE:
   READ_INTERFILE, '0_11.hdr', X

 MODIFICATION HISTORY:
   Written by:  J. Goldstein, Oct 1993

   12/22/93 JWG,TH     Bug fixes. Added byte swapping for short data
       10/29/97 RJF       Patched to handle the case of image data in
          the header file itself.
   1/7/04 SBS       Modify to avoid use of EXECUTE function for IDL VM


READ_JPEG2000 $RSI/read_jpeg2000.pro
[Previous] [Next]
 NAME:
   READ_JPEG2000

 PURPOSE:
   This function reads a JPEG2000 image.

 CATEGORY:
   Input/Output

 CALLING SEQUENCE:
   Result = READ_JPEG2000(File)

 INPUTS:
   File: The full path name of the file to read.

 OUTPUTS:
   This function returns an n x w x h array containing the image
   data where n is 1 for grayscale or 3 for RGB images, w is the
   width and h is the height.

   Red, Green, Blue
       Named variables that will contain the Red, Green, and Blue
       color vectors if a color palette exists.

 KEYWORDS:
   DISCARD_LEVELS: Set this keyword to indicate the number of highest
       resolution levels which will not appear in the image.
       Image dimensions are divided by 2 to the power of this number.

   MAX_LAYERS: Set this keyword to the maximum number of quality
       layers which will appear to be present. The default is zero,
       which implies that all layers should be retained.

   ORDER: Set this keyword to a nonzero value to store images in
       the Result from top to bottom. By default, images are stored
       in the Result from bottom to top.

   REGION: Set this keyword to a four-element vector containing the
       rectangular region of the image to read, in the coordinate
       system of the original image. The region is specified as
       [StartX, StartY, Width, Height].

 EXAMPLE
    ; Read in a 24-bit JPEG image.
    input = FILEPATH('marsglobe.jpg', SUBDIR=['examples','data'])
    READ_JPEG, input, image

    ; Create a JPEG2000 with 6 quality layers.
    WRITE_JPEG2000, 'marsglobe.jp2', image, N_LAYERS=6

    ; Verify the file information.
    success = QUERY_JPEG2000('marsglobe.jp2', info)
    help, info, /STRUCT

    WINDOW, 0, XSIZE=2*info.dimensions[0], YSIZE=info.dimensions[1]

    ; Use the DISCARD_LEVELS keyword.
    for discard=0,5 do TV, /TRUE, $
        READ_JPEG2000('marsglobe.jp2', DISCARD_LEVELS=discard)

    ; Extract a region.
    image = READ_JPEG2000('marsglobe.jp2', $
        REGION=[0,0,200,100])
    TV, REBIN(image, 3, 400, 200), 400, 0, /TRUE

    ; Use the MAX_LAYERS keyword.
    image = READ_JPEG2000('marsglobe.jp2', MAX_LAYERS=1, $
        REGION=[0,0,200,100])
    TV, REBIN(image, 3, 400, 200), 400, 200, /TRUE

 CALLED BY:
	READ_IMAGE
 MODIFICATION HISTORY:
   Written: CT, RSI, March 2004.


READ_PICT $RSI/read_pict.pro
[Previous] [Next]
 NAME:		READ_PICT
 PURPOSE: 	Reads limited types of image files written in the PICT
		Version 2 Format.  This format is used by the Apple 
		Macintosh Computers.
 CATEGORY:	
 CALLING SEQUENCE:
	READ_PICT, FILE, IMAGE		;Reads PICT file into IMAGE
	READ_PICT, FILE, IMAGE, R, G, B	;Reads Image and loads color vectors
 INPUTS:
       FILE = Scalar string giving the name of the PICT file to read.
       IMAGE = 2D matrix to be input.  
 OPTIONAL INPUT PARAMETERS:
       R, G, B = The Red, Green, and Blue color vectors to be read
               with IMAGE.  If not specified, the color table associated
		with the picture is ignored.
 OUTPUTS:
	IMAGE - the image that is read in from the file.
	R, G, B - the color vectors from the PICT file.
 CALLS: ***
	READ_PICT_ITEM, READ_PICT_UNPACKDATA
 SIDE EFFECTS:
	A file is opened, read_pict_UnPackData is called, I/O is performed
 RESTRICTIONS:
	Only creates Version 2 PICT files.  Not intended to read all PICT
	files.  Known to work with IDL PICT files written with write_pict
	routine in IDL.
 PROCEDURE:
	Read in the header, size, and the following quickdraw opcodes.

 MODIFICATION HISTORY:
	Written 19 November 1990, Steve Richards.
		19 November 1992, Steve Richards, Fixed a problem where
			the color vectors returned were integer and not
			bytes.
		Jul 1994,  DMS, RSI.  Added code for both big and little
			endian byte ordering.  Previous version would not
			work on little endian machines.


READ_PPM $RSI/read_ppm.pro
[Previous] [Next]
 NAME:
	READ_PPM

 PURPOSE:
	Read the contents of a PGM (gray scale) or PPM (portable pixmap
	for color) format image file and return the image in the form
	of an IDL variable.
	PPM/PGM format is supported by the PMBPLUS and Netpbm packages.

	PBMPLUS is a toolkit for converting various image formats to and from
	portable formats, and therefore to and from each other.

 CATEGORY:
	Input/Output.

 CALLING SEQUENCE:
	READ_PPM, File, Image

 INPUTS:
	File:	Scalar string giving the name of the PGM or PPM file.

 OUTPUTS:
	Image:	The 2D byte array to contain the image.  In the case
		of a PPM file, a [3, n, m] array is returned.

 KEYWORD Parameters:
	MAXVAL = returned maximum pixel value.
 CALLS: ***
	READ_PPM_NEXT_TOKEN
 CALLED BY:
	READ_IMAGE
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	Should adhere to the PGM/PPM "standard".
	Accepts: P2 = graymap ASCII, P5 graymap RAWBITS, P3 true-color
	ASCII pixmaps, and P6 true-color RAWBITS pixmaps.
	Maximum pixel values are limited to 255.
	Images are always stored with the top row first. (ORDER=1)

 EXAMPLE:
	To open and read the PGM image file named "foo.pgm" in the current
	directory, store the image in the variable IMAGE1 enter:

		READ_PPM, "foo.pgm", IMAGE1

 MODIFICATION HISTORY:
	Written Nov, 1994, DMS.


READ_SPR $RSI/read_spr.pro
[Previous] [Next]
 NAME:
       READ_SPR

 PURPOSE:
       This function reads a row-indexed sparse matrix from a specified
	file and returns it as the result.    Row-indexed sparse matrices
	are created by using the Numerical Recipes routine SPRSIN.

 CATEGORY:
      	Sparse Matrix File I/O

 CALLING SEQUENCE:
       result = READ_SPR('Filename')

 INPUTS:
	Filename:  Name of file containing a row-indexed sparse matrix

 KEYWORD PARAMETERS;
	NONE

 OUTPUTS:
	result:  Row-indexed sparse matrix


 MODIFICATION HISTORY:
       Written by:     BMH, 1/94.


READ_SRF $RSI/read_srf.pro
[Previous] [Next]
 NAME:
	READ_SRF

 PURPOSE:
	Read the contents of a Sun rasterfile and return the image and
	color table vectors (if present) in the form of IDL variables.

 CATEGORY:
	Input/Output.

 CALLING SEQUENCE:
	READ_SRF, File, Image [, R, G, B]

 INPUTS:
	File:	Scalar string giving the name of the rasterfile to read

 OUTPUTS:
	Image:	The 2D byte array to contain the image.


 OPTIONAL OUTPUT PARAMETERS:
     R, G, B:	The variables to contain the Red, Green, and Blue color vectors
		if the rasterfile containes colormaps.

 CALLED BY:
	READ_IMAGE
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	This routine only handles 1, 8, 24, and 32-bit rasterfiles of type
	RT_OLD and RT_STANDARD.  See the file /usr/include/rasterfile.h
	for the structure of Sun rasterfiles.

 EXAMPLE:
	To open and read the Sun rasterfile named "sun.srf" in the current
	directory, store the image in the variable IMAGE1, and store the color
	vectors in the variables R, G, and B, enter:

		READ_SRF, "sun.srf", IMAGE1, R, G, B

	To load the new color table and display the image, enter:

		TVLCT, R, G, B
		TV, IMAGE1
 
 MODIFICATION HISTORY:
	Written fall 1987, AB
	3/1/90, Added 24 bit images, DMS.
	7/8/90, Added 32 bit images, DMS.
	1/22/92, the colors within 24 bit images were not ordered
		correctly, DMS.
	5/7/96, Corrected bug in the color vector order for 24 bit
		images. As per the "Encyclopedia of Graphics File
		formats", O'Rielly & Ass., 24 bit pixel data is in
		BGR format rather that RGB. This was verified thru
		the use of XV. Also the 32 big reading section did
		perform the color correction correctly. kdb.


READ_SYLK $RSI/read_sylk.pro
[Previous] [Next]
 NAME:
   READ_SYLK

 PURPOSE:
   Reads the contents of a sylk (Symbolic Link) format spreadsheet data file 
   and returns a cell data range (if present) in the form of an IDL variable.

 CATEGORY:
   Input/Output.

 CALLING SEQUENCE:
   ReturnData = READ_SYLK(InFile [, STARTROW, STARTCOL, NROWS, NCOLS, ARRAY, 
       COLMAJOR, USEDOUBLES, USELONGS])

 INPUT:
   InFile: Scalar string with the name of the sylk file to read.

 OUTPUT:
   ReturnData: The table (vector of structs) or matrix (2D array) that will
       contain the spreadsheet cell data.  The size and type of this return
       variable is set using the optional input parameters (keywords) below.

 OPTIONAL INPUT PARAMETERS:
   STARTROW: The starting (0-based) row of spreadsheet cells to read.  If not
       specified, this value defaults to the first row of cells found in the 
       file.
   STARTCOL: The starting (0-based) column of spreadsheet cells to read.  If 
       not specified, this value defaults to the first column of cells found 
       in the file.
   NROWS: The number of spreadsheet rows to read in.  If not specified, this
       defaults to all of the cell rows found in the file.
   NCOLS: The number of spreadsheet columns to read in.  If not specified,
       this value defaults to all of the cell columns found in the file.
   ARRAY: Boolean flag.  If TRUE, the data type returned will be an IDL array.
       Note that the data in the cell range must be of the same type to 
       successfully return an array.  If this flag is not set, the routine
       will return a table (vector of structs) instead.  The tags of this
       struct will be labelled "Col0", "Col1", ..., "ColN" for a row major
       table and "Row0", "Row1", ..., "RowN" for a column major table.
   COLMAJOR: Boolean flag.  If TRUE, the range of spreadsheet cell data is
       transposed and then read into an IDL variable.  This flag should be set 
       when importing spreadsheet data which has column major organization 
       (ie., listings by column rather than row).  The default is row major 
       format.  
   USEDOUBLES: Boolean flag.  If TRUE, any floating point cell data will be
       read in and returned as a double precision rather than the default 
       float type.
   USELONGS: Boolean flag.  If TRUE, any integer cell data will be read in and
       returned as a long rather than the default int type.

 CALLS: ***
	CONTAINSVAL, GETSYLKCELLCOL, GETSYLKCELLCONTENTS, GETSYLKCELLRANGE
	GETSYLKCELLROW
 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   This routine *only* reads in numerical and string sylk data.  It igonores 
   all spreadsheet and cell formatting information such as cell width, text 
   justification, font type, date, time, and monetary notations, etc.  In
   addition, only attempts to read spreadsheet tables, like-typed cell rows,
   columns, or subsets thereof will succeed.


 EXAMPLES:
   Consider the following row major spreadsheet table with the upper left cell
   (value = "Index") at location [0, 0] that has been output to the sylk file
   "foo.slk":
   
   Index   Name   Gender  Platform
     1     Beth     F     Unix
     2     Kirk     M     VMS
     3     Mark     M     Windows
     4     Dave     M     Macintosh

   Note that the data format of the title row (STRING, STRING, STRING, STRING)
   is inconsistant with the following four rows (INT, STRING, STRING, STRING)
   in the table.   It is impossible to read all of the table into a single IDL
   variable, but you could make two calls to READ_SYLK to import all of the
   data:

       strTitle = READ_SYLK("foo.slk", NROWS = 1)
       arrstrTable = READ_SYLK("foo.slk", STARTROW = 1)

   The return data are as follows:

       IDL> HELP, strTitle
       STRTITLE        STRUCT    = -> <Anonymous> Array[1]

       IDL> PRINT, strTitle        
       { Index Name Gender Platform}

       IDL> HELP, arrstrTable
       ARRSTRTABLE     STRUCT    = -> <Anonymous> Array[4]

       IDL> PRINT, arrstrTable
       {       1 Beth F Unix}{       2 Kirk M VMS}{       3 Mark M 
       Windows}{       4 Dave M Macintosh}


   Further, consider the following call from the same sylk file:

       arrszNames = READ_SYLK("foo.slk", /ARRAY, STARTROW = 1, STARTCOL = 1, $
           NCOLS = 1)

   The return data is now:

       IDL> HELP, arrszNames
       ARRSZTABLE      STRING    = Array[4]

       IDL> PRINT, arrszNames
       Beth Kirk Mark Dave 


   If the COLMAJOR keyword flag is set the return value differs in type:

       arrszNames = READ_SYLK("foo.slk", /ARRAY, /COLMAJOR, STARTROW = 1, $
           STARTCOL = 1, NCOLS = 1)

   The return data is now:

       IDL> HELP, arrszNames
       ARRSZTABLE      STRING    = Array[1, 4]

       IDL> PRINT, arrszNames
       Beth 
       Kirk 
       Mark 
       Dave 


 MODIFICATION HISTORY:
   Written October 1994, AJH
   Converted from handles to pointers, 17 December 1996, AB
   Modified Feb, 1998, SVP
	Added FATAL_MESSAGE and FATAL_CleanUp to produce a catchable error.


READ_WAV $RSI/read_wav.pro
[Previous] [Next]
 NAME:
   READ_WAV

 PURPOSE:
   This function reads a Microsoft Windows .WAV (RIFF) file

 CATEGORY:
       Input/Output

 CALLING SEQUENCE:
       Result = READ_WAV(File [,Rate])

 INPUTS:
   File: The full path name of the file to read.

 OUTPUTS:
   This function returns an array containing the audio data
   from the file. The data can be 8 or 16 bit.  The leading
   dimension of the returned array is the channel selection
   (data is returned in channel interleaved format).

 OPTIONAL OUTPUTS:
   Rate : the sampling rate of the sequence in samples/second.

 KEYWORDS:
   None

 CALLS: ***
	SWAP_ENDIAN
 SIDE EFFECTS:
       IO is performed.

 RESTRICTIONS:
   Only the PCM (uncompressed) data only format is supported.

 PROCEDURE:
       Straightforward. Will work on both big endian and little endian
   machines.

 EXAMPLE:

 MODIFICATION HISTORY:
   RJF, RSI.   Sep, 1998. Original version.
   CT, RSI, Aug 2003: Fix bug in error code if unable to open file.


READ_WAVE $RSI/read_wave.pro
[Previous] [Next]
 NAME:
	READ_WAVE
 PURPOSE:
	READ a .wave or .bwave file created by the Advanced Data Visualizer
	into an series of IDL variables.
 CALLING SEQUENCE:
	READ_WAVE, FILE, VARIABLES, NAMES, DIMENSIONS
 INPUTS:
	FILE = Scalar string giving the name of the Wavefront file to write.
 KEYWORD PARAMETERS:
	MESHNAMES = The name of the mesh used in the Wavefront file
		for each variable.
 OUTPUTS:
	VARIABLES = Upon return, this variable contains a block of the 
		variables contained in the wavefront file.  Since each
		variable in a wavefront file can have more than one field
		(for instance, a vector variable has 3 fields), the fields
		of each variable make up the major index into the variable 
		block.  For instance, if a Wavefront file had one scalar 
		variable and one vector variable, the scalar would be
		extracted as follows:

			vector_scalar = variables[0,*,*,*]

		and the vector variable would be extracted as follows:

			vector_variable = variables[1:3,*,*,*]

		To find the dimensions of the returned variable, see the
		description below regarding DIMENSIONS

	NAMES = Upon return, this variable contains the string names of each
		variable contained in the file.
	DIMENSIONS = Upon return, this variable is a long array that describes
		how many fields in the large returned variable block each
		variable occupies.  In the above example of one scalar variable
		followed by a vector variable, the dimension variable would 
		be:
			DIMENSIONS = [1,3]
		So the first field of the returned variable block would be
		the scalar variable and the following 3 fields would comprise
		the vector variable.
 CALLS: ***
	GETDEF, GETNUM, GETWORD, READARRAY
 RESTRICTIONS:
	This routine only preserved the structure of the variables if they
	are regularly grided variables.  
 MODIFICATION HISTORY:
	Written July 16, 1991, by Steve Richards.


READ_X11_BITMAP $RSI/read_x11_bitmap.pro
[Previous] [Next]
 NAME:
	READ_X11_BITMAP

 PURPOSE:
	Read bitmaps stored in the X11 format.

	The X Windows bitmap(1) program produces a C header file
	containing the definition of a bitmap produced by that program.
	This procedure reads such a file and creates an IDL byte array
	containing the bitmap.

	This procedure is used primarily to read bitmaps to be used as
	IDL widget button labels.

 CATEGORY:
	Bitmaps, X Windows, widgets.

 CALLING SEQUENCE:
	READ_X11_BITMAP, File, Bitmap [, X, Y]

 INPUTS:
	File: The name of the file containing the bitmap.

 KEYWORD PARAMETERS:

	EXPAND_TO_BYTES: return a 2-D array which has one bit per byte
		(0 for a 0 bit), (255 for a 1 bit) instead. (See example)

 OUTPUTS:
	Bitmap: The variable in which to store the bitmap.  This variable
		is returned as a byte array.

 OPTIONAL OUTPUT PARAMETERS:
	X:	The width of the bitmap is returned in this variable.

	Y:	The height of the bitmap is returned in this variable.

 COMMON BLOCKS:
	None.

 EXAMPLE:
	To open and read the X11 bitmap file named "my.x11" in the current 
	directory, store the bitmap in the variable BITMAP1, and the width
	and height in the variables X and Y, enter:

		READ_X11_BITMAP, "my.x11", BITMAP1, X, Y

	To display the new bitmap, enter:

		READ_X11_BITMAP, "my.x11", Image, /EXPAND_TO_BYTES
		TV, Image, /ORDER

 MODIFICATION HISTORY:
	10 January 1991, AB
	1 Apr, 1992, CF fixed bug with bitmaps larger than 32k bytes.
	24 March 1993, JWG fixed EXPAND_TO_BYTES option


READ_XWD $RSI/read_xwd.pro
[Previous] [Next]
 NAME:
	READ_XWD

 PURPOSE:
	Read the contents of files created by the XWD (X Windows Dump)
	command and return the image and color table vectors in the form of
	IDL variables.

 CATEGORY:
	Input/Output.

 CALL:
	Result = READ_XWD(File_Name [, R, G, B])

 INPUTS:
   File_Name:	Scalar string giving the name of the xwd file to read

 OUTPUTS:
	READ_XWD returns a 2D byte array containing the image.  If the file
	cannot be open or read, the return value is zero.

 OPTIONAL OUTPUT PARAMETERS:
     R, G, B:	The variables to contain the Red, Green, and Blue color
		vectors if the XWD file contains color tables.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	I/O is performed.

 RESTRICTIONS:
	This function is intended to be used only on files containing
	8-bit pixmaps.  It is not intended to be used with all XWD files.
	No guarantees are made that all XWD files will work with this routine.
	This routine will not work with XWD files with version less than 6.

 PROCEDURE:
	The header is read into a structure and the bytes are reversed
	if necessary.  Then the colormap and image portions of the
	file are read into their respective variables.

 EXAMPLE:
	To open and read the X Windows Dump file named "my.xwd" in the current
	directory, store the image in the variable IMAGE1, and store the color 
	vectors in the variables, R, G, and B, enter:

		IMAGE1 = READ_XWD("my.xwd", R, G, B)

	To load the new color table and display the image, enter:

		TVLCT, R, G, B
		TV, IMAGE1


 MODIFICATION HISTORY:
	September, 1990 DMS and SMR, Research Systems, Inc.


REAL_PART $RSI/real_part.pro
[Previous] [Next]
 NAME:
   REAL_PART

 PURPOSE:
   This function returns the real part of a complex number, in the same
   precision (either single or double) as the input variable.

 CALLING SEQUENCE:
   Result = REAL_PART(Z)

 INPUTS:
   Z:  A scalar or array. Z may be of any numeric type.
       If Z is not complex then the result is simply converted to
       floating-point (single-precision for all integer types,
   double precision for type double).

 CALLED BY:
	butterworth
 MODIFICATION HISTORY:
   Written by:  CT, RSI, May 2001.


RECON3 $RSI/recon3.pro
[Previous] [Next]
 NAME:
   RECON3

 PURPOSE:
   This function can reconstruct a 3-dimensional data array from
       two or more images (or projections) of an object.   For example,
       if you placed a dark object in front of a white background and
       then photographed it three times (each time rotating the object a
       known amount) then these three images could be used with RECON3
       to approximate a 3-D volumetric representation of the object.
       RECON3 also works with translucent projections of an object.
       RECON3 returns a 3-D byte array.   RECON3 uses the back-projection
       method.   In medical imaging and other applications, a method
       known as "Filtered Backprojection" is often desired.   This may
       be accomplished here by first filtering the images as desired,
       and then using the filtered images for the reconstruction.

 CATEGORY:
   Volume Reconstruction

 CALLING SEQUENCE:
       vol = RECON3(Images, Obj_Rot, Obj_Pos, Focal, Dist, $
                    Vol_Pos, Img_Ref, Img_Mag, Vol_Size)

 INPUTS:
       Images:   The images to use to reconstruct the volume.   Execution
                 time increases linearly with more images.
                 Data Type: 8-bit (byte) array with dimensions [x, y, n]
                 where x is the horizontal image dimension, y is the vertical
                 image dimension, and n is the number of images.

       Obj_Rot:  The the amount the object is rotated to make it appear as
                 it does in each image.   The object is first rotated
                 about the X axis, then about the Y axis, and finally
                 about the Z axis (with the object's reference point at the
                 origin.
                 Data Type: [3, n] Float array where Obj_Rot[0, *] is the X
                 rotation for each image, Obj_Rot[1, *] is the Y rotation,
                 and Obj_Rot[2, *] is the Z rotation.

       Obj_Pos:  The position of the the object's reference point RELATIVE to
                 the camera lens.   The camera lens is located at the
                 coordinate origin and points in the negative Z direction
                 (the view up vector points in the positive Y direction).
                 Obj_Pos should be expressed in this coordinate system.
                 The values for Obj_Pos, Focal, Dist, and Vol_Pos should all
                 be expressed in the same units (mm, cm, m, in, ft, etc.).
                 Data Type: [3, n] Float array where Obj_Pos[0, *] is the X
                 position for each image, Obj_Pos[1, *] is the Y position,
                 and Obj_Pos[2, *] is the Z position.   All the values in
                 Obj_Pos[2, *] should be less than zero.

       Focal:    The focal length of the lens for each image.   Focal may be
                 set to zero to indicate a parallel image projection
                 (infinite focal length).
                 Data Type: Float array with n elements.

       Dist:     The distance from the camera lens to the image plane (film)
                 for each image.   Dist should be greater than Focal.
                 Data Type: Float array with n elements.

       Vol_Pos:  The two opposite corners of a cube that surrounds the object.
                 Vol_Pos should be expressed in the object's coordinate system
                 RELATIVE to the object's reference point.
                 Data Type: [3, 2] Float array where Vol_Pos[*, 0] specifies
                 one corner and Vol_Pos[*, 1] specifies the opposite corner.

       Img_Ref:  The pixel location at which the object's reference point
                 appears in each of the images.
                 Data Type: [2, n] Int or Float array where Img_Ref[0, *] is
                 the X coordinate for each image and Img_Ref[1, *] is the Y
                 coordinate.

       Img_Mag:  The magnification factor for each image.   This number is
                 actually the length (in pixels) that a test object would
                 appear in an image if it were N units long and N units
                 distant from the camera lens.
                 Data Type: [2, n] Int or float array where Img_Mag[0, *] is
                 the X dimension (in pixels) of a test object for each image,
                 and Img_Mag[1, *] is the Y dimension.   All elements in
                 Img_Mag should be greater than or equal to 1.

       Vol_Size: The size of the volume to return.   The returned volume will
                 be a 3-D byte array with dimensions equal to Vol_Size.
                 Execution time (and resolution) increases exponentially with
                 larger values for Vol_Size.
                 Data Type: Int array with 3 elements where Vol_Size[0]
                 specifies the X dimension of the volume, Vol_Size[1] specifies
                 the Y dimension, and Vol_Size[2] specifies the Z dimension.

 KEYWORD PARAMETERS:
       CUBIC:    If set, then cubic interpolation is used.   The default is
                 to use tri-linear interpolation, which is slightly faster.

       MISSING:  The value for cells in the 3-D volume that do not map to
                 any of the supplied images.   The Missing value is passed
                 to the IDL "INTERPOLATE" function.
                 Data Type: Byte.
                 Default : 0B

       MODE:     If Mode is less than zero then each cell in the 3-D volume
                 is the MINIMUM of the corresponding pixels in the images.
                 If Mode is greater than zero then each cell in the 3-D volume
                 is the MAXIMUM of the corresponding pixels in the images.
                 If Mode is equal to zero then each cell in the 3-D volume
                 is the AVERAGE of the corresponding pixels in the images.
                 Mode should usually be (-1) when the images contain a bright
                 object in front of a dark background.   Mode should usually
                 be (+1) when the images contain a dark object in front of a
                 light background.   AVERAGE mode requires more memory since
                 the volume array must temporarily be kept as an INT array
                 instead of a BYTE array.
                 Data Type: Int
                 Default : 0 (average cells)

 OUTPUTS:
   RECON3 returns a 3-D byte array containing the reconstructed object.

       If the images contain low (dark) values where the object is and high
       (bright) values where the object isn't, then Mode should be set to (+1).
       If the above is true then the returned volume will have low values
       where the object is, and high values where the object isn't.

       If the images contain high (bright) values where the object is and low
       (dark) values where the object isn't, then Mode should be set to (-1).
       If the above is true then the returned volume will have high values
       where the object is, and low values where the object isn't.

 CALLS: ***
	T3D
 RESTRICTIONS:
       In general, the object must be CONVEX for a good reconstruction to be
       possible.   Concave regions are not easily reconstructed.
       An empty coffee cup, for example, would be reconstructed as if it
       were full.

   The images should show strong light/dark contrast between the object
       and the background.

       The more images the better.   Images from many different angles will
       improve the quality of the reconstruction.   It is also important to
       supply images that are parallel and perpendicular to any axes of
       symmetry.   Using the coffee cup as an example, at least one image
       should be looking through the opening in the handle.

       Telephoto images are also better for reconstruction purposes than
       wide angle images.

 PROCEDURE:
   A 4x4 transformation matrix is created for each image based upon the
       parameters Obj_Rot, Obj_Pos, Focal, Dist, and Img_Ref.   Each cell in
       the volume is assigned a 3-D coordinate based upon the parameters
       Vol_Pos and Vol_Size.   These coordinates are multiplied by the
       transformation matricies to produce x,y image coordinates.   Each cell
       in the volume is assigned a value that is the AVERAGE, MINIMUM, or
       MAXIMUM of the image values at the x,y position (depending on Mode).

 EXAMPLE:
 ------------------------------------------------------------------------------
       ; Assumptions for this example :
       ; The object's major axis is parallel to the Z axis.
       ; The object's reference point is at its center.
       ; The camera lens is pointed directly at this reference point.
       ; The reference point is 5000 mm in front of the camera lens.
       ; The focal length of the camera lens is 200 mm.

       ; If the camera is focused on the reference point, then the
       ; distance from the lens to the camera's image plane must be
       ;    dist = (d * f) / (d - f) =
       ;    (5000 * 200) / (5000 - 200) = (1000000 / 4800) = 208.333 mm

       ; The object is roughly 600 mm wide and 600 mm high.
       ; The reference point appears in the exact center of each image.

       ;  If the object is 600 mm high and 5000 mm distant from the camera
       ;  lens, then the object image height must be
       ;     hi = (h * f) / (d - f)  =
       ;     (600 * 200) / (5000 - 200) = (120000 / 4800) = 25.0 mm
       ;  The object image appears 200 pixels high so the final magnification
       ;  factor is
       ;     img_mag = (200 / 25) = 8.0


       imgy = 256
       frames = 3

       images = Bytarr(imgx, imgy, frames, /Nozero)
       obj_rot = Fltarr(3, frames)
       obj_pos = Fltarr(3, frames)
       focal = Fltarr(frames)
       dist = Fltarr(frames)
       vol_pos = Fltarr(3, 2)
       img_ref = Fltarr(2, frames)
       img_mag = Fltarr(2, frames)

       vol_size = [40, 40, 40]

       ; The object is 5000 mm directly in front of the camera.
       obj_pos[0, *] =     0.0
       obj_pos[1, *] =     0.0
       obj_pos[2, *] = -5000.0

       ; The focal length of the lens is constant for all the images.
       focal[*] = 200.0

       ; The distance from the lens to the image plane is also constant.
       dist[*] = 208.333

       ; The cube surrounding the object is 600 mm X 600 mm.
       vol_pos[*, 0] = [-300.0, -300.0, -300.0]
       vol_pos[*, 1] = [ 300.0,  300.0,  300.0]

       ; The image reference point appears at the center of all the images.
       img_ref[0, *] = imgx / 2
       img_ref[1, *] = imgy / 2

       ; The image magnification factor is constant for all images.
       ; (The images haven't been cropped or resized).
       img_mag[*, *] = 8.0

       ; Only the object rotation changes from one image to the next.
       ; Note that the object is rotated about the X axis first, then Y,
       ; and then Z.

       ; Create some fake images for this example.
       images[30:160, 20:230, 0] = 255
       images[110:180, 160:180, 0] = 180
       obj_rot[*, 0] = [-90.0, 0.0, 0.0]

       images[70:140, 100:130, 1] = 255
       obj_rot[*, 1] = [-70.0, 75.0, 0.0]

       images[10:140, 70:170, 2] = 255
       images[80:90, 170:240, 2] = 150
       obj_rot[*, 1] = [-130.0, 215.0, 0.0]

       ; Reconstruct the volume.
       vol = RECON3(images, obj_rot, obj_pos, focal, dist, vol_pos, img_ref, $
                    img_mag, vol_size, Missing=255B, Mode=(-1))
 ------------------------------------------------------------------------------

 MODIFICATION HISTORY:
   Written by: Daniel Carr Thu Feb  4 02:54:29 MST 1993
   KDB - 23 Dec., 1993 - Variable dist had a conflict with Userlib
                 function DIST and could cause compile errors.
                 Renamed variable dist to distance.
       Modified by:    Daniel Carr     Mon Nov 21 14:21:57 MST 1994
          Improved performance and added CUBIC keyword.
       Modified by:    Daniel Carr     Tue Nov 22 12:18:15 MST 1994
          Fixed bug which affected small focal length images.
          Improved performance again.
   CT, RSI: 26 July 2001: Added /QUIET keyword.


REDUCE_COLORS $RSI/reduce_colors.pro
[Previous] [Next]
 NAME:
	REDUCE_COLORS

 PURPOSE:
	This procedure reduces the number of colors used in an image
	by eliminating pixel values without members.

 CATEGORY:
	Image display.

 CALLING SEQUENCE:
	REDUCE_COLORS, Image, Values

 INPUTS:
	Image:  The original image array. Note that the input array is
		replaced by its color-reduced equivalent.

 KEYWORD PARAMETERS:
	None.

 OUTPUTS:
	Image:  The color-reduced image array.
	Values: A vector of non-zero pixel values. If Image contains
		pixel values from 0 to M, Values will be an M+1 element
		vector containing the mapping from the old values to
		the new. Values[I] contains the new color index of old
		pixel index I.

 SIDE EFFECTS:
	Input array is overwritten.

 PROCEDURE:
	The pixel distribution histogram is obtained and the WHERE
	function is used to find bins with non-zero values. Next,
	a lookup table is made where table[old_pixel_value] contains
	new_pixel_value, and then applied to the image.

 EXAMPLE:
	To reduce the number of colors and display an image with the
	original color tables R, G, B:
	  REDUCE_COLORS, Image, V
	  TVLCT, R[V], G[V], B[V]

 MODIFICATION HISTORY:
	DMS,	RSI, Oct, 1992.


REGION_GROW $RSI/region_grow.pro
[Previous] [Next]
 NAME:
	REGION_GROW

 PURPOSE:
	This function performs region growing for a given region within
	an N-dimensional array.  REGION_GROW finds all pixels within the
	array that are connected neighbors to the region pixels and that
       fall within provided constraints.

	The constraints are specified either as a threshold range (a
       minimum and maximum pixel value) or as a multiple of the standard
       deviation of the region pixel values.

	If the threshold is used, the region is grown to include all
       connected neighboring pixels that fall within the given threshold.

	If the standard deviation multiple is used, the region is grown
	to include all connected neighboring pixels that fall within the
	range of the mean (of the region's pixel values) plus or minus the
	multiple times the standard deviation.

 CATEGORY:
	Image Processing.

 CALLING SEQUENCE:
	Result = REGION_GROW(Array, ROIPixels)

 INPUTS:
	Array:	An N-dimensional array of data values.  The region will
		be grown according to the data values within this array.

	ROIPixels:	A vector of indices into Array that represent
		the initial region that is to be grown.

 KEYWORD PARAMETERS:
	ALL_NEIGHBORS:	Set this keyword to indicate that all adjacent
		neighbors to a given pixel should be considered during
		region growing.  (This is sometimes called 8-neighbor
		searching when the array is 2-dimensional.)  The default
		is to search only the neighbors	that are exactly one unit
		in distance from the current pixel (sometimes called
		4-neighbor searching when the array is 2-dimensional).

	NAN:	Set this keyword to a non-zero value to cause the routine
		to check for occurrences of the IEEE floating-point value,
		NaN, in the input array.  Elements with the value NaN are
		treated as missing data.

	STDDEV_MULTIPLIER:	Set this keyword to a scalar value that
		serves as the multiplier of the standard deviation of the
		original region pixel values.  The pixel values of the
		grown region must fall within the range of:

			Mean +/- StdDevMultiplier*StdDev

		This keyword is mutually exclusive of THRESHOLD.

	THRESHOLD:	Set this keyword to a two-element vector, [min,max],
		of the inclusive range within which the pixel values of the
		grown region must fall.  The default is the range of pixel
		values within the initial region.  This keyword is mutually
		exclusive of STDDEV_MULTIPLIER.

 OUTPUTS:
	This function returns the vector of indices into Array that represent
	pixels within the grown region.  (Note: the grown region will not
       include pixels at the edges of the input array.)  If no pixels fall
       within the grown region, this function returns the value -1.

 CALLS: ***
	MEAN, STDDEV
 CALLED BY:
	XROI
 EXAMPLE:
	Grow a pre-defined region within an image of human red blood cells.

		; Load an image.
		fname = FILEPATH('rbcells.jpg', SUBDIR=['examples','data'])
		READ_JPEG, fname, img
		imgDims = SIZE(img, /DIMENSIONS)

		; Define original region pixels.
		x = FINDGEN(16*16) MOD 16 + 276.
		y = LINDGEN(16*16) / 16 + 254.
		roiPixels = x + y * imgDims[0]

		; Grow the region.
		newROIPixels = REGION_GROW(img, roiPixels)

		; Load a greyscale color table.
		LOADCT, 0

		; Set the topmost color table entry to red.
		topClr = !D.TABLE_SIZE-1
		TVLCT, 255, 0, 0, topClr

		; Show the results.
		tmpImg = BYTSCL(img, TOP=(topClr-1))
		tmpImg[rOIPixels] = topClr
		WINDOW, 0, XSIZE=imgDims[0], YSIZE=imgDims[1], $
                     TITLE='Original Region'
		TV, tmpImg

		tmpImg = BYTSCL(img, TOP=(topClr-1))
		tmpImg[newROIPixels] = topClr
		WINDOW, 2, XSIZE=imgDims[0], YSIZE=imgDims[1], $
                     TITLE='Grown Region'
		TV, tmpImg

 MODIFICATION HISTORY:
 	Written by:	DLD, February 2001.


REGRESS $RSI/regress.pro
[Previous] [Next]
 NAME:
	REGRESS

 PURPOSE:
	Perform a multiple linear regression fit.

	REGRESS fits the function:
		Y[i] = Const + A[0]*X[0,i] + A[1]*X[1,i] + ... +
                      A[Nterms-1]*X[Nterms-1,i]

 CATEGORY:
       G2 - Correlation and regression analysis.

 CALLING SEQUENCE:

	Result = REGRESS(X, Y)

 INPUTS:

       X:	The array of independent variable data.  X must
		be dimensioned as an array of Nterms by Npoints, where
		there are Nterms coefficients (independent variables) to be
		found and Npoints of samples.

       Y:	The vector of dependent variable points.  Y must have Npoints
		elements.

 OUTPUTS:

	REGRESS returns a column vector of coefficients that has Nterms
	elements.

 KEYWORDS:

   CHISQ:   Sum of squared errors divided by MEASURE_ERRORS if specified.

   CONST:   Constant term. (A0)

	CORRELATION: Vector of linear correlation coefficients.

   COVAR:   Covariance matrix of the coefficients.

	DOUBLE:  if set, force computations to be in double precision.

	FTEST:	The value of F for goodness-of-fit test.

	MCORRELATION:   The multiple linear correlation coefficient.

   MEASURE_ERRORS: Set this keyword to a vector containing standard
       measurement errors for each point Y[i].  This vector must be the same
       length as X and Y.

     Note - For Gaussian errors (e.g. instrumental uncertainties),
        MEASURE_ERRORS should be set to the standard
 	     deviations of each point in Y. For Poisson or statistical weighting
 	     MEASURE_ERRORS should be set to sqrt(Y).

   SIGMA:   The 1-sigma error estimates of the returned parameters.

     Note: if MEASURE_ERRORS is omitted, then you are assuming that the
           regression is the correct model. In this case,
           SIGMA is multiplied by SQRT(CHISQ/(N-M)), where N is the
           number of points in X. See section 15.2 of Numerical Recipes
           in C (Second Edition) for details.

   STATUS = Set this keyword to a named variable to receive the status
          of the operation. Possible status values are:
          0 for successful completion, 1 for a singular array (which
          indicates that the inversion is invalid), and 2 which is a
          warning that a small pivot element was used and that significant
          accuracy was probably lost.

    Note: if STATUS is not specified then any error messages will be output
          to the screen.

   YFIT:   Vector of calculated Y's.

 CALLED BY:
	P_CORRELATE
 PROCEDURE:
	Adapted from the program REGRES, Page 172,
	Bevington, Data Reduction and Error Analysis for the
	Physical Sciences, 1969.

 MODIFICATION HISTORY:
	Written, DMS, RSI, September, 1982.
	Added RELATIVE_WEIGHT keyword    W. Landsman   August 1991
       Fixed bug in invert  Bobby Candey 1991 April 22
       Added STATUS argument.  GGS, RSI, August 1996
   CT, RSI, March 2000: Fixed status flag. Cleaned up help.
   CT, RSI, July 2000: Change arguments to keywords.
         Add MEASURE_ERRORS [equivalent to 1/sqrt(Weights)],
         removes need for RELATIVE_WEIGHT.


RESOLVE_ALL $RSI/resolve_all.pro
[Previous] [Next]
 NAME:
	RESOLVE_ALL

 PURPOSE:
	Resolve (by compiling) all procedures and functions.
	This is useful when preparing .sav files containing all the IDL
	routines required for an application.
 CATEGORY:
	Programming.
 CALLING SEQUENCE:
	RESOLVE_ALL
 INPUTS:
	None.
 KEYWORD PARAMETERS:
	CLASS = if set, a list of object class names. RESOLVE_ALL's rules
	    for finding uncompiled functions and procedures are not able to
	    find object definitions or methods, because those things are not
	    known to IDL until the object classes are actually instantiated
	    and the methods called. However, if CLASS is set, RESOLVE_ALL
	    will ensure that the __DEFINE files for those classes and their
	    superclasses are compiled and execute. If then locates all methods
	    for those classes and their superclasses and makes sure they are
	    also compiled.
	CONTINUE_ON_ERROR = if set, continue when a routine fails to
	    resolve, otherwise throw an error and stop.
	QUIET = if set, produce no messages.
	RESOLVE_EITHER = A scalar or array of routine names to resolve.
	    Use this keyword instead of RESOLVE_FUNCTION or RESOLVE_PROCEDURE
	    if you do not know the type of the routine being resolved.
	    If the routines are already compiled, they are not recompiled.
	RESOLVE_FUNCTION = a scalar or array of function names to resolve.
	    If the routines are already compiled, they are not recompiled.
	RESOLVE_PROCEDURE = a scalar or array of procedure names to resolve.
	    If the routines are already compiled, they are not recompiled.
 	SKIP_ROUTINES = an optional string array containing the names
 	    of routines to NOT resolve.  This is useful when a library
 	    file containing the designated routines will be later included.
	UNRESOLVED = if CONTINUE_ON_ERROR is set, this output parameter will
	    contain the names of the unresolved procedures and functions
	    in a string array.  Routines in the SKIP_ROUTINES list are
	    also included in this result.
 OUTPUTS:
	No explicit outputs.
 CALLS: ***
	PATH_SEP, RESOLVE_ALL_BODY, RESOLVE_ALL_CLASS, UNIQ
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
 RESTRICTIONS:
	Will not resolve procedures or functions that are called via
	CALL_PROCEDURE, CALL_FUNCTION, or EXECUTE, or object methods.
	Only explicit calls are resolved.

	If an unresolved procedure or function is not in the IDL
	search path, an error occurs, and no additional routines
	are resolved unless CONTINUE_ON_ERROR is specified.

	This routine does not support the idea of a function and procedure
	both having the same name, and does not handle that case. This is
	generally not a good idea anyway, as it is confusing.

 PROCEDURE:
	This routine iteratively determines the names of unresolved calls
	to user-written or library procedures and functions, and then
	compiles them.  The process stops when there are no unresolved
	routines. If the CLASS keyword is set, this routine first ensures
	that all the class definitions are compiled (from the __define.pro)
	file, and that all methods for those classes and their superclasses
	are compiled.

 EXAMPLE:
	RESOLVE_ALL.

 MODIFICATION HISTORY:
 	Written by:
	DMS, RSI, January, 1995.
	DMS, RSI, April, 1997, Added SKIP_ROUTINES keyword.
	AB, RSI, April 1998, Added CONTINUE_ON_ERROR keyword. Reorganized
		the body of the resolving code.
	DMS, Aug, 1998.  Added UNRESOLVED keyword.
	AB, 13 January 1999, Added RESOLVE_EITHER keyword. Removed the old
		restriction that only one of the RESOLVE_ keywords are
		processed in a single call.
	AB, 6 February 2003, Added CLASS keyword.
	CT, August 2004: Fix RESOLVE_FUNCTION keyword so it works.


REVERSE $RSI/reverse.pro
[Previous] [Next]
 NAME:
   REVERSE

 PURPOSE:
   Reverse the order of rows or columns in an array or vector.

 CATEGORY:
   Array manipulation.

 CALLING SEQUENCE:
   Result = REVERSE(Array [, Subscript_Index])

 INPUTS:
   Array:    The array or vector containing the original data.

 OPTIONAL INPUT PARAMETERS:
 Subscript_Index:  If this parameter is omitted or 1, the first subscript is
     reversed (i.e., rows are reversed).  Set this parameter to
     2 to reverse columns.

 KEYWORD PARAMETERS:
   OVERWRITE = Set this keyword to do the transformation "in-place".
             The result overwrites the previous contents of the variable.

 OUTPUTS:
   REVERSE returns the input array, but reversed about
   one of its dimensions.

 CALLED BY:
	ANNOTATE, CW_DEFROI, CW_PALETTE_EDITOR, Cvttobm, DIALOG_READ_IMAGE, DIGITAL_FILTER
	EFONT, H5_BROWSER, IDLexObjview, IDLitwdConvolKernel, IR_FILTER, MAP_CONTINENTS
	MAP_GRID, MPEG_PUT, PREF_MIGRATE, READ_BINARY, SVDFIT, WIDGET_TREE_MOVE, WV_DENOISE
	WV_FN_COIFLET, WV_FN_DAUBECHIES, WV_FN_HAAR, WV_FN_SYMLET, XLOADCT, create_cursor
	idlitopstylecreate__define, idlitopvectorcontour__define
	idlitvisaxis__define [1], idlitvisaxis__define [2]
	idlitvisdataspace__define [10], idlitvisdataspace__define [11]
	idlitvisdataspace__define [12], idlitvisdataspace__define [13]
	idlitvisdataspace__define [14], idlitvisdataspace__define [15]
	idlitvisdataspace__define [16], idlitvisdataspace__define [17]
	idlitvisdataspace__define [18], idlitvisdataspace__define [19]
	idlitvisdataspace__define [1], idlitvisdataspace__define [20]
	idlitvisdataspace__define [2], idlitvisdataspace__define [3]
	idlitvisdataspace__define [4], idlitvisdataspace__define [5]
	idlitvisdataspace__define [6], idlitvisdataspace__define [7]
	idlitvisdataspace__define [8], idlitvisdataspace__define [9]
	idlitvislineprofile3d__define [1], idlitvislineprofile3d__define [2]
	idlitvisnormdataspace__define [10], idlitvisnormdataspace__define [11]
	idlitvisnormdataspace__define [12], idlitvisnormdataspace__define [13]
	idlitvisnormdataspace__define [14], idlitvisnormdataspace__define [15]
	idlitvisnormdataspace__define [16], idlitvisnormdataspace__define [1]
	idlitvisnormdataspace__define [2], idlitvisnormdataspace__define [3]
	idlitvisnormdataspace__define [4], idlitvisnormdataspace__define [5]
	idlitvisnormdataspace__define [6], idlitvisnormdataspace__define [7]
	idlitvisnormdataspace__define [8], idlitvisnormdataspace__define [9]
	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], 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]
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   None.

 PROCEDURE:
   Uses the REFORM function.

 MODIFICATION HISTORY:
   Old.
   Apr, 1991, DMS,   Added 3D reversing.
       Sept, 1992 Mark L. Rivers, added simple return for scaler argument
   Sept, 1994. Added default for 3D case.
   May 2000, CT, Rewrote to handle any dimensions, added OVERWRITE keyword.
   Nov 2004, CT: Drop trailing dimensions of length 1 for all arrays.
   June 2005, CT: Don't drop middle dimensions of length 1.


ROT $RSI/rot.pro
[Previous] [Next]
 NAME:
   ROT

 PURPOSE:
   Rotate, magnify or demagnify, and/or translate an image.

 CATEGORY:
   Z3 - Image processing, geometric transforms.

 CALLING SEQUENCE:
   Result = ROT(A, Angle, [Mag, X0, Y0], MISSING = missing,
       INTERP = Interp, CUBIC = Cubic)

 INPUTS:
   A:  The image array to be rotated.  This array may be of any type,
       but it must have two dimensions.

   ANGLE:  Angle of rotation in degrees CLOCKWISE. (Why?,
       because of an error in the old ROT.)

 OPTIONAL INPUT PARAMETERS:
   MAG:    Magnification/demagnification factor.  A value of 1.0 = no
       change, > 1 is magnification and < 1 is demagnification.

   X0: X subscript for the center of rotation.  If omitted, X0 equals
       the number of columns in the image divided by 2.

   Y0: Y subscript for the center of rotation.  If omitted, y0 equals
       the number of rows in the image divided by 2.

 KEYWORDS:
   INTERP: Set this keyword for bilinear interpolation.  If this keyword
       is set to 0 or omitted, nearest neighbor sampling is used.
       Note that setting this keyword is the same as using the
       ROT_INT User Library function.  This change (and others)
       essentially makes ROT_INT obsolete.

   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.

      MISSING: The data value to substitute for pixels in the output image
       that map outside the input image.

      PIVOT: Setting this keyword causes the image to pivot around the point
       X0, Y0, so that this point maps into the same point in the
       output image.  If this keyword is set to 0 or omitted, then the
       point X0, Y0 in the input image is mapped into the center of
       the output image.

 OUTPUTS:
   ROT returns a rotated, magnified, and translated version of the
   input image.  Note that the dimensions of the output image are
   always the same as those of the input image.

 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   None.

 RESTRICTIONS:
   None.

 PROCEDURE:
   The POLY_2D function is used to translate, scale, and
   rotate the original image.

 EXAMPLE:
   Create and display an image.  Then display a rotated and magnified
   version.  Create and display the image by entering:

       A = BYTSCL(DIST(256))
       TV, A

   Rotate the image 33 degrees and magnify it 1.5 times.  Use bilinear
   interpolation to make the image look nice.  Enter:

       B = ROT(A, 33, 1.5, /INTERP)
       TV, B

 MODIFICATION HISTORY:
   June, 1982.     Written by DMS, RSI.

   Feb, 1986.  Modified by Mike Snyder, ES&T Labs, 3M Company.
           Adjusted things so that rotation is exactly on the
           designated center.

   October, 1986.  Modified by DMS to use the POLY_2D function.

   Aug, 1988.  Added INTERP keyword.
       Dec, 1992.      Added PIVOT keyword, William Thompson, NASA/GSFC.
   Nov, 1993.  Added CUBIC keyword, DMS/RSI.
   CT, RSI, Nov 2001: Per Martin Downing's suggestion, change
       conversion of degrees-to-radians to double precision.


RS_TEST $RSI/rs_test.pro
[Previous] [Next]
 NAME:
       RS_TEST

 PURPOSE:
       This function tests the hypothesis that two sample popultions,
       {X[i], Y[i]}, have the same mean of distribution against the
       hypothesis that they differ. The result is a two-element vector
       containing the nearly-normal test statistic Z and the one-tailed
       probability of obtaining a value of Z or greater. This type of 
       test is often refered to as the Wilcoxon Rank-Sum Test or Mann-
       Whitney U-Test.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = RS_test(X, Y)

 INPUTS:
       X:    An n-element vector of type integer, float or double.

       Y:    An m-element vector of type integer, float or double.

 KEYWORD PARAMETERS:
      UX:    Use this keyword to specify a named variable which returns
             the Mann-Whitney statistic for X.

      UY:    Use this keyword to specify a named variable which returns
             the Mann-Whitney statistic for Y.

 CALLS: ***
	GAUSS_PDF, IDL_CRANK
 EXAMPLE:
       Define the vectors of sample data.
         x = [-14,   3,   1, -16, -21,   7,  -7, -13, -22, -17, -14, -8, $
                7, -18, -13,  -9, -22, -25, -24, -18, -13, -13, -18, -5]
         y = [-18, -9, -16, -14,  -3,  -9, -16, 10, -11, -3, -13, $
              -21, -2, -11, -16, -12, -13,  -6, -9,  -7, -11, -9]
       Test the hypothesis that two sample popultions, {X[i], Y[i]},
       have the same mean of distribution against the hypothesis that they
       differ at the 0.05 significance level.
         result = rs_test(x, y, ux = ux, uy = uy)
       The result should be the 2-element vector:
         [1.45134, 0.0733429]
       The keyword parameters should be returned as:
         ux = 330.000, uy = 198.000
       The computed probability (0.0733429) is greater than the 0.05
       significance level and therefore we do not reject the hypothesis
       that X and Y have the same mean of distribution. 

 PROCEDURE:
       RS_TEST computes the nonparametric Rank Sum Test for populations of
       equal or unequal size. The populations X[i] and Y[i] are combined
       and individual elements are ranked based on magnitude. Elements of
       identical magnitude are ranked using a rank equal to the mean of the
       ranks that would otherwise be assigned. The Mann-Whitney statistics
       (Ux and Uy) are computed and used to determine the nearly-normal test
       statistic (Z) and the one-tailed probability of obtaining a value of 
       Z or greater. The hypothesis that two sample populations have the same
       mean of distribution is rejected if Ux and Uy differ with statistical 
       significance. If either population contains 10 or fewer samples, the
       test statistic (Z) and the one-tailed probability of obtaining a value
       of Z or greater are returned as zero. In this case, consult published
       tables such as the ones available in the REFERENCE given below. 

 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