| Environments | MODELER |
| Batch Mode | Yes |
| Sections | Description Port Port Details Parameters Parameter Details Details Algorithm |
Generates a lookup-table layer to perform piece-wise contrast stretching of image data.
PWLUT2 allows a user to create a Lookup table (LUT) segment from scratch, which can then be run through the PWLUT function to create a piecewise LUT.
| In/Out | Name | Caption | Type | Min. - Max. Layers | Connection |
|---|---|---|---|---|---|
| Out | Output | Lookup Table Layer | LUT | 0 - 1 | Optional |
| Name | Caption | Type | Data Range | Default | Optional |
|---|---|---|---|---|---|
| Exponent | Exponent for Contrast Stretch | Real | 0.0 <= x <= 100.0 | 0.5 | yes |
| MinInGrayLevel | Minimum input gray level | Integer | 0 <= x <= 254 | <none> | No |
| MaxInGrayLevel | Maximum input gray level | Integer | 1 <= x <= 255 | <none> | No |
| MinOutGrayLevel | Minimum output gray level | Integer | 0 <= x <= 254 | <none> | yes |
| MaxOutGrayLevel | Maximum output gray level | Integer | 1 <= x <= 255 | <none> | yes |
| LowEndControl | Low end control | Text | OFF, MIN, MAX | MIN | No |
| HighEndControl | High end control | Text | OFF, MIN, MAX | MAX | No |
| LayerName | LUT layer name | Text | <string, max. 8 characters> | STR | No |
| LayerDesc | Layer description | Text | <string, max. 64 characters> | <none> | yes |
Exponent: Exponent for Contrast Stretch - Optional
Valid Values: 0.0 <= x <= 100.0 Default value: 0.5
Specifies a positive real number corresponding to the exponent in the contrast stretching formula:
newval = A*(oldval - MinInGrayLevel)**Exponent + MinOutGrayLevel
where newval and oldval are gray levels, A is the scaling factor, and MinInGrayLevel and MinOutGrayLevel are the minimum input and output gray levels. For instance, if Exponent is set to 1, the stretch is linear.
Exponent defaults to 0.5 (this eliminates the typical skewing of histograms).
MinInGrayLevel: Minimum Input Gray Level
Valid Values: 0 <= x <= 254 Default value: <none>
Specifies the range of input gray levels, along with MaxInGrayLevel.
MaxInGrayLevel: Maximum Input Gray Level
Valid Values: 1 <= x <= 255 Default value: <none>
Specifies the range of input gray levels, along with MinInGrayLevel.
MinOutGrayLevel: Minimum Output Gray Level - Optional
Valid Values: 0 <= x <= 254 Default value: <none>
Specifies the range of output gray levels, along with MaxOutGrayLevel. MaxOutGrayLevel must be greater than or equal to MinOutGrayLevel.
MaxOutGrayLevel: Maximum Output Gray Level - Optional
Valid Values: 1 <= x <= 255 Default value: <none>
Specifies the range of output gray levels, along with MinOutGrayLevel. MaxOutGrayLevel must be greater than or equal to MinOutGrayLevel.
LowEndControl: Low End Control
Valid Values: OFF, MIN, MAX Default value: MIN
Specifies the mapping of pixels that fall short of the input range in MinInGrayLevel.
HighEndControl: High End Control
Valid Values: OFF, MIN, MAX Default value: MAX
Specifies the mapping of pixels that are higher than the input range in MaxInGrayLevel.
Valid Values: <string, max. 8 characters> Default value: STR
Specifies a quick-identifier name that will be assigned to the output LUT layer. This string is displayed by ASL, and may be changed with MAS.
LayerDesc: Layer Description - Optional
Valid Values: <string, max. 64 characters> Default value: <none>
Specifies a descriptor that will be associated with the output layer (i.e., string describing contents or origins of data).
The function PWLUT2 allows users to create a lookup table segment from scratch, specifying the range of input and output values and the function they wish to apply to that range of data. It can be used to create a first LUT segment, which can then be passed to the PWLUT function to add more ranges to the LUT.
This allows for the creation of piecewise functions. These functions allow users to create enhancements that are not data-specific, but rather digital number specific.
Various types of functions can be obtained by varying the value of the exponent:
Exponent = 0.5 Square root function (default) Exponent = 1 Linear ramp function Exponent = 2 Squaring function
In general, the user has total control of the parameters which make up the contrast stretch function.
Exponent Power exponent (must be positive value) (default = 0.5) MinInGrayLevel Minimum input gray-level value (must be <= ISTR(2)) (default = 0) MaxInGrayLevel Maximum input gray-level value (must be >= ISTR(1)) (default = 255) MinOutGrayLevel Minimum output gray-level value (default = 0) MaxOutGrayLevel Maximum output gray-level value (default = 255)
If MinOutGrayLevel > MaxOutGrayLevel, the result is a 'negative' image.
LowEndControl and HighEndControl control the mapping function for input values that are outside the range specified by MinOutGrayLevel and MaxOutGrayLevel:
For X < LowEndControl F(X) = MinOutGrayLevel if LowEndControl = "MIN" (default)
F(X) = MaxOutGrayLevel if LowEndControl = "MAX"
F(X) unchanged if LowEndControl = "OFF"
For X > HighEndControl F(X) = MaxOutGrayLevel if HighEndControl = "MAX" (default)
F(X) = MinOutGrayLevel if HighEndControl = "MIN"
F(X) unchanged if HighEndControl = "OFF"
The contrast stretch function has the following form:
F(X) = A * (X - MinInGrayLevel) ** Exponent + MinOutGrayLevel MinInGrayLevel < X < MaxInGrayLevel XInput gray-level value F(X) Output gray-level value AScaling factor Exponent Power exponent (must be positive value) MinInGrayLevel Minimum input gray-level value (must be <= MaxInGrayLevel) MaxInGrayLevel Maximum input gray-level value (must be >= MinInGrayLevel) MinOutGrayLevel Minimum output gray-level value MaxOutGrayLevel Maximum output gray-level value If MinOutGrayLevel > MaxOutGrayLevel, the result is a `negative' image.
The formula for determining the scaling factor A is as follows:
MaxOutGrayLevel - MinOutGrayLevel
A = ----------------------------------------------
(MaxInGrayLevel - MinInGrayLevel) ** Exponent
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.