require(["esri/layers/pixelfilters/StretchFilter"], function(StretchFilter) { /* code goes here */ });
Description
(Added at v3.18)
A stretch filter used to work with client -side pixel data to enhance raster/image appearances. This can be used in conjunction with
RasterLayer or
WCSLayer.
Samples
Search for
samples that use this class.
Constructors
Properties
Methods
Constructor Details
Creates an instance of a StretchFilter.
Parameters:
<Object > options |
Optional |
Optional parameters. See options list below. |
options
properties:
<Boolean > dra |
Optional |
Indicates whether to perform dynamic range adjustment using the current pixel data. |
<Number[] > gamma |
Optional |
An array of gamma values, for example [0.8, 0.8, 0.8] . |
<Number > max |
Optional |
The maximum value of stretched pixels. Default value is 255 . |
<Number > maxPercent |
Optional |
Percent of pixels clipped on the right histogram tail, for example 0.25 . |
<Number > min |
Optional |
The minimum value of stretched pixels. Default value is 0
|
<Number > minPercent |
Optional |
Percent of pixels clipped on the left histogram tail, for example 1.5 . |
<Number > numberOfStandardDeviations |
Optional |
The number of standard deviations for StandardDeviation stretch, for example 2.5 . |
<String > outputPixelType |
Optional |
The output pixel type. Set this to U8 to avoid extra stretch by the layer. |
<Array[] > statistics |
Optional |
An array of arrays containing custom statistics objects. Each element represents a band statistic, i.e. [min, max, mean, standardDeviation] . |
<Number > stretchType |
Optional |
See the constants table for a list of possible stretchType values. |
<Boolean > useGamma |
Optional |
Indicates whether to perform non-linear gamma stretch. |
Sample:
var stretch = new StretchFilter({
"stretchType": 6,
"min": 0,
"max": 255,
"dra": true,
"minPercent": 0.2,
"maxPercent": 0.2,
"useGamma": false,
});
var rasterLayer = new RasterLayer{
url: "url",
pixelFilter:stretch.filter
};
Property Details
Indicates whether to perform dynamic range adjustment using the current pixel data.
An array of gamma values, for example [0.8, 0.8, 0.8]
.
The maximum value of stretched pixels.
Default value: 255
Percent of pixels clipped on the right histogram tail, for example 0.25
.
The minimum value of stretched pixels.
Default value: 0
Percent of pixels clipped on the left histogram tail, for example 1.5
.
The number of standard deviations for StandardDeviation stretch, for example 2.5
.
The output pixel type. Set this to U8
to avoid extra stretch by the layer.
An array of arrays containing custom statistics objects. Each element represents a band statistic, i.e. [min, max, mean, standardDeviation]
.
Number indicating the various stretch types. These include:
- 0 - No stretch filter
- 3 - StandardDeviation
- 4 - Histogram Equalization
- 5 - MinMax
- 6 - Percent Clip
Indicates whether to perform non-linear gamma stretch.
Method Details
It takes a
pixelData
object as input and processes it. The
pixelData
object contains a
pixelBlock property that gives you access to all of the pixels in the raster.
Inside the pixelFilter, you may loop through pixels through the pixelBlock property of the pixelData object and process them.
Parameters:
<Object > pixelData |
Required |
The pixelData object used as filter input. The pixelData object contains a pixelBlock property that gives you access to all of the pixels in the raster.
Inside the pixelFilter, you may loop through pixels through the pixelBlock property of the pixelData object and process them. |