org.jaitools.media.jai.rangelookup
Class RangeLookupDescriptor

java.lang.Object
  extended by javax.media.jai.OperationDescriptorImpl
      extended by org.jaitools.media.jai.rangelookup.RangeLookupDescriptor
All Implemented Interfaces:
Serializable, javax.media.jai.OperationDescriptor, javax.media.jai.RegistryElementDescriptor

public class RangeLookupDescriptor
extends javax.media.jai.OperationDescriptorImpl

Describes the "RangeLookup" operation.

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.

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

NameTypeDescriptionDefault 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)

Since:
1.0
Author:
Michael Bedward, Simone Giannecchini, GeoSolutions
See Also:
Range, RangeLookupTable, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
resources, sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
RangeLookupDescriptor()
          Constructor.
 
Method Summary
 
Methods inherited from class javax.media.jai.OperationDescriptorImpl
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeLookupDescriptor

public RangeLookupDescriptor()
Constructor.



Copyright © 2009-2013. All Rights Reserved.