javax.media.jai.operator
Class PiecewiseDescriptor

java.lang.Object
  |
  +--javax.media.jai.OperationDescriptorImpl
        |
        +--javax.media.jai.operator.PiecewiseDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class PiecewiseDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Piecewise" operation.

The "Piecewise" operation performs a piecewise linear mapping of the pixel values of an image. The piecewise linear mapping is described by a set of breakpoints which are provided as an array of the form

float breakPoints[N][2][numBreakPoints]
where the value of N may be either unity or the number of bands in the source image. If N is unity then the same set of breakpoints will be applied to all bands in the image. The abscissas of the supplied breakpoints must be monotonically increasing.

The pixel values of the destination image are defined by the pseudocode:

 if (src[x][y][b] < breakPoints[b][0][0]) {
     dst[x][y][b] = breakPoints[b][1][0]);
 } else if (src[x][y][b] > breakPoints[b][0][numBreakPoints-1]) {
     dst[x][y][b] = breakPoints[b][1][numBreakPoints-1]);
 } else {
     int i = 0;
     while(breakPoints[b][0][i+1] < src[x][y][b]) {
         i++;
     }
     dst[x][y][b] = breakPoints[b][1][i] +
                        (src[x][y][b] - breakPoints[b][0][i])*
                        (breakPoints[b][1][i+1] - breakPoints[b][1][i])/
                        (breakPoints[b][0][i+1] - breakPoints[b][0][i]);
 }
 

Resource List
Name Value
GlobalName Piecewise
LocalName Piecewise
Vendor com.sun.media.jai
Description Applies a piecewise pixel value mapping.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/PiecewiseDescriptor.html
Version 1.0
arg0Desc The breakpoint array.

Parameter List
Name Class Type Default Value
breakPoints float[][][] NO_PARAMETER_DEFAULT

See Also:
DataBuffer, ImageLayout, OperationDescriptor, Serialized Form

Fields inherited from class javax.media.jai.OperationDescriptorImpl
resources, sourceNames, supportedModes
 
Constructor Summary
PiecewiseDescriptor()
          Constructor.
 
Method Summary
 boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg)
          Validates the input source and parameter.
 
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, 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

PiecewiseDescriptor

public PiecewiseDescriptor()
Constructor.
Method Detail

validateArguments

public boolean validateArguments(String modeName,
                                 ParameterBlock args,
                                 StringBuffer msg)
Validates the input source and parameter.

In addition to the standard checks performed by the superclass method, this method checks that the number of bands in "breakPoints" is either 1 or the number of bands in the source image, the second breakpoint array dimension is 2, the third dimension is the same for abscissas and ordinates, and that the absicssas are monotonically increasing.

Overrides:
validateArguments in class OperationDescriptorImpl
Tags copied from class: OperationDescriptorImpl
Parameters:
modeName - the operation mode name
args - Input arguments, including source(s) and/or parameter(s).
msg - A string that may contain error messages.
Throws:
IllegalArgumentException - if modeName is null
See Also:
OperationDescriptorImpl.validateSources(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer), OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)