IMGWIN Name
IMGWIN Purpose
This is an image display routine to allow the user to interact with
an image. Moving the cursor in the window gives the value and location
inside the image. The image is enclosed in a SCALEIMAGE object, so many of
the input keywords are used to set the scaling parameters for that object.
If axes are requested, an IMGAXIS object is added to the SCALEIMAGE object.
Other keywords are used to set up the axis object. The entire window can
be saved to file in various formats. The image can be scaled interactively,
image colors can be changed, and various image and axes properties can be
accessed directly from the File menu of the image window.
Authors
FANNING SOFTWARE CONSULTING BURRIDGE COMPUTING
1645 Sheely Drive 18 The Green South
Fort Collins Warborough, Oxon
CO 80526 USA OX10 7DN, ENGLAND
Phone: 970-221-0438 Phone: +44 (0)1865 858279
E-mail: davidf@dfanning.com E-mail: davidb@burridgecomputing.co.uk
Category
Graphics display. Syntax
ImgWin, image
Arguments
image An 8-bit or 24-bit image array, or the name of an image file that
can be opened with READ_IMAGE.
Input Keywords
AXES: Set this keyword to draw a set of axes around the image.
BACKGROUND: This keyword specifies the name of a background color. By default, 'ivory'.
BETA: The beta factor in a Hyperpolic Sine stretch. Default is 3.0.
BOTTOM: The lowest value of the scaled image.
BREWER: Set if the color table index number (CT) is the index of a Brewer color table.
To use Brewer color tables, the file fsc_brewer.tbl must be in your IDL path.
COLOR: Set this keyword to the name of the axis color. The name is passed to cgColor
for processing. Default is "charcoal". Used only if AXES is set.
CTINDEX: The index of the color table to use to display the image. Applies only to
2D image arrays. By default, 0, gray scale. If set to -1, uses current color table.
EXPONENT: The logarithm exponent in a logarithmic stretch. Default is 4.0.
FULL_RESOLUTION: Set this keyword if you want the image to be displayed in its full, native resolution.
If this keyword is set, the XSIZE and YSIZE keywords set the scrollable window size.
GAMMA: The gamma factor in a gamma stretch. Default is 1.5.
KEEP_ASPECT: 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. This keyword is turned ON by default. In other
words, to allow free positioning, set KEEP_ASPECT=0. Note that if this keyword is
set, and the XSIZE and YSIZE keywords are undefined, that the window will have the
same aspect ratio as the image.
MAP_COORD: A MapCoord object that can be used to georeference the image in the display window.
MAP_GRID: If the file can be georegistered (e.g. a GeoTIFF file), then setting this keyword
will add a map grid to the MapCoord object. Otherwise, the keyword is
ignored. Can only be used when passing ImgWin a GeoTIFF filename.
MAP_OUTLINE: If the file can be georegistered (e.g. a GeoTIFF file), then setting this keyword
will add a continental outline to the MapCoord object. Otherwise, the keyword is
ignored. Can only be used when passing ImgWin a GeoTIFF filename.
MEAN: The mean factor in a logarithmic stretch. Default is 0.5.
MISSING_COLOR: The name of the missing color. The default is "gray".
MISSING_VALUE: The number that represents missing value in the image.
NCOLORS: The number of colors to scale the data into, as in this: (Default: 256)
displayImage = BYTSCL(image, MIN=self.sclmin, MAX=self.sclmax, TOP=self.ncolors-1)
NOINTERP: 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 is turned ON by default. In other words, to allow
interpolation, set NOINTERP=0.
POSITION: The position of the image in the display window. The position is given
as a four-element array in normalized (0 to 1) coordinates of the form
[x0, y0, x1, y1], where (x0,y0) is the lower-left corner of the image and
(x1,y1) is the upper-right corner of the image. If the KEEP_ASPECT keyword
is set, the image will be located within the specified POSITION in a way
that preserves the aspect ratio of the image. The default is [0.075, 0.075, 0.925, 0.925].
SCALETYPE: The type of scaling performed prior to display. Default is 0, linear scaling.
May be specified as a number or as a string (e.g, 3 or "ASINH").
Number Type of Stretch
0 Linear scaled = BytScl(image, MIN=minThresh, MAX=maxThresh)
1 Gamma scaled = GmaScl(image, MIN=minThresh, MAX=maxThresh, Gamma=gamma)
2 Log scaled = LogScl(image, MIN=minThresh, MAX=maxThresh, Mean=mean, Exponent=exponent)
3 Asinh scaled = AsinhScl(image, MIN=minThresh, MAX=maxThresh, Beta=beta)
4 Linear 2% A linear stretch, with 2 percent of pixels clipped at both the top and bottom
5 Square Root A linear stretch of the square root histogram of the image values.
6 Equalization A linear stretch of the histogram equalized image histogram.
7 Gaussian A Gaussian normal function is applied to the image histogram.
8 None No scaling whatsoever is done.
SCLMIN: The image data is scaled between SCLMIN and SCLMAX before display. Default = 0.
SCLMAX: The image data is scaled between SCLMIN and SCLMAX before display. Default = 255.
SIGMA: The sigma scale factor for Gaussian scaling. Default is 1.0.
TLB_TITLE: The title of the IMGWIN top-level base. Default: "Catalyst Image Window
WIN_KEEP_ASPECT: If this keyword is set, the IMGWIN window will maintain the same aspect ratio
as the image as it is resized.
XRANGE: If the AXES keyword is set, this keyword is a two-element vector
giving the X axis range. By default, [0, size of image in X].
XSIZE: The X size of the initial image window. If undefined, appoximately 600 pixels.
(Acutally size determined by the aspect ratio of the image.)
XTICKFORMAT: The tick formatting for the X axis, if the AXES keyword is set.
XTILE: The title of the X axis, if the AXES keyword is set.
YRANGE: If the AXES keyword is set, this keyword is a two-element vector
giving the Y axis range. By default, [0, size of image in Y].
YSIZE: The Y size of the initial image window. If undefined, appoximately 600 pixels.
(Acutally size determined by the aspect ratio of the image.)
YTICKFORMAT: The tick formatting for the Y axis, if the AXES keyword is set.
YTILE: The title of the Y axis, if the AXES keyword is set.
Output Keywords
OUTIMAGE: The image object that is created inside the program.
Modification History
Written by: David W. Fanning, 12 October 2008.
Fixed a problem with no image updates after writing the image to PostScript output. 8 Nov 2008. DWF.
Whoops! Fixed a problem with the KEEP_ASPECT keyword not working. 11 Dec 2008. DWF.
Added WIN_KEEP_ASPECT to allow the display window to keep the same aspect ratio as the image
upon resize. 11 Dec 2008. DWF.
A change to XStretch on 15 March revealed a small bug in the way XStretch was being called
in IMGWIN. It is now being called with the proper keywords. 18 March 2009. DWF.
Fixed a small problem with the way the CTINDEX keyword was handled. 8 May 2009. DWF.
PNG files with more than 8-bits per channel are now being handled correctly. 5 August 2009. DWF.
Modified to georegister GEOTIFF files when they are opened via a GeoTIFF file name. 30 August 2009. DWF.
Modified code so that input parameter data type would not change. 13 December 2009. DWF.
Fixed a problem with the image variable name when the name of a GeoTIFF is passed to
the program. 10 February 2010. DWF.
Fixed a problem with CTINDEX=-1 not working when passed GeoTIFF files. 21 Febrary 2010. DWF.
Added AUTODRAWGRID keyword to MAP_GRID calls. 11 March 2010.
Overly ambitious cleanup was killing passed in map coordinate variable Fixed. 24 March 2010. DWF.