NPAIRS IDL Programs

Last modified: Mon Jul 2 10:38:48 CDT 2001.


List of Routines


Routine Descriptions

ADD_SLASH

[Next Routine] [List of Routines]
	NAME
		add_slash - adds '/' to a directory name

	SYNOPSIS
		dirName2 = add_slash(dirName)

	PARAMETERS
		dirName - directory name(s)

	DESCRIPTION
		Adds '/' to end of the input string if one is not there.

	HISTORY
		04/06/94 - Jon Anderson - original code

(See add_slash.pro)


ANALYSIS_DEFS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		analysis_defs - sets defaults for processing and analysis programs

	SYNOPSIS
		@analysis_defs

	PARAMETERS

	DESCRIPTION
		Sets defaults for processing and analysis programs.

	HISTORY
		03/29/96 - Jon Anderson - original code
		3/29/96 - jra - changed rootDir to /data/projects
		4/15/96 - jra - changed procDir to anaDir and projDir to prjDir
		8/12/96 - jra - incorporated analysis.defaults file
		10/16/96 - jra - recon logic, rm interXformDir; added interTrfDir, etc
		10/18/96 - jra - make anaDir scalar if it has only one element
		11/1/96 - jra - added brainstatesFname
		3/24/97 - jra - added anatDir for MRI registration
		4/15/97 - jra - added GLM directory
		3/16/98 - jra - removed intraDir, interDir, intraXformDir, inter???Dir
		10/22/99 - jra - added PDA

(See analysis_defs.pro)


ANALYSIS_RD_DEFS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		analysis_rd_defs - reads ANALYSIS defaults file

	SYNOPSIS
		@analysis_rd_defs

	PARAMETERS
		<NONE>

	DESCRIPTION
		Reads file containing the defaults for the ANALYSIS program.

	HISTORY
		08/08/96 - Jon Anderson - original code
		10/16/96 - jra - moved o15, fdg, fmri defaults to separate files
		11/1/96 - jra - added analysisStateFname
		11/21/96 - jra - added 'defaultsFile' parameter
		12/11/96 - jra - removed tteMask, tteIndivNorm, ttePairBy
		3/24/97 - jra - added analysisMriDir
		4/15/97 - jra - added GLM defaults
		3/16/98 - jra - removed intraDir,interDir,intraXformDir,interTrfDir,smoothPar
		10/22/99 - jra - added PDA

(See analysis_rd_defs.pro)


ANCOVA_FVAL

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		ancova_fval - computes F-values in an ANCOVA analysis

	SYNOPSIS
		ancova_fval, data1, data2, fval, fvalSlp, nSamp, SLOPE=slope,
			NREG=nReg, TRLOC1=trLoc1, TRLOC2=trLoc2, ERROR=error, /DEBUG

	PARAMETERS
		data1 - data from treatment 1 (fltarr(nReg,nSub1)) [INPUT]
		data2 - data from treatment 2 (fltarr(nReg,nSub2)) (if data2
			is not 2D then it is assumed that both treatments are
			contained in data1; must specify trLoc1, trLoc2 for this
			case) [INPUT]
		fval - F values for significance between treatments (nReg) [OUTPUT]
		fvalSlp - F values for slope homogeneity (nReg) [OUTPUT]
		nSamp - number of samples for each region (nReg) [OUTPUT]
		slope - common regression coefficient (nReg) [OUTPUT]
		nReg - number of regions to be analyzed, that is, only process
			data1(0:nReg-1,*) and data2(0:nReg-1,*) (default is computed
			from size of data1)
		trLoc1,trLoc2 - locations in data matrices of treatment 1 and 
			treatment subjects; this is required if data2 is not given
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes F-values in an ANCOVA analysis. F-values for the homogeneity
		of regression slopes are also computed.

	HISTORY
		02/28/94 - Jon Anderson - original code
		8/30/94 - jra - added SLOPE and ERROR
		10/27/94 - jra - reform concatenated vectors
		1/11/96 - jra - added nReg, trLoc1, trLoc2; allow data1 input only

(See ancova_fval.pro)


ANCOVA_XFORM

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		ancova_xform - ANCOVA adusts the input data array

	SYNOPSIS
		ancova_xform, data, class, xdata, THRESH=thresh, ETHRESH=ethresh,
			NBADSLP=nBadSlp, NNOEFF=nNoEff, OVERWR=overWr, NREG=nReg,
			ERROR=error, /TIME, /DEBUG

	PARAMETERS
		data - data to be transformed (fltarr(nReg,nSub)) [INPUT]
		class - class id's for each subject (nSub) [INPUT]
		xdata - ANCOVA adjusted/transformed data (fltarr(nReg,nSub)) [OUTPUT]
		thresh - confidence level in F-distribution to use in test for
			homogeneity of regression coefficients (default is .001)
		ethresh - F-value threshold to test for significant treatment
			effects (default is 0, i.e - do not test significance)
		nBadSlp - number of regions that have different regression slopes
			(see thresh)
		nNoEff - number of regions with no sigficicant (see ethresh)
			baseline/activation effect
		/OVERWR - overwrite input data matrix with adusted data (default is
			to create a new data array 'xdata')
		nReg - number of regions in input matrix to be adusted; that is, do
			the operations on data(0:nReg-1,*)
		error - error status
		/TIME - time how long it takes (default is 0)
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Transforms input data array by "ANCOVA adjusting" each region:

		1) Separate data into baseline and activation pixel values.
		2) Regress global means (x-axis) against pixel values (y-axis).
		3) Using an F-test determine if the regression coefficients (slopes)
		   differ significantly between baseline and activation. If they do
		   differ then set all elements of that region to zero.
		4) If ETHRESH is set and non-zero test the region for a significant
		   F-value for a treatment effect. If the region is not significant
		   then set it to zero.
		5) Compute a common regression coefficient between the 2 data sets.
		   Call this slope B.
		6) The adjusted pixel values for each observation/scan is defined as
		   the intersection between the vertical line going through the grand
		   mean and the line with slope B going through the original pixel value.

	HISTORY
		03/03/94 - Jon Anderson - original code
		5/5/94 - jra - had to reform y1,y2 b/4 concatenating; added TIME
		5/10/94 - jra - allow for only 1 class (skip F-test)
		8/29/94 - jra - capability to zero regions with no treatment effects
		10/5/94 - jra - allow for no slope homogeneity testing (THRESH=0)
			added nBadSlp and nNoEff
		1/11/96 - jra - added overWr, nReg; made more memory efficient

(See ancova_xform.pro)


