Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: StretchFilter

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

NameSummary
new StretchFilter(options?)Creates an instance of a StretchFilter.

Properties

NameTypeSummary
draBooleanIndicates whether to perform dynamic range adjustment using the current pixel data.
gammaNumber[]An array of gamma values, for example [0.8, 0.8, 0.8].
maxNumberThe maximum value of stretched pixels.
maxPercentNumberPercent of pixels clipped on the right histogram tail, for example 0.25.
minNumberThe minimum value of stretched pixels.
minPercentNumberPercent of pixels clipped on the left histogram tail, for example 1.5.
numberOfStandardDeviationsNumberThe number of standard deviations for StandardDeviation stretch, for example 2.5.
outputPixelTypeStringThe output pixel type.
statisticsArray[]An array of arrays containing custom statistics objects.
stretchTypeNumberNumber indicating the various stretch types.
useGammaBooleanIndicates whether to perform non-linear gamma stretch.

Methods

NameReturn typeSummary
filter(pixelData)NoneIt takes a pixelData object as input and processes it.
Constructor Details

new StretchFilter(options?)

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

<Boolean> dra

Indicates whether to perform dynamic range adjustment using the current pixel data.

<Number[]> gamma

An array of gamma values, for example [0.8, 0.8, 0.8].

<Number> max

The maximum value of stretched pixels.
Default value: 255

<Number> maxPercent

Percent of pixels clipped on the right histogram tail, for example 0.25.

<Number> min

The minimum value of stretched pixels.
Default value: 0

<Number> minPercent

Percent of pixels clipped on the left histogram tail, for example 1.5.

<Number> numberOfStandardDeviations

The number of standard deviations for StandardDeviation stretch, for example 2.5.

<String> outputPixelType

The output pixel type. Set this to U8 to avoid extra stretch by the layer.

<Array[]> statistics

An array of arrays containing custom statistics objects. Each element represents a band statistic, i.e. [min, max, mean, standardDeviation].

<Number> stretchType

Number indicating the various stretch types. These include:
  • 0 - No stretch filter
  • 3 - StandardDeviation
  • 4 - Histogram Equalization
  • 5 - MinMax
  • 6 - Percent Clip

<Boolean> useGamma

Indicates whether to perform non-linear gamma stretch.
Method Details

filter(pixelData)

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.

Show Modal