Reference Guide > T Routines > TVSCL Procedure
  

TVSCL Procedure
Scales the intensity values of an input image into the range of the image display, usually from 0 to 235 on Windows and 0 to 255 on X Windows systems, and outputs the data to the image display at the specified location.
Usage
TVSCL, image[, x, y[, channel ]]
TVSCL, image[, position]
Input Parameters
image—A vector or two-dimensional matrix to be displayed as an image. If image is not already of byte type, it is converted prior to use.
x, y—(optional) The lower-left x- and y-coordinates of the displayed image.
channel—(optional) The memory channel to be written. If not specified, it is assumed to be zero. This parameter is ignored on display systems that have only one memory channel.
position—(optional) Number specifying the position of the image. Positions run from the left of the window to the right, and from the top of the window to the bottom (see Discussion for details).
Keywords
Bottom—Specifies the lower bound when scaling the intensity values.
Centimeters—If present, specifies that all position values (the x y parameters and the XSize and YSize keywords) are in centimeters from the origin. This is useful when dealing with devices that do not provide a direct relationship between image pixels and the size of the resulting image, such as PostScript printers.
If Centimeters is not present, position values are taken to be in device coordinates.
Channel—The memory channel to be written. This keyword is identical to the channel input parameter; only one needs to be used.
Data—If present, specifies that all position and size values are in data coordinates. This is useful when drawing an image over an existing plot, since the plot establishes the data scaling.
Device—If present, specifies that all position and size values are in device coordinates. This is the default.
Inches—If present, specifies that all position and size values are in inches from the origin. This is useful when dealing with devices that do not provide a direct relationship between image pixels and the size of the resulting image, such as PostScript printers.
Normal—If present, specifies that all position and size values are in normalized coordinates in the range 0.0 to 1.0. This is useful when you want to draw an image in a device-independent manner.
Order—If specified, overrides the current setting of the !Order system variable for the current image only. If nonzero, Order causes the image to be drawn from the top-down, instead of from the bottom-up (the default).
Top—Specifies the upper bound when scaling the intensity values.
True—(UNIX Only) If present and nonzero, indicates that a true-color image is to be displayed and specifies the index of the dimension over which color is interleaved:
*1—Displays pixel-interleaved images of dimensions (3, m, n).
*2—Displays row-interleaved images of dimensions (m, 3, n).
*3—Displays image-interleaved images of dimensions (m, n, 3). (Image interleaving is also known as band interleaving.)
 
note
To use True, the image parameter must have three dimensions, one of which is equal to 3.
XSize—The width of the resulting image. This keyword is intended for use by devices with scalable pixel size (such as PostScript), and is ignored by pixel-based devices that are unable to change the size of their pixels.
YSize—The height of the resulting image, with the same limitations as XSize.
Discussion
If position is used instead of the x and y parameters, the position of the image is calculated based on the largest grid of images of this size that will fit on the display, numbered from left to right and top to bottom. Specifically, the position is calculated as explained below.
The starting x-coordinate position is defined as:
The starting y-coordinate position is defined as:
where:
*YSize is the height of the display or window
*xdim and ydim are the dimensions of the array
*the images across the display surface are defined as:
For example, when displaying 128-by-128 images on a 512-by-512 display, the position numbers run from 0 to 15 as follows:
Example
This example uses TVSCL and TV to exhibit the difference between images whose intensity values are scaled into the full range of the image display and images that have not been scaled. The results are shown in Figure 17-2: Unscaled Image (left) and Scaled Image (right) on page 1293.
; Open the file containing the image.
OPENR, unit, FILEPATH('aerial_demo.img', $
   Subdir='demo/gallery3/data'), /Get_Lun
; Create an array large enough to hold the image.
img = BYTARR(512, 512)
; Read the image data.
READU, unit, img
; Close the file and free the file unit number.
FREE_LUN, unit
; Create a window large enough to hold two 512-by-512 images.
WINDOW, 0, XSize=1024, YSize=512
; Display the original image in the left half of the window.
TV, img
; Use TVSCL to display scaled image in right half of the window.
TVSCL, img, 1
 
Figure 17-2: Unscaled Image (left) and Scaled Image (right)
See Also
BYTSCL, TV, TVCRS, TVLCT, TVRD, TVSIZE
System Variables: !Order
For more information, see the PV‑WAVE User’s Guide.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.