APPLY_XFORM

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		apply_xform - apply a tranformation to coordinate

	SYNOPSIS
		apply_xform, inCoord,outCoord,xform, /VOX2TAL, /TAL2VOX, /HOMO, 
			/DEBUG

	PARAMETERS
		inCoord - input coordinate(s)
			(either [x,y,z] or [nCoord, [x,y,z]]
		outCoord - output coordinate(s)
		xform - transform to apply
		/VOX2TAL - transform from voxel coords to Talairach coords
		/TAL2VOX - transform from Talairach coords to voxel coords
		/HOMO - apply homogeneous transformation to input coordinates
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Unifies the interface to the various transformation routines.

	HISTORY
		10/5/92 - kas - original code
		2/2/94 - jra - allowed for homogeneous transformations
		2/8/94 - jra - forgot to divide through by 4th element in homo xform

(See apply_xform.pro)


ARROW_CURSOR

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		arrow_cursor - create small arrow as cursor

	SYNOPSIS
		arrow_cursor

	PARAMETERS
		<none>

	DESCRIPTION
		To set the cursor for the current window to an arrow similar
		to the one used in SunView for the current SunView window if
		running on a Sun.  If we are running on a Ultrix machine, then
		set the cursor to an arrow similar to the one used for X
		windows (i.e., the default X windows cursor).

	HISTORY
		??? - RSI - original code

(See arrow_cursor.pro)


ASSIGN_GROUPS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		assign_groups - assigns volumes to groups using information fields

	SYNOPSIS
		assign_groups, info, groupBy, group, STRGROUP=strGroup, ERROR=error, 
			/DEBUG

	PARAMETERS
		info - volume information array
		groupBy - how to build group structure:
			 0 - brain state
			 1 - patient population
			 2 - protocol
			 3 - subject id
			 4 - scan session id
			 5 - scan number (time)
			 6 - trial number
			 7 - sex
			 8 - miscellaneous
			 9 - miscellaneous 2
			10 - miscellaneous 3
			11 - volume number
		group - integer vector assigning to each volume a group number
		strGroup - string array of selected classifications
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Assigns volumes to belong to groups based on volume information
		fields. Combinations are allowed by specifying an integer vector
		for the 'groupBy' parameter (e.g - groupBy = [1,3,5]).

	HISTORY
		08/29/96 - Jon Anderson - original code
		11/7/96 - jra - added sex as a group partition
		1/21/97 - jra - added miscellaneous as a group partition
		6/9/97 - jra - check for invalid GROUPBY
		5/19/98 - jra - check for miscellaneous field being floats
		9/14/98 - jra - added misc2 and misc3 fields
		10/22/99 - jra - added volume number

(See assign_groups.pro)


ATLAS_SETUP

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		atlas_setup - initializes atlas common block

	SYNOPSIS
		atlas_setup, ERROR=error, /DEBUG

	DESCRIPTION
		Initializes the altas common block. This program must be
		called before running any programs that deal with the digitized
		Talairach atlas. The values set are:

		num_atl_imgs - # of sagittal, coronal, and axials in
			the Talairach atlas
		atl_img_nms - the names of the atlas images (e.g - a.G.0)
		atl_img_sz - sizes if digitized images in pixels
		atl_img_mm - millimetric coordinates of each image
		sag_tpts - coordinates of points in sagittal images that define
			the Talairach coordinates system
		cor_tpts - coordinates of points in coronal images that define
			the Talairach coordinates system
		axl_tpts - coordinates of points in axial images that define
			the Talairach coordinates system
		atl_abb_def - atlas abbreviations and their meanings
		img_offsets - locations in the digitized atlas file where each
			image starts
		atl_abb_locs - locations of all the abbreviations in the
			Talairach atlas (in pixel coordinates)
		fname_dig_imgs - filename of the digitized atlas file
		atl_prof_vname - name of volume holding atlas brain image
			profiles

	PARAMETERS
		error - error status
		/DEBUG - debug flag

	HISTORY
		6/4/92 - jra - original code
		8/19/92 - jra - atlas files now live in /usr/local/PET/atlas
		10/21/94 - jra - changed atlas directory to /usr/local/atlas
		10/25/94 - jra - added atl_prof_vname to common block

(See atlas_setup.pro)


ATL_IMG_OFFSETS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		atl_img_offsets - computes the image locations
			within the digitize atlas

	SYNOPSIS
		atl_img_offsets,atl_offsets,atl_img_sz,num_atl_imgs

	DESCRIPTION
		Computes the offsets into the digitized Talairach
		atlas file of each of the images in it.

	PARAMETERS
		atl_offsets - offsets of each image in the digitized
			Talairach atlas
		atl_img_sz - size of each atlas image
		num_atl_imgs - number of sagittals, coronals, and
			axials

	HISTORY
		?/?/91 - jra - original code

(See atl_img_offsets.pro)


AVG

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		avg - compute average of an array

	SYNOPSIS
		average = avg(array, dimension)

	PARAMETERS
		array - array to compute average over
		dimension - optional dimension (default is all)
		<return> - computed average (input array on error)

	DESCRIPTION
		Calculate the average value of an array, or calculate the average
		value over one dimension of an array as a function of all the other
		dimensions.

	HISTORY
		?? - RSI - original code

(See avg.pro)


BONFERRONI

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		bonferroni - computes a bonferroni threshold for the input data

	SYNOPSIS
		bonferroni, data, cutoff, THRESH=thresh, FIELD=field, DF=df,
			/APPLYTHR, THRDATA=thrData, ERROR=error, /DEBUG

	PARAMETERS
		data - data to be thresholded
		cutoff - returned cutoff value associated with specified threshold
			[RETURNED]
		thresh - p-value threshold (default is .05)
		field - field type:
			0: p values (default)
			1: Z-scores
			2: T-values
		df - degrees of freedom for T-value data
		/APPLYTHR - apply threshold to the input data (default is not)
		thrData - returned threshold data
		error - error status
		/DEBUG - perform debugging

	DESCRIPTION
		Computes the bonferroni threshold for the input data.

	HISTORY
		10/15/01 - Jon Anderson - original code

(See bonferroni.pro)


BOUNDING_CUBE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		bounding_cube - compute bounding cube of a volume

	SYNOPSIS
		bounding_cube, vol, xr,yr,zr, THRESH=thresh, /DEBUG

	PARAMETERS
		vol - input volume
		xr,yr,zr - output x,y,z ranges
		thresh - threshold to apply (default is 0)
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Compute bounding cube of points in a volume greater than a threshold.

	HISTORY
		95/04/17 - Kirt Schaper - original code

(See bounding_cube.pro)


BUILD_VAPET_PKG

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		build_vapet_pkg - builds a VAPET software package

	SYNOPSIS
		build_vapet_pkg, pkgNum, outDir, /RSI, LIBS=libs, ERROR=error, /DEBUG

	PARAMETERS
		pkgNum - ID number of package to build [REQUIRED]:
			1 - NPAIRS
		outDir - directory where IDL files are saved [REQUIRED]
		/RSI - include IDL programs written by RSI (default is not)
		libs - VAPET libraries to be searched for IDL include files
			(default is	'/usr/local/petlib','/usr/local/hbplib', and
			'/usr/local/publib'
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Builds a VAPET software package. This program finds all the IDL
		programs necessary to run a VAPET package, and saves them in the
		specified output directory.

	HISTORY
		02/9/01 - Jon Anderson - original code
		7/2/01 - jra - modified for new NPAIRS
		8/15/01 - jra - added o15_process

(See build_vapet_pkg.pro)


BUTTON

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		button - button widget for PV~WAVE

	SYNOPSIS
		bnum = button(/DEBUG)
		bnum = button(/NEW, TEXT=text, CORNER=[10,10], BSIZE=[40,20], /TOGGLE,
			ATEXT=atext, /ON, /PURGE,/MARK, WHITE=white, /DEBUG)
		button_draw, bnum, /ERASE, /DEBUG
		button_list
		button_change, bnum, TEXT=text, ATEXT=atext, ON=on, BYPASS=bypass

	DESCRIPTION
		Creates buttons on the current window, and then returns whether the
		mouse has been clicked inside a button.  The buttons may be defined
		with a text string, which is printed inside the button.

		The position and size of the button may be specified, else the
		position reverts to the position of the last button plus a default
		spacing (currently 10 pixels).

		The parameters fsize and bsize interact with each other.  If
		fsize is not specified, then it is set to be the largest font
		(up to 1.5) which will fit in the given window size

		To use routines which 'nest' buttons, specify /MARK on the definition
		of the first button.  This will limit subsequent /PURGE's to the buttons
		defined after and including the /MARK.

		Ancillary function definitions:
			button_draw - draws a specified button on the screen
			button_list - prints the current definitions of all buttons.
			button_change - changes attributes of a specified button

	PARAMETERS
		/NEW - create a new button
		text - text string to put in button (default is blank)
		corner - 2 element array with x,y location of lower left corner of button
			(default is [10,10] for first button, lower_right of last button
			 plus [10,0] for next button)
		bsize - 2 element array with x,y size of button
			(default is [40,30])
		fsize - font size to use (default is 1.0)
		/TOGGLE - new button is a toggle switch
			(default is just indicator)
		/PURGE - delete all entries in button table
		/MARK - mark start of new button series
		atext - if toggle switch, text for 'off' state
			(default is same as text)
		/ON - initial value for toggle button (default is off)
		white - value for white background of button (default is 255)
		/ERASE - specified button is to be erased
		/DEBUG - optional flag for debug output
		<return> - button number

	HISTORY
		6/17/91 - kas - original code
		6/18/91 - kas - added erase of purged buttons
		7/20/91 - kas - fixed logic on initial purge of buttons
		7/25/91 - kas - added bnum=-1 logic to button_draw
		10/16/91 - kas - added /on flag for toggle buttons
		12/12/91 - kas - added /mark for multiple buttons
		1/6/92 - kas - added button_change
		7/2/92 - kas - added /white
		7/30/92 - jra - added white to butt structure
		2/24/93 - kas - added BYPASS to button_change and allowed bnum=-1
		3/16/93 - kas - added WHITE to button_change
		3/22/94 - jra - return immediately after performing purge tasks

(See button.pro)


CEILING

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		ceiling - rounds its argument up to an interger

	SYNOPSIS
		y = ceiling(x)

	PARAMETERS
		x - scalar or array of any type
		<return> - ceiling of x of type long

	DESCRIPTION
		Returns the smallest number not less than x whose value is an
		extact mathematical integer.

	HISTORY
		?/?/91 - jra - original code
		10/26/93 - jra - works for negative numbers and arrays

(See ceiling.pro)


CHMOD

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		chmod - changes the permission mode of a file

	SYNOPSIS
		chmod, mode, filename

	PARAMETERS
		mode - the permission mode
		filename - name of file(s)

	DESCRIPTION
		Changes the permission (mode) of the specified file(s).

	HISTORY
		?/?/91 - jra - original code
		10/26/93 - jra - allow for multiple filenames
		4/10/97 - jra - removed -f option so HP doesn't barf

(See chmod.pro)


CLOSEST_ATL_ABB

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		closest_atl_abb - returns closest abbrv. in atlas image to a given point

	SYNOPSIS
		closest_atl_abb, page, xy, abb, def

	PARAMETERS
		page - page number of atlas image to be searched [REQUIRED]
		xy - point (2D pixel coordinates) in the specified atlas image/page
			whose nearest abbreviation is to be found [REQURIED]
		abb - abbreviation closest to point [RETURNED]
		def - definition of abbreviation [RETURNED]
		dist - distance in pixels from input point and nearest atlas
			abbreviation on specified page [RETURNED]

	DESCRIPTION
		Given a point in an atlas image, this procedure will locate
		the abbreviation closest to this point WITHIN THE SPECIFIED
		ATLAS PAGE. DO NOT USE THIS PROGRAM TO FIND THE NEAREST
		STRUCTURE TO A GIVE POINT.

	HISTORY
		6/19/92 - jra - original code
		7/10/92 - jra - added DIST
		8/4/99 - jra - updated the documenation

(See closest_atl_abb.pro)


CODAT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		codat - implements a collection of data analysis tools

	SYNOPSIS
		codat, id, Dir=dir, Data=data, LoadInfo=loadInfo, /ForceLoad,
			DmpOpts=dmpOpts, GlmOpts=glmOpts, PcaOpts=pcaOpts,
			CvaOpts=cvaOpts, Output=output, Xdata=xData, /Time,
			Error=error, /Debug

	PARAMETERS
		id - ID from which all output file names are created [REQUIRED]
		data - structure holding the data; see 'data_matrix.pro' for
			details; 'data' or 'loadInfo' must be specified [INPUT/OUTPUT]
		loadInfo - structure holding information on what data to load; 
			sedd 'data_matrix.pro' for details; 'data' or 'loadInfo' must
			be specfied [INPUT]
		/ForceLoad - force loading of data using 'loadInfo' even if 'data'
			was specified (default is not)
		dmpOpts - data matrix preprocessing options; this determines how
			the data matrix is processed/transformed prior to any analyses
			that are to be run; see 'codat_dmp_opts.pro' for details [INPUT]
		glmOpts - GLM options; see 'codat_glm_opts.pro' for details [INPUT]
		pcaOpts - PCA options; see 'codat_glm_opts.pro' for details [INPUT]
		cvaOpts - CVA options; see 'codat_glm_opts.pro' for details [INPUT]
		output - structure holding results for each analysis [OUTPUT]
		xData - data matrix after preprocessing and GLM adjustments [OUTPUT]
		/Time - time how long it takes to run
		error - error status; 0 good, non-zero bad [OUTPUT]
		/Debug - optional flag for debug output

	DESCRIPTION
		Implements a Collection Of Data Analysis Tools.

	HISTORY
		06/13/01 - Jon Anderson - original code
		7/2/01 - jra - logic to improve memory efficiency

(See codat.pro)


CODAT_CVA_OPTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		codat_cva_opts - creates CVA options variable for CODAT analysis

	SYNOPSIS
		opts = codat_cva_opts(/Run, /Keep, ID=id, Dir=dir, Comment=comment,
			/Time, GrpDef=grpDef, GrpLabels=grpLabels, RandLabel=randLabel,
			Enorm=eNorm, PcSet=pcSet, EigWgts=eigWgts, NeigImg=nEigImg,
			RefCva=refCva, /Debug

	PARAMETERS
		/Run - whether or not to run a PCA (default is not)
		/Keep - whether or not to keep the results from the PCA (default is 1)
		id - string used to identity the results of the PCA (default is '')
		dir - directory where to save PCA output files (default is '')
		comment - comment to include in log file (default is '')
		/Time - time how long it takes to run (default is 1)
		grpDef - specifies how the group structure is define:
			0 - brain state       1 - patient group
			2 - protocol id       3 - subject number
			4 - study/session     5 - scan number
			6 - trial number      7 - sex
			8 - miscellaneous 1   9 - miscellaneous 2
			10 - miscellaneous 3
		grpLabels - vector of integers defining the group membership for
			each volume; 'grpDef' or 'grpLabels' must be specified
		randLabel - integer vector specifying how to perform group relabeling;
			the first value is a boolean indicating whether or not to perform
			relabeling and the remain numbers (if any) define how to do the
			relabeling
		eNorm - how to normalize CVA eigenvectors
			0 - normalize by l'[W/(n-k)]l = 1, where l is an eigenvector and W
				is the within group matrix; this will cause the variance of each
				group to be 1; this is how CVA is normally done
			1 - normalize each eigenvector to have unit length (default)
		pcSet - string identify PC's to use in the CVA (e.g, PcSet='1-10,15'
			will cause the CVA program to use PC's 1,2,...,10,15)
		eigWgts - vector of floats specifying how to weight the eigenimages when
			constructing the canonical eigenimages; the PCA eigenvalues are raised
			to the power of these numbers (e.g, 0 means no weighting (saved as
			*.nwcgis), 1 means use the eigenvalues (saved as *.cgis), and .5 means
			use the square root of eigenvalues (saved as *.050cgis)) (default [0,1])
		nEigImg - number of canonical eigenimages to create
		refCva - pathname (minus suffix) of reference CVA to use to negate and permute
			the CVA dimensions (default is none)
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates CVA options variable for CODAT analysis.

	HISTORY
		06/13/01 - Jon Anderson - original code

(See codat_cva_opts.pro)


CODAT_DMP_OPTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		codat_dmp_opts - creates data matrix pre-proc options variable for CODAT

	SYNOPSIS
		opts = codat_dmp_opts(Method=method, VolAvgPar=volAvgPar, Zfill=zfill,
			/Debug)

	PARAMETERS
		method - integer vector specifying the order and type of transformations
			to perform on the data matrix:
			0 - no transformations (default)
			1 - divide by dose/weight
			2 - divide by volume mean
			3 - subtract out subject mean profiles
			4 - standard normal transformation
			5 - ANCOVA-adjust data
			6 - apply ANCOVA F-value mask to data
			7 - create mean scans across studies
			8 - read normalization factors from user specified file
			9 - GLM preprocessing
		volAvgPar - 3 element vector specifying how to compute volume averages
			that are used by the processing transformations (e.g, Method=2):
			(0:1) - 2 numbers between 0 and 1 that define a percentile range over
				which to compute the volumes means (default is 0,1)
			(2) - number specifying how much to erode the slice edges in each
				volume prior to computing the percentile volume means; this is
				used to eliminate falloff voxels on the brain edge (default is 5)
		zfill - determines how zero's are filled in
			0 - leave zero's as zero's
			1 - replace zero's by mean across voxels (volume mean)
			2 - replace zero's by mean across volumes (voxel mean)
			3 - replace zero's by linear regression of means and voxel values (default)
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates data matrix pre-processing options variable for a CODAT 
		analysis.

	HISTORY
		04/06/01 - Jon Anderson - original code

(See codat_dmp_opts.pro)


CODAT_GLM_OPTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		codat_glm_opts - creates GLM options variable for a CODAT analysis

	SYNOPSIS
		opts = codat_glm_opts(/Run, /Keep, ID=id, Dir=dir, Comment=comment,
			/Time, DmStudy=dmStudy, DmBlock=dmBlock, DmIndicator=dmIndicator,
			DmCovariate=dmCovariate, DmDegree=dmDegree, DmDetrend=dmDetrend,
			DmNCosines=dmNCosines, DmLinTime=dmLinTime, DmGlobalMeth=dmGlobalMeth,
			DmGlobalMean=dmGlobalMean, DmGlobalM0=dmGlobalM0,
			DmGlobalM1=dmGlobalM1, DmGlobalM2=dmGlobalM2, DmGlobalM3=dmGlobalM3,
			DmGlobalM4=dmGlobalM4, DmGlobalGrMean=dmGlobalGrMean,
			DmConstant=dmConstant, DmContrast=dmContrast, /DoRF, /DmRandLabel,
			/ResidPca, Save=save, /Debug

	PARAMETERS
		/Run - whether or not to run a PCA (default is not)
		/Keep - whether or not to keep the results from the PCA (default is 1)
		id - string used to identity the results of the PCA (default is '')
		dir - directory where to save PCA output files (default is '')
		comment - comment to include in log file (default is '')
		/Time - time how long it takes to run (default is 1)
		dmStudy - volume list file field to use in defining studies (SCALAR):
			-1: none (default)
			 0: protocol field
			 1: patient population field
		dmBlock - volume list file field to use in defining blocks (SCALAR):
			-1: none (default)
			 0: scanning session
			 1: scanning session and run (or trial)
		dmIndicator - volume list file field to use in defining indicators (SCALAR):
			-1: none (default)
			 0: brain state
			 1: scan number (time)
			 2: miscellaneous 1
			 3: run (or trial)
			 4: population
			 5: miscellaneous field 2
			 6: miscellaneous field 3
		dmIndicInter - 0 or 1 indicating whether the indicator is an effect of interest
			or not (default is 1)
		dmCovariate - volume list file field(s) to use in defining covariates (VECTOR):
			-1: none (default)
			 0: brain state
			 1: scan number (time)
			 2: miscellaneous 1
			 3: miscellaneous 2
			 4: miscellaneous 3
		dmDegree - the degree of the polynomial to use in each covariate (VECTOR):
		dmCovarInter - vector of 0 or 1's indicating whether the covariate(s) are effects
			of interest or not (default is 1's)
		dmDetrend - volume list file field to use in low frequency detrending (SCALAR):
			-1: none (default)
			 0: detrend each scanning session
			 1: detrend each run (trial) in each scanning session independently
			 2: detrend each miscellaneous 1
			 3: detrend each miscellaneous 2
			 4: detrend each miscellaneous 3
		dmNCosines - number of cosine basis functions to use in detrending (default is 1)
		dmLinTime - volume list file field to use in removing linear time effects (SCALAR):
			-1: none (default)
			 0: scan number for each scan session
			 1: scan number for each run (trial)
		dmGlobalMeth - specifies how to remove global effects (SCALAR):
			-1: none (default)
			 0: proportional scaling (i.e divide by global mean)
			 1: ANCOVA regression
			 2: ANCOVA regression on each scanning session
		dmGlobalMean - method to use in computing global means (SCALAR):
			 0: compute mean over all non-zero voxels (default)
			 1: compute mean over all voxels above a percentage of the full volume mean
			 2: compute mean over all voxels above a percentage of the volume maximum
			 3: compute mean over all voxels in a specified percentile range
			 4: read global means from a file
			 5: use dose/weight (defined in volume list file) as the global means 
		dmGlobalM0 - parameters for dmGlobalMean=0 (1 ELEMENT VECTOR):
			(0) - 0: compute the mean over all voxels
				- 1: compute the mean over all voxels that are to be analyzed by
					GLM (after minSamp masking, etc) (default)
		dmGlobalM1 - parameters for dmGlobalMean=1 (2 ELEMENT VECTOR):
			(0) - 0: compute the mean over all voxels
				- 1: compute the mean over all voxels that are to be analyzed by
					GLM (after minSamp masking, etc) (default)
			(1) - value between 0 and 1 specifying the %-age of full mean (default is 0)
		dmGlobalM2 - parameters for dmGlobalMean=2 (2 ELEMENT VECTOR):
			(0) - 0: compute the mean over all voxels
				- 1: compute the mean over all voxels that are to be analyzed by
					GLM (after minSamp masking, etc) (default)
			(1) - value between 0 and 1 specifying the %-age of volume maximum (default is 0)
		dmGlobalM3 - parameters for dmGlobalMean=3 (4 ELEMENT VECTOR):
			(0) - 0: compute the mean over all voxels
				- 1: compute the mean over all voxels that are to be analyzed by
					GLM (after minSamp masking, etc) (default)
			(1) - value between 0 and 1 specifying lower percentile range (default is 0)
			(2) - value between 0 and 1 specifying upper percentile range (default is 1)
			(3) - integer specifying how much to erode the edges in a volume prior to computing 
				the percentile volume means; used to eliminate falloff voxels on the brain
				edge (default is 5)
		dmGlobalM4 - name of file holding global means (dmGlobalMean=4)
		dmGlobalGrMean - how to perform SPM grand mean scaling (2 ELEMENT VECTOR):
			(0) - specfies type of scaling:
				-1: no grand mean scaling (default)
				 0: scaling of overall grand mean
				 1: scaling of scanning session grand means
			(1) - grand mean scaling factor (default is 50)
		dmConstant - how to handle the constant term
			-1: none (default)
			 0: mean center each column in data matrix
			 1: create column of 1's in design matrix
		dmContrast - specifies how to generate the contrast vector(s) (VECTOR):
			-1: none (default)
			 0: brain state on indicators
			 1: scan number (time) on indicators
			 2: miscellaneous 1 on indicators
			 3: each polynomial degree on each covariate
			 4: miscellaneous 2 on indicators
			 5: miscellaneous 3 on indicators
		/DoRF - perform random field theory on output SPM's (default is not)
		/DmRandLabel - boolean indicating whether or not to randomize the design
			matrix labels associated with the contrast vector(s) (default is not)
		/ResidPca - boolean indicating whether or not to run a PCA on the GLM 
			residual matrix (default is not)
		save - 7 element boolean vector specifying what GLM data to save:
			(0) - design matrix, contrast vector, list file
			(1) - beta matrix
			(2) - t statistic image
			(3) - PCA eigenimage
			(4) - PS dump of design matrix
			(5) - standard error volume
			(6) - contrast*beta matrix
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates GLM options variable for a CODAT analysis.

	HISTORY
		06/13/01 - Jon Anderson - original code

(See codat_glm_opts.pro)


CODAT_PCA_OPTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		codat_pca_opts - creates PCA options variable for a CODAT analysis

	SYNOPSIS
		opts = codat_pca_opts(/Run, /Keep, ID=id, Dir=dir, Comment=comment,
			/Time, /DoSSM, SsmSigPc=ssmSigPc, NeigImg=nEigImg, PcaMeth=pcaMeth,
			SaveVol=saveVol, /Debug)

	PARAMETERS
		/Run - whether or not to run a PCA (default is not)
		/Keep - whether or not to keep the results from the PCA (default is 1)
		id - string used to identity the results of the PCA (default is '')
		dir - directory where to save PCA output files (default is '')
		comment - comment to include in log file (default is '')
		/Time - time how long it takes to run (default is 1)
		/DoSSM - whether or not to run an SSM (default is not)
		ssmSigPc - string holding a list of numbers indicating the PC's
			in an SSM that are to be considered signficant; for example
			SsmSigPc='1-10' says that PC's 1,2,...,10 are significant;
			needed only if /DoSSM specified
		nEigImg - number of eigenimages to save to disk (default is 0)
		pcaMeth - what method to use in running PCA/SVD:
			0: covariance matrix (default)
			1: regular SVD
			2: generalized SVD
			3: generalized SVD with reordering of PC's according to "new"
				singular values
		saveVol - 2 element boolean vector specifying whether or not to save
			the GMP and GIS (eigenimages) volumes (defaultis [1,1])
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates PCA options variable for a CODAT analysis.

	HISTORY
		06/12/01 - Jon Anderson - original code

(See codat_pca_opts.pro)


COMBIN_NK

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		combin_nk - returns combinations of N things K at a time

	SYNOPSIS
		combin_nk, n, k, list, THINGS=things, ERROR=error, /DEBUG

	PARAMETERS
		n - number of things [REQUIRED]
		k - number of things to take [REQUIRED]
		list - returned list of all combination of N things taken
			K times; this in an M x K (intarr(M,k)) vector where
			is M is the number of combinations
		things - integer vector where each thing is assiged a value
			(default is [1,2,...,N])
		error - error status 
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Returns all combinations of N things taken K at a time.

	EXAMPLE
		IDL> combin_nk, 5,3, list
		IDL> print, list 
			1   1   1   1   1   1   2   2   2   3
			2   2   2   3   3   4   3   3   4   4
			3   4   5   4   5   5   4   5   5   5

	HISTORY
		11/06/98 - Jon Anderson - original code
		9/5/00 - jra - work with longs, not short ints

(See combin_nk.pro)


COMM_VOX_LOCS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		comm_vox_locs - returns common volume locations given 2 location vectors

	SYNOPSIS
		comm_vox_locs, vloc1, vloc2, vsize, index1, index2, NLOC=nLoc,
			ERROR=error, /DEBUG

	PARAMETERS
		vloc1 - vector holding encoded 1D volume locations [REQUIRED]
		vloc2 - vector holding encoded 1D volume locations [REQUIRED]
		vsize - 3 element vector specifying volume size [REQUIRED]
		index1 - indices of 'vloc1' that have same volume locations as
			'vloc2' [RETURNED]
		index2 - indices of 'vloc2' that have same volume locations as
			'vloc1' [RETURNED]
		nLoc - number of common voxel locations in 'vloc1' and 'vloc2'
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Returns common voxel locations given 2 1D location vectors. That is,
		'vloc1' holds the locations of a set of voxels from a volume of size
		'vsize'. Similarly for 'vloc2'. This routine finds the indices of
		'vloc1' and 'vloc2' such that vloc1(index1) and vloc2(index2) are
		common voxel locations.

	HISTORY
		08/06/98 - Jon Anderson - original code

(See comm_vox_locs.pro)


COMPUTE_EIGEN

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		compute_eigen - gets eigenvalues/vectors of real, nonsymmetric matrix

	SYNOPSIS
		compute_eigen, matrix, eval, evec, /DOUBLE, /NOBALANCE, ITMAX=itMax
			/REORDER, RMS=rms, /SILENT, ERROR=error, /DEBUG

	PARAMETERS
		matrix - an NxN real, nonsymmetric matrix
		eval - output eigenvalues (complex vector)
		evect - output eigenvectors (complex array)
		/DOUBLE - do arithmetic in double precision (default is single)
		/NOBALANCE - disables balancing of non-symmetric matrix (default 
			is to balance)
		itMax - maximum number of iterations allowed in computation of
			each eigenvector (default is 4)
		rms - average root mean square error in Ax - lx 
		/SILENT - do not print error messages (default is to bark)
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes the eigenvalues and eigenvectors of real, nonsymmetric matrix.

	HISTORY
		08/29/96 - Jon Anderson - original code
		10/4/96 - jra - handle scalar case
		3/19/97 - jra - converted to version 4 eigenvalue programs
		4/10/97 - jra - split into compute_eigen_1,2 for IDl versions 3,4
		6/9/97 - jra - added /SILENT

(See compute_eigen.pro)


COMPUTE_EIGEN_1

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		compute_eigen_1 - runs COMPUTE_EIGEN for older versions of IDL

	SYNOPSIS
		compute_eigen_1, matrix, eval, evec, /DOUBLE, /NOBALANCE, ITMAX=itMax
			/REORDER, RMS=rms, /SILENT, ERROR=error, /DEBUG

	PARAMETERS
		matrix - an NxN real, nonsymmetric matrix
		eval - output eigenvalues (complex vector)
		evect - output eigenvectors (complex array)
		/DOUBLE - do arithmetic in double precision (default is single)
		/NOBALANCE - disables balancing of non-symmetric matrix (default 
			is to balance)
		itMax - maximum number of iterations allowed in computation of
			each eigenvector (default is 4)
		rms - average root mean square error in Ax - lx 
		/SILENT - do not print error messages (default is to bark)
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Runs COMPUTE_EIGEN for older versions of IDL.

	HISTORY
		4/10/97 - Jon Anderson - original code (from compute_eigen.pro)
		4/18/97 - jra - politely exit when NR_HQR barfs
		6/9/97 - jra - added /SILENT

(See compute_eigen_1.pro)


COMPUTE_EIGEN_2

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		compute_eigen_2 - runs COMPUTE_EIGEN for newer versions of IDL

	SYNOPSIS
		compute_eigen_2, matrix, eval, evec, /DOUBLE, /NOBALANCE, ITMAX=itMax
			/REORDER, RMS=rms, /SILENT, ERROR=error, /DEBUG

	PARAMETERS
		matrix - an NxN real, nonsymmetric matrix
		eval - output eigenvalues (complex vector)
		evect - output eigenvectors (complex array)
		/DOUBLE - do arithmetic in double precision (default is single)
		/NOBALANCE - disables balancing of non-symmetric matrix (default 
			is to balance)
		itMax - maximum number of iterations allowed in computation of
			each eigenvector (default is 4)
		rms - average root mean square error in Ax - lx 
		/SILENT - do not print error messages (default is to bark)
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Runs COMPUTE_EIGEN for newer versions of IDL.

	HISTORY
		4/10/97 - Jon Anderson - original code (from compute_eigen.pro)
		4/18/97 - jra - politely exit when HQR barfs
		6/9/97 - jra - added /SILENT

(See compute_eigen_2.pro)


COMPUTE_PTILE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		compute_ptile - computes percent-tile value for specified distribution

	SYNOPSIS
		compute_ptile, distrib, ptile, val, /XZERO, NBIN=nBin, BINSIZE=binSize,
			ERROR=error, /DEBUG

	PARAMETERS
		distrib - distribution [REQURED]
		ptile - vector of percentiles [REQUIRED]
		val - return values at specified percentiles [RETURNED]
		/XZERO - ignore zeroes from all computations (default)
		nBin - number of histogram bins (default is 100)
		binSize - bin size; overrides 'nBin' (default computed from nBin)
		error - error status [RETURNED]
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes percent-tile values for specified distribution.

	HISTORY
		08/06/98 - Jon Anderson - original code
		4/29/99 - jra - fixed binSize bug
		8/16/99 - jra - integerize binSize when distribution is integerized
		9/16/99 - jra - limit number of significant digits in binSize to 3

(See compute_ptile.pro)


COMPUTE_VOL_MEAN

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		compute_vol_mean - computes the mean of a volume

	SYNOPSIS
		mean = compute_vol_mean(vol, METHOD=method, ABSTHRESH=absThresh,
			PCTMEAN=pctMean, PCTMAX=pctMax, PCTRANGE=pctRange, ERODESZ=erodeSz,
			VOLLOC=volLoc, VSIZE=vsize, ERROR=error, /DEBUG)

	PARAMETERS
		vol - volume whose mean is to be computed [REQUIRED]
		method - what method to use
			0: mean over all voxels
			1: mean over all voxels greater than specified threshold
			2: mean over all voxels greater than specified percentage of full mean
			3: mean over all voxels greater than specified percentage of volume maximum
			4: mean over all voxels within specified percentile range
		absThresh - absolute threshold used in METHOD=1; absolute threshold used
			in METHOD=2 to compute full mean; absolute threshold used in METHOD=3
			to eliminate voxels from the percentile computations (default is 0)
		pctMean - percentage (0 <= x <= 1) of full mean used in METHOD=2
			(default is 0)
		pctMax percentage (0 <= x <= 1) of volume maximum used in METHOD=3
			(default is 0)
		pctRange - 2 element vector specifying the percentile range over which
			to compute the volume mean (default is [0,1])
		erodeSz - size of erosion filter; used to eliminate edge voxels that may
			tend to have lower values do to resolution "drop off" (default is none)
		volLoc - if volume was specified as a 1D vector, then 'volLoc' is the 1D
			volume locations vector; needed for METHOD=4 only
		vsize - volume size in the 3 dimensions; needed only if volume was specified
			as 1D vector AND if METHOD=4
		error - error status; 0 is good, 1 is bad
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes the mean of a volume.

	HISTORY
		07/18/00 - Jon Anderson - original code

(See compute_vol_mean.pro)


CONCORDANCE_CC

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		concordance_cc - computes the concordance correlation coefficient

	SYNOPSIS
		ccc = concordance_cc(x, y, ERROR=error, /DEBUG)

	PARAMETERS
		x, y - vectors to compute concordance of
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes the concordance correlation coefficient.

	HISTORY
		02/10/97 - Jon Anderson - original code

(See concordance_cc.pro)


CONNCOMP_3D

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		conncomp_3d - 3D connected component analysis (pure IDL)

	SYNOPSIS
		conncomp_3d, inVol,labVol, MINSIZE=minSize, CONNECT=connect,
			THRESH=thresh, NCOMP=nComp, INFO=info, SORTBY=sortBy, /TIME,
			/REPORT, ERROR=error, /DEBUG

	PARAMETERS
		inVol - 3D volume array [REQUIRED]
		labVol -  output labeled volume/pathname [RETURNED]
		minSize - minimum size of connected component (default is 10)
		connect - mask of desired connectivity
			1 = face	2 = edge	4 = vertex
			(default is 1)
		thresh - threshold to apply (default is 1)
		nComp - number of connected components (RETURNED)
		info - connectivity info as array of structures (RETURNED)
		sortBy - how to sort by list of connected components: 0 - don't,
			1 - by component size, 2 - by peak value (default is 0)
		/TIME - report timing results
		/REPORT - print connectivity table to stdout (default is ON)
		error - error return (0 = no error)
		/DEBUG - optional flag for debug output

	DESCRIPTION
		3D connected component analysis.  This procedure is pure IDL, and,
		therefore, is slower than 'x_conncomp3d.pro' which uses the
		'x_conncomp3d' module in the sharable library libVAST.so.

		The structure of the info array is:
			label (int)
			size  (int)
			avg   (float)
			std   (float)
			cent  (3 element float vector -- x,y,z)
			moment (3 element float vector -- x,y,z)
			xrange (2 element float vector -- min,max)
			yrange (2 element float vector -- min,max)
			zrange (2 element float vector -- min,max)
			wcent (3 element float vector -- x,y,z)
			peak  (float)

		where,
			label - component label
			size - component size in voxels
			avg - component average
			stdev - component standard deviation
			{x,y,z}cent - component centroid
			{x,y,z}moment - component central moments
			xrange - component x extent
			yrange - component y extent
			zrange - component z extent
			{x,y,z}wcent - intensity weighted centroids
			peak - peak intensity

	HISTORY
		01/26/01 - Jon Anderson - original code

(See conncomp_3d.pro)


CONVEX_HULL

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		convex_hull - compute convex hull of set of boundary points

	SYNOPSIS
		convex_hull, img,hull, MINDIST=mindist, MAXDIST=maxdist, 
			POINT=point, /LAST, COLINEAR=0.0, /DEBUG

	DESCRIPTION
		Computes the convex hull of a set of points.
		The set of points is defined as the non-zero
		points in the given image.  The hull is returned
		as a set of locations in the image, which
		correspond to hull locations.

		img - 2D image of any size/type
		hull - hull locations
		mindist - minimum distance to look for next boundary point
			(default is 2)
		maxdist - maximum distance to look for next boundary point
			(default is 0, i.e. no maximum)
		point - locations in image to identify convex hull of
			(default is all points in img which are removed
			by a binary erode of 1 pixel)
		/LAST - use last boundary point for first hull point
			(default is to use first boundary point)
		colinear - minimum angle change for next point - to avoid
			multiple points on straight edge - units are radians
			(default is 0.0 - i.e. no restriction)
		ERROR = 0 if hull closed
		/DEBUG - optional flag for debug output

	HISTORY
		5/10/91 - kas - original code
		5/13/91 - kas - added maxdist parameter
		5/15/91 - kas - added mindist parameter
		5/16/91 - kas - added /last parameter
		7/19/91 - kas - added return of [-1] if error
		4/23/92 - kas - added colinear
		3/24/95 - kas - added point and revised logic for default value for point
		8/15/96 - kas/dcb - rename dist variable to avoid IDL library function clash
		3/21/2K - kr - pass back an error flag if there were problems with the hull

(See convex_hull.pro)


COVARIANCE_MAT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		covariance_mat - creates covariance matrix from input data matrix

	SYNOPSIS
		covariance_mat, data, covMat, NVAR=nVar, /OBSCOV, DF=df, /SSQ,
			/DOUBLE, /TIME, /DEBUG

	PARAMETERS
		data - data matrix (e.g fltar(nVar,nObs))
		covMat - covariance matrix; size is nVar x nVar if OBSCOV=0 else
			the size is nObs x nObs (returned)
		/OBSCOV - generate observations covariance matrix (default is
			to compute the variables covariance matrix)
		nVar - number of variables, i.e - do covariance on data(0:nVar-1,*)
			(default is computed from size of data matrix)
		df - degrees of freedom to divide by (default is #obs-1 for OBSCOV=0
			and #variables-1 for OBSCOV=1)
		/SSQ - compute sum of squares and products matrix instead of cov-
			ariance matrix, i.e, do not center the columns (OBSCOV=0) or the
			rows (OBSCOV=1) (default is covariance)
		/DOUBLE - use double precision (default is single)
		/TIME - time it (default is not)
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Creates covariance matrix from input data matrix.

	HISTORY
		03/16/94 - Jon Anderson - original code
		1/11/96 - jra - added /OBSCOV, nVar, df, ssq, /TIME
		10/13/99 - jra - added DOUBLE precision

(See covariance_mat.pro)


CVA

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva - performs a CVA analysis given the data and a group structure

	SYNOPSIS
		cva, data, group, Thresh=thresh, Enorm=eNorm, NsigDim=nSigDim,
			Eval=eval, Evect=evect, CanCrds=canCrds, Wmat=wMat, Bmat=bMat,
			ChiSqr=chisqr, ConfidReg=confidReg, /Silent, Error=error, /Debug

	PARAMETERS
		data - 2D array of data; data(i,j) is the data value for the ith
			variable and jth obersvation [REQUIRED]
		group - integer vector of group labels; 1 element per obersvation
			[REQUIRED]
		Thresh - chi-squared confidence threshold used in determining dimen-
			sionality and confidence circles (default is .95)
		Enorm - how to normalize CVA eigenvectors
			0 - normalize by l'[W/(n-k)]l = 1, where l is an eigenvector and W
			    is the within group matrix; this will cause the variance of each
			    group to be 1; this is how CVA is normally done
			1 - normalize each eigenvector to have unit length (default)
		NsigDim - number of significant CVA dimensions [RETURNED]
		Eval - CVA eigenvalues [RETURNED]
		Evect - CVA eigenvectors; Evect(i,j) is the eigenvector element for
			the ith CVA dimension and jth data variable [RETURNED]
		CanCrds - canonical variates; CanCrds(i,j) is the canonical score for
			the ith dimension and jth obersvation [RETURNED]
		Wmat - within group matrix; size is NxN where N is number of columns
			in the data matrix [RETURNED]
		Bmat - between group matrix; size is NxNn where N is number of columns
			in data matrix [RETURNED]
		Chisqr - 2D array (dlbarr(3,#dims+1)) holding chi squared data for
			each CVA dimension; chisqr(0,i): chi squared value (Bartletts
			statistic) for ith dimension; chisqr(1,i): p-value associated
			with chi squared; chisqr(2,i): degrees of freedom [RETURNED]
		ConfidReg - confidence regions on accuracy of canonical group means
			(fltarr(#groups,#dims)) [RETURNED]
		/Silent - do not report errors (default is off)
		error - error status [RETURNED]
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Performs a CVA analysis given the data and a group structure.

	HISTORY
		01/02/01 - Jon Anderson - original code

(See cva.pro)


CVA_CEIG_FNAME

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_ceig_fname - generates the filenames for canonical eigenimages

	SYNOPSIS
		cva_ceig_fname, id, wgts, fname, Dir=dir, Suffix=suffix, Error=error,
			/Debug

	PARAMETERS
		id - CVA output id string [REQUIRED]
		wgts - canonical eigenimage weight(s) [REQUIRED]
		fname - filename(s) of canonical eigenimage volumes [RETURNED]
		Dir - output CVA directory (default is '')
		Suffix - base suffix of canonical eigenimage volumes (default is 'cgis')
		Error - error status [RETURNED]
		/Debug - optional flag for debug output

	DESCRIPTION
		Generates the filenames for canonical eigenimage volumes.

	HISTORY
		01/03/01 - Jon Anderson - original code

(See cva_ceig_fname.pro)


CVA_COMP_EIGEN

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_comp_eigen - computes eigenvalue/vectors for a CVA analysis

	SYNOPSIS
		cva_comp_eigen, data, group, eval, evect, Wmat=wMat, Bmat=bMat,
			Rms=rms, Enorm=eNorm, /Silent, Error=error, /Debug

	PARAMETERS
		data - 2D array of data; data(i,j) is the data value for the ith
			variable and jth obersvation [REQUIRED]
		group - integer vector of group labels; 1 element per obersvation
			[REQUIRED]
		eval - CVA eigenvalues [RETURNED]
		evect - CVA eigenvectors; Evect(i,j) is the eigenvector element for
			the ith CVA dimension and jth data variable [RETURNED]
		Wmat - within group matrix; size is NxN where N is number of columns
			in the data matrix [RETURNED]
		Bmat - between group matrix; size is NxNn where N is number of columns
			in data matrix [RETURNED]
		Rms - root mean square error in testing eigenvalue/eigenvectors [RETURNED]
		Enorm - how to normalize CVA eigenvectors
			0 - normalize by l'[W/(n-k)]l = 1, where l is an eigenvector and W
			    is the within group matrix; this will cause the variance of each
			    group to be 1; this is how CVA is normally done
			1 - normalize each eigenvector to have unit length (default)
		/Silent - do not report errors (default is off)
		error - error status [RETURNED]
		/Debug - optional flag for debug output

	DESCRIPTION
		Computes eigenvalues and eigenvectors for a CVA analysis. The
		matrix used is inv(W)*B, where W is the within group matrix and
		B is the between group matrix.

	HISTORY
		01/02/01 - Jon Anderson - original code

(See cva_comp_eigen.pro)


CVA_CV_SIGNS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_cv_signs - establishes the sign for each CVA variate

	SYNOPSIS
		cva_cv_signs, canCrds, group, Negate=negate, /Debug

	PARAMETERS
		canCrds - 2D array of CV scores; canCrds(i,*) are the CV scores
			for the ith CVA dimension [REQUIRED]
		group - integer vector of group labels; 1 element per obersvation
			[REQUIRED]
		Negate - boolean vector specifying whether or not to force 
			negation; if negate(i) is non-zero then negate the ith+1
			CV dimension (default is to not negate any dimensions)
		/Debug - optional flag for debug output

	DESCRIPTION
		Establishes the sign for each CVA variate.

	HISTORY
		01/02/01 - Jon Anderson - original code

(See cva_cv_signs.pro)


CVA_GRP_MEANS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_grp_means - computes the group means in a CVA analysis

	SYNOPSIS
		cva_grp_means, cv, group, grpMeans, ERROR=error, /DEBUG

	PARAMETERS
		cv - 2D array of CV scores; cv(i,*) are the CV scores for the ith
			CVA dimensions [REQUIRED]
		group - vector of group labels; one label per observations [REQUIRED]
		grpMeans - 2D array of CV score group means; grpMeans(i,j) is the
			group mean for the ith CVA dimension and the jth group; the group
			labels are arranged from lowest to highest, so j = 0 is associated
			with the lowest group label [RETURNED]
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes the group means in a CVA analysis.

	HISTORY
		12/11/00 - Jon Anderson - original code

(See cva_grp_means.pro)


CVA_MAIN

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_main - runs a CVA on the results from a PCA

	SYNOPSIS
		cva_main, pcaId, PcaDir=pcaDir, GrpDef=grpDef, Group=group,
			PcRange=pcRange, PcSet=pcSet, PcSelMeth=pcSelMeth,
			PcSelPar=pcSelPar, Thresh=thresh, Enorm=eNorm, RefCva=refCva,
			Negate=negate, NceigImg=nCeigImg, CeigWgts=ceigWgts,
			OutId=outId, OutDir=outDir, CeigImg=ceigImg, Save=save,
			/LoadIt, INFO=info, PcvaEval=pcaEval, PcaPcs=pcaPcs,
			PcaEigImg=pcaEigImg, VolLoc=volLoc, /Silent, Try=try,
			Error=error, /Debug

	PARAMETERS
		----- Input -----
		pcaId - ID of PCA analysis on which the CVA is performed [REQUIRED]
		PcaDir - directory where the PCA files live (default is '')

		----- CVA parametes -----
		GrpDef - specifies how the group structure is define:
			 0 - brain state       1 - patient group
			 2 - protocol id       3 - subject number
			 4 - study/session     5 - scan number
			 6 - trial number      7 - sex
			 8 - miscellaneous 1   9 - miscellaneous 2 (second misc field in list file)
			10 - miscellaneous 3
			(default is 0, ie, brain state)
		Group - integer vector holding a group label for each volume; this
			parameter overrides 'grpDef' (default is to use 'grpDef')
		PcRange - range of PC's to use in the CVA (default is [1,10])
		PcSet - explicit set of PC's to use in the CVA (default is 'pcRange')
		PcSelMeth - how to auto select the PC's to use in the CVA:
			0: use PC's from either 'pcRange' or 'pcSet'
			1: highest R-squares from SSF/CV multiple regression
			2: between/within minimization computed on train/test sets (backward)
			3: between/within minimization computed on train/test sets (forward)
			4: chi-squared maximization (forward selection)
		PcSelPar - auto PC selection parameters (see 'cva_pc_select.pro')
		Thresh - chi-squared confidence threshold used in determining dimen-
			sionality and confidence circles (default is .95)
		Enorm - how to normalize CVA eigenvectors
			0 - normalize by l'[W/(n-k)]l = 1, where l is an eigenvector and W
			    is the within group matrix; this will cause the variance of each
			    group to be 1; this is how CVA is normally done
			1 - normalize each eigenvector to have unit length (default)
		RefCva - pathname (minus suffix) of reference CVA (default is none)
		Negate - boolean array indicating which canonical variables to negate
			(default is to not negate any)
		NceigImg - number of canonical eigenimages to create (default is 1 plus
			the number of significant dimensions)
		CeigWgts - vector of floats specifying how to weight the eigenimages when
			constructing the canonical eigenimages; the PCA eigenvalues are raised
			to the power of these numbers (e.g, 0 means no weighting (saved as
			*.nwcgis), 1 means use the eigenvalues (saved as *.cgis), and .5 means
			use the square root of eigenvalues (saved as *.050cgis)) (default [0,1])

		----- Output -----
		OutId - ID of output CVA files (default is built from 'pcaId')
		OutDir - directory where output CVA files are saved (default is '')
		CeigImg - 3D array holding the canonical eigenimages; ceigImg(i,j,k) is the
			pattern value for the ith canonical weight, jth voxel, and kth CVA
			dimension [RETURNED]
		Save - 12 element boolean vector specifying which files are to be saved:
			 (0) - save CVA log file (.log)
			 (1) - save volume list file (.info)
			 (2) - save group labels (.group)
			 (3) - save PC numbers used in CVA (.pcs)
			 (4) - save actual PC scores used in CVA (.pcScr)
			 (5) - save CVA eigenvalues (.eigval)
			 (6) - save CVA eigenvectors (.eigvct)
			 (7) - save canonical variates (.can)
			 (8) - save canonical variates for each canonical e-img weight (.cvs,.cvsAvg)
			 (9) - save chi-squared data (.chi)
			(10) - save r^2 values (.r2)
			(11) - save canonical eigenimages (e.g, '.nwcgis')
			(default is to save everything)

		----- Optional Input -----
		/LoadIt - force loading of PCA data even if all the PCA data is input via
			the command line (default)
		Info - volume information structure [OPTIONAL INPUT]
		PcaEval - PCA eigenvalues [OPTIONAL INPUT]
		PcaPcs - PCA principal component scores [OPTIONAL INPUT]
		PcaEigImg - PCA eigenimages [OPTIONAL INPUT]
		VolLoc - volume location vector [OPTIONAL INPUT]

		----- Miscellaneous -----
		/Silent - do not report errors (default is to bark)
		Try - 2 element vector (default is [1,0]):
			(0) - how many times to try and open files after an error
			(1) - how many seconds to wait until trying to re-open files
		Error - error status; 0 good, 1 bad [RETURNED]
		/Debug - optional flag for debug output

	DESCRIPTION
		Runs a CVA on the PC's generated from a PCA analysis.

	HISTORY
		01/02/01 - Jon Anderson - original code

(See cva_main.pro)


CVA_OUTPUT_ID

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_output_id - generates an output ID for a CVA analysis

	SYNOPSIS
		fname = cva_output_id(pcaId, Dir=dir, Error=error, /Debug)

	PARAMETERS
		pcaId - name of PCA ID [REQUIRED]
		dir - directory where CVA output will be saved (default is '')
		Error - error status [RETURNED]
		/Debug - optional flag for debug output

	DESCRIPTION
		Generates an output ID for a CVA analysis. The output filename
		has the form <pcaId>_cvaXXX, where XXX is a number between 1 and
		999.

	HISTORY
		01/03/01 - Jon Anderson - original code

(See cva_output_id.pro)


CVA_PC_SELECT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_pc_select - auto selects the PC's to use in a CVA

	SYNOPSIS
		cva_pc_select, pcSelMeth, group, pcSet, pcs, PcSelPar=pcSelPar,
			Thresh=thresh, Enorm=eNorm, PsFile=psFile, Error=error, /Debug

	PARAMETERS
		pcSelMeth - how to select PC's that go into the CVA
			0: use PC's from either 'pcRange' or 'pcSet'
			1: highest R-squares from SSF/CV multiple regression
			2: between/within minimization computed on train/test sets (backward)
			3: between/within minimization computed on train/test sets (forward)
			4: chi-squared maximization (forward selection)
		group - group labels
		pcSet - integer vector of initial PC numbers
		pcs - 2D array of PC scores
		PcSelPar - auto PC selection parameters
			pcSelMeth=1: 3 element float -->
				(0) - number of CVA dimensions to consider
				(1) - [if >= 0] R-squared threshold such that all PC's with R^2's
				      higher than this value are kept 
				      [if <  0] keep PC's whose cumulative R^2's are greater than
				      the absolute value of the specified threshold
				(2) - maximum number of PC's to select; 0 --> no limit
			pcSelMeth=2,3: 7 element float -->
				(0) - number of CVA dimensions to consider
				(1) - R-squared threshold used to prune down number of PC's:
					  [if >= 0] R-squared threshold such that all PC's with R^2's
				        higher than this value are kept 
				      [if <  0] keep PC's whose cumulative R^2's are greater than
				        the absolute value of the specified threshold
				(2) - size of training set (i.e, number of volumes)
				(3) - number of iterations to perform (# of samples)
				(4) - whether to use mean (0) or median (1) when determining
				      minimum BW ratio for a given PC group size
				(5) - whether to look to the left (0) or right (1) of the global
				      minimum when searching for a distribution that is not
				      significantly different from the global minimum distribution
				(6) - Mann-Whitney P-value threshold used to find which PC set has
				      the smallest (signficant) BW ratio
			pcSelMeth=4: 5 element float -->
				(0) - number of CVA dimensions to consider
				(1) - R-squared threshold used to prune down number of PC's:
					  [if >= 0] R-squared threshold such that all PC's with R^2's
				        higher than this value are kept 
				      [if <  0] keep PC's whose cumulative R^2's are greater than
				        the absolute value of the specified threshold
				(2) - number of PC's to add at each step (default is 3)
				(3) - max number of PC's to add at each step b/4 quiting (default is 10)
				(4) - internal usage; set to 0
		Thresh - chi-squared confidence threshold used in determining dimen-
			sionality and confidence circles (default is .95)
		Enorm - how to normalize CVA eigenvectors
			0 - normalize by l'[W/(n-k)]l = 1, where l is an eigenvector and W
			    is the within group matrix; this will cause the variance of each
			    group to be 1; this is how CVA is normally done
			1 - normalize each eigenvector to have unit length (default)
		PsFile - name of PS file used to track results from pcSelMeth=2,3)
		Error - error status
		/Debug - optional flag for debug output

	DESCRIPTION
		Auto selects the PC's to use in a CVA.

	HISTORY
		01/03/01 - Jon Anderson - original code

(See cva_pc_select.pro)


CVA_PLOT_CVS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_plot_cvs - plots the CV scores from a CVA analysis

	SYNOPSIS
		cva_plot_cvs, id, Dir=dir, SelDim=selDim, Format=format,
			PlotOpts=plotOpts, ArrowDef=arrowDef, ConfidDef=confidDef,
			/BoxPlot, Ydim=yDim, Negate=negate, Thresh=thresh, Xrange=xrange,
			Yrange=yrange, Title=title, Xtitle=xtitle, Ytitle=ytitle,
			Pmulti=pmulti, Psym=psym, SymSize=symSize, FsymSize=fSymSize,
			Connect=connect, ConnOrder=connOrder, ColorPlot=colorPlot,
			ColSym=colSym, ColLine=colLine, CharSize=charSize, /SymbolKey,
			Stamp=stamp, PrintIt=printit, PsFile=psFile, PsSize=psSize,
			/FlipXY, ERROR=error, /Debug

	PARAMETERS
		id - CVA id string [REQUIRED]
		dir - directory where CVA output files live (default is '')
		selDim - dimensions to plot (default is [1,...,#dim])
		format - integer specifying which plot format to use:
			1 - plot CV's against CV's from a fixed dimension (default)
			2 - plot CV's against observation number 
			3 - plot CV's against group number
			4 - plot CV's as a combination of formats 1 and 3
			5 - plot CV's as a combination of formats 1 and 2
		plotOpts - for format=1; 5 element boolean array specifying plot options:
			(0) - plot confidence circles (default)
			(1) - plot individual canonical variables (1 per volume) (default)
			(2) - plot a cross over each mean canonical variable (default)
			(3) - plot the mean canonical variables (default)
			(4) - connect mean canonical variables with arrows (default is not)
		arrowDef - 2D floating array (#class,5) that defines the characteristics
			of plotted arrows:
			arrowDef(*,0): line style
			arrowDef(*,1): line thickness
			arrowDef(*,2): arrow head length
			arrowDef(*,3): line color
			arrowDef(*,4): fill or not fill arrow head
		confidDef - 2D floating array (#class,5) that defines the characteristics
			of the confidence circles:
			confidDef(*,0): boolean - plot or not plot
			confidDef(*,1): line style
			confidDef(*,2): line thickness
			confidDef(*,3): number of points in confidence circle
			confidDef(*,4): color
		/BOXPLOT - perform box plots for FORMAT=3 (default is not)
		yDim - used for format=1; specifies which CVA dimension to use on the
			y axis (default is 1)
		negate - boolean vector specifying which CVA dimensions to negate
			(default is [0,0,0...], i.e, none)
		thresh - chi-squared confidence threshold used in determining dimen-
			sionality and confidence circles (default is .95)
		xrange - x axis plotting range; if 2 elements are given then the range
			is explicitly set to be from xrange(0) to xrange(1); if one element
			then the value specifies a strategy:
			0 - individual plot ranges
			1 - individual plot ranges; symmetric about 0
			2 - global plot ranges
			3 - global plot ranges; symmetric about 0
			(default is a function of 'format')
		yrange - see 'xrange'
		title - main plot title (default is a function of 'format')
		xtitle - x axis plot title (default is a function of 'format')
		ytitle - y axis plot title (default is a function of 'format')
		pmulti - 3 element integer vector specifying the multiple plot format
			(default is a function of 'format')
		psym - symbols to use for each CVA group; see 'psym_gen.pro' (default
			is computed)
		symSize - symbol size for each CVA group; if one size is given then this size
			is used for all groups (default is .6)
		fSymSize - 3 element vector specifying the final symbol size of the
			individual CVA variates, mean CVA variates, and the mean CVA variates
			marked with a cross; these values are multiplied by the 'symSize'
			value to get the final symbol size (default is [1,1.50,3.33])
		connect - integer vector (intarr(#groups)) specifying which CVA group
			means are to be connected together (default is [1,1,...], i.e,
			connect all the means)
		connOrder - integer vector (intarr(#groups)) specifying the order in
			which CVA group means are connected; see 'plotsOpts(4) (default is
			[1,2,3,4,..])
		colorPlot - specifies how to generate a color plot:
			0 - black and white plot (default)
			1 - color only plot symbols
			2 - color only plot lines
			3 - color both plot symbols and lines
		colSym - integer vector specifying how to color the symbols:
			0 - black if screen dump, white if PS dump; 1 - white if screen
			dump, black if PS dump; 2 - red; 3 - green; 4 - blue; 5 - yellow;
			6 - lavender; 7 - teal; 8 - purple; 9 - ishy green; 10 - dark pink;
			11 - army green, 12 - light blue
			(default is a function of colorPlot)
		colLine - integer vector specifying how to color the lines; see 'colSym'
			(default is a function of 'colorPlot')
		charSize - character size to use in plots (default is .75)
		/SYMBOLKEY - print symbol key at top of plot (FORMAT=1)
		stamp - string array to be printed ("stamped") at the bottom of each
			plotting page; use '' to suppress (default date, data files, etc)
		printit - output device:
			0 - screen dump (default)
			1 - PS dump: open device=YES, close device=YES, print=YES
			2 - PS dump: open device=YES, close device=YES, print=NO
			3 - PS dump: open device=YES, close device=NO,  print=NO
			4 - PS dump: open device=NO,  close device=NO,  print=NO
			5 - PS dump: open device=NO,  close device=YES, print=NO
			6 - PS dump: open device=NO,  close device=YES, print=YES
		psFile - name of output PS file (default is 'temp.ps')
		psSize - x,y size of PS dump in inches (default is [8,9])
		/FlipXY - for internal usage
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Plots the CV scores from a CVA analysis.

	HISTORY
		12/19/00 - Jon Anderson - original code
		2/14/01 - jra - added FORMAT=5 plotting option
		2/16/01 - jra - fixed a few bugs in FORMAT=4,5
		2/20/01 - jra - more bugs; added /BOXPLOT option
		2/23/01 - jra - more bugs; added ConfidDef and SymbolKey

(See cva_plot_cvs.pro)


CVA_READ_PCA

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_read_pca - reads in PCA output that is input to a CVA

	SYNOPSIS
		cva_read_pca, pcaId, PcaDir=pcaDir, Info=info, PcvaEval=pcaEval,
			PcaPcs=pcaPcs, PcaEigImg=pcaEigImg, VolLoc=volLoc, /GetEigImg,
			/LoadIt, RegType=regType, Error=error, /Debug

	PARAMETERS
		pcaId - string specifying ID of PCA files [REQUIRED]
		PcaDir - directory where PCA files live (default is '')
		Info - volume informat structure [RETURNED]
		PcaEval - eigenvalues from the PCA [RETURNED]
		PcaPcs - PC scores from the PCA [RETURNED]
		PcaEigImg - eigenimages from the PCA [RETURNED]
		VolLoc - volume location vector [RETURNED]
		/GetEigImg - read and return eigenimage; set to zero if the
			eigenimages are not needed (default is set)
		/LoadIt - force the reading of the PCA data; set to zero to bypass
			the reading in of the PCA data (must then input 'info', 'pcaEval',
			'pcaPcs', 'pcaEigImg', and 'volLoc' explicitly) (default is 1)
		RegType - region type; -1 -> don't know, 0 -> voxel, 1 -> VOI
		Error - error status [RETURNED]
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Reads in the output from a PCA analysis that is then used as iput
		to a CVA analysis.

	HISTORY
		01/02/01 - Jon Anderson - original code

(See cva_read_pca.pro)


CVA_REFERENCE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_reference - negates & permutes CVA dim's based on reference CVA

	SYNOPSIS
		cva_reference, refCva, nDim, group, eval, evect, canCrds, chisqr,
			RefSign=refSign, RefPermute=refPermute, NsigDim=nSigDim,
			Error=error, /Debug

	PARAMETERS
		refCva - pathname (minus suffix) of reference CVA [REQUIRED]
		nDim - number of CVA dimensions [REQUIRED]
		group - CVA group labels [REQUIRED]
		eval - eigenvalues from CVA [REQUIRED/RETURNED]
		evect - eigenvectors from CVA [REQUIRED/RETURNED]
		canCrds - canonical variates from CVA [REQUIRED/RETURNED]
		chisqr - chi-squared data from CVA [REQUIRED/RETURNED]
		RefSign - computed sign of each CVA dimension [RETURNED]
		RefPermute - computed permutation of each CVA dimension [RETURNED]
		NsigDim - the location of the permuted significant CVA dimension
			[RETURNED]
		Error - error status
		/Debug - optional flag for debug output

	DESCRIPTION
		Negates and permutes CVA dimensions based on a reference CVA. The
		data that is negated/permuted are the CVA eigenvalues, eigenvectors,
		canonical variates, and chi-square info.

	HISTORY
		01/02/01 - Jon Anderson - original code
		2/20/01 - jra - fixed bug when #dim's differ between ref & input CVA's

(See cva_reference.pro)


CVA_SIG_DIMS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_sig_dims - computes number of significant CVA dimensions

	SYNOPSIS
		cva_sig_dims, cvs, eval, group, Thresh=thresh, Dim=dim, ChiSqr=chisqr,
			ConfidReg=confidReg, Error=error, /Debug

	PARAMETERS
		cvs - 2D array (fltarr(#dims,#vols)) of CV scores; cvs(i,j) is
			the CV score for the jth volume in the ith dimension [REQUIRED]
		eval - CVA eigenvalues from invert(W)*B matrix [REQUIRED]
		group - integer vector of group labels (intarr(#vols)) [REQUIRED]
		Thresh - p-value threshold applied to each dimensions chi squared
			value to determine its significance (default is .95)
		Dim - number of significant CVA dimensions [RETURNED]
		ChiSqr - 2D array (dlbarr(3,#dims+1)) holding chi squared data for
			each CVA dimension; chisqr(0,i): chi squared value (Bartletts
			statistic) for ith dimension; chisqr(1,i): p-value associated
			with chi squared; chisqr(2,i): degrees of freedom [RETURNED]
		ConfidReg - confidence regions on accuracy of canonical group means
			(fltarr(#groups,#dims)) [RETURNED]
		/Debug - optional flag for debug output

	DESCRIPTION
		Computes number of significant CVA dimensions based on Bartlett's
		chi-squared statistic.

	HISTORY
		12/20/00 - Jon Anderson - original code

(See cva_sig_dims.pro)


CVA_WB_MATS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		cva_wb_mats - computes the between and within group CVA matrices

	SYNOPSIS
		cva_wb_mats, data, group, WMAT=wMat, BMAT=bMat, TMAT=tMat,
			BCOVMAT=bCovMat, NSAMP=nSamp, ERROR=error, /DEBUG

	PARAMETERS
		data - 2D data matrix; data(i,*) is ith variable; data(*,j) is
			jth observation [REQUIRED]
		group - vector specifying the group label for each observation
			[REQUIRED]
		wMat - within group matrix [RETURNED]
		bMat - between group matrix [RETURNED]
		tMat - total sum of squares and products matrix [RETURNED]
		bCovMat - between group covariance matrix; not really needed for
			CVA but may be useful for other stuff [RETURNED]
		nSamp - number of observations in each group [RETURNED]
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Computes the between and within group CVA matrices.

	HISTORY
		12/11/00 - Jon Anderson - original code
		1/3/01 - jra - make sure we return 2D matrices

(See cva_wb_mats.pro)


CW_DEFROI_VA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	cw_defroi_va

 PURPOSE:
   Widget to define a region of interest within a widget drawable. 
 CATEGORY:
   Regions of interest, graphics.
 CALLING SEQUENCE:
   Result = cw_defroi_va(draw)
 INPUTS:
   Draw = id of drawable to draw the region.  The drawable should
 	have both MOTION and BUTTON events enabled.
 KEYWORD PARAMETERS:
	ROITYPE = the initial ROI type: 0 - polygon, 1 - rectangle,
		2 - circle, 3 - ellipse. Default is .2 (note ROITYPE=1 is obsolete)
   IMAGE_SIZE = the size of the underlying array, expressed
       as a two element vector: [columns, rows].  Default =
       drawable size / zoom.
	CLIP - defines the clipping box ([X0,Y0,X1,Y1]) of the draw window.
		ROI's are not allow to go beyond the rectangle defined by CLIP. 
		Defaults is the draw window [0,0,IMAGE_SIZE(0)-1,IMAGE_SIZE(1)-1].
		[CLIP is not being used now]
   OFFSET = offset of lower left corner of image within the
       drawable.  Default = [0,0].
   ORDER = if set, return inverted subscripts, as if the array
       were output from top to bottom.
   RESTORE = Set to restore the drawable to its previous appearance
       on exit.  Otherwise, the regions remain on the drawable.
   ZOOM = if the image array was expanded (via REBIN for example)
       specify this two element vector containing the expansion
       factor in X and Y.  Default = [1,1].  Must be integer.
 OUTPUTS:
      Result = subscripts of points within the region[s] defined.
       If no region was defined, a scalar -1 is returned.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       The regions are drawn within the drawable.  Set the RESTORE
       keyword to undo the damage.  
 RESTRICTIONS:
   This is a MODAL widget.  No other widget applications will be
   responsive while this widget is in use.

 PROCEDURE:
   Complicated.
 EXAMPLE:
   To obtain the average of the counts of a region within a drawable:
   Assume A = the array of interest, n columns, m rows, and that
   it is displayed in drawable D, at offset X=20, Y=100, and zoomed
   with a factor of 2:
       TV, REBIN(A, M*2, N*2), 20, 100     ;Display the image
       q = cw_defroi_va(D, ZOOM=[2,2], OFFSET=[20,100], IMAGE_SIZE=[m,n])
       if q(0) ne -1 then print,'Average = ', total(a(q))/n_elements(q)
       
 MODIFICATION HISTORY:
   DMS, RSI, December, 1993.  Written.
	01/04/00 - jra - original code (from RSI's cw_defroi.pro)

(See cw_defroi_va.pro)


DATA_INFO

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		data_info - creates a structure holding data loading information

	SYNOPSIS
		info = data_info(NumVLF=numVLF, VLF=vlf, SelVol=selVol, VolDir=volDir,
			MskDir=mskDir, VolSuff=volSuff, MskSuff=mskSuff, PctMaxThr=pctMaxThr,
			LoadMinSamp=loadMinSamp, MinSamp=minSamp, Xmask=xmask, Format=format,
			Error=error, /Debug)

	PARAMETERS
		numVLF - number of volume list files (VLF) (default is number of
			elements in 'vlf')
		vlf - string array of volume list files
		selVol - integer array corresponding to volumes in the VLF that are
			to be included in the data matrix; the first volume in the VLF
			is 1, then 2nd volume 2, etc
		volDir - string array of directory where data volumes live
		mskDir - string array of directory where mask volumes live
		volSuff - string array of data volume suffixes
		mskSuff - string array of mask volume suffixes
		pctMaxThr - value between 0 and 1 that is used as percent of volume
			maximum threshold; any voxel less the 'pctMaxThr'*max(vol) is
			not included in the data matrix; a value of less than zero means
			to not threshold (default is -1)
		loadMinSamp - minimum number of samples for loading data (default is 1,
			i,e - voxel is included in data matrix provided it exists (non-zero)
			in at least 1 volume)
		minSamp - mininum number of samples to be used for later purposes (default
			is 0, i.e, all volumes)
		xmask - name of mask volume to be used as an extra mask (default is '')
		format - format of volumes to be loaded:
			0 - VAPET format
			1 - ECAT format
			2 - ANALYZE format
			3 - Doctor View
		error - error status
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates a structure holding data loading information.

	HISTORY
		06/13/01 - Jon Anderson - original code

(See data_info.pro)


DATA_MATRIX

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		data_matrix - creates a structure holding data matrix information

	SYNOPSIS
		data = data_matrix(Nrow=nrow, Ncol=ncol, MinSamp=minSamp,
			Matrix=matrix, /InsertMat, VolLoc=volLoc, Cmvox=cmvox,
			Vsize=vsize, Info=info, LoadInfo=loadInfo, Error=error,
			/Debug

	PARAMETERS
		data - returned structure holding data matrix stuff:
			nrow    : #rows
			ncol    : #columns
			minSamp : minimum number of samples
			matrix  : 2D data matrix
			volLoc  : volume locations vector
			cmvox   : voxel size
			vsize   : volume size
			info    : volume list file information array
		nrow - number of rows in data matrix
		ncol - number of columns in data matrix
		minSamp - minimum number of samples
		matrix - 2D data matrix [input/output]
		/InsertMat - insert the data matrix into the 'data' structure; set
			InsertMat=0 to not insert into data matrix (default it /InsertMat)
		volLoc - volume locations vectors
		cmvox - voxel size in CM's
		vsize - volume size in each dimension
		info - volume list file information array
		loadInfo - structure holding data loading information; see
			'data_info.pro' for details
		error - error status
		/Debug - optional flag for debug output

	DESCRIPTION
		Creates a structure holding data matrix information.

	HISTORY
		06/13/01 - Jon Anderson - original code
		7/2/01 - jra - added /Insert parameter

(See data_matrix.pro)


DECODE_LOC

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		decode_loc - decode a location array into the consituent parts

	SYNOPSIS
		deocode_loc, loc,dim, indices

	PARAMETERS
		loc - input vector containing locations in multi dimensional array
		dim - vector containing size (and number) of dimensions
		indices - output array with indices in each dimension
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Decodes a location array (typically obtained by using the
		'where' command) into the consituent indices.

	HISTORY
		8/20/92 - kas - original code

(See decode_loc.pro)


DEFINE_ELIPSE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		define_elipse - define verticies of elipse

	SYNOPSIS
		define_elipse, xcent,ycent, a,b,theta, xverts,yverts, NPTS=360

	DESCRIPTION
		Computes and returns the verticies of a elipse with
		the given center and major, and minor axes and angle.

	PARAMETERS
		xcent,ycent - center of elipse
		a,b - major and minor axes
		theta - rotation of elipse wrt +x
		xverts,yverts - vertices of elipse (returned)
		npts - number of vertices to generate
			(default is 4 x circumference)

	HISTORY
		1/3/92 - kas - original code
		5/5/92 - kas - changed default npts to be circumference
		5/20/93 - jra - changed default npts to be 4 x circumference

(See define_elipse.pro)


DIAGMAT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		diagmat - creates a diagonal matrix

	SYNOPSIS
		dmat = diagmat(diag, ERROR=error, /DEBUG)

	PARAMETERS
		diag - diagonal elements [REQUIRED]
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Creates a diagonal matrix.

	HISTORY
		07/14/99 - Jon Anderson - original code

(See diagmat.pro)


DIR_EXISTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		dir_exists - checks the existance of the specified directory(s)

	SYNOPSIS
		res = dir_exists(dirName, /CHECKTILDA, /DEBUG)

	PARAMETERS
		dirName - name of directory(s)
		/CHECKTILDA - expands and replaces ~<user> directories with the
			full pathnames; expansion and replacement is performed only if
			'dir_exists' cannot find ~<user> in its original form (i.e, w/o
			expansion) (default is 0)
		/DEBUG - perform debugging
		[RETURN] - 1 if directory exists, 0 otherwise

	DESCRIPTION
		Checks the existance of the specified directory(s).

	BUGS
		For IDL version 5.0 if directory is ~xxx, where xxx is not a valid
		user name, then 'dir_exists' returns 1, i.e, it thinks it exists.

	HISTORY
		5/10/95 - Jon Anderson - original code
		6/23/95 - jra - completely new logic; handles arrays of dirs
		7/3/95 - jra - fixed '.' bug
		8/15/95 - jra - handle symbolic links to directories
		9/18/95 - jra - handle '' and '..' directories
		9/10/97 - jra - fixed bug in setting parent directory
		11/2/99 - jra - implemented new, spawn-less directory test
		3/13/01 - jra - strategy based on IDL version

(See dir_exists.pro)


DISPLAY_HELP

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		display_help - display help message stored in text file

	SYNOPSIS
		display_help, help_text,help_title

	PARAMETERS
		help_text - path to disk file containing help text
		help_title - optional title for help window
			(default is 'Help')
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Displays the text stored in the given file in a
		separate window, waits for a mouse click to continue,
		deletes the window, and restores all display attributes.

	HISTORY
		8/17/92 - kas - original code

(See display_help.pro)


DISPLAY_TEXT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		display_text - displays text in a window

	SYNOPSIS
		display_text, text, XSIZE=xsize, YSIZE=ysize, WINPOS=winPos,
			TITLE=title, /KEEP, WINID=winId, /SINGLE, CURRLINE=currLine,
			/DEBUG

	PARAMETERS
		text - string array of text to be displayed
		xsize - size of window in x direction (default is computed
			such that text is visible)
		ysize  - size of window in y direction (default is 500)
		winPos - window position in x and y (default is 100,100)
		title - title of text window (default is '')
		/KEEP - do not delete window upon completion (default is 0)
		winId - returns window id of text window
		/SINGLE - perform just one operation based on value of the
			current line, i.e, move down or up then return (default
			is interactive mode)
		currLine - line number of text that is at top of window
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Displays text in a window and allows user to scroll up and down 
		to see text outside window field of view.

	HISTORY
		10/27/94 - Jon Anderson - original code
		11/7/94 - jra - added /KEEP, winId, /SINGLE, currLine

(See display_text.pro)


DRAW_LINE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		draw_line - draws a line on the screen

	SYNOPSIS
		draw_line,point,slope,origin,bounds,SW=sw,COL=col

	PARAMETERS
		point - point that line goes through
		slope - slope of the line 
		origin - lower left point of bounding rectangle
		bounds - width (x dim) and height (y dim) of rectangle
		sw - write mask of line to draw (default: current write mask)
		col - color of line (default: !p.color)
		linest - line style (default is solid line)

	DESCRIPTION
		Draws a line on the screen which intersects a given
		point and has a given slope. The line is also
		bounded by a user defined rectangle.

	HISTORY
		10/5/91 - jra - original code
		1/23/92 - jra - no longer check to see if point of
				intersection is in the bounding rectangle
		10/4/93 - jra - added LINESTYLE

(See draw_line.pro)


DRAW_LINE3

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		draw_line3 - draws a line segment between 2 points

	SYNOPSIS
		draw_line3, pt1, pt2, CLIP=clip, COLOR=color, DATA=data,
			DEVICE=device, NORMAL=normal, LINESTYLE=linestyle,
			SYMSIZE=symsize, THICK=thick, WIN=win, ARROW=arrow,
			/FILL

	PARAMETERS
		pt1,pt2 - points to connect
		clip - clipping vector (4 element vector (x0,y0,x1,y1) where
			(x0,y0) are lower left and (x1,y1) upper right)
			(default is size of window)
		color - color of line (default !d.n_colors-1)
		data - use data coordinates
		device - use device coordinates (default)
		normal - use normal coordinates
		linestyle - line style
		symsize - symbol size
		thick - line thickness
		win - window to draw line
		arrow - length arrow head at second point (default is 0)
		/FILL - fill in arrow head (default is not)

	DESCRIPTION
		Draw a line that connects the 2 input points.

	HISTORY
		8/5/92 - jra - original code
		8/12/92 - jra - fixed bug in computing inverse slope
		10/12/93 - kas - added arrow
		6/1/94 - kas - enhanced arrow logic
		9/7/95 - jra - added /FILL
		9/13/95 - jra - make arrow head same color as line
		12/19/00 - jra - do not draw arrow heads that live outside of clip

(See draw_line3.pro)


DRAW_MARK

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		draw_mark - draws a cross

	SYNOPSIS
		draw_mark, xy, COL=col, OVLBIT=ovlbit, MARKSIZE=marksize

	DESCRIPTION
		Draws a cross in a window at the point specified as input.

	PARAMETERS
		xy - coordinates to put origin of cross
		col - color of cross (default is !d.n_colors)
		ovlbit - overlay bit (default is 0)
		marksize - size of mark
		prev - coordinates of previous mark to be erased
		tmark - mark type
			0 -> cross (default)
			1 -> circle
		noOvl - do not use any overlays

	HISTORY
		6/24/92 - jra - original code
		7/2/92 - jra - added PREV, CICLE, and RAD
		7/9/92 - jra - removed CIRCLE and RAD and added TMARK
		7/22/92 - jra - added NOOVL

(See draw_mark.pro)


DUMP_WINDOW

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		dump_window - dump a window to a postscript file

	SYNOPSIS
		dump_window, win, NAME='window', WPOS=[100,100], OUTPUT=0, XSIZE=5.0,
			/MERGE,RESCALE=0,SCALEVALUE=scaleValue,FILLVALUE=0,DPI=300,
			/MONO, /SUBWINDOW, /HALF, /BATCH, /SELECT_BOX, /DEBUG

	PARAMETERS
		win - window id to dump
		name - name of postscript file -- .ps is appended
			(default is 'window'+window_id)
		wpos - position of tvmenu windows (default is [100,100])
		output_type - type of output file
			0=portrait PS, 1=landscape PS, 2=GIF, 3=TIFF, 4=EPS, 5=idl window, 6=full slide
			(default is 0)
		/MERGE - window contains merged data (odd/even intensities)
			- this affects the rescaling
			(default is OFF)
		rescale - rescaling type -- 0=none, 1=remove spikes, 2=inten cap,
			3=specified minimum bin size
			(default is 0)
		scaleValue - rescaleing value -- useage dependent on value of 'rescale'
			rescale=2 -- scaleValue is the maximum intensity in the image(s)
				(default is max(image))
			rescale=3 -- scaleValue is the minimum histogram bin size in the image(s)
				the maximum intensity allowed is the maximum intensity with at least
				'scaleValue' pixels in the image
				(default is 1 --  i.e. max(image))
		fillValue - value to use for filling (default is 0)
		dpi - dots per inch of output device (default is 300)
		/MONO - generate monochrome postscript output (i.e. COLOR=0)
		/SUBWINDOW - id specified is subwindow id
		/HALF - allow half point logic (default is on)
		/batch - batch mode (default is interactive)
		SELECT_BOX - interactive mode only - uses box_cursor to select a region to dump
                          =[nx,ny] of box, or
			    if set as a switch, the default box size =[64,64]
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Creates a dump of a given window.  Allows postscript, GIF, TIFF, and encapsulated
		postscript output.  Performs padding logic to assure that the postscript
		printing does not alias on the output device.

	HISTORY
		11/6/92 - kas - original code
		3/5/93 - kas/kr - changed default to not force aliasing in postscript
		3/16/93 - kas - eliminated spike values in window dump
		3/18/93 - kas - added /RESCALE
		5/5/93 - kas - fixed /PORTRAIT logic (wave doesn't look at the
			value of the parameter, only if the parameter is specified, so
			LANDSCAPE=0,PORTRAIT=1 was translated to be /LANDSCAPE)
		5/6/93 - kas - added fillValue
		12/21/93 - kas - added mono option
		12/21/93 - jra - fixed mono logic
		1/11/94 - kas - added subwindow logic
		2/8/94 - kas - added shape specific defaults for orientation
		3/17/94 - kas - added /HALF (half dot/pixel) logic
		12/8/94 - kas - added /GIF
		12/15/94 - kas - redo the interface, add GIF and TIFF output
		12/16/94 - kas - added invert for gif output
		1/30/94 - kas - add dump_file name option
		6/20/95 - kas - revise logic to correctly deal with landscape/portrait sizing
		9/11/95 - kas - move reset of writemask to end
		9/27/95 - kas - added specification of dpi (previously was constant)
		10/26/95 - kas - reset xnpix and ynpix with /select_box option, also de-iconify window
		11/17/95 - kas - add explicit ENCAPSUL=0 for non-encapsulated PostScript
		5/23/96 - jra - fixed bugs in /SUBWINDOW logic
		1/07/97 - kr - added slide format as a save option (.gif, .info, .Mset)
		10/18/99 - kr - forced tiff write orientation to be 0 (otherwise tiffs are saved upside down according to XV)

(See dump_window.pro)


EIGEN_SYMMETRIC

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		eigen_symmetric - solves symmetric eigenvalue problem

	SYNOPSIS
		eigen_symmetric, mat, evals, evects, RES=res, /TRASH,
			/DOUBLE, /CHECK, /SILENT, ERROR=error, /DEBUG

	PARAMETERS
		mat - symmetric matrix
		evals - eigenvalues (returned)
		evects - eigenvectors (returned)
			(evects(i,*) is the ith eigenvector)
		res - ||Ax - ex|| for each eigenvector/eigenvalue pair
		/TRASH - trash the input matrix; use this if you need to save
			some space and the input matrix is no longer needed; if
			set the residuals cannot be obtained (default is to save it)
		/DOUBLE - convert input matrix to double precision array; I am
			not sure this really does anything since the tred2 program
			works in single precision; so if space is of importance use
			DOUBLE=0; (default is double)
		/CHECK - chech that matrix is symmetric (default)
		fname - filename to write eigenvectors to
		/SILENT - hush mode (default is to report errors)
		error - error status
		/DEBUG - debug flag

	DESCRIPTION
		Converts the input symmetric matrix to a tridiangonal matix
		using the Householder method. The eigenvalues and eigenvectors
		are then computed using the QL algorithm.

	HISTORY
		2/24/92 - jra - original code
		5/18/92 - jra - added FNAME
		1/29/93 - jra - normalized tridiagonal matix b/4 input to QL
			and added RES
		3/16/94 - jra - fixed bug in computing residuals
		1/11/96 - jra - added /TRASH and /DOUBLE, /CHECK
		5/13/99 - jra - handle errors more gracefully

(See eigen_symmetric.pro)


ELAP_TIME

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		elap_time - compute and print elapsed time

	SYNOPSIS
		elap_time, delta, /START, /LAP, PREFIX=prefix, /PURGE, /NOPRINT, 
			TIMESTR=timeStr, /DEBUG

	DESCRIPTION
		Both starts an elapsed time counter, and prints the
		elapsed time from the last start call.

	PARAMETERS
		delta - returned elapsed time in seconds
		/START - start counting for elapsed time
		/LAP - report elapsed time, but don't pop start time
		prefix - prefix for printout of elapsed time
		/PURGE - purge all starting times
		/NOPRINT - do not print elapsed time to screen (default is to print)
		timeStr - returned elapsed time string; this is the string that
			is printed to the screen (unless /NOPRINT)
		/DEBUG - optional flag for debug output

	HISTORY
		8/2/91 - kas - original code
		1/29/92 - kas - added /LAP
		11/14/00 - jra - added /NOPRINT and timeStr

(See elap_time.pro)


ENCODE_LOC

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		encode_loc - converts array indices into long integer scalar values

	SYNOPSIS
		encode_loc, indices, dim, loc, ORDER=order, ERROR=error, /DEBUG

	PARAMETERS
		indices - 2D array with array indices (intarr(nDim,nPts)) [REQUIRED]
		dim - integer vector specifying size of each dimension (intarr(nDim))
			[REQUIRED]
		loc - long vector of encoded array locations [RETURNED]
		order - integer vector (intarr(nDim)) specifying the order of each 
			dimension; order(i) indicates the order of the ith dimension; the
			dimension with the lowest order is the one that has its indices
			change the fast; the dimension with the highest order is the one
			that has its indices change the slowest (default is [1,2,3])
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Converts array indices into its equivalent long integer scalar value.

	HISTORY
		11/09/00 - Jon Anderson - original code

(See encode_loc.pro)


EXPAND_ARRAY

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		expand_array - expand an array by a given amount in each dimension

	SYNOPSIS
		expand_array, array,incr, VALUE=value, /DEBUG

	PARAMETERS
		array - array to be expanded (input and output)
		incr - vector with expansion amounts (1 dimensional or scaler)
			(default is 10 in each dimension)
		value - value to initialize each element in exanded portion of
			the new array (default is 0)
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Simply expands the given (potentially multi-dimensional)
		array by the given amounts in each dimension.
		Deals with arrays of all types, with up to 7 dimensions.

	HISTORY
		9/2/92 - kas - original code
		10/30/92 - jra - made incr an input variable only
		6/8/95 - kas - allow up to 7 dimensions
			(incr must either agree with array or be scaler)
		10/22/99 - jra - added VALUE option
		11/14/00 - jra - return immediately if increments are all 0

(See expand_array.pro)


EXTRAC2

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		extrac2 - extracts a sub-array from a larger array

	SYNOPSIS
		result = extrac2(array, start, siz, ERROR=error)

	PARAMETERS
		array - array from which the subarray will be extracted [REQUIRED]
		start - integer vector specifying for each dimension the starting
			subscript in 'array from the subarray [REQUIRED]
		siz - integer vector specifying for each dimension the size of
			the output array for that dimension [REQUIRED]
		error - error status; 0 good, 1 bad
		result - the extracted subarray [RETURNED]

	DESCRIPTION
		Extracts a sub-array from a larger array. Same as IDL's 'extrac'
		except 'start' and 'siz' are specified as vectors and not as scalars
		for each dimension. This allows, 'extrac2' to be called without
		knowing before hand the dimension of 'array'.

	HISTORY
		03/17/99 - Jon Anderson - original code

(See extrac2.pro)


FDG_PROC_RD_DEFS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		fdg_proc_rd_defs - reads FDG preprocessing defaults

	SYNOPSIS
		@fdg_proc_rd_def

	PARAMETERS

	DESCRIPTION
		Reads FDG preprocessing defaults.

	HISTORY
		10/16/96 - Jon Anderson - original code
		3/16/98 - jra - added fdgProcInterDir,fdgProcInterTrfDir,fdgProcResampSmooth
		9/3/98 - jra - added FDG/MRI intra and FDG inter resampling via MRI

(See fdg_proc_rd_defs.pro)


FDR

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		fdr - computes an FDR threshold for the input data

	SYNOPSIS
		fdr, data, cutoff, RAT=rat, FIELD=field, DF=df, /APPLYTHR,
			THRDATA=thrData, ERROR=error, /DEBUG

	PARAMETERS
		data - data to be thresholded
		cutoff - returned cutoff value associated with specified threshold
			[RETURNED]
		rat - false discovery rate threshold (default is .05)
		field - field type:
			0: p values (default)
			1: Z-scores
			2: T-values
		df - degrees of freedom for T-value data
		/APPLYTHR - apply threshold to the input data (default is not)
		thrData - returned threshold data
		error - error status
		/DEBUG - perform debugging

	DESCRIPTION
		Computes an FDR threshold for the input data.

	HISTORY
		11/12/01 - Jon Anderson - original code

(See fdr.pro)


FILE_EXISTS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		file_exists - checks the existance of a file

	SYNOPSIS
		ret = file_exists(fname, /COMPRESS)

	PARAMETERS
		fname - name of file(s) to be checked
		/COMPRESS - check if compressed version of file exists
		<returned> - 1 if it exists, 0 if it doesn't

	DESCRIPTION
		Returns a 1 if the file exists and a 0 if it does not.

	HISTORY
		?/?/91 - jra - original code
		2/20/97 - jra - added /COMPRESS
		1/23/01 - jra - handle multiple filenames
		10/29/01 - jra - 5.3 doesn't allow openr on a directory

(See file_exists.pro)


FIND_IDL_INCLUDES

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		find_idl_includes - finds IDL include files in specified directories

	SYNOPSIS
		find_idl_includes, fname, NUM=num, LIBS=libs, /DEBUG

	PARAMETERS
		fname - string array of IDL include files [RETURNED]
		num - number of include files [RETURNED
		libs - string array of libraries to check (default is
			'/usr/local/petlib', '/usr/local/hbplib', and
			'/usr/local/publib')
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Finds all the IDL include files that exist in the specified
		libraries. It does this by checking for the existance of the
		words 'PRO ' and 'FUNCTION ' in each file.

	HISTORY
		01/24/01 - Jon Anderson - original code

(See find_idl_includes.pro)


FIND_REFVOL

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		find_refvol - finds a reference volume of specified voxel and volume size

	SYNOPSIS
		find_refvol, vsize, cmvox, refVolName, FORMAT=format, /READIT, VOL=vol,
			HDR=hdr, REFVOLDIR=refVolDir, REFVOLDB=refVolDB, ERROR=error, /DEBUG

	PARAMETERS
		vsize - 3 element vector specifying the size of each dimension
			of desired reference volume [REQUIRED]
		cmvox - 3 element vector specifying the voxel size, in cm's, of
			each dimension [REQUIRED]
		refVolName - name of found reference volume; if no volume is found
			then refVolName is set to '' [RETURNED]
		format - file format which volume is saved as; see 'rd_volume.pro'
		/READIT - if set, then read the volume and return results in 'vol' and
			'hdr' parameters (default is not)
		vol - 3D volume array; see /READIT [RETURNED]
		hdr - VAPET header of returned volume; see /READIT [RETURNED]
		refVolDir - name of reference volume directory; the default is specified
			by the enviromental variable VAST_REFVOLDIR; if this is not set
			then the default is '/data/projects/refVol'
		refVolDB - name of the reference volume data base (default is 
			<refVolDir>/refvol.db
		error - error status; a 1 is returned if the program is called incorrectly
			or if the found reference volume cannot be read (see /READIT), otherwise
			a zero is return; it is not an error if the reference volume cannot be
			found
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Finds a reference volume (usually MRI) of specified voxel and
		volume size. It is assumed that a data base for the reference
		volumes exists in the reference volume directory. This data base
		file is an ASCII file with one row per volume. The first 3 numbers
		are the volume size, the next 3 numbers are the voxel sizes in
		cm's, the field is the name of the volume, and the last field is
		the volume format (e.g, 0 for VAPET format).

	HISTORY
		02/14/01 - Jon Anderson - original code

(See find_refvol.pro)


FLOAT2STR

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		float2str - return string version of floating point number

	SYNOPSIS
		float_string = float2str(fnum, DECIMAL=1, /COMMA, /DEBUG)

	DESCRIPTION
		Returns a string representing the given floating point
		number truncated to the given number of decimal
		places.

	PARAMETERS
		fnum - floating point number
		decimal - desired number of decimal places
			(default is 1)
		/COMMA - use comma separater for arrays
		/DEBUG - optional flag for debug output
		<return> - string version of 'fnum'

	HISTORY
		3/26/91 - kas - original code
		2/28/92 - kas - added special logic for DECIMAL=0
		8/25/92 - kas - added logic for arrays
		8/27/92 - kas - added /COMMA
		9/3/92 - kas - fixed bug for neg values with DECIMAL=0
		8/8/94 - kas - changed to stub call to flt2str

(See float2str.pro)


FLT2STR

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		flt2str - return string version of floating point number

	SYNOPSIS
		float_string = flt2str(fnum, DECIMAL=1, /COMMA, /VECTOR, /DEBUG)

	DESCRIPTION
		Returns a string representing the given floating point
		number truncated to the given number of decimal
		places.

	PARAMETERS
		fnum - floating point number
		decimal - desired number of decimal places
			(default is 1)
		/COMMA - use comma separater for arrays
		/VECTOR - optional flag for vector output
			(surrounded by brackets, comma separated)
		/DEBUG - optional flag for debug output
		<return> - string version of 'fnum'

	HISTORY
		3/26/91 - kas - original code
		2/28/92 - kas - added special logic for DECIMAL=0
		8/25/92 - kas - added logic for arrays
		8/27/92 - kas - added /COMMA
		9/3/92 - kas - fixed bug for neg values with DECIMAL=0
		8/8/94 - kas - renamed to flt2str (from float2str)
		10/14/97 - kas - enlarged internal format to allow really large numbers
		10/12/99 - kas - added /VECTOR

(See flt2str.pro)


FMRI_PROC_RD_DEFS

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		fmri_proc_rd_defs - reads FMRI preprocessing defaults

	SYNOPSIS
		@fmri_proc_rd_defs

	PARAMETERS

	DESCRIPTION
		Reads FMRI preprocessing defaults.

	HISTORY
		10/16/96 - Jon Anderson - original code
		2/26/98 - jra - added AIR3 stuff
		9/16/99 - jra - added AIR3C stuff
		6/12/01 - jra - added more intersubject alignment methods

(See fmri_proc_rd_defs.pro)


GAMMARAT

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		gammarat - computes the ratio of 2 gamma functions

	SYNOPSIS
		rat = gammarat(x, y)

	PARAMETERS
		x - value at which to compute numerator gamma function
		y - value at which to compute denominator gamma function

	DESCRIPTION
		Computes the ratio of 2 gamma functions.

	HISTORY
		05/04/00 - Jon Anderson - original code
		6/13/01 - jra - handle big numbers

(See gammarat.pro)


GET_DIR

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		get_dir - returns the directory of a filename

	SYNOPSIS
		dir = get_dir(fname, /RMSLASH)

	PARAMETERS
		fname - pertinent filename
		/RMSLASH - remove leading /'s from input filename
		<return> - directory

	DESCRIPTION
		Returns the directory of a filename including the last '/'.
		Examples:
		IDL> print, get_dir('/abc/def/xxxxx')
			/abc/def/
		IDL> print, get_dir('/abc/def/xxxxx/')
			/abc/def/xxxxx/
		IDL> print, get_dir('/abc/def/xxxxx/', /RMSLASH)
			/abc/def/

	HISTORY
		12/31/92 - jra - original code
		10/16/96 - jra - added /RMSLASH
		12/6/96 - jra - added logic for input string arrays

(See get_dir.pro)


GET_INT_LIST

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		get_int_list - builds an integer vector from the input string

	SYNOPSIS
		get_int_list, str, intVect, NUM=num, /SORTLIST, /UNIQUE,
			DELIM=delim, RANCHAR=ranChar, /SILENT, ERROR=error, /DEBUG

	PARAMETERS
		str - string of specifying integer list
		intVect - returned integer vector
		num - number of integers in returned list
		/SORTLIST - sort list from smallest to highest interger
			(default is not)
		/UNIQUE - return only the unique elements in the list (default
			is not)
		delim - delimiter characters (default is space,tab,comma)
		ranChar - how integer ranges are separated (default is '-')
		/SILENT - do not report errors (default is to report)
		error - error status
		/DEBUG - optional flag for debug output

	DESCRIPTION
		Builds an integer vector from the input string. The string consists
		of integers separated by white space (space or tab), commas, and
		dashes. If two numbers are separated by a dash, then all integers
		between them will be include in the list.

		IDL> get_int_list, '1-4, 10, 7 10', intVect, /SORT, /UNIQUE
		IDL> print, intVect
			1       2       3       4       7      10

	HISTORY
		12/06/96 - Jon Anderson - original code
		8/5/99 - jra - added /SILENT

(See get_int_list.pro)


GET_LIST_FILE

[Previous Routine] [Next Routine] [List of Routines]
	NAME
		get_list_file - widget program for getting volume list files

	SYNOPSIS
		get_list_file, INFO=info, IMAP=iMap, SELVOL=selVol, VOLLIST=volList,
			LISTDIR=listDir, LISTFILT=listFilt, /DEBUG

	PARAMETERS
		info - volume information structure array
		iMap - integer vector (1 element for each volume) indicating
			which list file the volume belongs to; this maybe useful
			when 'info' was created from more than one list file
		selVol - integer vector of volume numbers of those volumes
			selected from the list file(s); if all volumes are selected
			then selVol=[1,...,#vol]
		volList - array of structures holding information about each
			list file; this is mainly for internal usage
		listDir - list of directories to be searched (default is '')
		listFilt - filter to be ap