Replace value

 

DSpGMIdentity: DSpGMReplaceValue

In this operation every pixel of a raster band having a certain value is set to another value. The raster band is overwritten with the result of the operation. The operation can be applied to raster bands having any kind of data type.

The operation is provided in a high-level and a low-level format. In the high-level format a raster object, a band identifier and a token are specified, together with the value. The operation applies to all pixels and the result is stored in the specified band. In the low-level format the operation is applied to a block of contiguous memory containing a specified number of pixels. The low-level format is useful to chain a number of operations without the overhead of storing intermediate results.

If you want to preserve the original raster band, you should make a copy of the band first.

 

Declaration

High-level declaration:

procedure DSpGMReplaceValue(const r: TDSpRaster; const band, token: integer;
                            var old, replace);

Low-level declaration:

procedure DSpGMReplaceValue(const data: pointer; dt: TDSpDataType;
                            pixels: integer; var old, replace);

Parameter Description
r A valid raster object. It must be opened for write access.
band The identifier of the raster band. The band must exist in the raster, and it can be of any type. The data type can be any available data type.
token The access token for the raster. The token has to be generated for write access.
old

The value for which every pixel of the raster band is scanned. If the value is found, it is replaced by the replace value. This value will be converted to the data type of the raster band before the operation.

replace The value that is assigned to a pixel if it has the old value. This value will be converted to the data type of the raster band before the operation.
data A pointer to a block of memory containing pixels pixel values.
pixels Number of pixels in the data block of memory.
dt The data type of the raster band to which the data block of memory belongs.


Go to SourceForge
Last modified: 6 January 2005. Page maintained by pvanlaake