public class RangeLookupDescriptor
extends javax.media.jai.OperationDescriptorImpl
This is a variation on the JAI Lookup operation. It works with a RangeLookupTable object in which each entry maps a source image value range to a destination image value.
Users may also define a ROI
object to use for masking image areas.
In the example below, double data values from a source image are mapped to integer values in a destination image.
RenderedImage srcImage = ...
// RangeLookupTable is an immutable class. Use the associated Builder class
// to construct a new table. The type parameters define source data type
// and destination type respectively
RangeLookupTable.Builder<Double, Integer> builder =
new RangeLookupTable.Builder<Double, Integer>();
// Map all source values less than zero to -1
Range<Double> r = Range.create(Double.NEGATIVE_INFINITY, false, 0.0, false);
builder.add(r, -1);
// Map all source values from 0.0 (inclusive) to 1.0 (exclusive) to 1
r = Range.create(0.0, true, 1.0, false);
builder.add(r, 1);
// Map all source values from 1.0 (inclusive) to 2.0 (exclusive) to 2
r = Range.create(1.0, true, 2.0, false);
builder.add(r, 2);
// Map all source values greater than or equal to 2.0 to 3
r = Range.create(2.0, true, Double.POSITIVE_INFINITY, false);
builder.add(r, 3);
// Create the lookup table and the JAI operation
RangeLookupTable<Double, Integer> table = builder.build();
ParameterBlockJAI pb = new ParameterBlockJAI("rangelookup");
pb.setSource("source0", srcImage);
pb.setParameter("table", table);
RenderedImage destImage = JAI.create("rangelookup", pb);
The example above uses a table with complete coverage of all source image values. It is also allowed to have a table that only covers parts of the
source domain. In this case, a default destination value can be specified via the "default" parameter to RangeLookup, and this will be returned for
all unmatched source values. If the "default" parameter is null (which is its default setting) unmatched source values will be passed through to
the destination image. Note that this may produce surprising results when converting a float or double source image to an integral destination
image due to value truncation and overflow.
Parameters
Name | Type | Description | Default value |
---|---|---|---|
table | RangeLookupTable | Table mapping source value ranges to destination values | NO DEFAULT |
default | Number | Specifies the value to return for source values that do not map to any ranges in the lookup table. If null, unmatched source values will be passed through to the destination image. | null (pass-through) |
roi | javax.media.jai.ROI | Specifies a ROI to use for reducing computation area | null |
Constructor and Description |
---|
RangeLookupDescriptor()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static javax.media.jai.RenderedOp |
create(RenderedImage source,
RangeLookupTable table,
Number defaultValue,
javax.media.jai.ROI roi,
RenderingHints hints)
Creates a new
RenderedOp with the RLookup operation applied. |
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
public static javax.media.jai.RenderedOp create(RenderedImage source, RangeLookupTable table, Number defaultValue, javax.media.jai.ROI roi, RenderingHints hints)
RenderedOp
with the RLookup operation applied.table
- input RangeLookupTable
defaultValue
- Value to set for pixels outside ROI or outside of the Table Rangeroi
- Input ROI
to use in computationhints
- Configuration hintsCopyright © 2006–2018 GeoSolutions. All rights reserved.