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

require(["esri/layers/PixelBlock"], function(PixelBlock) { /* code goes here */ });

Description

(Added at v3.13)
The PixelBlock is used to hold pixels. It stores and decodes source data fetched from an image service.

Samples

Search for samples that use this class.

Constructors

NameSummary
new PixelBlock(options)Creates a new PixelBlock object.

Properties

NameTypeSummary
heightNumberNumber of rows.
maskArrayAn array of nodata mask.
pixelTypeStringPixel type.
pixelsNumber[][]A two dimensional array representing the pixels from the Image Service displayed on the client.
statisticsObject[]Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.).
widthNumberNumber of columns.

Methods

NameReturn typeSummary
addData(planeData)NoneAdds another plane.
getAsRGBA()ArrayReturns pixels and masks using a single array in bip format (for example [p_00_r, p_00_g, p_00_b, p_00_a, p_10_r, p_10_g, p_10_b, p_10_a, ...]).
getAsRGBAFloat()ArraySimilar to getAsRGBA, but returns floating point data.
getPlaneCount()NumberReturns the plane band count.
Constructor Details

new PixelBlock(options)

Creates a new PixelBlock object.
Parameters:
<Object> options Required Constructor parameters. See options list below.
options properties:
<Number> height Required Number of rows.
<Array> mask Optional An array of nodata mask. The size is height*width. It's arranged row by row in this format: [p_00, p_10, p_20, ... p_10, p_11, .....]. p_xy means pixel value at the column x row y. The mask is per pixel, not per band.
<String> pixelType Optional Pixel type. Known values include "S8" | "S16" | "S32" | "U8" | "U16" | "U32" | "F32" | "F64"
<Number[][]> pixels Required A two dimensional array. The first dimension is number of bands, the second dimension is height * width. The band x is pixels[x-1]. For each band pixels[x], the size is height*width. It's arranged row by row in this format: [p_00, p_10, p_20, ... p_10, p_11, .....]. p_xy means pixel value at the column x row y.
<Object[]> statistics Optional Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.).
<Number> width Required Number of columns.
Property Details

<Number> height

Number of rows.

<Array> mask

An array of nodata mask. The size is height*width. It's arranged row by row in this format: [p_00, p_10, p_20, ... p_10, p_11, .....]. p_xy means pixel value at the column x row y. The mask is per pixel, not per band.

<String> pixelType

Pixel type.
Known values: "S8" | "S16" | "S32" | "U8" | "U16" | "U32" | "F32" | "F64"

<Number[][]> pixels

A two dimensional array representing the pixels from the Image Service displayed on the client. The first dimension is number of bands, the second dimension is height * width. The band x is pixels[x-1]. For each band pixels[x], the size is height*width. It's arranged row by row in this format: [p_00, p_10, p_20, ... p_10, p_11, .....]. p_xy means pixel value at the column x row y.

<Object[]> statistics

Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.).

<Number> width

Number of columns.
Method Details

addData(planeData)

Adds another plane. The planData parameter needs to have two properties set: pixels and statistics.
Parameters:
<Object> planeData Required Must have two properties set: pixels and statistics.
Object Specifications:
<planeData>
<Number[][]> pixels Required A two dimensional array. The first dimension is number of bands, the second dimension is height * width.
<Object[]> statistics Required Array of objects containing numeric statistical properties (for example minValue, maxValue, noDataValue, etc.).

getAsRGBA()

Returns pixels and masks using a single array in bip format (for example [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.
Return type: Array

getAsRGBAFloat()

Similar to getAsRGBA, but returns floating point data. The result can be used to create a webgl texture (OES_texture_float).
Return type: Array

getPlaneCount()

Returns the plane band count.
Return type: Number
Show Modal