imscale - Scale 2-D variables to create byte-value image variables.

SYNOPSIS

imscale  [ parameter=value ...]  [ inputfile outputfile ]
imscale  [ parameter=value ...]  [ inputfile ... directory ]

Parameters are: include_vars, image_colors, bg_color, bad_color, over_color, under_color, max_width, max_height, fixed_size, zoom_factor, real_resample, est_range, min_value, max_value, invert_scale, north_up .

DESCRIPTION

imscale performs many of the same functions as Image Display under xvu, except that imscale writes output to TeraScan datasets rather than to the display screen.

For each input dataset, imscale processes one or more 2-D variables, storing the results in the corresponding output dataset. The variables from a given input dataset are assumed to have the same dimensions. This simplification ensures that all output variables have the same dimensions, regardless of size-related parameter options.

Variable data is scaled so variable values in the range [min_value, max_value] are mapped to the output range [0, image_colors -1]. image_colors is user-specified. min_value and max_value can be user-specified or estimated by imscale. In the latter case, imscale will compute min_value and max_value for a variable if that variable's valid_min and valid_max attributes are undefined (i.e., are equal to the variable's bad_value).

When computing a variable's min_value and max_value, imscale subsamples the variable's data with a maximum delta of 5, but with a minimum subsampled width and height of 20 points; i.e. rules:

     if vnx = variable width and vny = variable height

     deltax = (vnx > 100) ? 5 : (vnx > 20) ? vnx/20 : 1;
     deltay = (vny > 100) ? 5 : (vny > 20) ? vny/20 : 1;

Variable values greater than max_value or less than min_value are mapped to output values over_color and under_color, respectively. Missing variable values are mapped to the output value bad_color.

imscale allows the scale to be inverted. In this case, the variable's min_value is mapped to image_colors -1, and values less than min_value are mapped to over_color. Similarly, the variable's max_value is mapped to zero, and values greater than max_value are mapped to under_color.

imscale has a number of parameters that control the size of the output images: max_width, max_height, fixed_size, zoom_factor, and real_resample. These parameters are analogous to controls on the Image Set panel for xvu. max_width and max_height are the dimensions of the largest possible output image. fixed_size indicates that all output images will be exactly max_width wide and max_height tall.

If real_resample is not in effect, then either (1) the number of window pixels per image pixel or (2) the number of image pixels per window pixel is forced to be an integer. If real_resample is in effect, there is no such constraint. Consider the following cases in which

(1) variable to display is 256 pixels wide by 320 high (2) the maximum output image size is 800 pixels square

zoom fixed real ==> output output net factor size resamp width height zoom ------
------ ------ ------ ------ ---- 1 - yes 256 320 1 1 yes yes 800 800 1 1 - - 256 320 1 1
yes - 800 800 1 2 - yes 512 640 2 2 yes yes 800 800 15/16 2 - - 512 640 2 2 yes - 800 800
1 4 - yes 640 800 5/2 4 yes yes 800 800 15/16 4 - - 512 640 2 4 yes - 800 800 1 

When an input variable has earth location, imscale can flip and/or mirror the output image so north is up and east is to the right. This is controlled by the north_up parameter. This capability is useful when working with unregistered polar orbiter satellite data.

PARAMETERS

include_vars
This is the list of variables to scale. If the list is prefixed with a minus sign, all variables except those listed will be scaled. Wildcards * and ? are allowed. The default is to scale all variables.
image_colors
This is the number of image colors to use in the scaling process described above. The default is 216. The valid range is [2, 256].
bg_color
OPTIONAL. This is the image value for output pixels that are not covered by input image data. If image_colors is 256, then the default is 0. Otherwise the default is image_colors. The valid range is [0, 255].
bad_color
OPTIONAL. This is the image value that input variable bad (missing) values are mapped to. If image_colors is 256, then the default is 255. Otherwise the default is image_colors. The valid range is [0, 255].
over_color
OPTIONAL. This is the image value that variable 'overflow' values are mapped to. The default is image_colors -1. The valid range is [0, 255].
under_color
OPTIONAL. This is the image value that variable 'underflow' values are mapped to. The default is 0. The valid range is [0, 255].
max_width
This is the maximum width (2nd dimension) of the output images. The default value is 1280. The valid range is [1, 2560].
max_height
This is the maximum height (1st dimension) of the output images. The default value is 1024. The valid range is [1, 2048].
fixed_size
This parameter determines whether or not the dimensions of all output images are fixed at max_width and max_height. The default value is no. Valid responses are [yes, no].
zoom_factor
This is the image zoom factor. The default value is 1. The valid range is [1, 64].
real_resample
If real_resample=no, then either (1) the number of window pixels per image pixel or (2) the number of image pixels per window pixel is forced to be an integer. Otherwise there is no restriction. Valid responses are [yes, no]. The default value is yes.
est_range
This parameters indicates whether or not imscale is to estimate the input variables' min_value and max_value. The default is yes. Valid responses are [yes, no].
min_value, max_value
These parameters specify the input variables minimum and maximum values. These parameters are used only if est_range=no. There are no defaults values, and no restrictions other than max_value must not be less than min_value.
invert_scale
This parameter determines whether or not image scaling is inverted as described earlier. Valid responses are [yes, no]. The default value is no.
north_up
This parameter determines whether output images should be flipped and/or mirrored so that north is up and east is to the right. This parameter does not apply when input variables do not have earth location. Valid responses are [yes, no]. The default value is no.

EXAMPLES

In the following example, unregistered AVHRR channel 4 temperature data is scaled down to a 216 color image. Automatic scaling is NOT used, and the user-specified input range of values is [10, 20] Celsius. Because the scale is inverted, 10 degrees Celsius is mapped to image color 215, and 20 degrees Celsius is mapped to image color 0. Note, too, that because the input is unregistered, the north_up option was selected to make sure that north is really up in the output image. (North is down for ascending NOAA satellite passes.)

loreto% imscale n7.84191.2316 image
include_vars   : char(255) ? [] *4
image_colors   : int       ? [216]
max_width      : int       ? [1280]
max_height     : int       ? [1024]
fixed_size     : char(  3) ? [no]
zoom_factor    : int       ? [1]
real_resample  : char(  3) ? [yes]
est_range      : char(  3) ? [yes] n
min_value      : real      ? 10
max_value      : real      ? 20
invert_scale   : char(  3) ? [no] y
north_up       : char(  3) ? [no] y

SEE ALSO

cmdgraphics


Last Update: $Date: 1998/05/29 17:37:51 $