PixelBlock
require(["esri/layers/support/PixelBlock"], function(PixelBlock) { /* code goes here */ });
esri/layers/support/PixelBlock
An object representing the pixels in the view. It stores and decodes source data fetched from an image service. This provides the user access to each pixel on the client via the pixels property.
Constructors
- new PixelBlock(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
Number | The height (or number of rows) of the PixelBlock in pixels. more details | more details | PixelBlock | |
Number[] | An array of numbers representing pixels to show and pixels to hide from the view. more details | more details | PixelBlock | |
Number[][] | A two dimensional array representing the pixels from the Image Service displayed on the client. more details | more details | PixelBlock | |
String | The pixel type. more details | more details | PixelBlock | |
Object[] | An array of objects containing numeric statistical properties. more details | more details | PixelBlock | |
Number | The width (or number of columns) of the PixelBlock in pixels. more details | more details | PixelBlock |
Property Details
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
- heightNumber
The height (or number of rows) of the PixelBlock in pixels.
- maskNumber[]
An array of numbers representing pixels to show and pixels to hide from the view. The length of this array is height * width. It's arranged row by row in this format:
[p_00, p_10, p_20, ... p_10, p_11, .....]
wherep_xy
is the pixel value at the columnx
and rowy
.The mask is per pixel, not per band. Items in the mask array with a value of
0
indicates pixels to not display in the view at that index. Items with a value of1
indicate to display the pixels at there corresponding indices.
- pixelsNumber[][]
A two dimensional array representing the pixels from the Image Service displayed on the client. The length of the first dimension is the same as the number of bands in the layer. The length of the second dimension is height * width. The length of each band is the same. The pixels in each band are arranged row by row in this format:
[p_00, p_10, p_20, ... p_10, p_11, ...]
wherep_xy
is the pixel value at the columnx
and rowy
.Example:var pixels = imgLyr.pixelData.pixelBlock.pixels; // Prints the number of bands in the layer console.log(pixels.length); // An array containing all the pixels in the first band var band1 = pixels[0];
- pixelTypeString
The pixel type.
Possible Values: s8 | s16 | s32 | u8 | u16 | u32 | f32 | f64
- statisticsObject[]
An array of objects containing numeric statistical properties. Each object has the following specification if defined:
- widthNumber
The width (or number of columns) of the PixelBlock in pixels.
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
Adds another plane to the PixelBlock. more details | more details | addData | ||
Number[] | Returns pixels and masks using a single array in bip format (e.g. more details | more details | getAsRGBA | |
Number[] | Similar to getAsRGBA, but returns floating point data. more details | more details | getAsRGBAFloat | |
Number | Returns the plane band count of the PixelBlock. more details | more details | getPlaneCount |
Method Details
- addData(planeData)inner
Adds another plane to the PixelBlock.
Parameters:planeData ObjectThe data to add to the PixelBlock.
Specification:pixels Number[][]A two dimensional array representing the pixels to add.
statistics Object[]An array of objects containing numeric statistical properties. See statistics for details on the specifications of each object.
Returns pixels and masks using a single array in bip format (e.g. [p_00_r, p_00_g, p_00_b, p_00_a, p_10_r, p_10_g, p_10_b, p_10_a, .....]). Use this method to get an unsigned 8 bit pixel array. The result can be used to create a webgl texture.
Returns:Type Description Number[] An unsigned 8-bit pixel array.
Similar to getAsRGBA, but returns floating point data. The result can be used to create a webgl texture (OES_texture_float).
Returns:Type Description Number[] A floating point array.
Returns the plane band count of the PixelBlock.
Returns:Type Description Number The plane band count.