NAME: LOADDATA PURPOSE: The purpose of this function is to read a selection of standard data sets that are found in the normal IDL distribution in the subdirectory $IDL_DIR/examples/data. At least 17 data sets are available in all categories of data. The user selects one of the possible data sets with the mouse. CATEGORY: File I/O. CALLING SEQUENCE: If calling from the IDL command line: data = LoadData() If calling from within a widget program: data = LoadData(Cancel=cancelled, Group_Leader=event.top) If you know which data set you want, you can load it directly: data = LoadData(7) OPTIONAL INPUTS: selection : The number of the data selection. Values start at 1, and go up to the number of data sets available (currently 17). KEYWORD PARAMETERS: CANCEL : An output keyword that is 1 of the use clicked the CANCEL button and 0 otherwise. data = Loaddata(Cancel=cancelled) IF cancelled THEN RETURN GROUP_LEADER: The group leader of the widget. This keyword is required if you wish LOADDATA to be a modal widget program. (Which you *always* do when calling it from a widget program.) IMAGES: Set this keyword if you only want to select 2D image data sets. Note that the selection number does *not* change just because fewer data sets are available in the selection widget. COMMON BLOCKS: None. SIDE EFFECTS: None. RESTRICTIONS: None. EXAMPLE: To load the world elevation data set: image = LoadData(7) MODIFICATION HISTORY: Written by: David Fanning, 5 March 1999. Added some additonal random data capability. 29 April 99. DWF Added IMAGES keyword. 31 March 2000. DWF.
(See loaddata.pro)
NAME: MPI_AXIS__DEFINE PURPOSE: This is a compound widget program for interactively adjusting and keeping track of keywords appropriate for configuing axis properties. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics CALLING SEQUENCE: xAxisObjext = Obj_New("MPI_AXIS", /XAxis) xAxisID = xAxisObject->GUI(baseWidgetID) INPUT PARAMETERS: None. INPUT KEYWORDS (Sent to the INIT method. The same keywords can be set with the SETPROPERTY method of the object.): AUTOKEYWORDS - An anonymous struture of keywords that are passed to the AutoRange function. AUTORANGE - The name of a function that can return axis range information as 2-element array. CHARSIZE - The character size used for the axis. By default, 1.0. EXACT - Set to indicate exact axis range scaling. (Can also be set with the STYLE keyword.) EXTEND - Set to indicate extended axis range. (Can also be set with the STYLE keyword.) GRIDSTYLE - The style used for drawing grid lines. HIDE - Set to indicate hidden axis style. (Can also be set with the STYLE keyword.) LOG - Set to indicate logarithmic axis. MARGIN - The axis margin. (Currently unimplemented.) MINOR - The number of minor tick marks between the major tick marks on the axis. NAME = A user-defined "name" for the object. NOBOX - Set to inhibit box-style axis. (Can also be set with the STYLE keyword.) NOZERO - Set to indicate NO_ZERO axis style. (Can also be set with the STYLE keyword.) RANGE - The axis range as a two-element array, [minrange, maxrange]. STYLE - The axis style. A 32-bit value whose bits select certain properties. See the on-line documentation for the !X.STYLE system variable for more information. These style properties can be set in a more natural way with other keywords. THICK - The thickness of the axis. By default, 1.0. TICKFORMAT - The format to use with tick marks. May be name of procedure. TICKINTERVAL - The interval to space tick marks for first-level axis. (Currently not implemented.) TICKLAYOUT - The type of tick layout desired. (Currently not implemented.) TICKLEN - The length of the ticks on the axis. By default, 0.0. (Note that changing this value will cause the Plot TICKLEN value to be ignored for the axis.) TICKNAME - The string names associated with each tick mark. (Currently not implemented.) TICKS - The number of major tick intervals. TICKUNITS - The units to use for tick labeling. (Currently not implemented.) TICKV - A vector of tick values. (Currently not implemented.) TITLE - The axis title. XAXIS - Set to indicate an X axis object. This is the default. YAXIS - Set to indicate a Y axis object. ZAXIS - Set to indicate a Z axis. METHOD PROCEDURES: GUI - This procedure method displays a graphical user interface that allows the user to change the axis configuration parameters. PARAMETERS: parent - The parent of the compound widget. KEYWORDS: EVENT_PRO - The specified event handler procedure. EVENT_FUNC - The specified event handler function. ONLY_STYLE - If set, display only style parameters in the GUI. ONLY_TICK - If set, display only tick parameters in the GUI. SHORT_FORM - Normally, all the axis properties are displayed in the GUI. Setting this keyword places the Tick and Style properties behind buttons on the interface. UVALUE - The user value of the compound widget. SETPROPERTY - This procedure can be used to set the properties of the axis configuration object without using the graphical user interface. The keywords are identical to those used in the INIT method, above. METHOD FUNCTIONS: GETKEYWORDS - This function method contains no arguments or keywords. It returns a structure, with fields equivalent to PLOT keywords for setting axis properties. The idea is that these keywords can be passed directly to the PLOT command using the keyword inheritance mechanism via the _EXTRA keyword to the plot command. ished with it. PROGRAM NOTES: Required Programs: The following programs are required to reside in your !PATH. They can be obtained from the Coyote Library: http://www.dfanning.com/programs/cw_spacer.pro http://www.dfanning.com/programs/error_message.pro http://www.dfanning.com/programs/fsc_droplist.pro http://www.dfanning.com/programs/fsc_field.pro EXAMPLE: A heavily documented program, named MPI_PLOT, is supplied with this program. This program not only explains how to use the MPI_PLOTCONFIG__DEFINE and the MPI_AXIS__DEFINE programs, it can be used as a wrapper program for the PLOT command that you can use with your own data. The program can be downloaded here: http://www.dfanning.com/programs/mpi_plot.pro MODIFICATION HISTORY: Written by David Fanning, March 2001.
(See mpi_axis__define.pro)
NAME: MPI_PLOT PURPOSE: This program is a simple wrapper for the IDL PLOT command. The main purpose of the program is to demonstrate one way the MPI_PLOTCONFIG program can be used to update plot parameters. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics CALLING SEQUENCE: MPI_Plot, x, y MPI_Plot, xx, yy, /Overplot INPUT PARAMETERS: x - The independent data. If y is not present, x is taken to be the dependent data. y - The dependent data. The vectors x and y must be the same length. xs - The independent data to overplot. If yy is not present, xx is taken to be the dependent data. yy - The dependent data to overplot. The vectors xx and yy must be the same length. INPUT KEYWORDS: BACKGROUND - The name of a background color. (See below for a list of color names.) By default on 24-bit systems: 'IVORY'. Uses 'GRAY' on 8-bit systems. COLOR - The name of the plot color. (See below for a list of color names.) By default on 24-bit systems: 'SADDLE BROWN'. Uses 'GREEN' on 8-bit systems. When OVERPLOTing, use the COLOR keyword to specify the color of the overplot. DATACOLOR - The name of the data color. By default the same as the COLOR keyword. (See below for a list of color names.) When OVERPLOTing, use the COLOR keyword to specify the color of the overplot. PSYM - The plot symbol value. By default, 18. Possible values are: 0 - Dot 1 - Filled Circle 2 - Filled Upward Triangle 3 - Filled Downward Triangle 4 - Filled Diamond 5 - Filled Square 6 - Open Circle 7 - Open Upward Triangle 8 - Open Downward Triangle 9 - Open Diamond 10 - Open Square 11 - Plus Sign 12 - X 13 - Star 14 - Filed Rightfacing Triangle 15 - Filled Leftfacing Triangle 16 - Open Rightfacing Triangle 17 - Open Leftfacing Triangle 18 - No Symbol (the default). TITLE - The title of the plot. By default, a null string. XTITLE - The title of the X axis of the plot. By default, a null string. YTITLE - The title of the Y axis of the plot. By default, a null string. In addition, any keyword appropriate for the MPI_PLOTCONFIG object program can be used. Among those keywords, are these most popular ones: CHARSIZE - The character size of the plot. By default, 1.0. CHARTHICK - The character thickness of the plot. By default, 1.0. FONT - The type of plot font: -1=Hershey, 0=Hardware, 1=True-Type. By default, !P.FONT. LINESTYLE - The plot linestyle. By default, 0. Possible values are: 0 - Solid Line 1 - Dotted 2 - Dashed 3 - Dash Dot 4 - Dash Dot Dot 5 - Long Dash 6 - No Line POSITION - The position of the plot in the plot window in normalized coordinates. By default, [0.20, 0.15, 0.95, 0.95]. SYMSIZE - The plot symbol size. By default, 1.0. THICK - The plot line thickness. By default, 1.0. TICKLEN - The plot tick length. By default, 0.02. COLOR NAMES: The following color names can be used for BACKGROUND, COLOR and DATACOLOR keywords: White, Snow, Ivory, Light Yellow, Cornsilk, Beige, Seashell, Linen, Antique White, Papaya, Almond, Bisque, Moccasin, Wheat, Burlywood, Tan, Light Gray, Lavender, Medium Gray, Gray, Slate Gray, Dark Gray , Charcoal, Black, Light Cyan, Powder Blue, Sky Blue, Steel Blue, Dodger Blue, Royal Blue, Blue, Navy, Honeydew, Pale Green, Aquamarine, Spring Green, Cyan, Turquoise, Sea Green, Forest Green, Green Yellow, Chartreuse, Lawn Green, Green, Lime Green, Olive Drab, Olive, Dark Green, Pale Goldenrod, Khaki, Dark Khaki, Yellow, Gold, Goldenrod, Dark Goldenrod, Saddle Brown, Rose, Pink, Rosy Brown, Sandy Brown, Peru, Indian Red, Chocolate, Sienna, Dark Salmon, Salmon, Light Salmon, Orange, Coral, Light Coral, Firebrick, Brown, Hot Pink, Deep Pink, Magenta, Tomato, Orange Red, Red, Violet Red, Maroon, Thistle, Plum, Violet, Orchid, Medium Orchid, Dark Orchid, Blue Violet, and Purple. REQUIRED PROGRAMS: The following programs are required to reside in your !PATH. They can be obtained from the Coyote Library: http://www.dfanning.com/programs/adjustposition.pro http://www.dfanning.com/programs/cw_drawcolor.pro http://www.dfanning.com/programs/cw_spacer.pro http://www.dfanning.com/programs/error_message.pro http://www.dfanning.com/programs/fsc_color.pro http://www.dfanning.com/programs/fsc_droplist.pro http://www.dfanning.com/programs/fsc_field.pro http://www.dfanning.com/programs/fsc_fileselect.pro http://www.dfanning.com/programs/fsc_inputfield.pro http://www.dfanning.com/programs/fsc_psconfig__define.pro http://www.dfanning.com/programs/mpi_plotconfig__define.pro http://www.dfanning.com/programs/mpi_axis.pro http://www.dfanning.com/programs/mpi_axis__define.pro http://www.dfanning.com/programs/pickcolorname.pro http://www.dfanning.com/programs/psconfig.pro http://www.dfanning.com/programs/pswindow.pro http://www.dfanning.com/programs/tvread.pro All these programs can be obtained at once by downloading the MPI_PLOT zip file: http://www.dfanning.com/programs/mpi_plot.zip RESTRICTIONS: The addition of the OVERPLOT keyword required a COMMON block. Thus, only one version of MPI_PLOT can be active at any particular time. Colors will be loaded in the color table. EXAMPLE: x = Findgen(11) & y = Findgen(11) MPI_PLOT, x, y MPT_PLOT, Reverse(x), y, /Overplot, Linestyle=2 MODIFICATION HISTORY: Written by David Fanning, March 2001, and offered to the IDL user community by the Max-Plank Institute of Meteorology in Hamburg, Germany. Added OVERPLOT keyword and made numerous general improvements. 21 November 2001. DWF
(See mpi_plot.pro)
NAME: MPI_PLOTCONFIG__DEFINE PURPOSE: This is a program for interactively adjusting and keeping track of keywords appropriate for configuring the PLOT command. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics CALLING SEQUENCE: plotConfigObj = Obj_New("MPI_PLOTCONFIG") INPUT PARAMETERS: None. INPUT KEYWORDS (Sent to the INIT method. The same keywords can be set with the SETPROPERTY method of the object.): BACKGROUND - The name of the background color. By default on 24-bit systems: 'IVORY'. ON 8-bit systems 'GRAY'. CHARSIZE - The character size of the plot. By default, 1.0. CHARTHICK - The character thickness of the plot. By default, 1.0. COLOR - The name of the plot color. (This will be the axis color if DATACOLOR is also used.) By default on 24-bit systems: 'SADDLE BROWN'. Uses 'GREEN' on 8-bit systems. DATACOLOR - The name of the data color. (Requires use of USEDATACOLOR to be active.) By default on 24-bit systems: 'NAVY'. Uses 'YELLOW' on 8-bit systems. _EXTRA - Extra keywords to be passed to MPI_AXIS objects used internally. FONT - The type of plot font: -1=Hershey, 0=Hardware, 1=True-Type. By default, !P.FONT.; LINESTYLE - The plot linestyle. By default, 0. Possible values are: 0 - Solid Line 1 - Dotted 2 - Dashed 3 - Dash Dot 4 - Dash Dot Dot 5 - Long Dash 6 - No Line NOAXISINFO - Set this keyword to inhibit axis information on the GUI. By default, 0. POSITION - The position of the plot in the plot window in normalized coordinates. By default, [0.20, 0.15, 0.95, 0.95]. PSYM - The plot symbol value. By default, 18. Possible values are: 0 - Dot 1 - Filled Circle 2 - Filled Upward Triangle 3 - Filled Downward Triangle 4 - Filled Diamond 5 - Filled Square 6 - Open Circle 7 - Open Upward Triangle 8 - Open Downward Triangle 9 - Open Diamond 10 - Open Square 11 - Plus Sign 12 - X 13 - Star 14 - Filed Rightfacing Triangle 15 - Filled Leftfacing Triangle 16 - Open Rightfacing Triangle 17 - Open Leftfacing Triangle 18 - No Symbol (the default). SYMSIZE - The plot symbol size. By default, 1.0. SUBTITLE - The plot subtitle. By default, "". TITLE - The plot title. By default, "". THICK - The plot line thickness. By default, 1.0. TICKLEN - The plot tick length. By default, 0.02. USEDATACOLOR - Set this keyword to return a DATACOLOR field in the keyword structure. By default, 0. XAXIS - An MPI_AXIS object for the X axis. One is created by default, if not provided. YAXIS - An MPI_AXIS object for the Y axis. One is created by default, if not provided. METHOD PROCEDURES: GUI - This procedure method displays a graphical user interface that allows the user to change plot configuration parameters. The following keywords can be used: ALL_EVENTS - Set this keyword to have an event sent any time something in the GUI changes. The default is to send an event only when the user hits the ACCEPT button. Note that the NOTIFYID keyword must be used to generate events. BLOCK - Set this keyword if you want to block the command line. The default is to NOT block the command line. DEFAULTFONT - The name of a font to use as the default font. GROUP_LEADER - The group leader for this GUI. If this keyword is used, the program will be distroyed when the group leader is destroyed. LABELDEFAULTSIZE - The default screen size for a label. All labels are offsets from this size. 55 by default. The purpose of this keyword is to allow the user to modify the look of the GUI if different fonts are used. LABELFONT - The name of a font to use for program labels. NOTIFYID - A two-element array containing the widget identifier and top-level base ID of a widget designated to receive an event from this program. The event structure will be defined and sent like this: Widget_Control, notifyid[0], Send_Event={ MPI_PLOTCONFIG_EVENT, $ ID: notifyid[0], $ TOP:notifyid[1], $ HANDLER: 0L, $ OBJECT: self } Most event handlers will be written so that they will get the plot keywords from the plot configuration object and draw the plot. A sample event handler might look like this: PRO MPI_Plot_Configuration_Events, event Widget_Control, event.top, Get_UValue=info, /No_Copy WSet, info.wid plotkeywords = event.object->GetKeywords() Plot, info.indep, info.dep, _Extra=plotkeywords Widget_Control, event.top, Set_UValue=info, /No_Copy END XLONGFORM - By default, the X axis information is displayed in "short" form, with only the most relevant information readily available. Other axis information is accessed via buttons. Set this keyword to display the X axis information in a "long" form, in which all the axis information is immediately visible. YLONGFORM - By default, the Y axis information is displayed in "short" form, with only the most relevant information readily available. Other axis information is accessed via buttons. Set this keyword to display the Y axis information in a "long" form, in which all the axis information is immediately visible. SETPROPERTY - This procedure can be used to set the properties of the plot configuration object without using the graphical user interface. The keywords are identical to those used in the INIT method, above. METHOD FUNCTIONS: GETKEYWORDS - This function method contains no arguments or keywords. It returns a structure, with fields equivalent to PLOT keywords. The idea is that these keywords can be passed directly to the PLOT command using the keyword inheritance mechanism via the _EXTRA keyword to the plot command. A possible sequence of commands might look like this: IDL> plotConfigObj = Obj_New("MPI_PLOTCONFIG") ; Create the plot configuration object. IDL> plotConfigObj->GUI, /Block ; Allow the user to configure the plot parameters. IDL> plotKeywords = plotConfigObj->GetKeywords() ; Get the plot keywords. IDL> Plot, x, y, _Extra=plotKeywords ; Draw the plot in the way the user specified. IDL> Obj_Destroy, plotConfigObj ; Destroy the object when finished with it. PROGRAM NOTES: Color Names: Color names are those used with FSC_Color and PickColorName. See the documentation for those programs for instuctions on loading your own colors. To see the default colors and names, type this: IDL> color = PickColorName('yellow') Working with DataColor: Many people like to have the data color in a line plot different from the axis color. This requires two commands in IDL: a PLOT command with the NODATA keyword set, to draw in the axis color, followed by the OPLOT command, with the data drawn in the data color. Unfortunately, IDL only has a single COLOR keyword to represent both colors. So, you must be a bit resourceful to use this feature. The proper sequence of commands to use this feature of the plot configuration object will looks like this. First, initialize the object with the USEDATACOLOR keyword: plotConfigObj = Obj_New("MPI_PLOTCONFIG", /UseDataColor) ; Use the DataColor option. When you are ready to draw the plot, the keyword structure will have a new field named DataColor. Since this keyword is not recognized by the PLOT command, it will be ignored in the first PLOT command to draw the axes: plotKeywords = plotConfigObj->GetKeywords() ; Get the plot keywords. Plot, x, y, _Extra=plotKeywords, /NoData ; Just draw the axes. Next, change the color field to the datacolor field value, and overplot the data onto the axes you just drew: plotKeywords.color = PlotKeywords.datacolor OPlot, x, y, _Extra=plotKeywords You can see an example of how this is done in the heavily documented example program MPI_PLOT, which you can use as a wrapper for the PLOT command with your own data, if you like. Required Programs: The following programs are required to reside in your !PATH. They can be obtained from the Coyote Library: http://www.dfanning.com/programs/adjustposition.pro http://www.dfanning.com/programs/cw_drawcolor.pro http://www.dfanning.com/programs/cw_spacer.pro http://www.dfanning.com/programs/error_message.pro http://www.dfanning.com/programs/fsc_color.pro http://www.dfanning.com/programs/fsc_droplist.pro http://www.dfanning.com/programs/fsc_field.pro http://www.dfanning.com/programs/fsc_plotwindow.pro http://www.dfanning.com/programs/mpi_axis__define.pro http://www.dfanning.com/programs/pickcolorname.pro http://www.dfanning.com/programs/pswindow.pro http://www.dfanning.com/programs/tvread.pro EXAMPLE: A heavily documented program, named MPI_PLOT, is supplied with this program. This program not only explains how to use the MPI_PLOTCONFIG__DEFINE program, it can be used as a wrapper program for the PLOT command that you can use with your own data. The program can be downloaded here: http://www.dfanning.com/programs/mpi_plot.pro MODIFICATION HISTORY: Written by David Fanning, March 2001.
(See mpi_plotconfig__define.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:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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 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:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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 object_shade_surf.pro)
NAME: PICKCOLOR PURPOSE: A modal dialog widget allowing the user to select the RGB color triple specifying a color. The return value of the function is the color triple specifying the color or the "name" of the color if the NAME keyword is set. AUTHOR: FANNING SOFTWARE CONSULTING: David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics, Color Specification. See related program FSC_COLOR. CALLING SEQUENCE: color = PickColor(colorindex) RETURN VALUE: The return value of the function is a 1-by-3 array containing the values of the color triple that specifies the selected color. The color can be loaded, for example, in any color index: color = PickColor(240) TVLCT, color, 240 The return value is the original color triple if the user selects the CANCEL button. IF the NAMES keyword is set, the return value of the function is the "name" of the selected color. This would be appropriate for passing to the FSC_COLOR program, for example. OPTIONAL INPUT POSITIONAL PARAMETERS: COLORINDEX: The color index of the color to be changed. If not specified the color index !D.Table_Size - 2 is used. The Current Color and the Color Sliders are set to the values of the color at this color index. OPTIONAL INPUT KEYWORD PARAMETERS: GROUP_LEADER: The group leader for this widget program. This keyword is required for MODAL operation. If not supplied the program is a BLOCKING widget. Be adviced, however, that the program will NOT work if called from a blocking widget program, unless a GROUP_LEADER is supplied. NAMES: Set this keyword to return the "name" of the selected color rather than its color triple. STARTINDEX: 88 pre-determined colors are loaded The STARTINDEX is the index in the color table where these 88 colors will be loaded. By default, it is !D.Table_Size - 89. TITLE: The title on the program's top-level base. By default the title is "Pick a Color". OPTIONAL INPUT KEYWORD PARAMETERS: CANCEL: A keyword that is set to 1 if the CANCEL button is selected and to 0 otherwise. COMMON BLOCKS: None. SIDE EFFECTS: 88 pre-determined colors are loaded in the color table. In addition, the color index at COLORINDEX is modified while the program is on the display. When the program exits, the entry color table is restored. Thus, on 8-bit displays there might be some color effects in graphics windows while PICKCOLOR is on the display. Changes in the color table are not noticable on 16-bit and 24-bit displays. EXAMPLE: To specify a color for a plot in color decomposition OFF mode: Device, Decomposed=0 !P.Color = !P.Color < (!D.Table_Size - 1) color = PickColor(!P.Color, Cancel=cancelled) IF NOT cancelled THEN BEGIN TVLCT, color, !P.Color Plot, data ENDIF To specify a color for a plot in color decomposition ON mode: Device, Decomposed=1 color = PickColor(Cancel=cancelled) !P.Color = Color24(color) IF NOT cancelled THEN Plot, data To obtain the name of the selected color to pass to GetColor: selectedColor = PickColor(/Name) axisColor = FSC_Color(selectedColor, !D.Table_Size-4) MODIFICATION HISTORY: Written by: David Fanning, 28 Oct 99. Added NAME keyword. 18 March 2000, DWF. Fixed a small bug when choosing a colorindex less than !D.Table_Size-17. 20 April 2000. DWF. Added actual color names to label when NAMES keyword selected. 12 May 2000. DWF. Modified to use 88 colors and FSC_COLOR instead of 16 colors and GETCOLOR. 4 Dec 2000. DWF.
(See pickcolor.pro)
NAME: PICKCOLORNAME PURPOSE: The purpose of this program is to provide a blocking or modal widget interface for selecting a color "name". The program uses colors familiar to the FSC_COLOR program, and is often used to select a color name for passing to FSC_COLOR. AUTHOR: FANNING SOFTWARE CONSULTING: David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics, Color Specification. CALLING SEQUENCE: colorName = PickColorName(startColorName) OPTIONAL INPUT PARAMETERS: startColorName: A string with the "name" of the color. Valid names depend on program variables, but typically include these colors: Black Pink Magenta Aqua Cyan SkyBlue Yellow Beige Green Charcoal Red Gray Blue Orchid Navy White The color WHITE is used if this parameter is absent. INPUT KEYWORD PARAMETERS: BOTTOM: The colors used in the program must be loaded somewhere in the color table. This keyword indicates where the colors start loading. By default BOTTOM is set equal to !D.Table_Size-NCOLORS-1. COLUMNS: Set this keyword to the number of columns the colors should be arranged in. FILENAME: The string name of an ASCII file that can be opened to read in color values and color names. There should be one color per row in the file. Please be sure there are no blank lines in the file. The format of each row should be: redValue greenValue blueValue colorName Color values should be between 0 and 255. Any kind of white-space separation (blank characters, commas, or tabs) are allowed. The color name should be a string, but it should NOT be in quotes. A typical entry into the file would look like this: 255 255 0 Yellow GROUP_LEADER: This identifies a group leader if the program is called from within a widget program. Note that this keyword MUST be provided if you want to guarantee modal widget functionality. (If you don't know what this means, believe me, you WANT to use this keyword, always.) INDEX: This keyword identifies a color table index where the selected color is to be loaded when the program exits. The default behavior is to restore the input color table and NOT load a color. TITLE: This keyword accepts a string value for the window title. The default is "Select a Color". OUTPUT KEYWORD PARAMETERS: CANCEL: On exit, this keyword value is set to 0 if the user selected the ACCEPT button. IF the user selected the CANCEL button, or closed the window in any other way, this keyword value is set to 1. COMMON BLOCKS: None. SIDE EFFECTS: Colors are loaded in the current color table. The input color table is restored when the program exits. This will only be noticable on 8-bit displays. The startColorName is returned if the user cancels or destroys the widget before a selection is made. Users should check the CANCEL flag before using the returned color. EXAMPLE: To call the program from the IDL comamnd line: IDL> color = PickColorName("red") & Print, color To call the program from within a widget program: color = PickColorName("red", Group_Leader=event.top) & Print, color MODIFICATION HISTORY: Written by: David Fanning, 31 August 2000. Modified program to read colors from a file and to use more colors on 24-bit platforms. 16 October 2000. DWF. Added the COLUMNS keyword. 16 October 2000. DWF. Fixed a small problem with mapping a modal widget. 2 Jan 2001. DWF
(See pickcolorname.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:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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 process.pro)
NAME: PSCONFIG PURPOSE: This program is simply a function wrapper for the FSC_PSCONFIG object program (fsc_psconfig__define.pro). It was written so that it could serve as a drop-in replacement for the PS_FORM program it replaces. It calls the object program's graphical user interface as a modal widget and returns the DEVICE keywords collected from the form in a form that is appropriate for configuring the PostScript device. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CALLING SEQUENCE: psKeywords = PSConfig() CATEGORY: Configuring PostScript output. DOCUMENTATION: Complete documentation for the FSC_PSCONFIG object, including keyword and method descriptions, and example programs using the object can be found on the Coyote's Guide to IDL Programming web page: http://www.dfanning.com/programs/docs/fsc_psconfig.html INPUT: psConfigObject -- An optional FSC_PSCONFIG object reference can be passed as an argument to the function. The object is not destroyed if passed in as an argument. psObject = Obj_New("FSC_PSCONFIG") keywords = PSConfig(psObject) Having the object means that you have an on-going and current record of exactly how your PostScript device is configured. Be sure to destroy the object when you are finished with it. KEYWORDS: Any keyword accepted by the FSC_PSCONFIG object can be used with this program. Here are a few of the most popular keywords. Bits_per_Pixel - The number of image bits saved for each image pixel: 2, 4, or 8. The default is 8. Color - Set this keyword to select Color PostScript output. Turned on by default. DefaultSetup - Set this keyword to the "name" of a default style. Current styles (you can easily create and add your own to the source code) are the following: "System (Portrait)" - The normal "default" system set-up. Also, "System". "System (Landcape)" - The normal "default" landscape system set-up. "Centered (Portrait)" - The window centered on the page. Also, "Center" or "Centered". "Centered (Landscape)" - The window centered on the landscape page. Also, "Landscape". "Square (Portrait)" - A square plot, centered on the page. "Square (Landscape)" - A square plot, centered on the landscape page. "Figure (Small)" - A small encapsulated figure size, centered on page. Also, "Encapsulated" or "Encapsulate". "Figure (Large)" - A larger encapsulated figure size, centered on page. Also, "Figure". "Color (Portrait)" - A "centered" plot, with color turned on. Also, "Color". "Color (Landscape)" - A "centered" landscape plot, with color turned on. Directory - Set this keyword to the name of the starting directory. The current directory is used by default. Encapsulate - Set this keyword to select Encapsulated PostScript output. Turned off by default. European - Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units). Turned off by default. Filename - Set thie keyword to the name of the PostScript file. The default is "idl.ps". Inches - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. Set by European keyword by default. Landscape - Set this keyword to select Landscape page output. Portrait page output is the default. PageType - Set this keyword to the "type" of page. Possible values are: "Letter" - 8.5 by 11 inches. (Default, unless the European keyword is set.) "Legal" - 8.5 by 14 inches. "Ledger" - 11 by 17 inches. "A4" - 21.0 by 29.7 centimeters. (Default, if the European keyword is set.) XOffset - Set this keyword to the X Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.) XSize - Set this keyword to the X size of the PostScript "window". Uses "System (Portrait)" defaults. YOffset - Set this keyword to the Y Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.) YSize - Set this keyword to the Y size of the PostScript "window". Uses "System (Portrait)" defaults. In addition, the following keywords can be used: CANCEL -- An output keyword that will be set to 1 if the user chooses the Cancel button on the form. It will be 0 otherwise. FONTINFO -- Set this keyword is you wish to have font information appear on the form. The default is to not include font information. FONTTYPE -- Set this keyword to a named variable that will indicate the user's preference for font type. Values will be -1 (Hershey fonts), 0 (hardware fonts), and 1 (true-type fonts). This keyword will always return -1 unless the FONTINFO keyword has also been set. GROUP_LEADER -- Set this keyword to a widget identifier of the widget you wish to be a group leader for this program. EXAMPLE: To have the user specify PostScript configuration parameters, use the program like this: keywords = PSConfig(Cancel=cancelled) IF cancelled THEN RETURN thisDevice = !D.Name Set_Plot, 'PS' Device, _Extra=keywords Plot, findgen(11) ; Or whatever graphics commands you use. Device, /Close_File Set_Plot, thisDevice OTHER PROGRAMS NEEDED: The following programs are required to run this one: fsc_droplist.pro fsc_fileselect.pro fsc_inputfield.pro fsc_plotwindow fsc_psconfig__define.pro MODIFICATIONS: Written by David Fanning, 31 January 2000.
(See psconfig.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. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ 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. FUDGE: A quick way to set symetrical XFUDGE and YFUDGE factors. If this keyword is set to a value, XFUDGE and YFUDGE keywords are set to the same value. LANDSCAPE: Normally this function assumes a PostScript window in Portrait mode. Setting this keyword assumes you want the graphic in Landscape mode. 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. PAGESIZE: Set this keyword to a string indicating the type of PostScript page size you want. Current values are "LETTER", "LEGAL", and "A4". Default is "LETTER". PRINTER: Set this keyword if the output will be used to configure the PRINTER device, rather than the PS device. (In the PRINTER device, offsets are always calculated from the lower-left corner of the page and do not rotate in Landscape mode, as they do with the PS device.) Note that the PRINTER device is only able to accept these keywords in IDL 5.1 and higher. XFUDGE: Printers calculate the offset point from the printable edge of the paper (sometimes), rather from the corner of the paper. For example, on my Lexmark printer, both X and Y offsets are calculated from a point 0.25 inches in from the edge. This keyword allows you to set a "fudge" factor that will be subtracted from the XOFFSET that is returned to the user. This allows you to create output that is centered on the page. The fudge factor should be in the same units as the returned size and offset values. YFUDGE: Printers calculate the offset point from the printable edge of the paper (sometimes), rather from the corner of the paper. For example, on my Lexmark printer, both X and Y offsets are calculated from a point 0.25 inches in from the edge. This keyword allows you to set a "fudge" factor that will be subtracted from the YOFFSET that is returned to the user. This allows you to create output that is centered on the page. The fudge factor should be in the same units as the returned size and offset values. 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, PORTRAIT:0, LANDSCAPE:0} The units of the four size fields are inches unless the CM keyword is set. The output can be used to immediately configure the PostScript or Printer device, like this: Set_Plot, 'PS' ; or 'PRINTER' Device, _Extra=pageInfo RESTRICTIONS: The aspect ratio of the current graphics window is calculated like this: aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE EXAMPLE: To create a PostScript output window with the same aspect ratio as the curently active display window, type: pageInfo = PSWINDOW() SET_PLOT, 'PS' DEVICE, _Extra=pageInfo To configure the PRINTER device: pageInfo = PSWINDOW(/Printer, Fudge=0.25) SET_PLOT, 'PRINTER' DEVICE, _Extra=pageInfo 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 Fixed a bug in how landscape offsets were calculated. 19 JUL 99. DWF. Fixed a bug in the way margins were used to conform to my original conception of the program. 19 JUL 99. DWF. Added Landscape and Portrait fields to the return structure. 19 JUL 99. DWF. Added PageSize keyword, changed MARGIN keyword, and completely rewrote most of the intenal code. 9 FEB 2000. DWF. Fixed a bug in how I calculated the aspect ratio. 1 MAR 2000. DWF. Added PRINTER keyword to return proper offset values for the PRINTER device, where the offset location is not rotated. 1 MAR 2000. DWF. Added PRINTER fudge factors to take into account that printer offsets are calculated from the printable area of the paper, rather than the corner of the paper. 8 AUG 2000. DWF.
(See pswindow.pro)
NAME: REVERSE_AXES PURPOSE: The purpose of this program is to extend the SIMPLE_SURFACE program to demonstrate how to create reversible axes in object graphics. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Widgets, Object Graphics. CALLING SEQUENCE: REVERSE_AXES, 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: EXACT: Set this keyword to get exact axis scaling. _EXTRA: This keyword collects otherwise undefined keywords that are passed to the surface initialization routine. GROUP_LEADER: The group leader for this program. When the group leader is destroyed, this program will be destroyed. LANDSCAPE: Set this keyword if you are printing in landscape mode. The default is Portrait mode. The Landscape keyword on the PRINTER object is set, but not all printers will honor this keyword setting. If yours does not, set Landscape mode in the Printer Setup dialog. VECTOR: Set this keyword if you want vector printing (as opposed to the default bitmap printing). XTITLE: A string used as the X title of the plot. YTITLE: A string used as the Y title of the plot. ZTITLE: A string used as the Z title of the plot. COMMON BLOCKS: None. EXAMPLE: To use this program with your 2D data, type: IDL> Reverse_Axes, data MODIFICATION HISTORY: Written by: David Fanning, October 2001.
(See reverse_axes.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 minimum data range. And the maximum value of the vector (or array) is set equal to the maximum data range. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Utilities CALLING SEQUENCE: scaledVector = SCALE_VECTOR(vector, minRange, maxRange) INPUT POSITIONAL PARAMETERS: vector: The vector (or array) to be scaled. minRange: The minimum value of the scaled vector. Set to 0 by default. maxRange: The maximum value of the scaled vector. Set to 1 by default. INPUT KEYWORD PARAMETERS: MAXVALUE: Any value in the input vector greater than this value is set to this value before scaling. MINVALUE: Any value in the input vector less than this value is set to this value before scaling. NAN: Set this keyword to enable not-a-number checking. NANs in vector will be ignored. 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 1998. Added MAXVALUE and MINVALUE keywords. 5 Dec 1999. DWF. Added NAN keyword at request of Ben Tupper. 18 Sept 2000. DWF.
(See scale_vector.pro)
NAME: SELECTIMAGE PURPOSE: The purpose of this program is to allow the user to select an image file for reading. The image data is returned as the result of the function. The best feature of this program is the opportunity to browse the image before reading it. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: General programming. CALLING SEQUENCE: image = SelectImage() INPUT PARAMETERS: None. All input is via keywords. INPUT KEYWORDS: BMP -- Set this keyword to select BMP files. DICOM -- Set this keyword to select DICOM files. DIRECTORY -- The initial input directory name. The current directory by default. FILENAME -- The initial filename. If the initial directory has image files of the correct type, the default is to display the first of these files. Otherwise, blank. _EXTRA -- This keyword is used to collect and pass keywords on to the FSC_FILESELECT object. See the code for FSC_FILESELECT for details. GIF -- Set this keyword to select GIF files. This capability is not available in IDL 5.4 and higher. GROUP_LEADER -- Set this keyword to a widget identifier group leader. This keyword MUST be set when calling this program from another widget program to guarantee modal operation. JPEG -- Set this keyword to select JPEG files. PICT -- Set this keyword to select PICT files. PNG -- Set this keyword to select PNG files. PREVIEWSIZE -- Set this keyword to the maximum size (in pixels) of the preview window. Default is 150. TIFF -- Set this keyword to select TIFF files. (This is the default filter selection.) OUTPUT KEYWORDS: CANCEL -- This keyword is set to 1 if the user exits the program in any way except hitting the ACCEPT button. The ACCEPT button will set this keyword to 0. FILEINFO -- This keyword returns information about the selected file. Obtained from the QUERY_**** functions. COMMON BLOCKS: None. RESTRICTIONS: Probably doesn't work correctly on VMS systems :-( If you can help, please contact me. I don't have a VMS system to test on. OTHER COYOTE LIBRARY FILES REQUIRED: http://www.dfanning.com/programs/fsc_fileselect.pro http://www.dfanning.com/programs/tvimage.pro EXAMPLE: To read JPEG files from the directory: IDL> image = SelectImage(/JPEG) MODIFICATION HISTORY: Written by: David Fanning, 18 Jan 2001. Added modification to read both 8-bit and 24-bit BMP files. 27 Jan 2001. DWF.
(See selectimage.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:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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 select_objects.pro)
NAME: SHOWPROGRESS__DEFINE PURPOSE: An object for creating a progress bar. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Utilities CALLING SEQUENCE: progressBar = Obj_New("SHOWPROGRESS") INPUTS: parent: A widget identifier of the widget that will be the group leader for this program. It is *required* for modal operation. If missing, you are on your own. :-( KEYWORDS: CANCELBUTTON: Set this keyword if a Cancel button is desired. DELAY: The total time the widget should be on the display in AutoUpDate mode. The keyword applies only to AutoUpDate mode. Default is 5 seconds. STEPS: The number of steps to take in AutoUpDate mode. The keyword applies only to AutoUpDate mode. MESSAGE: The text of the label above the progress bar. Default is "Operation in Progress...". TITLE: ; The text of the top-level base title bar. Default is "" COLOR: The color to draw the progress bar. XSIZE: The XSize of the progress bar in Device coordinates. Default is 150. YSIZE: The YSize of the progress bar in Device coordinates. Default is 10. AUTOUPDATE: Set this keyword to be in AutoUpDate mode. PROCEDURE: There are two modes. In AutoUpDate mode, a delay and number of steps is required. The modal widget stays on the display until the total time exceeds the DELAY or the requested number of steps is taken. A TIMER widget is used to generate update events. Nothing can be going on concurrently in AutoUpDate mode. To enter AutoUpDate mode, type this: progressBar = Obj_New("SHOWPROGRESS", /AutoUpDate, Delay=2, Steps=10) progressBar->Start Obj_Destroy, progressBar The program will update and destroy itself automatically. (The object itself is not destroyed. You must do this explicitly, as in the example above.) In normal mode, the user is responsible for starting, updating, and destroying the progress indicator. The sequence of commands might look like this: progressBar = Obj_New("SHOWPROGRESS") progressBar->Start FOR j=0,9 DO BEGIN Wait, 0.5 ; Would probably be doing something ELSE here! progressBar->Update, (j+1)*10 ENDFOR progressBar->Destroy Obj_Destroy, progressBar Normal mode gives you the opportunity to update the Progress Bar in a loop while something else is going on. See the example program at the end of this file. Note that the object itself is not destroyed when calling the DESTROY method. You must explicitly destroy the object, as in the example above. METHODS: CHECKCANCEL: This function method returns a 1 if the user has clicked the CANCEL button. Otherwise, it returns a 0. cancelled = progressBar->CheckCancel() IF cancelled THEN progressBar->Destroy DESTROY: Destroys the ShowProgress widgets. It does NOT destroy the object. progressBar->Destroy GETPROPERTY: Gets the properties that can be set in the INIT method, including the parent widget ID. progressBar->GetProperty, Steps=currentNSteps, Delay=currentDelay SETCOLOR: Changes the color of the progress bar. progressBar->SetColor, !P.Color SETLABEL: Changes the text on the widget label. progressBar->SetLabel, 'This text instead' SETPROPERTY: Allows the user to set the INIT parameter via keywords. progressBar->SetProperty, Color=244, XSize=200, Message='Please Wait...' START: Puts the ShowProgress bar on the display. In AutoUpDate mode, the widget starts to automatically update. progressBar->Start UPDATE: Updates the progress bar. Requires on argument, a number between 0 and 100 that indicates the percent of progress bar that should be filled with a color. progressBar->Update, 50 EXAMPLE: See the example program at the bottom of this file. RESTRICTIONS: In contradiction to the IDL documentation, making the parent widget insensitive in normal mode does NOT prevent the parent widgets from receiving events on my Windows NT 4.0, SP 4 system running IDL 5.2, IDL 5.2.1, or IDL 5.3 (beta). Note that if you specify a CANCEL button the Show Progress program CANNOT run as a MODAL widget program. Thus, user *may* be able to generate events in the calling program while this program is running. MODIFICATION HISTORY: Written by: David Fanning, 26 July 1999. Added code so that the current graphics window doesn't change. 1 September 1999. DWF. Added yet more code for the same purpose. 3 September 1999. DWF. Added a CANCEL button and made other minor modifications. 12 Oct 1999. DWF.
(See showprogress__define.pro)
NAME: SIMPLE_SURFACE PURPOSE: The purpose of this program is to demonstrate how to create a simple surface plot with axes and rotational capability in object graphics. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Widgets, Object Graphics. CALLING SEQUENCE: SIMPLE_SURFACE, 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: EXACT: Set this keyword to get exact axis scaling. _EXTRA: This keyword collects otherwise undefined keywords that are passed to the surface initialization routine. GROUP_LEADER: The group leader for this program. When the group leader is destroyed, this program will be destroyed. LANDSCAPE: Set this keyword if you are printing in landscape mode. The default is Portrait mode. The Landscape keyword on the PRINTER object is set, but not all printers will honor this keyword setting. If yours does not, set Landscape mode in the Printer Setup dialog. VECTOR: Set this keyword if you want vector printing (as opposed to the default bitmap printing). XTITLE: A string used as the X title of the plot. YTITLE: A string used as the Y title of the plot. ZTITLE: A string used as the Z title of the plot. COMMON BLOCKS: None. EXAMPLE: To use this program with your 2D data, type: IDL> Simple_Surface, data
(See simple_surface.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. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 2642 Bradbury Court Fort Collins, CO 80521 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ 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. 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 to be sure hardware fonts are not selected. 29 April 2000. DWF. Added a pixmap to get proper scaling in skinny windows. 16 May 2000. DWF. Forgot I can't do pixmaps in all devices. :-( Fixed. 7 Aug 2000. DWF.
(See str_size.pro)
NAME: TEXTURE_SURFACE PURPOSE: The purpose of this program is to demonstrate how to create a simple surface plot with an image applied as a texture in object graphics. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Widgets, Object Graphics. CALLING SEQUENCE: TEXTURE_SURFACE, data, x, y, Image=image 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: BORDERCOLOR : A three element array [R, G, B] describing the color used to draw the non-textured part of the surface if POSITION is specified. COLORTABLE: The number of an IDL color table to use for the image texture. Used only if the supplied image is 2D. Ignored otherwise. EXACT: Set this keyword to get exact axis scaling. _EXTRA: This keyword collects otherwise undefined keywords that are passed to the surface initialization routine. GROUP_LEADER: The group leader for this program. When the group leader is destroyed, this program will be destroyed. IMAGE: An 8-bit or 24-bit image you wish to use for the image texture. LANDSCAPE: Set this keyword if you are printing in landscape mode. The default is Portrait mode. The Landscape keyword on the PRINTER object is set, but not all printers will honor this keyword setting. If yours does not, set Landscape mode in the Printer Setup dialog. POSITION: A four element array of the form [x1, y1, x2, y2] that will position the image with its lower-left corner at (x1,y1) and its upper- right corner at (x2,y2) in the device coordinate system of the surface. In other words, if my surface is a 41 by 41 array, and I want the image positioned with lower-left at (5,10) and upper-right at (25,18), then I call the program like this: Texture_Surface, Position=[5, 10, 25, 18]. VECTOR: Set this keyword if you want vector printing (as opposed to the default bitmap printing). XTITLE: A string used as the X title of the plot. YTITLE: A string used as the Y title of the plot. ZTITLE: A string used as the Z title of the plot. COMMON BLOCKS: None. EXAMPLE: To use this program with your surface data and 2D image, type: IDL> data = Loaddata(2) IDL> image = Loaddata(7) IDL> Texture_Surface, data, Image=image, Colortable=33 MODIFICATION HISTORY Written by David Fanning, 1 Nov 2001, from previous Simple_Surface code. Modifications suggested by Karl Shultz added to allow surface color specification and improved resolution about image edges when positioning images. BORDERCOLOR keyword added. DWF. 4 Nov 2001.
(See texture_surface.pro)
NAME: TVIMAGE PURPOSE: This purpose of TVIMAGE is to enable the TV command in IDL to be a completely device-independent and color-decomposition- state independent command. On 24-bit displays color decomposition is always turned off for 8-bit images and on for 24-bit images. The color decomposition state is restored for those versions of IDL that support it (> 5.2). Moreover, TVIMAGE adds features that TV lacks. For example, images can be positioned in windows using the POSITION keyword like other IDL graphics commands. TVIMAGE also supports the !P.MULTI system variable, unlike the TV command. TVIMAGE was written to work especially well in resizeable graphics windows. Note that if you wish to preserve the aspect ratio of images in resizeable windows, you should set the KEEP_ASPECT_RATIO keyword, described below. TVIMAGE works equally well on the display, in the PostScript device, and in the Printer and Z-Graphics Buffer devices. The TRUE keyword is set automatically to the correct value for 24-bit images, so you don't need to specify it when using TVIMAGE. AUTHOR: FANNING SOFTWARE CONSULTING: David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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. x : The X position of the lower-left corner of the image. This parameter is only recognized if the TV keyword is set. y : The Y position of the lower-left corner of the image. This parameter is only recognized if the TV keyword is set. KEYWORD PARAMETERS: BACKGROUND: This keyword specifies the background color. Note that the keyword ONLY has effect if the ERASE keyword is also set or !P.MULTI is set to multiple plots and TVIMAGE is used to place the *first* plot. 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. HALF_HALF: If set, will tell CONGRID to extrapolate a *half* row and column on either side, rather than the default of one full row/column at the ends of the array. If you are interpolating images with few rows, then the output will be more consistent with this technique. This keyword is intended as a replacement for MINUS_ONE, and both keywords probably should not be used in the same call to CONGRID. 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. NOINTERPOLATION: Setting this keyword disables the default bilinear interpolation done to the image when it is resized. Nearest neighbor interpolation is done instead. This is preferred when you do not wish to change the pixel values of the image. This keyword must be set, for example, when you are displaying GIF files that come with their own non-IDL color table vectors. NORMAL: Setting this keyword means image position coordinates x and y are interpreted as being in normalized coordinates. This keyword is only valid if the TV keyword is set. OVERPLOT: Setting this keyword causes the POSITION keyword to be ignored and the image is positioned in the location established by the last graphics command. For example: Plot, Findgen(11), Position=[0.1, 0.3, 0.8, 0.95] TVImage, image, /Overplot 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. TV: Setting this keyword makes the TVIMAGE command work much like the TV command, although better. That is to say, it will still set the correct DECOMPOSED state depending upon the kind of image to be displayed (8-bit or 24-bit). It will also allow the image to be "positioned" in the window by specifying the coordinates of the lower-left corner of the image. The NORMAL keyword is activated when the TV keyword is set, which will indicate that the position coordinates are given in normalized coordinates rather than device coordinates. Setting this keyword will ensure that the keywords KEEP_ASPECT_RATIO, MARGIN, MINUS_ONE, MULTI, and POSITION are ignored. 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 in the same variable as an output parameter. If a 24-bit image is displayed on an 8-bit display, the 24-bit image must be converted to an 8-bit image and the appropriate color table vectors. This is done with the COLOR_QUAN function. The TVIMAGE command will load the color table vectors and set the NOINTERPOLATION keyword if this is done. Note that the resulting color table vectors are normally incompatible with other IDL-supplied color tables. Hence, other graphics windows open at the time the image is display are likely to look strange. 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, lun, 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. Added support for the !P.Multi system variable. 3 March 99. DWF Added DEVICE, DECOMPOSED=1 command for all 24-bit images. 2 April 99. DWF. Added ability to preserve DECOMPOSED state for IDL 5.2 and higher. 4 April 99. DWF. Added TV keyword to allow TVIMAGE to work like the TV command. 11 May 99. DWF. Added the OVERPLOT keyword to allow plotting on POSITION coordinates estabished by the preceding graphics command. 11 Oct 99. DWF. Added automatic recognition of !P.Multi. Setting MULTI keyword is no longer required. 18 Nov 99. DWF. Added NOINTERPOLATION keyword so that nearest neighbor interpolation is performed rather than bilinear. 3 Dec 99. DWF Changed ON_ERROR condition from 1 to 2. 19 Dec 99. DWF. Added Craig Markwardt's CMCongrid program and removed RSI's. 24 Feb 2000. DWF. Added HALF_HALF keyword to support CMCONGRID. 24 Feb 2000. DWF. Fixed a small problem with image start position by adding ROUND function. 19 March 2000. DWF. Updated the PRINTER device code to take advantage of available keywords. 2 April 2000. DWF. Reorganized the code to handle 24-bit images on 8-bit displays better. 2 April 2000. DWF. Added BACKGROUND keyword. 20 April 2000. DWF. Fixed a small problem in where the ERASE was occuring. 6 May 2000. DWF. Rearranged the PLOT part of code to occur before decomposition state is changed to fix Background color bug in multiple plots. 23 Sept 2000. DWF. Removed MULTI keyword, which is no longer needed. 23 Sept 2000. DWF. Fixed a small problem with handling images that are slices from 3D image cubes. 5 Oct 2000. DWF. Added fix for brain-dead Macs from Ben Tupper that restores Macs ability to display images. 8 June 2001. DWF.
(See tvimage.pro)
NAME: TVREAD PURPOSE: To get accurate screen dumps with the IDL command TVRD on 24-bit PC and Macintosh computers, you have to be sure to set color decomposition on. This program adds that capability automatically. In addition, the program will optionally write BMP, GIF, JPEG, PICT, PNG, and TIFF color image files of the screen dump. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics CALLING SEQUENCE: image = TVREAD(xstart, ystart, ncols, nrows) The returned image will be a 2D image on 8-bit systems and a 24-bit pixel interleaved true-color image on 24-bit systems. A -1 will be returned if a file output keyword is used (e.g., JPEG, TIFF, etc.). OPTIONAL INPUTS: XSTART -- The starting column index. By default, 0. YSTART -- The starting row index. By default, 0. NCOLS -- The number of columns to read. By default, !D.X_Size - XSTART NROWS -- The number of rows to read. By default, !D.Y_Size - YSTART. KEYWORD PARAMETERS: BMP -- Set this keyword to write the screen dump as a color BMP file. CANCEL -- An output keyword set to 1 if the user cancels out of a filename dialog. Set to 0 otherwise. COLORS -- If a 24-bit image has to be quantized, this will set the number of colors in the output image. Set to 256 by default. Applies to BMP, GIF, PICT, and PNG formats written from 24-bit displays.(See the COLOR_QUAN documentation for details.) CUBE -- If this keyword is set to a value between 2 and 6 the color quantization will use a cubic method of quantization. Applies to BMP, GIF, PICT, and PNG formats written from 24-bit displays.(See the COLOR_QUAN documentation for details.) DITHER -- If this keyword is set the quantized image will be dithered. Applies to BMP, GIF, PICT, and PNG formats written from 24-bit displays. (See the COLOR_QUAN documentation for details.) FILENAME -- The base name of the output file. (No file extensions; they will be added automatically.) This name may be changed by the user. image = TVREAD(Filename='myfile', /JPEG) No file will be written unless a file output keyword is used (e.g., JPEG, TIFF, etc.) in the call. By default the FILENAME is set to "idl". The file extension will be set automatically to match the type of file created. GIF -- Set this keyword to write the screen dump as a color GIF file. JPEG -- Set this keyword to write the screen dump as a color JPEG file. NODIALOG -- Set this keyword if you wish to avoid the DIALOG_PICKFILE dialog that asks you to name the output file. This keyword should be set, for example, if you are processing screens in batch mode. PICT -- Set this keyword to write the screen dump as a color PICT file. PNG -- Set this keyword to write the screen dump as a color PNG file. TIFF -- Set this keyword to write the screen dump as a color TIFF file. QUALITY -- This keyword sets the amount of compression for JPEG images. It should be set to a value between 0 and 100. It is set to 75 by default. (See the WRITE_JPEG documentation for details.) WID -- The index number of the window to read from. The current graphics window (!D.Window) is selected by default. An error is issued if no windows are currently open on a device that supports windows. _EXTRA -- Any keywords that are appropriate for the WRITE_*** routines are also accepted via keyword inheritance. COMMON BLOCKS: None RESTRICTIONS: Requires ERROR_MESSAGE from the Coyote Library: http://www.dfanning.com/programs/error_message.pro Requires IDL 5.2 and higher. MODIFICATION HISTORY: Written by David Fanning, 9 AUG 2000. Added changes to make the program more device independent. 16 SEP 2000. DWF. Removed GIF file support for IDL 5.4 and above. 18 JAN 2001. DWF. Added NODIALOG keyword. 28 MAR 2001. DWF. Added an output CANCEL keyword. 29 AUG 2001. DWF.
(See tvread.pro)
NAME: TVSCALE PURPOSE: This purpose of TVSCALE is to enable the TVSCL command in IDL to be a completely device-independent and color-decomposition- state independent command. On 24-bit displays color decomposition is always turned off for 8-bit images and on for 24-bit images. The color decomposition state is restored for those versions of IDL that support it (> 5.2). Moreover, TVSCALE adds features that TVSCL lacks. For example, images can be positioned in windows using the POSITION keyword like other IDL graphics commands. TVSCALE also supports the !P.MULTI system variable, unlike the TVSCL command. TVSCALE was written to work especially well in resizeable graphics windows. Note that if you wish to preserve the aspect ratio of images in resizeable windows, you should set the KEEP_ASPECT_RATIO keyword, described below. TVSCALE works equally well on the display, in the PostScript device, and in the Printer and Z-Graphics Buffer devices. The TRUE keyword is set automatically to the correct value for 24-bit images, so you don't need to specify it when using TVSCALE. In addition, you can use the TOP and BOTTOM keywords to define a particular set of number to scale the data to. The algorithm used is this: TV. BytScl(image, TOP=top-bottom) + bottom Note that if you scale the image between 100 and 200, that there are 101 possible pixel values. So the proper way to load colors would be like this: LoadCT, NColors=101, Bottom=100 TVSCALE, image, Top=200, Bottom=100 Alternatively, you could use the NCOLORS keyword: LoadCT, NColors=100, Bottom=100 TVSCALE, image, NColors=100, Bottom=100 AUTHOR: FANNING SOFTWARE CONSULTING: David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics display. CALLING SEQUENCE: TVSCALE, image INPUTS: image: A 2D or 3D image array. It does not have to be byte data. x : The X position of the lower-left corner of the image. This parameter is only recognized if the TVSCL keyword is set. y : The Y position of the lower-left corner of the image. This parameter is only recognized if the TVSCL keyword is set. KEYWORD PARAMETERS: BACKGROUND: This keyword specifies the background color. Note that the keyword ONLY has effect if the ERASE keyword is also set or !P.MULTI is set to multiple plots and TVSCALE is used to place the *first* plot. BOTTOM: The image is scaled so that all displayed pixels have values greater than or equal to BOTTOM and less than or equal to TOP. The value of BOTTOM is 0 by default. 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. HALF_HALF: If set, will tell CONGRID to extrapolate a *half* row and column on either side, rather than the default of one full row/column at the ends of the array. If you are interpolating images with few rows, then the output will be more consistent with this technique. This keyword is intended as a replacement for MINUS_ONE, and both keywords probably should not be used in the same call to CONGRID. 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. MAXVALUE: The data is linearly scaled between the MIN and MAX values, if they are provided. MAX is set to MAX(image) by default. MINVALUE: The data is linearly scaled between the MIN and MAX values, if they are provided. MIN is set to MIN(image) by default. 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. NCOLORS: If this keyword is supplied, the TOP keyword is ignored and the TOP keyword is set equal to BOTTOM + NCOLORS - 1. This keyword is provided to make TVSCALE easier to use with the color-loading programs such as LOADCT: LoadCT, 5, NColors=100, Bottom=100 TVScale, image, NColors=100, Bottom=100 NOINTERPOLATION: Setting this keyword disables the default bilinear interpolation done to the image when it is resized. Nearest neighbor interpolation is done instead. This is preferred when you do not wish to change the pixel values of the image. NORMAL: Setting this keyword means image position coordinates x and y are interpreted as being in normalized coordinates. This keyword is only valid if the TVSCL keyword is set. OVERPLOT: Setting this keyword causes the POSITION keyword to be ignored and the image is positioned in the location established by the last graphics command. For example: Plot, Findgen(11), Position=[0.1, 0.3, 0.8, 0.95] TVScale, image, /Overplot 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. TOP: The image is scaled so that all displayed pixels have values greater than or equal to BOTTOM and less than or equal to TOP. The value of TOP is !D.Table_Size by default. TVSCL: Setting this keyword makes the TVIMAGE command work much like the TVSCL command, although better. That is to say, it will still set the correct DECOMPOSED state depending upon the kind of image to be displayed (8-bit or 24-bit). It will also allow the image to be "positioned" in the window by specifying the coordinates of the lower-left corner of the image. The NORMAL keyword is activated when the TV keyword is set, which will indicate that the position coordinates are given in normalized coordinates rather than device coordinates. Setting this keyword will ensure that the keywords KEEP_ASPECT_RATIO, MARGIN, MINUS_ONE, MULTI, and POSITION are ignored. 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, lun, image FREE_LUN, lun thisPosition = [0.1, 0.1, 0.9, 0.9] TVSCALE, 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, 27 May 1999 from TVIMAGE code. Added MIN, MAX, and NCOLORS keywords 28 May 1999. DWF. Added the OVERPLOT keyword to allow plotting on POSITION coordinates estabished by the preceding graphics command. 11 Oct 99. DWF. Added NOINTERPOLATION keyword so that nearest neighbor interpolation is performed rather than bilinear. 3 Dec 99. DWF Brought the TVSCALE code up to date with TVIMAGE code. 3 April 2000. DWF. Brought the TVSCALE code up to date with TVIMAGE code. 6 May 2000. DWF. Change MIN and MAX keywords to MINVALUE and MAXVALUE to prevent ambiguous keyword errors. 27 July 2000. DWF. Brought up to date with changes in TVImage. 23 Sept 2000. DWF. Added fix for brain-dead Macs from Ben Tupper that restores Macs ability to display images. 8 June 2001. DWF.
(See tvscale.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:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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. Simplified program so you can pass it an undefined variable. :-) 17 May 2000. DWF
(See 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. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: IDL 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 the arbitary coordinate system of the viewplane rectangle. 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]. TITLE: A string containing a title for the colorbar axis annotation. The default is a null string. OTHER METHODS: Clamp (Procedure): Given a two-element array in the data range of the colorbar, the colorbar image is clamped to this range. In other words, the range of colors is clamped to the specified range. Values above or below the range in the colorbar are set to the minimum and maximum range values, respectively. GetProperty (Procedure): Returns colorbar properties in keyword parameters as defined for the INIT method. Keywords allowed are: COLOR MAJOR MINOR NAME PALETTE POSITION RANGE TITLE TRANSFORM SetProperty (Procedure): Sets colorbar properties in keyword parameters as defined for the INIT method. Keywords allowed are: COLOR NAME MAJOR MINOR PALETTE POSITION RANGE TITLE TRANSFORM 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 W. 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. Fixed bug when adding a text object via the TEXT keyword. 9 May 99. DWF. Fixed a bug with getting the text object via the TEXT keyword. 16 Aug 2000. DWF. Added the TRANSFORM keyword to GetProperty and SetProperty methods. 16 Aug 2000. DWF. Added RECOMPUTE_DIMENSIONS=2 to text objects. 16 Aug 2000. DWF. Added a polygon object around the image object. This allows rotation in 3D space. 16 Aug 2000. DWF. Removed TEXT keyword (which was never used) and fixed TITLE keyword. 8 Dec 2000. DWF. Added ENABLE_FORMATTING keyword to title objects. 22 October 2001. DWF. Added a CLAMP method. 18 November 2001. DWF.
(See vcolorbar__define.pro)
NAME: WINDOWIMAGE PURPOSE: The purpose of this routine is to demonstrate how to interactively adjust the contrast and brightness (also called the window and level) of an image. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: Graphics, Widgets. CALLING SEQUENCE: WINDOWIMAGE, image INPUTS: image: A 2D image array. Typically, the image will be a 16-bit medical image of some type. If this parameter is not present, a 16-bit dicom image from the examples/data directory will be selected. KEYWORD PARAMETERS: COLORTABLE: The index of an IDL-supplied color table to load. Gray-scale by default. COMMON BLOCKS: None. SIDE EFFECTS: None. RESTRICTIONS: The TVIMAGE and COLORBAR__DEFINE programs from the Coyote Library are required to run this program: http://www.dfanning.com/programs/tvimage.pro http://www.dfanning.com/programs/colorbar__define.pro EXAMPLE: To display a 16-bit medical image, type: IDL> WINDOWIMAGE MODIFICATION HISTORY: Written by: David Fanning, 7 November 2001. Modified the windowing algorithm to keep the window within the data range. Added colorbar and pixmap for smoother updating. 18 Nov 2001. DWF.
(See windowimage.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<EMAIL_ADDRESS>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<EMAIL_ADDRESS>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 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, an object method, or an IDL procedure if and when a new color table has been loaded. The event handler, object method, or IDL procedure is then responsibe for updating the program's display on 16- or 24-bit display systems. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Widgets, Object, Command line. CALLING SEQUENCE: XCOLORS INPUTS: None. KEYWORD PARAMETERS: BLOCK: If this keyword is set, the program will try to block the IDL command line. Note that this is only possible if no other widget program is currently blocking the IDL command line. It is much more reliable to make XCOLORS a modal widget (see the MODAL keyword), although this can generally only be done when XCOLORS is called from another widget program. BOTTOM: The lowest color index of the colors to be changed. COLORINFO: This output keyword will return either a pointer to a color information structure (if the program is called in a non-modal fashion) or a color information structure (if the program is called in modal or blocking fashion). The color information structure is an anonymous structure defined like this: struct = { R: BytArr(!D.Table_Size), $ ; The current R color vector. G: BytArr(!D.Table_Size), $ ; The current G color vector. B: BytArr(!D.Table_Size), $ ; The current B color vector. NAME: "", $ ; The name of the current color table. INDEX: 0 } ; The index number of the current color table. If a pointer to the structure is obtained, you will be responsible for freeing it to prevent memory leakage: XColors, ColorInfo=colorInfoPtr Print, "Color Table Name: ", (*colorInfoPtr).Name Ptr_Free, colorInfoPtr Note that that Name field will be "Unknown" and the Index field will be -1 until a color table is actually selected by the user. You are responsible for checking this value before you use it. When called in modal or blocking fashion, you don't have to worry about freeing the pointer, since no pointer is involved: XColors, /Block, ColorInfo=colorInfoData Help, colorInfoData, /Structure Print, "Color Table Name: ", colorInfoData.Name DATA: This keyword can be set to any valid IDL variable. If the variable is defined, the specified object method or notify procedure will be passed this variable via a DATA keyword. This keyword is defined primarily so that Notify Procedures are compatible with the XLOADCT way of passing data. It is not strictly required, since the _EXTRA keyword inheritance mechanism will allow passing of *any* keyword parameter defined for the object or procedure that is to be notified. 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. _EXTRA: This keyword inheritance mechanism will pick up and pass along to any method or procedure to be notified and keywords that are defined for that procedure. Note that you should be sure that keywords are spelled correctly. Any mis-spelled keyword will be ignored. 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. MODAL: Set this keyword (along with the GROUP_LEADER keyword) to make the XCOLORS dialog a modal widget dialog. Note that NO other events can occur until the XCOLORS program is destroyed when in modal mode. 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, NAME:""} 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. The name field will have the name of the currently 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. (Note the NAME field will initially be "Unknown"). 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:''} where the Object field is an object reference, and the Method field is the name of the object method that should be called when XCOLORS loads its color tables. ainfo = {XCOLORS_NOTIFYOBJ, a, 'Draw'} binfo = {XCOLORS_NOTIFYOBJ, b, 'Display'} 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:''} END Or, you can simply define this structure as it is shown here in your code. "Extra" keywords added to the XCOLORS call are passed along to the object method, which makes this an alternative way to get information to your methods. If you expect such keywords, your methods should be defined with an _Extra keyword. NOTIFYPRO: The name of a procedure to notify or call when the color tables are loaded. If the DATA keyword is also defined, it will be passed to this program via an DATA keyword. But note that *any* keyword appropriate for the procedure can be used in the call to XCOLORS. For example, here is a procedure that re-displays and image in the current graphics window: PRO REFRESH_IMAGE, Image=image, _Extra=extra, WID=wid IF N_Elements(wid) NE 0 THEN WSet, wid TVIMAGE, image, _Extra=extra END This program can be invoked with this series of commands: IDL> Window, /Free IDL> TVImage, image, Position=[0.2, 0.2, 0.8, 0.8] IDL> XColors, NotifyPro='Refresh_Image', Image=image, WID=!D.Window Note that "extra" keywords added to the XCOLORS call are passed along to your procedure, which makes this an alternative way to get information to your procedure. If you expect such keywords, your procedure should be defined with an _Extra keyword as illustrated above. 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 1997, added color protection for the program. DWF 24 April 1997, fixed a window initialization bug. DWF 18 June 1997, fixed a bug with the color protection handler. DWF 18 June 1997, Turned tracking on for draw widget to fix a bug in TLB Tracking Events for WindowsNT machines in IDL 5.0. DWF 20 Oct 1997, Changed GROUP keyword to GROUP_LEADER. DWF 19 Dec 1997, Fixed bug with TOP/BOTTOM reversals and CANCEL. DWF. 9 Jun 1998, Fixed bug when using BOTTOM keyword on 24-bit devices. DWF 9 Jun 1998, Added Device, Decomposed=0 for TrueColor visual classes. DWF 9 Jun 1998, Removed all IDL 4 compatibility. 21 Oct 1998, Fixed problem with gamma not being reset on CANCEL. DWF 5 Nov 1998. Added the NotifyObj keyword, so that XCOLORS would work interactively with objects. DWF. 9 Nov 1998. Made slider reporting only at the end of the drag. If you want continuous updating, set the DRAG keyword. DWF. 9 Nov 1998. Fixed problem with TOP and BOTTOM sliders not being reset on CANCEL. DWF. 10 Nov 1998. Fixed fixes. Sigh... DWF. 5 Dec 1998. Added INDEX field to the XCOLORS_LOAD event structure. This field holds the current color table index number. DWF. 5 Dec 1998. Modified the way the colorbar image was created. Results in greatly improved display for low number of colors. DWF. 6 Dec 1998. Added the ability to notify an unlimited number of objects. DWF. 12 Dec 1998. Removed obsolete Just_Reg keyword and improved documetation. DWF. 30 Dec 1998. Fixed the way the color table index was working. DWF. 4 Jan 1999. Added slightly modified CONGRID program to fix floating divide by zero problem. DWF 2 May 1999. Added code to work around a Macintosh bug in IDL through version 5.2 that tries to redraw the graphics window after a TVLCT command. DWF. 5 May 1999. Restore the current window index number after drawing graphics. Not supported on Macs. DWF. 9 Jul 1999. Fixed a couple of bugs I introduced with the 5 May changes. Sigh... DWF. 13 Jul 1999. Scheesh! That May 5th change was a BAD idea! Fixed more bugs. DWF. 31 Jul 1999. Substituted !D.Table_Size for !D.N_Colors. DWF. 1 Sep 1999. Got rid of the May 5th fixes and replaced with something MUCH simpler. DWF. 14 Feb 2000. Removed the window index field from the object notify structure. DWF. 14 Feb 2000. Added NOTIFYPRO, DATA, and _EXTRA keywords. DWF. 20 Mar 2000. Added MODAL, BLOCK, and COLORINFO keywords. DWF 20 Mar 2000. Fixed a slight problem with color protection events triggering notification events. DWF. 31 Mar 2000. Fixed a problem with pointer leakage on Cancel events, and improved program documentation. DWF. 17 Aug 2000. Fixed a problem with CANCEL that occurred only if you first changed the gamma settings before loading a color table. DWF. 10 Sep 2000. Removed the requirement that procedures and object methods must be written with an _Extra keyword. DWF. 5 Oct 2000. Added the File keyword to LOADCT command, as I was suppose to. DWF. 5 Oct 2000. Now properly freeing program pointers upon early exit from program. DWF. 7 Mar 2001. Fixed a problem with the BLOCK keyword. DWF. 12 Nov 2001. Renamed Congrid to XColors_Congrid. DWF.
(See 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. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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: CBARTITLE: A string used as the title of the colorbar. _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. Default is 10. Note that contour levels are acutally calculated, since the NLEVELS keyword to the contour object does not always result in the correct number of 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. Fixed a bug in the way the data was scaled into the view. 9 May 99. DWF. Fixed a bug in the filled contours. 11 May 99. DWF. Added a line to make sure 256 colors are available in Z buffer. 19 Dec 99. DWF. Fixed a small bug where the X and Y vectors weren't sent to IDLgrContour. 19 Sept 2000. DWF. Added CBARTITLE keyword and fixed a small memory leak. Updated VCOLORBAR code. 8 Dec 2000. DWF. Fixed a minor problem with the Colorbar. Removed GIF support for IDL 5.4 and higher. 27 Mar 2001. DWF.
(See xcontour.pro)
NAME: XIMAGE PURPOSE: The purpose of this program is to demonstrate how to create a image plot with axes,a title, and the ability to select a location and image value using object graphics. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Widgets, 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: An 8-bit or 24-bit image. 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. (Keyword ignored if a 24-bit image is used. 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. TITLE: A string used as the title of the plot. XRANGE: A two-element array specifying the X axis range. XSIZE: The initial X window size. Default is 400 pixels. XTITLE: A string used as the X title of the plot. YRANGE: A two-element array specifying the Y axis range. YSIZE: The initial Y window size. Default is 400 pixels. YTITLE: A string used as the Y title of the plot. COMMON BLOCKS: None. SIDE EFFECTS: None. RESTRICTIONS: Requires the XColors program from the Coyote library to change color tables. http://www.dfanning.com/programs/xcolors.pro EXAMPLE: To use this program with your 8-bit or 24-bit 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. Modified program to show how image values can be selected. 8 May 2000. DWF. Made several modifications to resize event handler. Much improved. 2 June 2000. DWF. Completely updated program to reflect current (IDL 5.5) capabilities. 12 Nov 2001. DWF.
(See 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. Added slider for controlling animation speed. 30 June 99.
(See 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. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>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: COLORPRINT: Set this keyword to obtain printed output in color. If not set (the default), printed output is in black and white. EXACT: Set this keyword to a one- or two-element array to set exact axis scaling for the axes. If Exact is a one-element array, both axes are set to the same value. If Exact is a two-element array, the first elements sets the X axis property and the second element sets the Y axis property. For example, to set the X axis to exact scaling and the Y axis to normal scaling, type: IDL> x = Findgen(10) IDL> XPlot, x, Sin(x), Exact=[1,0], XRange=[0,8.5] _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. LANDSCAPE: Set this keyword if you are printing in landscape mode. The default is Portrait mode. The Landscape keyword on the PRINTER object is set, but not all printers will honor this keyword setting. If yours does not, set Landscape mode in the Printer Setup dialog. PSYM: The index of a plotting symbol to use on the plot. Integers 0-7 are valid values. SYMSIZE: Sets the size of the symbols. By default, symbols are sized so that they are 0.015 percent of the axis range. VECTOR: Set this keyword if you want the printed output to be in vector (as opposed to bitmap) form. This is faster, but not as accurate. 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, 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. Fixed a bug in the way symbols were (NOT!) sized. 11 May 99. DWF. Added non-exact axis scaling. 12 May 99. DWF. Fixed bug that changed data when calling with single parameter. 13 May DWF. Added VECTOR, LANDSCAPE and COLORPRINT keywords and improved printing capabilities. 16 Feb 2000. DWF. Modified the EXACT keyword to accept values for X and Y axes independently. 10 May 2000. DWF. Updated for IDL 5.4. 13 June 2001. DWF.
(See 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. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com CATEGORY: Graphics, Widgets CALLING SEQUENCE: XSTRETCH, image INPUT PARAMETERS: image: The image data to be stretched.It must be 2D. (This may now be a pointer to the image data rather than the image itself.) 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.Table_Size-4. OUTPUTS: None. COMMON BLOCKS: None. SIDE EFFECTS: None. DEPENDENCIES: The following programs are required from the Coyote Library: tvimage.pro pswindow.pro psconfig.pro fsc_inputfield.pro fsc_droplist.pro fsc_fileselect.pro fsc_plotwindow.pro fsc_psconfig__define.pro 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. April, 1999. Made lines thicker. Offered default image. DWF. April, 1999. Replaced TV command with TVIMAGE. DWF. April, 1999. Made both windows resizeable. DWF. April, 2000. Made several modifications to histogram plot and to the way colors were handled. Added ability to pass pointer to the image as well as image itself. DWF. February 2001. Removed GIF file support for IDL 5.4 and fixed a problem with cleaning up the pixmap. DWF.
(See xstretch.pro)
NAME: ZIMAGE PURPOSE: The purpose of this program is to display an image which can be zoomed by drawing a rubberband box on top of it. The "zoomed" image appears in its own window. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: Image Processing, Widgets. CALLING SEQUENCE: ZIMAGE, image INPUTS: image: A 2D array of image data. KEYWORD PARAMETERS: BOTTOM: The lowest color index of the colors to be used (see NCOLORS). The default is 0. COLORINDEX: The color index for the rubberband box. This index will be loaded with a green color. Whatever color is there will be restored when the ZIMAGE program exits. The default is NCOLORS + BOTTOM. NCOLORS: This is the number of colors to use when displaying the image. The default is !D.N_COLORS-2. GROUP_LEADER: This keyword is used to assign a group leader to this program. This program will be destroyed when the group leader is destroyed. Use this keyword if you are calling ZIMAGE from another widget program. NOINTERPOLATION: Setting this keyword causes nearest neighbor resampling of of the zoomed image instead of the default bilinear interpolation of resampled pixels. OUTPUTS: None. COMMON BLOCKS: None. SIDE EFFECTS: The COLORINDEX color is turned to green while the rubberband box is being drawn. The color is restored after the box is drawn. RESTRICTIONS: Uses XCOLORS from the Coyote Library: http://www.dfanning.com/programs/xcolors.pro PROCEDURE: Clicking the left mouse button allows you to drag a rubberband box over the portion of the window you want to zoom into. Clicking the right mouse button calls up hidden controls that allow you to load different color tables and set the zoom factor. The rubberband box is drawn with pixmaps and the "device copy" technique. This is an excellent example of how you can take advantage of the widget program *as* the loop do to something (i.e., draw the box) that in a regular IDL program would have to be done in a loop. Motion events are only turned on for the draw widget when the box has to be drawn. EXAMPLE: To display an image you can zoom into, type: ZIMAGE, image MODIFICATION HISTORY: Written by: David Fanning, 15 August 96. Fixed a !D.N_Colors problem. 17 June 98. Made modifications so program works in 24-bit environment. 28 July 98. DWF. Fixed a problem with the pop-up controls under certain circumstances. 13 Oct 98. DWF. Added 24-bit color response. 13 Oct 98. DWF. Added ability for each window to have its own color changing tool. 9 Oct 99. DWF. Small changes, error checking. 24 April 2000. DWF. Modified draw widget error handling to be consistent with current programming practices. 26 April 2001. DWF.
(See zimage.pro)
NAME: ZOOMBOX PURPOSE: The purpose of this program is to display an image which can be zoomed by drawing a rubberband box on top of it. The "zoomed" image appears in its own window. The program is written in object graphics. Either 8-bit or 24-bit images may be used. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: Image Processing, Widgets. CALLING SEQUENCE: ZOOMBOX, image INPUTS: image: An 8-bit or 24-bit image. GROUP_LEADER: This keyword is used to assign a group leader to this program. This program will be destroyed when the group leader is destroyed. Use this keyword if you are calling ZOOMBOX from another widget program. HARDWARE_RENDERING: Set this keyword if you want to render the scene using the hardware renderer. This is NOT recommended, since this makes rendering exceedingly slow on most machines. INTERPOLATE: Set this keyword to use bilinear interpolation on the sub-image defined by the box when zooming. The default is to use nearest neighbor interpolation. OUTPUTS: None. COMMON BLOCKS: None. SIDE EFFECTS: DEPENDENCIES: Uses XCOLORS and PICKCOLOR from the Coyote Library: http://www.dfanning.com/programs/xcolors.pro http://www.dfanning.com/programs/pickcolor.pro PROCEDURE: Clicking the left mouse button allows you to drag a rubberband box over the portion of the window you want to zoom into. EXAMPLE: IDL> ZOOMBOX RESTRICTIONS: Object graphics programs are really meant to be used on 24-bit displays.  MODIFICATION HISTORY: Written by: David W. Fanning, 24 April 2000. Modified draw widget event handling. 22 October 2001. DWF.
(See zoombox.pro)
NAME: ZPLOT PURPOSE: The purpose of this program is to display a line plot in a resizeable graphics window which can be zoomed by drawing an "arrow box" on top of it. To return to the un-zoomed plot, click and release anywhere in the window. AUTHOR: FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone:<PHONE_NUMBER> E-mail<EMAIL_ADDRESS>Coyote's Guide to IDL Programming: http://www.dfanning.com/ CATEGORY: Widgets. CALLING SEQUENCE: ZPlot, x, y OPTIONAL INPUTS: x: If only one positional parameter, this is assumed to be the dependent data. If there are two positional parameters, this is assumed to be the independent data in accordance with the PLOT command. y: The dependent data, if the X parameter is present. KEYWORD PARAMETERS: Any valid PLOT keyword can be used with this program. In additon, the following keywords are defined specifically. GROUP_LEADER: This keyword is used to assign a group leader to this program. This program will be destroyed when the group leader is destroyed. Use this keyword if you are calling ZIMAGE from another widget program. XLOG: Set this keyword if you wish the X axis to be logarthmic style. YLOG: Set this keyword if you wish the Y axis to be logarthmic style. ZOOM_XSIZE: The initial X size of the plot window. Default is 400 pixels. ZOOM_YSIZE: The initial Y size of the plot window. Default is 400 pixels. COMMON BLOCKS: None. SIDE EFFECTS: Drawing colors are loaded into the color table. RESTRICTIONS: Zooms only along the X axis. PROCEDURE: Click and drag the cursor to create an "arrow box". The plot is zoomed into the X coordinates of the box, when released. To restore unzoomed plot, click and release anywhere in the window. EXAMPLE: To display an plot you can zoom into, type: ZPLOT MODIFICATION HISTORY: Written by: David Fanning, 15 February 2000. Modified the original rubberband box to be an "arrow box". 1 April 2000. DWF. Added the ability to produce log style plots. 20 November 2001. DWF.
(See zplot.pro)