This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.
This function returns the names of all the directories rooted at the "target" directory. The function is specific for the Windows operating system. The return names are given with respect to the target name.
(See /host/bluemoon/usr2/idllib/contrib/fanning/alldir.pro)
NAME:
ASPECT
PURPOSE:
This function calculates and returns the normalized position
coordinates necessary to put a plot with a specified aspect ratio
into the currently active graphics window. It works on the display
output window as well as in a PostScript output window.
CATEGORY:
Graphics
CALLING SEQUENCE:
position = ASPECT(aspectRatio)
INPUTS:
aspectRatio: A floating point value that is the desired aspect
ratio (ratio of heigth to width) of the plot in the current
graphics output window. If this parameter is missing, an aspect
ratio of 1.0 (a square plot) is assumed.
KEYWORD PARAMETERS:
MARGIN: The margin around the edges of the plot. The value must be
a floating point value between 0.0 and 0.5. It is expressed in
normalized coordinate units. The default margin is 0.15.
OUTPUTS:
position: A four-element floating array of normalized coordinates.
The order of the elements is [x0, y0, x1, y1], similar to the
!P.POSITION system variable or the POSITION keyword on any IDL
graphic command.
EXAMPLE:
To create a plot with an aspect ratio of 1:2 and a margin of
0.10 around the edge of the output window, do this:
plotPosition = ASPECT(0.5, Margin=0.10)
PLOT, Findgen(11), POSITION=plotPosition
Notice this can be done in a single IDL command, like this:
PLOT, Findgen(11), POSITION=ASPECT(0.5, Margin=0.10)
MODIFICATION HISTORY:
Written by: David Fanning, November 1996.
Added better error checking, 18 Feb 97, DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/aspect.pro)
Name:
binary
Purpose:
Returns the binary representation of a number of any numerical type.
Argument:
number scalar or array of numbers (any numerical type)
Returns:
Byte array with binary representation of numbers.
Examples:
Binary representation of 11b:
IDL> print, binary(11b)
0 0 0 0 1 0 1 1
Binary representation of pi (x86: Little-endian IEEE representation):
IDL> print, format='(z9.8,5x,4(1x,8i1))', long(!pi,0), binary(!pi)
40490fdb 01000000 01001001 00001111 11011011 (x86 Linux)
0fdb4149 00001111 11011011 01000001 01001001 (Alpha OpenVMS)
IDL> print, format='(8(1x,8i0))', binary(!dpi)
01000000 00001001 00100001 11111011 01010100 01000100 00101101 00011000
Some first tests before type double was added:
print, format='(2a6,4x,2z9.8,4x,8z3.2)', $
!version.arch, !version.os, long(!dpi,0,2), byte(!dpi,0,8)
x86 linux 54442d18 400921fb 18 2d 44 54 fb 21 09 40
sparc sunos 400921fb 54442d18 40 09 21 fb 54 44 2d 18
alpha vms 0fda4149 68c0a221 49 41 da 0f 21 a2 c0 68
(Beginning with IDL 5.1, Alpha VMS uses IEEE representation as well.)
Modification history:
19 Dec 1997 Originally a news posting by David Fanning.
(Re: bits from bytes)
20 Dec 1997 "Complete" rewrite: eliminate loops.
22 Dec 1997 Bit shift instead of exponentiation, return byte
array, handle input arrays.
Think about double and complex types.
22 Sep 1998 Complete rewrite: reduce every numerical type to
single bytes. Check that big and little endian machines
return exactly the same results (if IEEE).
(See /host/bluemoon/usr2/idllib/contrib/fanning/best_binary.pro)
This function returns the binary representation of byte, integer, and long integer numbers. ; What kind of number is this?
(See /host/bluemoon/usr2/idllib/contrib/fanning/better_binary.pro)
This function returns the binary representation of byte, integer, and long integer numbers. ; What kind of number is this?
(See /host/bluemoon/usr2/idllib/contrib/fanning/binary.pro)
NAME:
CHGCOLOR
PURPOSE:
The purpose of this routine is to allow the user to change
the color at a particular color index. The user is able to
mix their own color by manipulating red, green, and blue
sliders. This routine is ideal for changing axes or background
colors of a plot, for example. The routine works on 8-bit,
16-bit, and 24-bit displays.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, Colors.
CALLING SEQUENCE:
CHGCOLOR, index
REQUIRED INPUTS:
INDEX: The color index to be changed. It must be a value
between 0 and 255.
KEYWORD PARAMETERS:
LABEL: Text that goes next to the color window. The default is
"Resulting Color".
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
NOTIFYID: A a 2 column by n row array that contains the IDs of widgets
that should be notified when CHGCOLOR changes a color. The first
column of the array contains widgets that should be notified. The
second column contains IDs of widgets that are at the top of the
hierarch in which the corresponding widgets in the first column
are located. (The purpose of the top widget IDs is to make it
possible for the widget in the first column to get the "info"
structure of the widget program.) An CHGCOLOR_LOAD event will be
sent to the widget identified in the first column. The event
structure is defined like this:
event = {CHGCOLOR_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
r:(!D.N_COLORS < 256), g:(!D.N_COLORS < 256), b:(!D.N_COLORS < 256)}
The ID field will be filled out with NOTIFYID(0, n) and the TOP
field will be filled out with NOTIFYID(1, n).
TITLE: This is the window title. It is "Modify Drawing Color" by
default. The program is registered with the name "chgcolor " plus
the TITLE string. The register name is checked before the widgets
are defined. This gives you the opportunity to have multiple copies
of CHGCOLOR operating simultaneously. (For example, one will change
the background color and one will change the plotting color.)
XOFFSET: This is the X offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
YOFFSET: This is the Y offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Color at the specified index is changed. Events are sent to widgets
if the NOTIFYID keyword is used.
RESTRICTIONS:
None.
EXAMPLE:
To change the background color of a plot, type:
CHGCOLOR, !P.Background
To see a more complete example, look at the program SLICE
in the Coyote Software Library:
ftp://ftp.frii.com/pub/dfanning/outgoing/idl_examples
MODIFICATION HISTORY:
Written by David Fanning, 23 April 97.
12 May 97, Fixed a bug in the way colors were loaded when
a tracking event occurred. DWF
13 May 97, Added a JUST_REGISTER keyword and set it up for
running in IDL 5.0 as a non-blocking widget.
27 Sept 98. Fixed problems caused by IDL 5.1 color changes.
27 Sept 98. Removed JUST_REGISTER keyword. Made widget non-blocking.
03 Nov 98. Modified layout and added slider ganging. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/chgcolor.pro)
NAME: CIndex
PURPOSE: This is a program for viewing the current colors in the
colortable with their index numbers overlayed on each color.
CATEGORY: Graphics
CALLING SEQUENCE: CIndex
INPUTS: None.
Optional Inputs: None
OUTPUTS: None
OPTIONAL OUTPUTS: None
KEYWORD Parameters: None
COMMON BLOCKS: None
SIDE EFFECTS: None
RESTRICTIONS: None
PROCEDURE:
Draws a 16x16 set of small rectangles in 256 different colors.
Writes the color index number on top of each rectangle.
MODIFICATION HISTORY: David Fanning, RSI, May 1995
Widgetized and made it work in 24-bit color. Colors are
updated by clicking in window. 22 Oct 98.
(See /host/bluemoon/usr2/idllib/contrib/fanning/cindex.pro)
NAME:
COLOR24
PURPOSE:
The purpose of this function is to convert a RGB color triple
into the equivalent 24-big long integer.
CATEGORY:
Graphics, Color Specification.
CALLING SEQUENCE:
color = COLOR24(rgb_triple)
INPUTS:
RGB_TRIPLE: A three-element column or row array representing
a color triple. The values of the elements must be between
0 and 255.
KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
To convert the color triple for the color YELLOW,
(255, 255, 0), to the hexadecimal value '00FFFF'x
or the decimal number 65535, type:
color = COLOR24([255, 255, 0])
This routine was written to be used with routines like
COLORS or GETCOLOR
MODIFICATION HISTORY:
Written by: David Fanning, 3 February 96.
(See /host/bluemoon/usr2/idllib/contrib/fanning/color24.pro)
NAME:
COLORBAR
PURPOSE:
The purpose of this routine is to add a color bar to the current
graphics window.
CATEGORY:
Graphics, Widgets.
CALLING SEQUENCE:
COLORBAR
INPUTS:
None.
KEYWORD PARAMETERS:
BOTTOM: The lowest color index of the colors to be loaded in
the bar.
CHARSIZE: The character size of the color bar annotations. Default is 1.0.
COLOR: The color index of the bar outline and characters. Default
is ncolors - 1 + bottom.
DIVISIONS: The number of divisions to divide the bar into. There will
be (divisions + 1) annotations. The default is 2.
FORMAT: The format of the bar annotations. Default is '(F6.2)'.
MAX: The maximum data value for the bar annotation. Default is
NCOLORS-1.
MIN: The minimum data value for the bar annotation. Default is 0.
NCOLORS: This is the number of colors in the color bar.
POSITION: A four-element array of normalized coordinates in the same
form as the POSITION keyword on a plot. Default is
[0.88, 0.15, 0.95, 0.95] for a vertical bar and
[0.15, 0.88, 0.95, 0.95] for a horizontal bar.
PSCOLOR: This keyword is only applied if the output is being sent to
a PostScript file. It indicates that the PostScript device
is configured for color output. If this keyword is set, then
the annotation is drawn in the color specified by the COLOR
keyword. If the keyword is not set, the annotation is drawn
in the color specified by the !P.COLOR system variable
(usually this will be the color black). In general, this
gives better looking output on non-color or gray-scale
printers. If you are not specifically setting the annotation
color (with the COLOR keyword), it will probably
be better NOT to set this keyword either, even if you
are outputting to a color PostScript printer.
RIGHT: This puts the labels on the right-hand side of a vertical
color bar. It applies only to vertical color bars.
TITLE: This is title for the color bar. The default is to have
no title.
TOP: This puts the labels on top of the bar rather than under it.
The keyword only applies if a horizontal color bar is rendered.
VERTICAL: Setting this keyword give a vertical color bar. The default
is a horizontal color bar.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Color bar is drawn in the current graphics window.
RESTRICTIONS:
The number of colors available on the display device (not the
PostScript device) is used unless the NCOLORS keyword is used.
EXAMPLE:
To display a horizontal color bar above a contour plot, type:
LOADCT, 5, NCOLORS=100
CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
C_COLORS=INDGEN(25)*4, NLEVELS=25
COLORBAR, NCOLORS=100
MODIFICATION HISTORY:
Written by: David Fanning, 10 JUNE 96.
10/27/96: Added the ability to send output to PostScript. DWF
11/4/96: Substantially rewritten to go to screen or PostScript
file without having to know much about the PostScript device
or even what the current graphics device is. DWF
1/27/97: Added the RIGHT and TOP keywords. Also modified the
way the TITLE keyword works. DWF
7/15/97: Fixed a problem some machines have with plots that have
no valid data range in them. DWF
12/5/98: Fixed a problem in how the colorbar image is created that
seemed to tickle a bug in some versions of IDL. DWF.
1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/colorbar.pro)
NAME:
COLORBAR__DEFINE
PURPOSE:
The purpose of this routine is to implement a COLORBAR object
class. The ColorBar is rendered in the direct graphics system.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Graphics.
CALLING SEQUENCE:
colorbar = Obj_New("COLORBAR")
INPUTS:
All inputs to the program are via keyword parameters.
KEYWORD PARAMETERS:
Background: Background color. This is the color with which the colorbar is
erased. The default color is !P.Background.
Bottom: Bottom color index of colors allocated to colorbar.
Charsize: Character size of annotation. Default is 1.0.
Color: Color of annotation and outline. Default is !P.Color.
Font: Font to use for annotation. Default is -1, Hershey fonts.
Format: Format of annotation. Default is "(F8.2)".
Major: The number of major tick intervals. Default is 5.
Minor: The number of minor tick intervals. Default is 2.
MinusOne: Set this keyword to choose MinusOne keyword on the Congrid command
that resizes the colorbar into the window.
NColors: The number of colors allocated to colorbar. Default is (256 < !D.N_Colors).
Neighbor: Set to indicate Nearest Neighbor sampling for Congrid. Default is 0 (Bilinear).
Position: The position of colorbar in normalized coordinates. Default for a horizontal
colorbar is [0.15, 0.88, 0.85, 0.95]. Default for a vertical colorbar is
[0.88, 0.15, 0.95, 0.85]. These defaults are designed for a 400 by 400 window.
Range: The data range on colorbar. Default is [0, 255].
TickLen: The length of tick marks. Default is 0.2.
Title: The title of the color bar. Default is a null string.
Vertical: Set this keyword if you want a vertical colorbar. Default is horizontal.
XEraseBox: A five-element vector of X points (normalized) for erasing the colorbar plot.
Normally this keyword will not have to be used. The program uses the plot
REGION for erasing. But larger character sizes can result in annotation going
outside the region enclosed by the plot. If that is the case, then use this
keyword along with YEraseBox to specify a larger-than-normal erasure area.
The points are sent to the POLYFILL command for erasing.
POLYFILL, xEraseBox, yEraseBox, /Normal, Color=background
YEraseBox: A five-element vector of Y points (normalized) for erasing the colorbar plot.
OBJECT METHODS:
Draw: This procedure method draws the colorbar in the display window. The ERASE keyword
to this method will erase the current colorbar (by calling the ERASE method)
before drawing the colorbar in the display window.
colorbar->Draw
Erase: This procedure method erases the colorbar object in the window. It accomplishes
this by performing a POLYFILL in the background color. This method is
primarily useful for interactive graphics display devices.
colorbar->Erase
GetProperty: This procedure method allows one to obtain the current state of the
object via the keyword parameters listed above.
colorbar->GetProperty, Range=currentRange, Title=currentTitle
Print, currentRange, currentTitle
SetProperty: This procedure method allows one to set the properties of the colorbar
object via the keywords described above. In addition, a DRAW and ERASE
keyword are provided so that the colorbar can be immediately drawn when
the new property is set.
colorbar->SetProperty, Range=[500, 15000], /Erase, /Draw
COMMON BLOCKS:
None.
SIDE EFFECTS:
The display window is not erased first.
RESTRICTIONS:
None.
EXAMPLE:
To create a colorbar, use it, then destroy it, type:
colorbar = Obj_New("COLORBAR", Title='Colorbar Values', Range=[0,1000], Format='(I4)')
Window
LoadCT, 5
colorbar->Draw
colorbar->SetProperty, Range=[0,500], /Erase, /Draw
Obj_Destroy, colorbar
MODIFICATION HISTORY:
Written by: David Fanning, Fanning Software Consulting, 26 November 1998.
Added Horizontal keyword to SetProperty method and fixed problem in going
from Vertical to Horizontal color bars. 29 Nov 1998. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/colorbar__define.pro)
NAME:
CONGRID
PURPOSE:
Shrink or expand the size of an array by an arbitrary amount.
This IDL procedure simulates the action of the VAX/VMS
CONGRID/CONGRIDI function.
This function is similar to "REBIN" in that it can resize a
one, two, or three dimensional array. "REBIN", however,
requires that the new array size must be an integer multiple
of the original size. CONGRID will resize an array to any
arbitrary size (REBIN is somewhat faster, however).
REBIN averages multiple points when shrinking an array,
while CONGRID just resamples the array.
CATEGORY:
Array Manipulation.
CALLING SEQUENCE:
array = CONGRID(array, x, y, z)
INPUTS:
array: A 1, 2, or 3 dimensional array to resize.
Data Type : Any type except string or structure.
x: The new X dimension of the resized array.
Data Type : Int or Long (greater than or equal to 2).
OPTIONAL INPUTS:
y: The new Y dimension of the resized array. If the original
array has only 1 dimension then y is ignored. If the
original array has 2 or 3 dimensions then y MUST be present.
z: The new Z dimension of the resized array. If the original
array has only 1 or 2 dimensions then z is ignored. If the
original array has 3 dimensions then z MUST be present.
KEYWORD PARAMETERS:
INTERP: If set, causes linear interpolation to be used.
Otherwise, the nearest-neighbor method is used.
CUBIC: If specified and non-zero, "Cubic convolution"
interpolation is used. This is a more
accurate, but more time-consuming, form of interpolation.
CUBIC has no effect when used with 3 dimensional arrays.
If this parameter is negative and non-zero, it specifies the
value of the cubic interpolation parameter as described
in the INTERPOLATE function. Valid ranges are -1 <= Cubic < 0.
Positive non-zero values of CUBIC (e.g. specifying /CUBIC)
produce the default value of the interpolation parameter
which is -1.0.
MINUS_ONE:
If set, will prevent CONGRID from extrapolating one row or
column beyond the bounds of the input array. For example,
If the input array has the dimensions (i, j) and the
output array has the dimensions (x, y), then by
default the array is resampled by a factor of (i/x)
in the X direction and (j/y) in the Y direction.
If MINUS_ONE is present (AND IS NON-ZERO) then the array
will be resampled by the factors (i-1)/(x-1) and (j-1)/(y-1).
OUTPUTS:
The returned array has the same number of dimensions as the original
array and is of the same data type. The returned array will have
the dimensions (x), (x, y), or (x, y, z) depending on how many
dimensions the input array had.
PROCEDURE:
IF the input array has three dimensions, or if INTERP is set,
then the IDL interpolate function is used to interpolate the
data values.
If the input array has two dimensions, and INTERP is NOT set,
then the IDL POLY_2D function is used for nearest neighbor sampling.
If the input array has one dimension, and INTERP is NOT set,
then nearest neighbor sampling is used.
EXAMPLE:
; vol is a 3-D array with the dimensions (80, 100, 57)
; Resize vol to be a (90, 90, 80) array
vol = CONGRID(vol, 90, 90, 80)
MODIFICATION HISTORY:
DMS, Sept. 1988.
DMS, Added the MINUS_ONE keyword, Sept. 1992.
Daniel Carr. Re-wrote to handle one and three dimensional arrays
using INTERPOLATE function.
DMS, RSI, Nov, 1993. Added CUBIC keyword.
SJL, Nov, 1997. Formatting, conform to IDL style guide.
DWF, Jan, 1999. Added error checking to look for divide by zero.
(See /host/bluemoon/usr2/idllib/contrib/fanning/xcolors.pro)
This utility routine is used to count the number of columns in an ASCII data file. It uses the first row. as the count example.
(See /host/bluemoon/usr2/idllib/contrib/fanning/count_columns.pro)
This utility routine is used to count the number of rows in an ASCII data file.
(See /host/bluemoon/usr2/idllib/contrib/fanning/count_rows.pro)
NAME: COYOTELIST__DEFINE PURPOSE: The purpose of this program is to implement a list that is linked in both the forward and backward directions. There is no restriction as to what can be stored in a linked list node. The linked list is implemented as an object.
(See /host/bluemoon/usr2/idllib/contrib/fanning/coyotelist__define.pro)
Format an axis for showing dates.
(See /host/bluemoon/usr2/idllib/contrib/fanning/date.pro)
Very simple event handler. Get array, execute the "command".
(See /host/bluemoon/usr2/idllib/contrib/fanning/display.pro)
This function draws a rubberband box in the window specified by the positional parameter (or the current graphics window, by default). The coordinates of the final box are returned by the function. Click in the graphics window and drag to draw the box. ; Catch possible errors here.
(See /host/bluemoon/usr2/idllib/contrib/fanning/drawbox.pro)
This is the event handler for the draw widget graphics window. ; Deal only with DOWN, UP, and MOTION events.
(See /host/bluemoon/usr2/idllib/contrib/fanning/drawbox_widget.pro)
All program button events handled here.
(See /host/bluemoon/usr2/idllib/contrib/fanning/drawline.pro)
NAME:
FILE_LINE
PURPOSE:
This function finds the number of lines in an ASCII data file.
It should be platform independent (well Windows and UNIX at least!).
CATEGORY:
Read/Write OR Input/Output.
CALLING SEQUENCE:
Result = FILE_LINE(File_name)
INPUTS:
File_name: The name of the file to find the number of lines in.
This can now be an array of filenames!!
OUTPUTS:
This function returns the number of lines in a file. If the input is
an array of filenames then the output is a long array with length of
the input array plus 1. This array will contain the number of lines
in each of the files plus the total number of lines for all the files
combined.
PROCEDURE:
Calls FILE_SIZE.
EXAMPLE:
To find the number of lines in the file test.dat enter:
IDL> out=FILE_LINE('test.dat')
OR
IDL> files=['test1.dat','test2.dat','test3.dat']
IDL> print,FILE_LINE(files)
15 20 30 65
MODIFICATION HISTORY:
Copyright R.Bauer 2. Jan. 1996
Modified by Paul Krummel, 12 February 1997, CSIRO Division of Atmospheric
Research. Changed error messages to english and modified them. Added complete
header information and usage information (help keyword).
Added some more comments and a check to see if filename is a string.
Modified by Paul Krummel, 8 January 1998. Has been considrably modified
and can now take in an array of filenames or just one file name.
(See /host/bluemoon/usr2/idllib/contrib/fanning/file_line.pro)
NAME:
FILE_SIZE
PURPOSE:
This function finds the number of bytes in an ASCII data file.
It should be platform independent (well Windows and UNIX at least!).
CATEGORY:
Read/Write OR Input/Output.
CALLING SEQUENCE:
Result = FILE_SIZE(File_name)
INPUTS:
File_name: The name of the file to find the number of bytes in.
OUTPUTS:
This function returns the number of bytes in a file.
PROCEDURE:
Uses fstat to find information about the opened unit number.
EXAMPLE:
To find the size in bytes of the file test.dat enter:
IDL> out=FILE_SIZE('test.dat')
MODIFICATION HISTORY:
Copyright R.Bauer 2. Jan. 1996
The idea to use fstat instead of spawn ls -l was given by Phil Williams.
Modified by Paul Krummel, 12 February 1997, CSIRO Division of Atmospheric
Research. Changed error messages to english and modified them. Added complete
header information and usage information (help keyword).
Added some more comments and a check to see if filename is a string.
(See /host/bluemoon/usr2/idllib/contrib/fanning/file_line.pro)
NAME:
GETCOLOR
PURPOSE:
The purpose of this function is to return the value of a
"named" color. The result is a 1-by-3 vector containing
the values of the color triple if the user specified a
a particular color. Or it is a 5-by-3 array containing the
color triples of all 5 supported color if no positional
parameter is passed.
CATEGORY:
Graphics, Color Specification.
CALLING SEQUENCE:
result = GETCOLOR(color)
OPTIONAL INPUTS:
COLOR: A string with the "name" of the color. Five colors
are allowed: "CHARCOAL", "RED", "GREEN", "BLUE" and "YELLOW".
If the string is anything else, a YELLOW color triple is
returned.
KEYWORD PARAMETERS:
TRUE: If this keyword is set the specified color triple is returned
as a 24-bit integer equivalent. The lowest 8 bits correspond to
the red value; the middle 8 bits to the green value; and the
highest 8 bits correspond to the blue value.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
The TRUE keyword is operational only if the input COLOR is present.
EXAMPLE:
To load a yellow color in color index 100 and plot in yellow, type:
TVLCT, GETCOLOR('yellow'), 100
PLOT, data, COLOR=100
To do the same thing on a 24-bit color system, type:
PLOT, data, COLOR=GETCOLOR('yellow', /TRUE)
To load all five colors into the current color table, starting at
color index 200, type:
TVLCT, GETCOLOR(), 200
MODIFICATION HISTORY:
Written by: David Fanning, 10 February 96.
Fixed a bug in which N_ELEMENTS was spelled wrong. 7 Dec 96.
(See /host/bluemoon/usr2/idllib/contrib/fanning/getcolor.pro)
NAME:
GETIMAGE
PURPOSE:
The purpose of this function is to allow the user to open either
regular or XDR binary image files of two or three dimensions.
CATEGORY:
Widgets, File I/O.
CALLING SEQUENCE:
image = GETIMAGE(filename)
INPUTS:
filename: The name of the file to open for reading.
KEYWORD PARAMETERS:
CANCEL: An output variable that can be set to a named variable.
The value of the return variable will be 1 if the user clicked
the "Cancel" button or if there was a problem reading the file.
DIRECTORY: The name of the directory the file is located in. By
default the program looks in the "training" directory under the
main IDL directory, if one exists. Otherwise, it defaults to the
current directory.
FRAMES: The 3rd dimension of a 3D data set. Defaults to 0.
HEADER: The size of any header information in the file in BYTES.
Default is 0.
PARENT: The group leader for this widget program. The PARENT is
required if GETIMAGE is called from another widget program.
XDR: Set this keyword if the binary file is of XDR type.
XOFFSET: This is the X offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
XSIZE: The size of the 1st dimension of the data.
YOFFSET: This is the Y offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
YSIZE: The size of the 2nd dimension of the data.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A "CANCEL" operation is indicated by a 0 return value.
Any error in reading the file results in a 0 return value.
RESTRICTIONS:
None.
EXAMPLE:
To load the image "galaxy.dat" in the $IDL/examples/data
directory, type:
image = GETIMAGE('galaxy.dat', DIRECTORY=!DIR + '/examples/data', $
XSIZE=256, YSIZE=256, Cancel=cancelled, Parent=event.top)
IF NOT cancelled THEN TV, image
MODIFICATION HISTORY:
Written by: David Fanning, 3 February 96.
Fixed bug that prevented reading INTEGER data. 19 Dec 96.
Modifed program for IDL 5 MODAL operation. 19 Oct 97.
Added CANCEL keyword. 27 Oct 97. DWF.
Fixed CANCLE keyword spelling. Sigh... 29 JUN 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/getimage.pro)
This is a function that recursively searches through a structure tree, finding ALL of the structure's field names. It returns a pointer to an array of pointers, each pointing to the names of structure fields.
(See /host/bluemoon/usr2/idllib/contrib/fanning/get_tags.pro)
NAME:
HCOLORBAR
FILENAME:
hcolorbar__define.pro
;
PURPOSE:
The purpose of this program is to create a horizontal
colorbar object to be used in conjunction with other
IDL 5 graphics objects.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
IDL 5 Object Graphics.
CALLING SEQUENCE:
thisColorBar = Obj_New('HColorBar')
REQUIRED INPUTS:
None.
INIT METHOD KEYWORD PARAMETERS:
COLOR: A three-element array representing the RGB values of a color
for the colorbar axes and annotation. The default value is
white: [255,255,255].
NAME: The name associated with this object.
NCOLORS: The number of colors associated with the colorbar. The
default is 256.
MAJOR: The number of major tick divisions on the colorbar axes.
The default is 5.
MINOR: The number of minor tick marks on the colorbar axes.
The default is 4.
PALETTE: A palette object for the colorbar. The default palette
is a gray-scale palette object.
POSITION: A four-element array specifying the position of the
colorbar in normalized coordinate space. The default position
is [0.10, 0.90, 0.90, 0.95].
RANGE: The range associated with the colorbar axis. The default
is [0, NCOLORS].
TEXT: A text object. Colorbar axis annotation will use this text
object to set its properties. The default is a text object
using a 8 point Helvetica font in the axis color.
TITLE: A string containing a title for the colorbar axis
annotation. The default is a null string.
OTHER METHODS:
GetProperty (Procedure): Returns colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
NAME
MAJOR
MINOR
PALETTE
POSITION
RANGE
TEXT
TITLE
SetProperty (Procedure): Sets colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
NAME
MAJOR
MINOR
PALETTE
POSITION
RANGE
TEXT
TITLE
SIDE EFFECTS:
A HColorBar structure is created. The colorbar INHERITS IDLgrMODEL.
Thus, all IDLgrMODEL methods and keywords can also be used. It is
the model that is selected in a selection event, since the SELECT_TARGET
keyword is set for the model.
RESTRICTIONS:
None.
EXAMPLE:
To create a colorbar object and add it to a plot view object, type:
thisColorBarObject = Obj_New('HColorBar')
plotView->Add, thisColorBarObject
plotWindow->Draw, plotView
MODIFICATION HISTORY:
Written by David Fanning, from VColorBar code, 20 Sept 98. DWF.
Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/hcolorbar__define.pro)
FUNCTION NAME:
ICON_BUTTON
PURPOSE:
This is a compound widget to put up a small button with an image on it.
It is implemented as a draw widget, but acts like a button. The event
structure that is returned is a WIDGET_BUTTON event structure for a
SELECT event.
MAJOR TOPICS:
Widget Programming
FUNCTION:
Used almost identically to WIDGET_BUTTON.
CALLING SEQUENCE:
buttonID = ICON_BUTTON(parent, Value='icon_button', Image=image)
POSITIONAL PARAMETERS:
parent -- The identifier of the parent widget.
KEYWORD PARAMETERS:
BOTTOM -- The starting color index of the image colors.
COLORINDEX -- A four-element array that gives the color indicies for the button
colors. COLORINDEX(0) is the button outline color. COLORINDEX(1) is the dark
edge color. COLORINDEX(2) is the light edge color.
COLORINDEX(3) is the button highlight color.
EVENT_FUNC -- The name of an event handler function for this button.
EVENT_PRO -- The name of an event handler procedure for this button.
IMAGE -- The 2D array to use as the icon display.
NCOLORS -- The number of colors to use for the image display.
VALUE -- The value of the icon. (Used to make it look like a button.)
UVALUE -- A user value. Used in the normal way.
XOFFSET -- The X offset of the icon on the display.
YOFFSET -- The Y offset of the icon on the display.
XSIZE -- This is the XSIZE of the icon.
YSIZE -- This is the YSIZE of the icon.
EXAMPLE:
To make an icon button out of the CTSCAN.DAT image, do this:
Load colors for the icon button's boundaries.
TVLCT, [255, 70, 150, 255], [255, 70, 150, 255], $
[255, 70, 150, 255], 200
Read image data.
ctscan = GetImage()
Build widgets.
base = Widget_Base()
icon = Icon_Button(base, ColorIndex=Indgen(4)+200, $
Value='icon_button', Image=ctscan, NColors=200, Bottom=0)
Widget_Control, base, /Realize
MAJOR FUNCTIONS and PROCEDURES:
None.
EVENT STRUCTURE:
event = {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:1}
MODIFICATION HISTORY:
Written by: David Fanning, August 1996.
Given to attendees of IDL training courses.
(See /host/bluemoon/usr2/idllib/contrib/fanning/icon_ex.pro)
x - The x coordinate of the point. y - The y coordinate of the point. px - The x coordinates of the polygon. py - The y coordinates of the polygon. The return value of the function is 1 if the point is inside the polygon and 0 if it is outside the polygon.
(See /host/bluemoon/usr2/idllib/contrib/fanning/inside.pro)
NAME:
LINKEDLIST
FILENAME:
linkedlist__define.pro
PURPOSE:
The purpose of this program is to implement a list that
is linked in both the forward and backward directions. There
is no restriction as to what can be stored in a linked list
node. The linked list is implemented as an object.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
General programming.
CALLING SEQUENCE:
mylist = Obj_New('LINKEDLIST', item)
OPTIONAL INPUTS:
item: The first item added to the list. Items can be any
valid IDL variable type.
COMMON BLOCKS:
Are you kidding?!
RESTRICTIONS:
Be sure to destroy the LINKEDLIST object when you are finished
with it: Obj_Destroy, mylist
Node index numbers start at 0 and go to n-1, where n is the
number of items in the list.
PUBLIC METHODS:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::ADD, item, index, AFTER=after, BEFORE=before
The ADD method adds a data item to the list.
Parameters:
item: The data item to be added to the list. Required.
index: The location in the list where the data item is
to be added. If neither the AFTER or BEFORE keyword is
set, the item is added AFTER the item at the index location.
If index is missing, the index points to the last item in
the list. Optional.
Keywords:
AFTER: If this keyword is set, the item is added after the
item at the current index.
BEFORE: If this keyword is set, the item is added before the
item at the current index.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::DELETE, index, ALL=all
The DELETE method deletes an item from the list.
Parameters:
index: The location in the list where the data item is
to be delete. If index is missing, the index points to
the last item in the list. Optional.
Keywords:
ALL: If this keyword is set, all items in the list are deleted.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_COUNT
The GET_COUNT method returns the number of items in the list.
Return Value: The number of items stored in the linked list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_ITEM, index
The GET_ITEM method returns a pointer to the specified data
item from the list.
Parameters:
index: The location in the list from which the data item is
to be retrieved. If not present, the last item in the list
is retrieved. Optional.
Return Value: A pointer to the specified data item stored
in the list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FUNCTION LINKEDLIST::GET_NODE, index
The GET_NODE method returns a pointer to the specified node
from the list.
Parameters:
index: The location in the list from which the data node is
to be retrieved. If not present, the last node in the list
is retrieved. The node is a structure with three fields:
Previous is a pointer to the previous node in the list.
Next is a pointer to the next node in the list. A null pointer
in the previous field indicates the first node on the list. A
null pointer in the next field indicates the last node on the
list. The item field is a pointer to the item stored in the
node. Optional.
Return Value: A pointer to the specified node structure in
the linked list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::HELP, PRINT=print
The HELP method performs a HELP command on each item
in the linked list.
Keywords:
PRINT: If this keyword is set, the PRINT command is used
instead of the HELP command on the items in the list.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO LINKEDLIST::MOVE_NODE, nodeIndex, location, BEFORE=before
The MOVE_NODE method moves a list node from one location to another.
Parameters:
nodeIndex: The location in the list of the node you are moving.
Required.
location: The location (index) you are moving the node to. If
location is missing, the location points to the node at the
end of the list.
Keywords:
BEFORE: If this keyword is set, the node is added to the
list before the location node. Otherwise, it is added after
the location node.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXAMPLE:
mylist = Obj_New("LINKEDLIST", 5)
mylist->Add, 10
mylist->Add, 7.5, 1, /Before
mylist->Add, 12.5
mylist->Help
mylist->Delete
mylist->Help, /Print
MODIFICATION HISTORY:
Written by: David Fanning, 25 August 98.
(See /host/bluemoon/usr2/idllib/contrib/fanning/linkedlist__define.pro)
NAME:
MAKEY
PURPOSE:
Make simulated data. Useful for software development.
CATEGORY:
CALLING SEQUENCE:
data = makey( n, w)
INPUTS:
n = number of data values to make. in
w = smoothing window size (def = 5% of n). in
KEYWORD PARAMETERS:
Keywords:
/PERIODIC forces data to match at ends. Will not work
for smoothing windows much more than about 30% of n.
SEED=s Set random seed for repeatable results.
LASTSEED=s returns last random seed used.
OUTPUTS:
data = resulting data array (def = undef). out
COMMON BLOCKS:
makey_com
NOTES:
MODIFICATION HISTORY:
R. Sterner, 2 Apr, 1986.
Johns Hopkins University Applied Physics Laboratory.
RES 21 Nov, 1988 --- added SEED.
R. Sterner, 2 Feb, 1990 --- added periodic.
R. Sterner, 29 Jan, 1991 --- renamed from makedata.pro.
R. Sterner, 24 Sep, 1992 --- Added /NORMALIZE.
R. Sterner, 1994 Feb 22 --- Greatly simplified. Always normalize.
Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
(See /host/bluemoon/usr2/idllib/contrib/fanning/loaddata.pro)
NAME:
MAKEZ
PURPOSE:
Make simulated 2-d data. Useful for software development.
CATEGORY:
CALLING SEQUENCE:
data = makez( nx, ny, w)
INPUTS:
nx, ny = size of 2-d array to make. in
w = smoothing window size (def = 5% of sqrt(nx*ny)). in
KEYWORD PARAMETERS:
Keywords:
/PERIODIC forces data to match at ends. Will not work
for smoothing windows much more than about 30% of n.
SEED=s Set random seed for repeatable results.
LASTSEED=s returns last random seed used.
OUTPUTS:
data = resulting data array (def = undef). out
COMMON BLOCKS:
makez_com
NOTES:
MODIFICATION HISTORY:
R. Sterner, 29 Nov, 1986.
R. Sterner, 1994 Feb 22 --- Rewrote from new makey.
Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
(See /host/bluemoon/usr2/idllib/contrib/fanning/loaddata.pro)
NAME:
NORMALIZE
PURPOSE:
This is a utility routine to calculate the scaling vector
required to position a graphics primitive of specified range
at a specific position in an arbitray coordinate system. The
scaling vector is given as a two-element array like this:
scalingVector = [translationFactor, scalingFactor]
The scaling vector should be used with the [XYZ]COORD_CONV
keywords of a graphics object or model. For example, if you
wanted to scale an X axis into the coordinate range of -0.5 to 0.5,
you might type something like this:
xAxis->GetProperty, Range=xRange
xScale = Normalize(xRange, Position=[-0.5, 0.5])
xAxis, XCoord_Conv=xScale
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Object Graphics
CALLING SEQUENCE:
xscaling = NORMALIZE(xrange, POSITION=position)
INPUTS:
XRANGE: A two-element vector specifying the data range.
KEYWORD PARAMETERS:
POSITION: A two-element vector specifying the location
in the coordinate system you are scaling into. The vector [0,1]
is used by default if POSITION is not specified.
COMMON BLOCKS:
None.
EXAMPLE:
See above.
MODIFICATION HISTORY:
Written by: David Fanning, OCT 1997.
(See /host/bluemoon/usr2/idllib/contrib/fanning/normalize.pro)
NAME:
OBJECT_SHADE_SURF
PURPOSE:
This program shows you the correct way to write an
elevation-shaded surface in object graphics. This would
be the equivalent of these direct graphics commands:
Surface, data, Shades=BytScl(data)
Shade_Surf, data, Shades=BytScl(data)
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Object Graphics
CALLING SEQUENCE:
OBJECT_SHADE_SURF, data, x, y
INPUTS:
data: The 2D surface data.
x: A vector of X values, corresponding to the X values of data.
y: A vector of Y values, corresponding to the Y values of data.
KEYWORD PARAMETERS:
STYLE: Set equal to 1 for a wire-frame surface. Set equal to 2 for
a solid surface (the default).
COMMON BLOCKS:
None.
EXAMPLE:
OBJECT_SHADE_SURF
MODIFICATION HISTORY:
Written by: David Fanning, November 1998.
(See /host/bluemoon/usr2/idllib/contrib/fanning/object_shade_surf.pro)
NAME:
OWINDOW
PURPOSE:
The purpose of this program is to create an object window.
I use it mostly when I am creating and testing object graphics
programs, but it is also a nice template for larger object
graphics programs. The window is resizeable and it destroys
its objects when it is destroyed.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, IDL 5 Object Graphics.
CALLING SEQUENCE:
thisWindow = OWindow(thisView)
REQUIRED INPUTS:
None. A default view object is created with a gray background and
a viewplane rectangle defined as [0,0,1,1].
OPTIONAL INPUTS:
thisView: A view or scene object that you wish to be displayed
in the window.
RETURN VALUE:
thisWindow: The window graphics object associated with this window.
OPTIONAL KEYWORD PARAMETERS:
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
TITLE: A string used as the title of the graphics window.
XSIZE: The X Size of the graphics window in device coordinates. The
default value is 300.
YSIZE: The Y Size of the graphics window in device coordinates. The
default value is 300.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
To display a view object in this window, type:
IDL> thisWindow = OWindow(thisView)
Later, after you have modified the view object, you can type:
IDL> thisWindow->Draw, modifiedView
MODIFICATION HISTORY:
Written by David Fanning, 19 June 97.
Set RETAIN=1 on draw widget. 6 Oct 97. DWF.
Changed discredited IDLgrContainer to IDL_Container. 29 JUN 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/owindow.pro)
NAME:
PARSELINE
PURPOSE:
This function accepts a string as an argument and returns an
array which contains the numerical values in that string. It can
handle space or comma delimited numerical values. It returns
a value of -1 if non-numerical stuff is found in the line.
CALLING SEQUENCE:
array_out = PARSELINE(string_in, desired_data)
OPTIONAL INPUTS:
DESIRED_DATA -- An array which specifies the desired columns of data
from the string. It is zero based. Column numbers can be repeated in
the array. If this is not specified the default is to return an array
containing each value in the string once in the order they appear in
the string.
KEYWORD PARAMETERS:
DOUBLE -- The default behavior. The returned array will be a double
precision floating point array.
FLOAT -- The returned array will be a single precision floating point
array.
INTEGER -- The returned array will be an array of short integers.
RETURN VALUE:
array_out = dblarr(n_data) N_DATA is either the number of columns in
the string or the number of elements in the DESIRED_DATA array.
USAGE:
The calling procedure will look something like:
IDL> text=''
IDL> openr,1,'input.dat'
IDL> readf,1,text
IDL> data=parseline(text,[0,1,5,4,6,7])
IDL> print,data
0.10000000 3.4000000 2.4000000e-06 5.0000000 2.0080000 0.0000000
MAJOR FUNCTIONS and PROCEDURES:
None.
MODIFICATION HISTORY:
Written by: Alan Munter, munter@uiuc.edu, May 1997.
(See /host/bluemoon/usr2/idllib/contrib/fanning/parseline.pro)
Device, Decomposed=0 ; Establish plot coordinates.
(See /host/bluemoon/usr2/idllib/contrib/fanning/polarplot.pro)
Display an image next to its power spectrum.
(See /host/bluemoon/usr2/idllib/contrib/fanning/power_spectrum.pro)
This program sends the contents of the specified
window to the default printer. The current window
is used if a window index number is not provided.
This program was originally written by David Fanning
using advice from RSI. It was extensively modified and
improved by Armand J.L. Jongen and others on the IDL newsgroup.
KEYWORD PARAMETERS:
LANDSCAPE If this keyword is set, the output is in Landscape
mode. Otherwise, Portrait mode is used.
NOSCALE If this keyword is set, the output is not scaled
to fill the page, but is left in its actual
device coordinate size.
NOCENTER If this keyword is set, the output is positioned
in the lower-left corner of the display. Otherwise,
the output is centered on the page.
; Check parameters.
(See /host/bluemoon/usr2/idllib/contrib/fanning/print_it.pro)
NAME:
PROCESS
PURPOSE:
The purpose of this routine is to demonstrate a simple
image processing program that runs as a "color aware"
application. The program works on 8-bit, 16-bit, and
24-bit displays. The image is displayed in a resizeable
graphics window and the window contents can be saved as
GIF or JPEG images. The application can "protect" its
colors from other applications that change colors. The
color protection is implemented via draw widget EXPOSE
events or the Refresh Colors button in the menubar.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets.
CALLING SEQUENCE:
PROCESS
INPUTS:
image: An optional 2D image. The image is always scaled.
KEYWORD PARAMETERS:
BOTTOM: The lowest color index of the colors to be changed.
GROUP: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
NCOLORS: This is the number of colors to load when a color table
is selected.
COMMON BLOCKS:
None.
SIDE EFFECTS:
This is a non-blocking widget.
RESTRICTIONS:
The GETIMAGE and XCOLORS programs from the Fanning Consulting
web page are required: http://www.dfanning.com/.
EXAMPLE:
To run the program, type:
PROCESS
MODIFICATION HISTORY:
Written by: David Fanning, 13 April 97.
Fixed a bug in the TVImage call. 25 June 97. DWF.
Extensively modified to incorporate changing ideas
about color protection and operation on 8-bit and
24-bit displays. 19 Oct 97. DWF.
Whoops. Forgot to make *this* draw widget the current
graphics window. 15 Nov 97. DWF.
IDL 5.1 changed the way color decomposition works. Had
to find a fix for this. 25 May 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/process.pro)
NAME:
PSWINDOW
PURPOSE:
This function is used to calculate the size of a PostScript
window that has the same aspect ratio (ratio of height to
width) as the current display graphics window. It creates
the largest possible PostScript output window with the
desired aspect ratio. This assures that graphics output
looks similar, if not identical, to PostScript output.
CATEGORY:
Graphics.
CALLING SEQUENCE:
pageInfo = PSWINDOW()
INPUTS:
None.
KEYWORD PARAMETERS:
CM: Normally the structure value that is returned from this
function reports its values in inches. Setting this keyword
causes the return values to be in units of centimeters.
LANDSCAPE: Normally this function assumes a PostScript window
in Portrait mode. Setting this keyword assumes you want
the graphic in Landscape mode.
MARGIN: Normally this function creates the largest possible
PostScript window of the specified aspect ratio that can fit
on an 8.5 x 11 inch PostScript page. The margin is an amount
subtracted from the page size before the output window is sized.
A default margin of 0.5 is used to assure that the page can be
printed on most PostScript printers. The value should be
specified in the same units the function returns.
OUTPUTS:
pageInfo: The output value is a named structure defined like
this:
pageInfo = {PSWINDOW_STRUCT, XSIZE:0.0, YSIZE:0.0, $
XOFSET:0.0, YOFFSET:0.0, INCHES:0}
The units of the four fields are inches unless the CM
keyword is set.
RESTRICTIONS:
The aspect ratio of the current graphics window is calculated
like this:
aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE
A PostScript page of 8.5 x 11.0 inches is assumed.
EXAMPLE:
To create a PostScript output window with the same aspect
ratio as the curently active display window, type:
sizes = PSWINDOW()
SET_PLOT, 'PS'
DEVICE, XSIZE=sizes.xsize, YSIZE=sizes.ysize, $
XOFFSET=sizes.xoffset, YOFFSET=sizes.yoffset, INCHES=sizes.inches
MODIFICATION HISTORY:
Written by: David Fanning, November 1996.
Fixed a bug in which the YOFFSET was calculated incorrectly
in Landscape mode. 12 Feb 97.
Took out a line of code that wasn't being used. 14 Mar 97.
Added correct units keyword to return structure. 29 JUN 98. DWF
(See /host/bluemoon/usr2/idllib/contrib/fanning/pswindow.pro)
NAME:
PS_FORM
PURPOSE:
This function displays a form the user can interactively manipulate
to configure the PostScript device driver (PS) setup. The function returns
a structure of keywords that can be sent directly to the DEVICE command
via its _EXTRA keyword
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
MAJOR TOPICS:
Device Drivers, Hardcopy Output, PostScript Output
PROCEDURE:
This is a pop-up form widget. It is a modal or blocking widget.
Keywords appropriate for the PostScript (PS) DEVICE command are returned.
The yellow box in the upper right hand corner of the form represents the
PostScript page. The green box represents the "window" on the PostScript
page where the graphics will be drawn.
Use your LEFT mouse button to move the plot "window" around the page.
Use your RIGHT mouse button to draw your own plot window on the page.
The CREATE FILE and ACCEPT buttons are meant to indicate slightly
different operations, although this is sometimes confusing. My idea
is that PS_FORM is a *configuration* dialog, something the user displays
if he or she wants to change the way the PostScript device is configured.
Thus, in many of my widget programs if the user clicks a "Write PostScript File"
button, I just go ahead and write a PostScript file without displaying the
form. (I can do this because I always keep a copy of the current device
configuration in my info structure.) To get to the form, the user must
select a "Configure PostScript Device" button.
At that time, the user might select the ACCEPT button to just change
the PostScript device configurations. Or the user can select the
CREATE FILE button, which both accepts the configuration *and* creates
a PostScript file. If you find the CREATE FILE button confusing, you
can just edit it out of the form and use the ACCEPT button for the
same purpose.
HELP:
formInfo = PS_FORM(/Help)
USAGE:
The calling procedure for this function in a widget program will look something
like this:
info.ps_config = PS_FORM(/Initialize)
...
formInfo = PS_FORM(Cancel=canceled, Create=create, $
Defaults=info.ps_config, Parent=event.top)
IF NOT canceled THEN BEGIN
IF create THEN BEGIN
thisDevice = !D.Name
Set_Plot, "PS"
Device, _Extra=formInfo
Enter Your Graphics Commands Here!
Device, /Close
Set_Plot, thisDevice
ENDIF
info.ps_config = formInfo
ENDIF
OPTIONAL INPUT PARAMETERS:
XOFFSET -- Optional xoffset of the top-level base of PS_Form. Default is
to try to center the form on the display.
YOFFSET -- Optional yoffset of the top-level base of PS_Form. Default is
to try to center the form on the display.
INPUT KEYWORD PARAMETERS:
BITS_PER_PIXEL -- The initial configuration of the bits per pixel button.
BLOCKING -- Set this keyword to make this a blocking widget under IDL 5.0.
(All widget programs block under IDL 4.0.)
COLOR -- The initial configuration of the color switch.
DEFAULTS -- A stucture variable of the same type and structure as the
RETURN VALUE of PS_FORM. It will set initial conditions. This makes
it possible to start PS_FORM up again with the same values it had the
last time it was called. For example:
mysetup = PS_FORM()
newsetup = PS_FORM(Defaults=mysetup)
NOTE: Using the DEFAULTS keyword will nullify any of the other
DEVICE-type keywords listed above (e.g., XSIZE, ENCAPSULATED, etc.)
ENCAPSULATED -- The initial configuration of the encapsulated switch.
FILENAME -- The initial filename to be used on the form.
HELP -- Prints a helpful message in the output log.
INCHES -- The initial configuration of the inches/cm switch.
INITIALIZE -- If this keyword is set, the program immediately returns the
"localdefaults" structure. This gives you the means to configue the
PostScript device without displaying the form to the user. I use this
to write a PostScript file directly and also to initialize my info
structure field that contains the current PostScript form setup. Passing
the setup structure into PS_FORM via the DEFAULTS keyword gives my PS_FORM
a program "memory".
info.ps_setup = PS_FORM(/Initialize)
LANDSCAPE -- The initial configuration of the landscape/portrait switch.
LOCALDEFAULTS -- A structure like the DEFAULTS structure. Used if the
"Local Defaults" button is pressed in the form. This gives you the
opportunity to have a "local" as well as "system" default setup.
If this keyword is not used, the procedure PS_Form_Set_Personal_Local_Defaults
is called. Use this procedure (see below) to define your own local
defaults.
XOFFSET -- The initial XOffSet of the PostScript window.
YOFFSET -- The initial YOffSet of the PostScript window.
XSIZE -- The initial XSize of the PostScript window.
YSIZE -- The initial YSize of the PostScript window.
OUTPUT KEYWORD PARAMETERS
CANCEL -- This is an OUTPUT keyword. It is used to check if the user
selected the "Cancel" button on the form. Check this variable rather
than the return value of the function, since the return value is designed
to be sent directly to the DEVICE procedure. The varible is set to 1 if
the user selected the "Cancel" button. Otherwise, it is set to 0.
CREATE -- This output keyword can be used to determine if the user
selected the 'Create File' button rather than the 'Accept' button.
The value is 1 if selected, and 0 otherwise.
RETURN VALUE:
formInfo = { PS_FORM_INFO, $
xsize:0.0, $ ; The x size of the plot
xoff:0.0, $ ; The x offset of the plot
ysize:0.0, $ ; The y size of the plot
yoff:0.0 $ ; The y offset of the plot
filename:'', $ ; The name of the output file
inches:0 $ ; Inches or centimeters?
color:0, $ ; Color on or off?
bits_per_pixel:0, $ ; How many bits per image pixel?
encapsulated:0,$ ; Encapsulated or regular PostScript?
landscape:0 } ; Landscape or portrait mode?
MAJOR FUNCTIONS and PROCEDURES:
None. Designed to work originally in conjunction with XWindow,
a resizable graphics window.
MODIFICATION HISTORY:
Written by: David Fanning, RSI, March 1995.
Given to attendees of IDL training courses.
Modified to work when grapics device set to PostScript: 6 May 95.
Modified to configure initial conditions via keywords: 13 October 95.
Modified to load personal local defaults if LocalDefaults keyword not
used: 3 Nov 95.
Found and fixed bits_per_pixel error in Local Defaults setting
procedure: 3 Nov 95.
Modified to produce initial plot box with the same aspect ratio as
the current graphics window. (XSIZE or YSIZE keywords overrule this
behavior.) 22 Apr 96.
Fixed annoying behavior of going to default-sized plot box when selecting
the Landscape or Portrait option. Now keeps current plot box size.
22 Apr 96.
Made the size and offset text widgets a little bigger and changed the
size and offset formatting from F4.2 to F5.2 to accomodate larger plot
box sizes. 29 Apr 96.
Fixed a bug in the filename text widget that caused a crash when a CR
was hit. 3 Sept 96.
Added the Initialize keyword to immediately return the "localdefaults"
structure. 27 Oct 96.
Fixed another problem with the BITS_PER_PIXEL keyword. 27 Oct 96.
Made the return value a named structure of the name PS_FORM_INFO.
3 Nov 96.
Discovered and fixed a problem whereby YOFFSET was set incorrectly if
LOCALDEFAULTS was used instead of DEFAULTS keyword. 3 Nov 96.
Fixed bug in how Portrait mode was set using YSIZE and XSIZE keywords.
25 Nov 96.
Fixed a bug in how YOFFSET was calculated when in Landscape mode. 27 Nov 96.
Fixed a memory leak with the local defaults pointer. 25 Jan 97.
Added the CREATE keyword and modified the appearance of the form. 22 Apr 97.
Modifed subroutine names to avoid confusion. 22 Apr 97.
Fixed a bug I introduced when I added the CREATE keyword. 23 Apr 97.
Modified the program for IDL 5. 30 May 97, DWF.
Fixed Inches to CM exclusive button problem. 30 May 97, DWF.
Fixed a problem when the widget is killed with the mouse. 30 May 97. DWF
Added a Select Filename button. 12 Oct 97.
Modified program layout slightly. 12 Oct 97.
Added valid directory/file error checking for the filename. 12 Oct 97. DWF
Added further support for IDL 5 modal functionality. 20 Oct 97. DWF
(See /host/bluemoon/usr2/idllib/contrib/fanning/ps_form.pro)
NAME:
READTAB
PURPOSE:
Read any kind of ASCII-tables into floating point array
Empty Lines or lines starting with ';','#' or '!' are ignored
CATEGORY:
Input/Output
CALLING SEQUENCE:
var= READTAB(filename, [cols])
INPUTS:
Filename - Input Datafile
KEYWORD PARAMETERS:
COLS - Vektor with colum numbers to pick, otherwise all
colums are returned
OUTPUTS:
Floating point array with dimension specified by Colums and
Rows in the input file
(See /host/bluemoon/usr2/idllib/contrib/fanning/readtab.pro)
NAME:
SCALE_VECTOR
PURPOSE:
This is a utility routine to scale the points of a vector
(or an array) into a given data range. The minimum value of
the vector (or array) is set equal to the minimun data range. And
the maximun value of the vector (or array) is set equal to the
maximun data range.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Utilities
CALLING SEQUENCE:
scaledVector = SCALE_VECTOR(vector, minRange, maxRange)
INPUTS:
vector: The vector (or array) to be scaled.
minRange: The minimun value of the scaled vector. Set to 0 by default.
maxRange: The maximun value of the scaled vector. Set to 1 by default.
;
RETURN VALUE:
scaledVector: The vector (or array) values scaled into the data range.
This is always at least a FLOAT value.
COMMON BLOCKS:
None.
EXAMPLE:
x = [3, 5, 0, 10]
xscaled = SCALE_VECTOR(x, -50, 50)
Print, xscaled
-20.0000 0.000000 -50.0000 50.0000
MODIFICATION HISTORY:
Written by: David Fanning, 12 Dec 98.
(See /host/bluemoon/usr2/idllib/contrib/fanning/scale_vector.pro)
NAME:
SELECT_OBJECTS
PURPOSE:
The purpose of this program is to demonstrate how to select
and move objects in an object graphics window. Once the objects
appear in the window, use your mouse to select the objects and
move them in the window. The window is resizeable.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Object Graphics.
CALLING SEQUENCE:
SELECT_OBJECTS
REQUIRED INPUTS:
None.
KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Requires VCOLORBAR from the Coyote Library:
http://www.dfanning.com/programs/vcolorbar__define.pro.
EXAMPLE:
Select_Objects
MODIFICATION HISTORY:
Written by David Fanning, 21 September 98.
Added the ability to shrink and expand the objects. 27 Sept 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/select_objects.pro)
NAME:
SLICE
PURPOSE:
This is a routine to display a 3D data set and slice through it
at arbitrary orthographic angles. The display window (when run
with the GUI) is resizeable. The output can be sent either to
the display, to a GUI, or to a PostScript printer (as true
PostScript output, not a screen dump.) When run with the GUI,
slices can be animated and displays can be saved and restored
for later processing. The program works on 8-bit, 16-bit, and
24-bit displays.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
3D Graphics, Widgets.
CALLING SEQUENCE:
For display in a regular IDL graphics window:
SLICE, data
For display with a built-in GUI:
SLICE, data, /GUI
To send display to a PostScript printer:
deviceKeywords = PS_FORM(/INITIALIZE)
SLICE, data, POSTSCRIPT=deviceKeywords
INPUTS:
data: The 3D data set to be displayed. The data is assumed to be
scaled into the number of colors (keyword NCOLORS).
KEYWORD PARAMETERS:
AX The rotation of the 3D coordinate system about the X axis.
Must be between 0 and 90 degrees. Default is 30 degrees.
AZ The rotation of the 3D coordinate system about the Z axis.
Must be between -30 and 210 degrees. Default is 30 degrees.
BACKGROUND The color index of the plot background. Default is BOTTOM.
BOTTOM The starting index of the color table. Default is 0.
COLOR The color index of the plot axes and annotation. Default is
(NCOLORS-1) + BOTTOM.
CHARSIZE The size of the plot annotations. Default is 1.0.
_EXTRA This keyword allows other undefined keywords to be passed
to the SURFACE command. For example: XTITLE, YTITLE, ZTITLE,
and TITLE keywords.
GROUP The group leader of the GUI. Normally used with GUI.
GUI Set this keyword if you want a graphical user interface to the
program functionality.
NCOLORS The number of colors used in the color table. The default is
!D.N_COLORS.
NOAXES Set this keyword to draw the plot without axes.
POSTSCRIPT This will be a strucuture of the type returned by PS_FORM.
The fields of the structure are used to congfigue the PostScript device.
THISINSTANCE Multiple versions of the GUI program can be running concurrently.
This keyword is used to make sure they can be managed by XMANAGER
concurrently. The keyword is NOT normally set by the user.
TRANSPARENT This keyword sets the transparency threshold for the 3D volume.
allowed values go from 0 to 100 percent. The default is 0.
WID The window index number of the window you wish the display to go into.
In non-GUI mode, the window does not have to currently be open. This
keyword is ignored in GUI mode.
WTITLE The window title. Used in conjunction with THISINSTANCE to label
control and graphics windows. It can be set by the user.
XCOORD The X coordinate of the 3D data set. The data will be sliced at this
coordinate in the X direction. The default is XSIZE / 2.
XSLICE Set this keyword to draw an slice through the data in the X direction.
YCOORD The Y coordinate of the 3D data set. The data will be sliced at this
coordinate in the Y direction. The default is YSIZE / 2.
YSLICE Set this keyword to draw an slice through the data in the Y direction.
ZCOORD The Z coordinate of the 3D data set. The data will be sliced at this
coordinate in the Z direction. The default is ZSIZE / 2.
ZSLICE Set this keyword to draw an slice through the data in the Z direction.
OUTPUTS:
None.
COMMON BLOCKS:
None.
RESTRICTIONS:
Requires modified IDL library routines CW_ANIMATE and XINTERANIMATE
which have been added to this code. Requires the programs PS_FORM,
XCOLORS, and CHGCOLOR from the Coyote Software Library.
ftp://ftp.frii.com/pub/dfanning/outgoing/idl_examples
EXAMPLE:
To run this program with a GUI, a charcoal background color, axes
drawn in yellow and with the X and Y axes shown, type:
filename = FILEPATH(SUBDIR=['examples', 'data'], 'abnorm.dat')
OPENR, lun, filename, /GET_LUN
heart = BYTARR(64,64,15)
READU, lun, heart
FREE_LUN, lun
LOADCT, 5, NCOLORS=150, BOTTOM=0
TVLCT, [70, 255], [70, 255], [70, 0], 150
SLICE, heart, /GUI, BACKGROUND=150, COLOR=151, NCOLORS=150, $
BOTTOM=0, /XSLICE, /YSLICE
The program code comes with its own example program. Type:
IDL> .Compile SLICE
IDL> example
MODIFICATION HISTORY:
Written by: David Fanning, Sept 1996.
31 Oct 96: Made slight changes in how PostScript output is handled.
23 April 1997. Fixed a bug that prevented PostScript output when
the size was expressed in centimeters. DWF.
23 April 1997. Added support for 24-bit color displays. DWF
(See /host/bluemoon/usr2/idllib/contrib/fanning/slice.pro)
NAME:
SMOOTH2
PURPOSE:
Do multiple smoothing. Gives near Gaussian smoothing.
CATEGORY:
CALLING SEQUENCE:
b = smooth2(a, w)
INPUTS:
a = array to smooth (1,2, or 3-d). in
w = smoothing window size. in
KEYWORD PARAMETERS:
OUTPUTS:
b = smoothed array. out
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
R. Sterner. 8 Jan, 1987.
Johns Hopkins University Applied Physics Laboratory.
RES 14 Jan, 1987 --- made both 2-d and 1-d.
RES 30 Aug, 1989 --- converted to SUN.
R. Sterner, 1994 Feb 22 --- cleaned up some.
Copyright (C) 1987, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
(See /host/bluemoon/usr2/idllib/contrib/fanning/loaddata.pro)
NAME:
STR_SIZE
PURPOSE:
The purpose of this function is to return the proper
character size to make a specified string a specifed
width in a window. The width is specified in normalized
coordinates. The function is extremely useful for sizing
strings and labels in resizeable graphics windows.
CATEGORY:
Graphics Programs, Widgets.
CALLING SEQUENCE:
thisCharSize = STR_SIZE(thisSting, targetWidth)
INPUTS:
thisString: This is the string that you want to make a specifed
target size or width.
OPTIONAL INPUTS:
targetWidth: This is the target width of the string in normalized
coordinates in the current graphics window. The character
size of the string (returned as thisCharSize) will be
calculated to get the string width as close as possible to
the target width. The default is 0.25.
KEYWORD PARAMETERS:
INITSIZE: This is the initial size of the string. Default is 1.0.
STEP: This is the amount the string size will change in each step
of the interative process of calculating the string size.
The default value is 0.05.
OUTPUTS:
thisCharSize: This is the size the specified string should be set
to if you want to produce output of the specified target
width. The value is in standard character size units where
1.0 is the standard character size.
RESTRICTIONS:
The program does not work with hardware fonts. If !P.Font is
equal to 0, the program issues an error message and returns the
initsize if it is defined, or 1.
EXAMPLE:
To make the string "Happy Holidays" take up 30% of the width of
the current graphics window, type this:
XYOUTS, 0.5, 0.5, ALIGN=0.5, "Happy Holidays", $
CHARSIZE=STR_SIZE("Happy Holidays", 0.3)
MODIFICATION HISTORY:
Written by: David Fanning, 17 DEC 96.
Added a scaling factor to take into account the aspect ratio
of the window in determing the character size. 28 Oct 97. DWF
Added check for hardware fonts. 6 May 98. DWF
(See /host/bluemoon/usr2/idllib/contrib/fanning/str_size.pro)
SURF_CLIP: clip a 2D Z array, and two matching 1D arrays for x
and y.
The function returns a 2D array that is truncated in x and y.
XRANGE, YRANGE -> the range for x and y in data coordinates
XCLIP, YCLIP -> return the truncated x and y arrays
author: Martin Schultz, Harvard University (1998)
EXAMPLE: x=findgen(100)
y=findgen(50)
z=dist(100,50)
zc=surf_clip(z,x,y,xrange=[20,80],yrange=[20,40], $ ;
xclip=xc,yclip=yc)
surface,zc,xc,yc
(See /host/bluemoon/usr2/idllib/contrib/fanning/surf_clip.pro)
NAME:
TVIMAGE
PURPOSE:
This purpose of TVIMAGE is to allow you to display an image
on the display or in a PostScript file in a particular position.
The position is specified by means of the POSITION keyword. In
this respect, TVIMAGE works like other IDL graphics commands.
Moreover, the TVIMAGE command works identically on the display
and in a PostScript file. You don't have to worry about how to
"size" the image in PostScript. The output on your display and
in the PostScript file will be identical. The major advantage of
TVIMAGE is that it can be used in a natural way with other IDL
graphics commands in resizeable IDL graphics windows. TVIMAGE
is a replacement for TV and assumes the image has been scaled
correctly when it is passed as an argument.
AUTHOR:
FANNING SOFTWARE CONSULTING:
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Graphics display.
CALLING SEQUENCE:
TVIMAGE, image
INPUTS:
image: A 2D or 3D image array. It should be byte data.
KEYWORD PARAMETERS:
ERASE: If this keyword is set an ERASE command is issued
before the image is displayed. Note that the ERASE
command puts the image on a new page in PostScript
output.
_EXTRA: This keyword picks up any TV keywords you wish to use.
KEEP_ASPECT_RATIO: Normally, the image will be resized to fit the
specified position in the window. If you prefer, you can
force the image to maintain its aspect ratio in the window
(although not its natural size) by setting this keyword.
The image width is fitted first. If, after setting the
image width, the image height is too big for the window,
then the image height is fitted into the window. The
appropriate values of the POSITION keyword are honored
during this fitting process. Once a fit is made, the
POSITION coordiates are re-calculated to center the image
in the window. You can recover these new position coordinates
as the output from the POSITION keyword.
MARGIN: A single value, expressed as a normalized coordinate, that
can easily be used to calculate a position in the window.
The margin is used to calculate a POSITION that gives
the image an equal margin around the edge of the window.
The margin must be a number in the range 0.0 to 0.333. This
keyword is ignored if the POSITION keyword is used.
MINUS_ONE: The value of this keyword is passed along to the CONGRID
command. It prevents CONGRID from adding an extra row and
column to the resulting array, which can be a problem with
small image arrays.
POSITION: The location of the image in the output window. This is
a four-element floating array of normalized coordinates of
the type given by !P.POSITION or the POSITION keyword to
other IDL graphics commands. The form is [x0, y0, x1, y1].
The default is [0.0, 0.0, 1.0, 1.0]. Note that this can
be an output parameter if the KEEP_ASPECT_RATIO keyword is
used.
OUTPUTS:
None.
SIDE EFFECTS:
Unless the KEEP_ASPECT_RATIO keyword is set, the displayed image
may not have the same aspect ratio as the input data set.
RESTRICTIONS:
If the POSITION keyword and the KEEP_ASPECT_RATIO keyword are
used together, there is an excellent chance the POSITION
parameters will change. If the POSITION is passed in as a
variable, the new positions will be returned as an output parameter.
If the image is 2D then color decomposition is turned OFF
for the current graphics device (i.e., DEVICE, DECOMPOSED=0).
If outputting to the PRINTER device, the aspect ratio of the image
is always maintained and the POSITION coordinates are ignored.
The image always printed in portrait mode.
EXAMPLE:
To display an image with a contour plot on top of it, type:
filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
image = BYTARR(360,360)
OPENR, lun, filename, /GET_LUN
READU, image
FREE_LUN, lun
TVIMAGE, image, POSITION=thisPosition, /KEEP_ASPECT_RATIO
CONTOUR, image, POSITION=thisPosition, /NOERASE, XSTYLE=1, $
YSTYLE=1, XRANGE=[0,360], YRANGE=[0,360], NLEVELS=10
MODIFICATION HISTORY:
Written by: David Fanning, 20 NOV 1996.
Fixed a small bug with the resizing of the image. 17 Feb 1997. DWF.
Removed BOTTOM and NCOLORS keywords. This reflects my growing belief
that this program should act more like TV and less like a "color
aware" application. I leave "color awareness" to the program
using TVIMAGE. Added 24-bit image capability. 15 April 1997. DWF.
Fixed a small bug that prevented this program from working in the
Z-buffer. 17 April 1997. DWF.
Fixed a subtle bug that caused me to think I was going crazy!
Lession learned: Be sure you know the *current* graphics
window! 17 April 1997. DWF.
Added support for the PRINTER device. 25 June 1997. DWF.
Extensive modifications. 27 Oct 1997. DWF
1) Removed PRINTER support, which didn't work as expected.
2) Modified Keep_Aspect_Ratio code to work with POSITION keyword.
3) Added check for window-able devices (!D.Flags AND 256).
4) Modified PostScript color handling.
Craig Markwart points out that Congrid adds an extra row and column
onto an array. When viewing small images (e.g., 20x20) this can be
a problem. Added a Minus_One keyword whose value can be passed
along to the Congrid keyword of the same name. 28 Oct 1997. DWF
Changed default POSITION to fill entire window. 30 July 1998. DWF.
Made sure color decomposition is OFF for 2D images. 6 Aug 1998. DWF.
Added limited PRINTER portrait mode support. The correct aspect ratio
of the image is always maintained when outputting to the
PRINTER device and POSITION coordinates are ignored. 6 Aug 1998. DWF
Removed 6 August 98 fixes (Device, Decomposed=0) after realizing that
they interfere with operation in the Z-graphics buffer. 9 Oct 1998. DWF
Added a MARGIN keyword. 18 Oct 1998. DWF.
Re-established Device, Decomposed=0 keyword for devices that
support it. 18 Oct 1998. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/tvimage.pro)
NAME:
TYPE
PURPOSE:
Finds the type class of a variable.
CATEGORY:
Programming.
CALLING SEQUENCE:
Result = TYPE(X)
INPUTS:
X
Arbitrary, doesn't even need to be defined.
OUTPUTS:
Returns the type of X as a long integer, in the (0,11) range.
0 Undefined
1 Byte
2 Integer
3 Long integer
4 Float
5 Double precision
6 Complex number
7 String
8 Structure
9 Double complex
10 Pointer
11 Object reference
PROCEDURE:
Extracts information from the SIZE function.
EXAMPLE:
To find the type class of a variable:
IDL> print,TYPE(7)
2
IDL> print,TYPE(7D)
5
IDL> print,TYPE('7')
7
MODIFICATION HISTORY:
Created 15-JUL-1991 by Mati Meron, University of Chicago.
Modified 7 November 1997 by Paul Krummel,
CSIRO Division of Atmospheric Research.
Added in help message and expanded header
info (Pointers and Object references).
(See /host/bluemoon/usr2/idllib/contrib/fanning/file_line.pro)
NAME:
UNDEFINE
PURPOSE:
The purpose of this program is to delete or undefine
an IDL program variable from within an IDL program or
at the IDL command line. It is a more powerful DELVAR.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Utilities.
CALLING SEQUENCE:
UNDEFINE, variable
REQUIRED INPUTS:
variable: The variable to be deleted.
SIDE EFFECTS:
The variable no longer exists.
EXAMPLE:
To delete the variable "info", type:
IDL> Undefine, info
MODIFICATION HISTORY:
Written by David Fanning, 8 June 97, from an original program
given to me by Andrew Cool, DSTO, Adelaide, Australia.
(See /host/bluemoon/usr2/idllib/contrib/fanning/undefine.pro)
NAME:
VCOLORBAR
FILENAME:
vcolorbar__define.pro
;
PURPOSE:
The purpose of this program is to create a vertical
colorbar object to be used in conjunction with other
IDL 5 graphics objects.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
IDL 5 Object Graphics.
CALLING SEQUENCE:
thisColorBar = Obj_New('VColorBar')
REQUIRED INPUTS:
None.
INIT METHOD KEYWORD PARAMETERS:
COLOR: A three-element array representing the RGB values of a color
for the colorbar axes and annotation. The default value is
white: [255,255,255].
NAME: The name associated with this object.
NCOLORS: The number of colors associated with the colorbar. The
default is 256.
MAJOR: The number of major tick divisions on the colorbar axes.
The default is 5.
MINOR: The number of minor tick marks on the colorbar axes.
The default is 4.
PALETTE: A palette object for the colorbar. The default palette
is a gray-scale palette object.
POSITION: A four-element array specifying the position of the
colorbar in normalized coordinate space. The default position
is [0.90, 0.10, 0.95, 0.90].
RANGE: The range associated with the colorbar axis. The default
is [0, NCOLORS].
TEXT: A text object. Colorbar axis annotation will use this text
object to set its properties. The default is a text object
using a 8 point Helvetica font in the axis color.
TITLE: A string containing a title for the colorbar axis
annotation. The default is a null string.
OTHER METHODS:
GetProperty (Procedure): Returns colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
NAME
MAJOR
MINOR
PALETTE
POSITION
RANGE
TEXT
TITLE
SetProperty (Procedure): Sets colorbar properties in keyword
parameters as defined for the INIT method. Keywords allowed are:
COLOR
NAME
MAJOR
MINOR
PALETTE
POSITION
RANGE
TEXT
TITLE
SIDE EFFECTS:
A VCOLORBAR object is created. The colorbar INHERITS IDLgrMODEL.
Thus, all IDLgrMODEL methods and keywords can also be used. It is
the model that is selected in a selection event, since the SELECT_TARGET
keyword is set for the model.
RESTRICTIONS:
None.
EXAMPLE:
To create a colorbar object and add it to a plot view object, type:
thisColorBarObject = Obj_New('VColorBar')
plotView->Add, thisColorBarObject
plotWindow->Draw, plotView
MODIFICATION HISTORY:
Written by David Fanning, 19 June 97.
Changed the optional "colorbarmodel" parameter to an
optional GETMODEL parameter. 26 June 97. DWF.
Fixed bug in the way the color palette was assigned. 13 Aug 97. DWF.
Added missing container object to self structure. 13 Aug 97. DWF.
Removed image model, which was a workaround for
broken 5.0 objects. 5 Oct 97. DWF
Fixed cleanup procedure to clean up ALL objects. 12 Feb 98. DWF.
Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
Modified colorbar to INHERIT an IDLgrModel object. This allows me to
add the colorbar to other models directly. 20 Sept 98. DWF.
Added NAME keyword to give the colorbar a name. 20 Sept 98. DWF.
Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/vcolorbar__define.pro)
NAME: wheretomulti.pro
FUNCTION: Convert WHERE output to 2d or 3d indices
USAGE: WhereToMulti, Array, Indices, Col, Row, Frame
INPUT ARGUMENTS:
Array: the array that was WHERE'd
Indices: the indices returned by WHERE
OUTPUT ARGUMENTS:
Col: Indices to first dimension.
Row: Indices to second dimension.
Frame: Indices to third dimension. Returned only for 3-d array.
OPTIONAL ARGUMENTS:
KEYWORDS:
REQUIRED MODULES:
SIDE EFFECTS:
ERROR HANDLING:
If Array is not a vector or matrix, all return values are set to zero
and a message is written to the screen.
NOTES:
HISTORY:
1998 Sept 15 J.L.Saba Developed based on code from David Fanning's
web site.
(See /host/bluemoon/usr2/idllib/contrib/fanning/wheretomulti.pro)
NAME:
WRITE_MPEG
PURPOSE:
Write a sequence of images as an mpeg movie
CATEGORY: utility
CALLING SEQUENCE:
WRITE_MPEG,'movie.mpg',ims
INPUTS:
ims: sequence of images as a 3D array with dimensions [sx, sy, nims]
where sx = xsize of images
sy = ysize of images
nims = number of images
OPTIONAL INPUTS:
KEYWORD PARAMETERS:
delaft: if set delete temporary array after movie was created
you should actually always do it otherwise you get
problems with permissions on multiuser machines (since
/tmp normally has the sticky bit set)
rep: if given means repeat every image 'rep' times
(as a workaround to modify replay speed)
OUTPUTS: None
OPTIONAL OUTPUTS:
COMMON BLOCKS:
SIDE EFFECTS:
creates some files in TMPDIR which are only removed when
the DELAFT keyword is used
RESTRICTIONS:
depends on the program mpeg_encode from University of
California, Berkeley, which must be installed in /usr/local/bin
PROCEDURE:
writes a parameter file based on the dimensions of the image
array + the sequence of images in ppm format into a
temporary directory; finally spawns mpeg_encode to build the
movie
EXAMPLE:
MODIFICATION HISTORY:
Mon Nov 18 13:13:53 1996, Christian Soeller
grabbed original from the net and made slight modifications
(See /host/bluemoon/usr2/idllib/contrib/fanning/write_mpeg.pro)
NAME:
xcd
PURPOSE:
Change current directory via mouse.
Two lists are displayed side by side. The one on the left shows
directories. Click on a directory to cd there. The list
on the right shows files to help you see where you are.
(The list on the right does not respond to mouse clicks.)
CATEGORY:
Utility.
CALLING SEQUENCE:
xcd
INPUTS:
None.
KEYWORD PARAMETERS:
None
OUTPUTS:
None.
SIDE EFFECTS:
Your current directory can be changed.
RESTRICTIONS:
Windows & OpenVMS platforms only. Originally written on Windows95.
Should work on other Windows platforms, but I (Paul) havn't tried it.
With a little effort, one probably could port Xcd to other platforms
(i.e. Unix or Mac).
Note that drive names (e.g. "a:", "c:", etc.) are hardcoded in
xcd::init. Change that line of code to show drive letters
appropriate for your system.
PROCEDURE:
Xcd creates an object that has a reference to a DirListing, and
widgets for displaying that DirListing. If the user clicks on a
sub-directory (or "..\") in the xcd object, or droplist-selects
a different drive via the xcd object, the xcd object changes
IDL's current directory to that location, and refreshes with a
new current-directory DirListing.
MODIFICATION HISTORY:
Paul C. Sorenson, July 1997. paulcs@netcom.com.
Written with IDL 5.0. The object-oriented design of Xcd is
based in part on an example authored by Mark Rivers.
Jim Pendleton, July 1997. jimp@rsinc.com
Modified for compatability with OpenVMS as a basis for
platform independent code
Paul C. Sorenson, July 13 1997. Changes so that DirListing class
methods do not return pointers to data members. (Better
object-oriented design that way.)
(See /host/bluemoon/usr2/idllib/contrib/fanning/xcd.pro)
NAME:
XCOLORS
PURPOSE:
The purpose of this routine is to interactively change color tables
in a manner similar to XLOADCT. No common blocks are used so
multiple copies of XCOLORS can be on the display at the same
time (if each has a different TITLE). XCOLORS has the ability
to notify a widget event handler or an object method if and when
a new color table has been loaded. The event handler or object method
is then responsibe for updating the program's display on 16- or
24-bit display systems.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets.
CALLING SEQUENCE:
XCOLORS
INPUTS:
None.
KEYWORD PARAMETERS:
BOTTOM: The lowest color index of the colors to be changed.
DRAG: Set this keyword if you want colors loaded as you drag
the sliders. Default is to update colors only when you release
the sliders.
FILE: A string variable pointing to a file that holds the
color tables to load. The normal colors1.tbl file is used by default.
GROUP_LEADER: The group leader for this program. When the group
leader is destroyed, this program will be destroyed.
NCOLORS: This is the number of colors to load when a color table
is selected.
NOTIFYID: A 2-column by n-row array that contains the IDs of widgets
that should be notified when XCOLORS loads a color table. The first
column of the array is the widgets that should be notified. The
second column contains IDs of widgets that are at the top of the
hierarchy in which the corresponding widgets in the first column
are located. (The purpose of the top widget IDs is to make it
possible for the widget in the first column to get the "info"
structure of the widget program.) An XCOLORS_LOAD event will be
sent to the widget identified in the first column. The event
structure is defined like this:
event = {XCOLORS_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
R:BytArr(!D.N_COLORS < 256), G:BytArr(!D.N_COLORS < 256), $
B:BytArr(!D.N_COLORS < 256), INDEX:0}
The ID field will be filled out with NOTIFYID[0, n] and the TOP
field will be filled out with NOTIFYID[1, n]. The R, G, and B
fields will have the current color table vectors, obtained by
exectuing the command TVLCT, r, g, b, /Get. The INDEX field will
have the index number of the just-loaded color table.
Note that XCOLORS can't initially tell *which* color table is
loaded, since it just uses whatever colors are available when it
is called. Thus, it stores a -1 in the INDEX field to indicate
this "default" value. Programs that rely on the INDEX field of
the event structure should normally do nothing if the value is
set to -1. This value is also set to -1 if the user hits the
CANCEL button.
Typically the XCOLORS button will be defined like this:
xcolorsID = Widget_Button(parentID, Value='Load New Color Table...', $
Event_Pro='Program_Change_Colors_Event')
The event handler will be written something like this:
PRO Program_Change_Colors_Event, event
; Handles color table loading events. Allows colors be to changed.
Widget_Control, event.top, Get_UValue=info, /No_Copy
thisEvent = Tag_Names(event, /Structure_Name)
CASE thisEvent OF
'WIDGET_BUTTON': BEGIN
; Color table tool.
XColors, NColors=info.ncolors, Bottom=info.bottom, $
Group_Leader=event.top, NotifyID=[event.id, event.top]
ENDCASE
'XCOLORS_LOAD': BEGIN
; Update the display for 24-bit displays.
Device, Get_Visual_Depth=thisDepth
IF thisDepth GT 8 THEN BEGIN
WSet, info.wid
...Whatever display commands are required go here. For example...
TV, info.image
ENDIF
ENDCASE
ENDCASE
Widget_Control, event.top, Set_UValue=info, /No_Copy
END
NOTIFYOBJ: A vector of structures (or a single structure), with
each element of the vector defined as follows:
struct = {XCOLORS_NOTIFYOBJ, object:Obj_New(), method:'', wid:0}
where the "object" is an object reference, "method" is the object
method that should be called when XCOLORS loads its color tables,
and "wid" is the window index number of the window where the object
output should be displayed. Note that the current graphics window
will be set to struct.wid before the object method is called.
ainfo = {XCOLORS_NOTIFYOBJ, a, 'Draw', 0}
binfo = {XCOLORS_NOTIFYOBJ, b, 'Display', 3}
XColors, NotifyObj=[ainfo, binfo]
Note that the XColors program must be compiled before these structures
are used. Alternatively, you can put this program, named
"xcolors_notifyobj__define.pro" (*three* underscore characters in this
name!) in your PATH:
PRO XCOLORS_NOTIFYOBJ__DEFINE
struct = {XCOLORS_NOTIFYOBJ, OBJECT:Obj_New(), METHOD:'', WID:0}
END
TITLE: This is the window title. It is "Load Color Tables" by
default. The program is registered with the name 'XCOLORS:' plus
the TITLE string. The "register name" is checked before the widgets
are defined. If a program with that name has already been registered
you cannot register another with that name. This means that you can
have several versions of XCOLORS open simultaneously as long as each
has a unique title or name. For example, like this:
IDL> XColors, NColors=100, Bottom=0, Title='First 100 Colors'
IDL> XColors, NColors=100, Bottom=100, Title='Second 100 Colors'
XOFFSET: This is the X offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
YOFFSET: This is the Y offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Colors are changed. Events are sent to widgets if the NOTIFYID
keyword is used. Object methods are called if the NOTIFYOBJ keyword
is used. This program is a non-blocking widget.
RESTRICTIONS:
None.
EXAMPLE:
To load a color table into 100 colors, starting at color index
50 and send an event to the widget identified at info.drawID
in the widget heirarchy of the top-level base event.top, type:
XCOLORS, NCOLORS=100, BOTTOM=50, NOTIFYID=[info.drawID, event.top]
MODIFICATION HISTORY:
Written by: David Fanning, 15 April 97. Extensive modification
of an older XCOLORS program with excellent suggestions for
improvement by Liam Gumley. Now works on 8-bit and 24-bit
systems. Subroutines renamed to avoid ambiguity. Cancel
button restores original color table.
23 April 97, added color protection for the program. DWF
24 April 97, fixed a window initialization bug. DWF
18 June 97, fixed a bug with the color protection handler. DWF
18 June 97, Turned tracking on for draw widget to fix a bug
in TLB Tracking Events for WindowsNT machines in IDL 5.0. DWF
20 Oct 97, Changed GROUP keyword to GROUP_LEADER. DWF
19 Dec 97, Fixed bug with TOP/BOTTOM reversals and CANCEL. DWF.
9 Jun 98, Fixed bug when using BOTTOM keyword on 24-bit devices. DWF
9 Jun 98, Added Device, Decomposed=0 for TrueColor visual classes. DWF
9 Jun 98, Removed all IDL 4 compatibility.
21 Oct 98, Fixed problem with gamma not being reset on CANCEL. DWF
5 Nov 98. Added the NotifyObj keyword, so that XCOLORS would work
interactively with objects. DWF.
9 Nov 98. Made slider reporting only at the end of the drag. If you
want continuous updating, set the DRAG keyword. DWF.
9 Nov 98. Fixed problem with TOP and BOTTOM sliders not being reset
on CANCEL. DWF.
10 Nov 98. Fixed fixes. Sigh... DWF.
5 Dec 98. Added INDEX field to the XCOLORS_LOAD event structure. This
field holds the current color table index number. DWF.
5 Dec 98. Modified the way the colorbar image was created. Results in
greatly improved display for low number of colors. DWF.
6 Dec 98. Added the ability to notify an unlimited number of objects. DWF.
12 Dec 98. Removed obsolete Just_Reg keyword and improved documetation. DWF.
30 Dec 98. Fixed the way the color table index was working. DWF.
4 Jan 99. Added slightly modified CONGRID program to fix floating divide
by zero problem. DWF
(See /host/bluemoon/usr2/idllib/contrib/fanning/xcolors.pro)
NAME:
XCONTOUR
PURPOSE:
The purpose of this program is to demonstrate how to
create a contour plot with axes and a title in the
new IDL 5 object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, IDL 5 Object Graphics.
CALLING SEQUENCE:
XCONTOUR, data, x, y
REQUIRED INPUTS:
None. Fake data will be used if no data is supplied in call.
OPTIONAL INPUTS
data: A 2D array of surface data.
x: A vector of X data values.
y: A vector of Y data values.
OPTIONAL KEYWORD PARAMETERS:
_EXTRA: This keyword collects otherwise undefined keywords that are
passed to the old IDL contour command. Most of the keywords will
have absolutely no effect.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
NLEVELS: The number of equally spaced contour intervals to draw.
There are no provisions (yet) for specifying your own contour levels.
TITLE: A string used as the title of the plot.
XTITLE: A string used as the X title of the plot.
YTITLE: A string used as the Y title of the plot.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
To use this program with your 2D data, type:
IDL> XContour, data
MODIFICATION HISTORY:
Written by David Fanning, 9 June 97.
Added a colorbar to the plot. 19 June 97, DWF.
Modified the way VCOLORBAR was called. 14 July 97. DWF.
Fixed cleanup procedure to clean up ALL objects. 12 Feb 98. DWF.
Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
Modified to use the IDLgrColorbar object. 20 Sept 98. DWF.
Added the ability to do a filled contour. 27 Sept 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/xcontour.pro)
NAME:
XIMAGE
PURPOSE:
The purpose of this program is to demonstrate how to
create a image plot with axes and a title in the
new IDL 5 object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, IDL 5 Object Graphics.
CALLING SEQUENCE:
XImage, image
REQUIRED INPUTS:
None. The image "worldelv.dat" from the examples/data directory
is used if no data is supplied in call.
OPTIONAL INPUTS
image: A 2D or 3D image array.
OPTIONAL KEYWORD PARAMETERS:
COLORTABLE: The number of a color table to use as the image palette.
Color table 0 (grayscale) is used as a default.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
KEEP_ASPECT_RATIO: Set this keyword if you wish the aspect ratio
of the image to be preserved as the graphics display window is resized.
SIZE: The initial window size. Default is 300 by 300 pixels.
TITLE: A string used as the title of the plot.
XRANGE: A two-element array specifying the X axis range.
XTITLE: A string used as the X title of the plot.
YRANGE: A two-element array specifying the Y axis range.
YTITLE: A string used as the Y title of the plot.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
To use this program with your 2D or 3D image data, type:
IDL> XImage, image
MODIFICATION HISTORY:
Written by David Fanning, 13 June 97.
Added Keep_Apect_Ratio keyword and Zoom buttons. DWF 15 JUNE 97.
Improved font handling and color support. DWF 4 OCT 97.
Fixed memory leakage from improper object cleanup. 12 FEB 98. DWF
Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/ximage.pro)
NAME:
XMOVIE
PURPOSE:
This program is a simplified version of XINTERANIMATE. It is written
to illustrate the proper way to write an animation loop in a widget
program using the WIDGET_TIMER functionality.
CATEGORY:
Widgets.
CALLING SEQUENCE:
XMOVIE, image3d
INPUTS:
image3d: A three-dimensional image array. The animation occurs over
the third dimension.
KEYWORD PARAMETERS:
GROUP: The group leader of the program. When the group leader dies,
this program dies as well.
TITLE: The window title of the program. The default is "Animation
Example...".
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
EXAMPLE:
To open the abnormal heart data and animate it, type:
filename = FILEPATH(SUBDIR=['examples', 'data'], 'abnorm.dat')
OPENR, lun, filename, /GET_LUN
data = BYTARR(64, 64, 15)
READU, lun, data
FREE_LUN, lun
data = REBIN(data, 256, 256, 15)
XMOVIE, data
MODIFICATION HISTORY:
Written by: David Fanning, June 96.
(See /host/bluemoon/usr2/idllib/contrib/fanning/xmovie.pro)
NAME:
XPLOT
PURPOSE:
The purpose of this program is to demonstrate how to
create a line plot with axes and a title in the
new IDL 5 object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642 Bradbury Court
Fort Collins, CO 80521 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, IDL 5 Object Graphics.
CALLING SEQUENCE:
XPlot, x, y
REQUIRED INPUTS:
x: A vector of input values used as the dependent data.
OPTIONAL INPUTS
y: A vector of input values used as the dependent data.
If both x and y parameters are present, x is the independent data.
OPTIONAL KEYWORD PARAMETERS:
_EXTRA: This keyword collects otherwise undefined keywords that are
passed to new Plot command. To some extent these are similar to the
old IDL Plot command. For example: Linestyle=2, Thick=3,
XRange=[-100,100], etc.
GROUP_LEADER: The group leader for this program. When the group leader
is destroyed, this program will be destroyed.
PSYM: The index of a plotting symbol to use on the plot. Integers 0-7
are valid values.
TITLE: A string used as the title of the plot.
XTITLE: A string used as the X title of the plot.
YTITLE: A string used as the Y title of the plot.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Axes are always drawn with the Exact keyword set.
EXAMPLE:
To use this program, pass a 1D vector or vectors, like this:
IDL> XPlot, RandomU(seed, 11) * 9, YRange=[0, 10]
MODIFICATION HISTORY:
Written by David Fanning, 13 June 97.
Modified axis font handling. 17 Sept 97. DWF.
Was not destroying all objects on exit. 12 Feb 98. DWF.
Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
(See /host/bluemoon/usr2/idllib/contrib/fanning/xplot.pro)
NAME:
XSTRETCH
PURPOSE:
The purpose of this program is to interactively apply a simple
linear stretch to an image by moving two lines on a histogram
plot of the image. The portion of the image data between the
two lines is stretched over the available colors in the color table.
CATEGORY:
Graphics, Widgets
CALLING SEQUENCE:
XSTRETCH, image
INPUT PARAMETERS:
image: The image data to be stretched.It must be 2D.
KEYWORD PARAMETERS:
COLORTABLE: The index of a colortable you would like to load.
The current colortable is used if this keyword is undefined.
_EXTRA: This keyword collects any keyword appropriate for the
Plot command.
GROUP_LEADER: Keyword to assign a group leader (so this program can be
called from within another widget program).
MAX_VALUE: Keyword to assign a maximun value for the Histogram Plot.
Images with lots of pixels of one color (e.g. black) skew
the histogram. This helps make a better looking plot.
NCOLORS: Keyword to assign the number of colors used to display
the image. The default is !D.N_Colors-4.
OUTPUTS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
If you have a 2D image in the variable "image", you can run this
program like this:
XSTRETCH, image
MODIFICATION HISTORY:
Written by: David Fanning, April 1996.
October, 1996 Fixed a problem with not restoring the color
table when the program exited. Substituted a call to XCOLORS
instead of XLOADCT.
October, 1998. Added NO_BLOCK keyword and modified to work with
24-bit color devices.
(See /host/bluemoon/usr2/idllib/contrib/fanning/xstretch.pro)
NAME:
XSURFACE
PURPOSE:
The purpose of this program is to demonstrate how to
create a surface with axes and a title in the new IDL 5
object graphics.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
2642