IIMAGE

Syntax | Arguments | Keywords | Examples | Version History

The IIMAGE procedure creates an iTool and associated user interface (UI) configured to display and manipulate image data.

Note
If no arguments are specified, the IIMAGE procedure creates an empty Image tool.

This routine is written in the IDL language. Its source code can be found in the file iimage.pro in the lib/itools subdirectory of the IDL distribution.

For more information on using the iImage tool, see "Working with Images" (iTool User's Guide).

Syntax

IIMAGE[, Image[, XY]]

or

IIMAGE[, Filename]

iTool Common Keywords: [, ANISOTROPIC_SCALE_2D=value] [, ANISOTROPIC_SCALE_3D=value] [, BACKGROUND_COLOR=value] [, CURRENT_ZOOM=value] [, DEPTHCUE_BRIGHT=value] [, DEPTHCUE_DIM=value] [, DIMENSIONS=[x, y]] [, /DISABLE_SPLASH_SCREEN] [, /FIT_TO_VIEW] [, FONT_COLOR=RGB triple] [, FONT_NAME=string] [, FONT_SIZE=value] [, FONT_STYLE={0|1|2|3}] [, IDENTIFIER=variable] [, LOCATION=[x, y]] [, MACRO_NAMES=string or string array] [, NAME=string] [, /NO_SAVEPROMPT] [, OVERPLOT=iToolID] [, RENDERER={0 | 1}] [, SCALE_ISOTROPIC=value] [, /STRETCH_TO_FIT] [, STYLE_NAME=string] [, TITLE=string] [, VIEW_GRID=[columns, rows]] [, /VIEW_NEXT] [, VIEW_NUMBER=integer] [, VIEW_TITLE=string] [, VIEW_ZOOM=value] [, WINDOW_TITLE=string] [, XMARGIN=value] [, YMARGIN=value] [, /ZOOM_ON_RESIZE]

Image Keywords: [, ALPHA_CHANNEL=array] [, BLUE_CHANNEL=array] [, CHANNEL=bitmask] [, CLIP_PLANES=array] [, GREEN_CHANNEL=array] [, GRID_UNITS=value] [, /HIDE] [, IMAGE_DIMENSIONS=[widthheight]] [, IMAGE_LOCATION=[x, y]] [, INSERT_COLORBAR=value] [, /INTERPOLATE] [, /ORDER] [, RED_CHANNEL=array] [, RGB_TABLE=array] [, TRANSPARENCY=value] [, ZVALUE=value]

Axis Keywords: [, [XY]GRIDSTYLE={0 | 1 | 2 | 3 | 4 | 5 | 6}] [, [XY]MAJOR=integer] [, [XY]MINOR=integer] [, [XY]RANGE=[minmax]] [, [XY]SUBTICKLEN=ratio] [, [XY]TEXT_COLOR=RGB vector] [, [XY]TICKFONT_INDEX={0 | 1 | 2 | 3 | 4}] [, [XY]TICKFONT_SIZE=float] [, [XY]TICKFONT_STYLE={0 | 1 | 2 | 3}] [, [XY]TICKFORMAT=string or string array] [, [XY]TICKINTERVAL=value] [, [XY]TICKLAYOUT={0 | 1 | 2}] [, [XY]TICKLEN=value] [, [XY]TICKNAME=string array] [, [XY]TICKUNITS=string] [, [XY]TICKVALUES=vector] [, [XY]TITLE=string]

Arguments

Image

Either a vector, a two-dimensional, or a three-dimensional array representing the sample values to be displayed as an image.

If Image is a vector:

If Image is a two-dimensional array:

If Image is a three-dimensional array:

X

Either a vector or a two-dimensional array representing the x-coordinates of the image grid.

If the Image argument is a vector:

If the Image argument is a two-dimensional array (for which neither dimension is 3):

Y

Either a vector or a two-dimensional array representing the y-coordinates of the image grid.

If the Image argument is a vector:

If the Image argument is a two-dimensional array:

Filename

The name of a file that contains image data. Calling IIMAGE wtih the Filename argument is equivalent to calling IOPEN, passing the resulting data into IIMAGE as the first argument, and passing the file-supplied palette with the RGB_TABLE keyword.

Keywords

Note
Keywords to the IIMAGE routine that correspond to the names of registered properties of the iImage tool must be specified in full, without abbreviation.

ALPHA_CHANNEL

Set this keyword to a two-dimensional array representing the alpha channel pixel values for the image to be displayed. This keyword is ignored if the Image argument is present, and is intended to be used in conjunction with some combination of the RED_CHANNEL, GREEN_CHANNEL, and BLUE_CHANNEL keywords.

ANISOTROPIC_SCALE_2D

For two-dimensional anisotropic visualizations, set this keyword to a floating point value indicating the ratio of the Y dimension to the X dimension. The default is 0.7. If the dataspace and its contained visualizations are isotropic then this keyword is ignored.

ANISOTROPIC_SCALE_3D

For three-dimensional anisotropic visualizations, set this keyword to a floating point value indicating the ratio of the Z dimension to the X and Y dimensions. The default is 0.7. If the dataspace and its contained visualizations are isotropic then this keyword is ignored.

BACKGROUND_COLOR

Set this keyword to an RGB value specifying the color to be used as the background color for the view. The default is [255, 255, 255] (white). The BACKGROUND_COLOR keyword can be used when a tool is being created or when a new visualization is being created in an existing tool with the use of the OVERPLOT, VIEW_NUMBER or VIEW_NEXT keywords. The background color is applied to the current view. For example, if multiple views have been created with the VIEW_GRID keyword, and the VIEW_NUMBER keyword is used to create a visualization in the second view, use of the BACKGROUND_COLOR keyword would set the background color in the second view only.

BLUE_CHANNEL

Set this keyword to a two-dimensional array representing the blue channel pixel values for the image to be displayed. This keyword is ignored if the Image argument is present, and is intended to be used in conjunction with some combination of the RED_CHANNEL, GREEN_CHANNEL, and ALPHA_CHANNEL keywords.

CHANNEL

Set this keyword to a hexadecimal bitmask that defines which color channel(s) to draw. Each bit that is a 1 is drawn; each bit that is a 0 is not drawn. For example, 'ff0000'X represents a Blue channel write. The default is to draw all channels, and is represented by the hexadecimal value 'ffffff'X.

CLIP_PLANES

Set this keyword to an array of dimensions [4, N] specifying the coefficients of the clipping planes to be applied to this object. The four coefficients for each clipping plane are of the form [A, B, C, D], where Ax + By + Cz + D = 0. Portions of this object that fall in the half space Ax + By + Cz + D > 0 will be clipped. By default, the value of this keyword is a scalar (-1) indicating that no clipping planes are to be applied.

Note
A window is only able to support a limited number of clipping planes. Some of these clipping planes may already be in use by the tool to support specific data display features. If the total number of clipping planes exceeds the limit, an informational message is displayed.

CURRENT_ZOOM

Set this keyword to the zoom factor to be used for the current view. The default value is 1.0, which represents 100%.

DEPTHCUE_BRIGHT

Set this keyword to a floating-point value giving the distance in the Z plane at which the objects in the view begin to fade into the background color. The values range from -1 (closest to the viewer) to +1 (farthest from the viewer). The default value is 0. See DEPTHCUE_DIM for examples.

DEPTHCUE_DIM

Set this keyword to a floating-point value giving the distance in the Z plane at which the objects in the view have completely faded into the background color. The values range from -1 (closest to the viewer) to +1 (farthest from the viewer). The default value is 0. Some usage examples are:

DIMENSIONS

Set this keyword to a two-element vector of the form [width, height] to specify the dimensions of the drawing area of the specific tool in device units. The minimum width of the window correlates to the width of the menubar. The minimum window height is 100 pixels.

DISABLE_SPLASH_SCREEN

Set this keyword to disable the iTools splash screen. By default, the first time an iTool is run, the splash screen is displayed.

FIT_TO_VIEW

Set this keyword to automatically scale the newly-created visualization so that it fills the current view. This keyword is ignored if VIEW_ZOOM is present.

FONT_COLOR

Set this keyword equal to an RGB vector specifying the title text color. The default is [0, 0, 0] (black).

This keyword applies only to the text annotation created by the TITLE keyword. It is ignored if TITLE is not specified.

FONT_NAME

Set this keyword equal to a string specifying the name of the IDL or system font to use for the title text. The default is "Helvetica".

This keyword applies only to the text annotation created by the TITLE keyword. It is ignored if TITLE is not specified.

FONT_SIZE

Set this keyword equal to an integer specifying the font size for the title text. The default is 16 pt.

This keyword applies only to the text annotation created by the TITLE keyword. It is ignored if TITLE is not specified.

FONT_STYLE

Set this keyword equal to an integer specifying the font style to be used for the title text. Allowed values are:

0

Normal (the default)

1

Bold

2

Italic

3

Bold Italic

This keyword applies only to the text annotation created by the TITLE keyword. It is ignored if TITLE is not specified.

GREEN_CHANNEL

Set this keyword to a two-dimensional array representing the green channel pixel values for the image to be displayed. This keyword is ignored if the Image argument is present, and is intended to be used in conjunction with some combination of the RED_CHANNEL, BLUE_CHANNEL, and ALPHA_CHANNEL keywords.

GRID_UNITS

Set this keyword to an integer specifying the units for the image grid. This keyword applies only when there is a map projection inserted. It has the following values:

HIDE

Set this keyword to a boolean value indicating whether this object should be drawn:

IDENTIFIER

Set this keyword to a named IDL variable that will contain the iToolID for the created tool. This value can then be used to reference this tool during overplotting operations or command-line-based tool management operations.

IMAGE_DIMENSIONS

Set this keyword to a 2-element vector, [width, height], to specify the image dimensions (in data units). By default, the dimensions match the pixel width of the image.

IMAGE_LOCATION

Set this keyword to a 2-element vector, [x, y], to specify the image location (in data units). By default, the location is [0, 0].

INSERT_COLORBAR

If the newly-created visualization contains a color table (as specified by the RGB_TABLE keyword) set this keyword to automatically insert a colorbar. By default the colorbar will be positioned in the bottom center of the view. To manually position the colorbar, set this keyword equal to a two-element vector with values in the range (0 to 1) specifying the location of the bottom left corner of the colorbar in normalized coordinates.

INTERPOLATE

Set this keyword to one (1) to display the iImage tool using bilinear interpolation. The default is to use nearest neighbor interpolation.

LOCATION

Set this keyword to a two-element vector of the form [x, y] to specify the location of the upper left-hand corner of the tool relative to the display screen, in device units.

Note
Some X Window managers explicitly ignore any request from the client for window placement. See Positioning Top-Level Bases for additional information.

MACRO_NAMES

Set this keyword to a scalar string or an array of strings that specifies the names of one or more macros to run. The macro names are retrieved and the macros are run sequentially after the iTool and (if applicable) any visualizations have been created. If a macro of the specified name does not exist, IDL generates an error and the routine exits.

NAME

Set this keyword to a string to specify the name for this visualization. The name is used for tool-related display purposes only.

NO_SAVEPROMPT

Set this keyword to cause the iTool not to prompt the user to save changes when closing the tool. The default is to prompt the user to save changes.

ORDER

Set this keyword to force the rows of the image data to be drawn from top to bottom. By default, image data is drawn from the bottom row up to the top row.

OVERPLOT

Set this keyword to an iToolID to direct the graphical output of the particular tool to the tool specified by the provided iToolID.

Set this keyword to 1 (one) to place the graphical output for the command in the current tool. If no current tool exists, a new tool is created.

RED_CHANNEL

Set this keyword to a two-dimensional array representing the red channel pixel values for the image to be displayed. This keyword is ignored if the Image argument is present, and is intended to be used in conjunction with some combination of the GREEN_CHANNEL, BLUE_CHANNEL, and ALPHA_CHANNEL keywords.

RENDERER

Set this keyword to override the value specified by the IDL_GR_WIN_RENDERER (Windows) or IDL_GR_X_RENDERER (UNIX) preference for the iTool. IDL will use the specified graphics renderer when drawing objects within the iTool window. Valid values are:

Value
Description
0

Use platform native OpenGL

1

Use IDL's software implementation

If your platform does not have a native OpenGL implementation, IDL uses its own software implementation regardless of the value of this property. See Hardware vs. Software Rendering (Object Programming) for details.

RGB_TABLE

Set this keyword to the number of the predefined IDL color table, or to either a 3 by 256 or 256 by 3 byte array of RGB color values. If no color tables are supplied, the tool will provide a default 256-entry linear grayscale ramp.

SCALE_ISOTROPIC

Set this keyword to indicate the scaling method to be used for the dataspace. Possible

values are:

0

Automatic scaling. If any visualization within the dataspace has its Isotropic scaling property set to True, the dataspace will be automatically set to isotropic. If none of the visualizations are isotropic, the dataspace will be automatically set to anisotropic. This is the default.

1

Isotropic scaling. The dataspace will be proportionally scaled in the X, Y, and Z directions according to the data ranges in each direction.

2

Anistropic scaling. The dataspace will be scaled in the X, Y, and Z directions according to the ANISOTROPIC_SCALE_2D or ANISOTROPIC_SCALE_3D keywords.

Note
If the dataspace is anisotropic (either automatically or by setting SCALE_ISOTROPIC to 2), then the ANISOTROPIC_SCALE_2D or ANISOTROPIC_SCALE_3D keywords may be used to change the scaling. If the dataspace is isotropic then the ANISOTROPIC_SCALE_2D and ANISOTROPIC_SCALE_3D keywords are ignored.

STRETCH_TO_FIT

Set this keyword to indicate whether the visualizations should be stretched to fit within the view. The default value is 0 (False).

STYLE_NAME

Set this keyword equal to a string that specifies the name of a user-defined or a system style. If a style of the specified name does not exist, IDL generates an error and the routine exits.

The style is applied using the following rules:

TITLE

Set this keyword to a string specifying a title for the newly-created visualization. The text annotation will be added to the dataspace containing the new visualization. If the TITLE is specified, you can also specify any of the FONT_COLOR, FONT_NAME, FONT_SIZE, and FONT_STYLE keywords to control the title appearance.

Note
Prior to IDL version 7.1, the TITLE keyword specified the title for the iTool window rather than for the visualization. Use the WINDOW_TITLE keyword to create a window title.

TRANSPARENCY

Set this keyword equal to an integer between 0 and 100 that specifies the percent transparency of the image visualization. The default is zero.

VIEW_GRID

Set this keyword to a two-element vector of the form [columns, rows] to specify the view layout within the new tool. This keyword is only used if a new tool is being created (for example, if OVERPLOT, VIEW_NEXT, or VIEW_NUMBER are specified then VIEW_GRID is ignored).

VIEW_NEXT

Set this keyword to change the view selection to the next view following the currently-selected view before issuing any graphical commands. If the currently-selected view is the last one in the layout, then /VIEW_NEXT will cause the first view in the layout to become selected. This keyword is ignored if no current tool exists.

Note
The contents of the newly-selected view will be emptied unless /OVERPLOT is set.

VIEW_NUMBER

Set this keyword to change the currently-selected view to the view specified by the VIEW_NUMBER before issuing any graphical commands. The view number starts at 1, and corresponds to the position of the view within the graphics container (not necessarily the position on the screen). This keyword is ignored if no current tool exists.

Note
The contents of the newly-selected view will be emptied unless /OVERPLOT is set.

VIEW_TITLE

Set this keyword equal to a scalar string that will be placed in a text annotation centered horizontally in the current view, near the top. The text will be created with the properties (size, style, color, etc.) defined for text annotations in the current tool style.

VIEW_ZOOM

Set this keyword to a floating-point number giving the initial view zoom factor. For example, setting VIEW_ZOOM to 2.0 would give an initial zoom of 200%. The default is 1.0.

WINDOW_TITLE

Set this keyword to a string to specify a title for the tool window. The title is displayed in the title bar of the tool.

XMARGIN

Set this keyword to a floating-point value giving the horizontal margin size between the edge of the view and the edge of the visualization. The valid range is 0.0 to 0.49, and the default value is 0.15. This keyword is ignored if STRETCH_TO_FIT is set to 0.

[XY]GRIDSTYLE

The index of the linestyle to be used for plot tickmarks and grids (i.e., when [XY]TICKLEN is set to 1.0). See LINESTYLE for a list of linestyles.

[XY]MAJOR

Set this keyword to an integer representing the number of major tick marks. The default is -1, specifying that IDL will compute the number of tickmarks. Setting MAJOR equal to zero suppresses major tickmarks entirely.

[XY]MINOR

Set this keyword to an integer representing the number of minor tick marks. The default is -1, specifying that IDL will compute the number of tickmarks. Setting MINOR equal to zero suppresses minor tickmarks entirely.

[XY]RANGE

Set this keyword to the desired data range of the axis, a 2-element vector. The first element is the axis minimum, and the second is the maximum.

[XY]SUBTICKLEN

Set this keyword to a floating-point scale ratio specifying the length of minor tick marks relative to the length of major tick marks. The default is 0.5, specifying that the minor tick mark is one-half the length of the major tick mark.

[XY]TEXT_COLOR

Set this keyword to an RGB value specifying the color for the axis text. The default value is [0, 0, 0] (black).

[XY]TICKFONT_INDEX

Set this keyword equal to one of the following integers, which represent the type of font to be used for the axis text:

[XY]TICKFONT_SIZE

Set this keyword to a floating-point integer representing the point size of the font used for the axis text. The default is 12.0 points.

[XY]TICKFONT_STYLE

Set this keyword equal to one of the following integers, which represent the style of font to be used for the axis text:

[XY]TICKFORMAT

Set this keyword to a string, or an array of strings, in which each string represents a format string or the name of a function to be used to format the tick mark labels. If an array is provided, each string corresponds to a level of the axis. The TICKUNITS keyword determines the number of levels for an axis.

If the string begins with an open parenthesis, it is treated as a standard format string. See Format Codes (Application Programming).

If the string does not begin with an open parenthesis, it is interpreted as the name of a callback function to be used to generate tick mark labels. This function is defined with either three or four parameters, depending on whether TICKUNITS is specified.

If TICKUNITS are not specified:

If TICKUNITS are specified:

The callback function is called with four parameters: Axis, Index, Value, and Level, where:

Used with the LABEL_DATE function, this property can easily create axes with date/time labels.

[XY]TICKINTERVAL

Set this keyword to a floating-point scalar indicating the interval between major tick marks for the first axis level. The default value is computed according to the axis [XYZ]RANGE and the number of major tick marks ([XYZ]MAJOR). The value of this keyword takes precedence over the value set for the [XYZ]MAJOR keyword.

For example, if TICKUNITS = ['S', 'H', 'D'], and TICKINTERVAL = 30, then the interval between major ticks for the first axis level will be 30 seconds.

[XY]TICKLAYOUT

Set this keyword to integer scalar that indicates the tick layout style to be used to draw each level of the axis.

Valid values include:

[XY]TICKLEN

Set this keyword to a floating-point value that specifies the length of each major tick mark, measured in data units. The recommended, and default, tick mark length is 0.2. IDL converts, maintains, and returns this data as double-precision floating-point.

[XY]TICKNAME

Set this keyword to a string array of up to 30 elements that controls the annotation of each tick mark.

[XY]TICKUNITS

Set this keyword to a string (or a vector of strings) indicating the units to be used for axis tick labeling. If more than one unit is provided, the axis will be drawn in multiple levels, one level per unit.

The order in which the strings appear in the vector determines the order in which the corresponding unit levels will be drawn. The first string corresponds to the first level (the level nearest to the primary axis line).

Valid unit strings include:

If any of the time units are utilized, then the tick values are interpreted as Julian date/time values. Note that the singular form of each of the time value strings is also acceptable (e.g, TICKUNITS = 'Day' is equivalent to TICKUNITS = 'Days').

Note
Julian values must be in the range -1095 to 1827933925, which corresponds to calendar dates 1 Jan 4716 B.C.E. and 31 Dec 5000000 C.E., respectively.

[XY]TICKVALUES

Set this keyword to a floating-point vector of data values representing the values at each tick mark. If TICKVALUES is set to 0, the default, IDL computes the tick values based on the axis range and the number of major ticks. IDL converts, maintains, and returns this data as double-precision floating-point.

[XY]TITLE

Set this keyword to a string representing the title of the specified axis.

YMARGIN

Set this keyword to a floating-point value giving the vertical margin size between the edge of the view and the edge of the visualization. The valid range is 0.0 to 0.49, and the default value is 0.15. This keyword is ignored if STRETCH_TO_FIT is set to 0.

ZOOM_ON_RESIZE

Set this keyword to 1 (True) so that visualizations change size when the window is resized. The default value is 0 (False), which ensures that visualizations remain the same size regardless of the window dimensions.

ZVALUE

Set this keyword to the height of the Z plane onto which the image will be projected. The default is zero. If the ZVALUE is zero then the image visualization is considered to be 2D. If the ZVALUE is nonzero, then the image visualization is considered to be 3D, and the dataspace associated with this image will be automatically switched to 3D.

Examples

In the IDL Intelligent Tools system, data can be imported from the IDL Command Line (as described in Example 1), or data can be imported via the File menu in the iTool window (as described in Examples 2 and 3). For detailed information on importing data via the iTool file menu, refer to Data Import Methods (iTool User's Guide).

Example 1

This example shows how use the IDL Command Line to load data into the iImage tool.

At the IDL Command Line, enter:

file = FILEPATH('mineral.png', $
   SUBDIRECTORY = ['examples', 'data'])
data = READ_PNG(file)
IIMAGE, data, WINDOW_TITLE = 'Electron Image of Mineral Deposits'

Double-click the image to display image properties, and use the Image Palette setting to load the Stern Special predefined color table through the Load Predefined button in the Palette Editor.

Use the Text Annotation tool to insert a title at the top of the image. Select InsertColorbars to insert a color bar at the bottom of the image. Double-click on the colorbar to display its properties, and change the Title setting to Stern Special.

The following figure displays the output of this example:

Figure 11-4: Mineral iImage Example with Sterns Color Table

iimage_example3.gif

Example 2

This example shows how to use the iTool FileOpen command to load binary data into the iImage tool.

At the IDL Command Line, enter:

IIMAGE

Select FileOpen to display the Open dialog, then browse to find worldelv.dat in the examples/data directory in the IDL distribution, and click Open.

In the Binary Template dialog, click New Field, and enter the following information in the New Field dialog:

Click OK to close the New Field dialog and the Binary Template dialog, and the image is displayed.

Note
For more information on using the Binary Template to import data, see Using the BINARY_TEMPLATE Interface.

Double-click the image to display image properties, and use the Image Palette setting to load the STD GAMMA-II predefined color table through the Load Predefined button in the Palette Editor.

The following figure displays the output of this example:

Figure 11-5: World Elevation iImage Example

iimage_example2.gif

Example 3

This example shows how to use the IDL Import Data Wizard to load image data into the iImage tool.

At the IDL Command Line, enter:

IIMAGE

Select FileImport to display the IDL Import Data wizard.

  1. At Step 1, select From a File and click Next>>.
  2. At Step 2, under File Name:, browse to find n_vasinfecta.jpg in the examples/data directory in the IDL distribution, and click Next>>.
  3. At Step 3, select Image and click Finish.

Define the edges within the image by selecting OperationsFilterSobel Filter.

The following figure displays the output of this example:

Figure 11-6: Sobel FIltered Neocosmospora Vasinfecta iImage Example

iimage_example1.gif

Version History

6.0

Introduced

6.1

Added BACKGROUND_COLOR, GRID_UNITS, MACRO_NAMES, and STYLE_NAME keywords

6.2

Added DISABLE_SPLASH_SCREEN and VIEW_TITLE keywords

6.4

Added the ANISTROPIC_SCALE_2D, ANISTROPIC_SCALE_3D, FIT_TO_VIEW, INSERT_COLORBAR, RENDERER, SCALE_ISOTROPIC, TRANSPARENCY, VIEW_ZOOM keywords

7.1

Added the Filename argument.

Added the FONT_COLOR, FONT_NAME, FONT_SIZE, FONT_STYLE, WINDOW_TITLE, CURRENT_ZOOM, DEPTHCUE_BRIGHT, DEPTHCUE_DIM, STRETCH_TO_FIT, XMARGIN, YMARGIN, and ZOOM_ON_RESIZE keywords.

Modified behavior of the TITLE keyword to create a text annotation along with the visualization.