javax.media.jai.operator
Class BandCombineDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.BandCombineDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class BandCombineDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "BandCombine" operation.

The BandCombing operation computes a set of arbitrary linear combinations of the bands of a rendered or renderable source image, using a specified matrix. The matrix must a number of rows equal to the number of desired destination bands and a number of columns equal to the number of source bands plus one. In other words, the array may be constructed using the syntax:

 double[][] matrix = new double[destBands][sourceBands + 1];
 

The number of source bands used to determine the matrix dimensions is given by source.getSampleModel().getNumBands() regardless of the type of ColorModel the source has.

The extra column in the matrix contains constant values each of which is added to the respective band of the destination. The transformation is therefore defined by the pseudocode:

 // s = source pixel
 // d = destination pixel
 for(int i = 0; i < destBands; i++) {
     d[i] = matrix[i][sourceBands];
     for(int j = 0; j < sourceBands; j++) {
         d[i] += matrix[i][j]*s[j];
     }
 }
 

If the result of the computation underflows/overflows the minimum/maximum value supported by the destination image, then it will be clamped to the minimum/maximum value respectively.

Resource List
Name Value
GlobalName BandCombine
LocalName BandCombine
Vendor com.sun.media.jai
Description Performs arbitrary interband linear combination using a specified matrix.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/BandCombineDescriptor.html
Version 1.0
arg0Desc The matrix specifying the band combination.

Parameter List
Name Class Type Default Value
matrix double[][] NO_PARAMETER_DEFAULT

See Also:
OperationDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
BandCombineDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, double[][] matrix, RenderingHints hints)
          Performs arbitrary interband linear combination using a specified matrix.
static RenderableOp createRenderable(RenderableImage source0, double[][] matrix, RenderingHints hints)
          Performs arbitrary interband linear combination using a specified matrix.
 boolean validateArguments(String modeName, ParameterBlock args, StringBuffer message)
          Validates the input source and parameters.
 
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

BandCombineDescriptor

public BandCombineDescriptor()
Constructor.

Method Detail

validateArguments

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

In addition to the standard checks performed by the superclass method, this method checks that "matrix" has at least 1 row and (source bands + 1) columns.

The number of source bands is considered to be equal to source.getSampleModel().getNumBands().

Specified by:
validateArguments in interface OperationDescriptor
Overrides:
validateArguments in class OperationDescriptorImpl
Parameters:
modeName - the operation mode name
args - Input arguments, including source(s) and/or parameter(s).
message - A string that may contain error messages.
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)

create

public static RenderedOp create(RenderedImage source0,
                                double[][] matrix,
                                RenderingHints hints)
Performs arbitrary interband linear combination using a specified matrix.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderedImage source 0.
matrix - The matrix specifying the band combination.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if matrix is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp

createRenderable

public static RenderableOp createRenderable(RenderableImage source0,
                                            double[][] matrix,
                                            RenderingHints hints)
Performs arbitrary interband linear combination using a specified matrix.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.createRenderable(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderableImage source 0.
matrix - The matrix specifying the band combination.
hints - The RenderingHints to use. May be null.
Returns:
The RenderableOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if matrix is null.
See Also:
JAI, ParameterBlockJAI, RenderableOp