org.geotoolkit.image.jai
Class Combine

Object
  extended by PlanarImage
      extended by OpImage
          extended by PointOpImage
              extended by Combine
All Implemented Interfaces:
RenderedImage, ImageJAI, PropertyChangeEmitter, PropertySource, WritablePropertySource
Direct Known Subclasses:
Combine.Dyadic

public class Combine
extends PointOpImage

Computes a set of arbitrary linear combinations of the bands of many rendered source images, using a specified matrix. The matrix size (numRows × numColumns) must be equal to the following:

The number of source bands used to determine the matrix dimensions is given by the following code regardless of the type of ColorModel the sources have:

int sourceBands = 0;
for (int i=0; i<sources.length; i++) {
    sourceBands += sources[i].getSampleModel().getNumBands();
}
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 (not all from the same source image)
// 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];
    }
}
In the special case where there is only one source, this method is equivalent to JAI's "BandCombine" operation.

Since:
2.1
Version:
3.00
Author:
Martin Desruisseaux (IRD), Rémi Eve (IRD)
Module:
coverage/geotk-coverage (download)    View source code for this class

Nested Class Summary
static class Combine.Dyadic
          Optimized Combine operation for dyadic (two sources) image.
static interface Combine.Transform
          Transforms the sample values for one pixel during a "Combine" operation.
 
Field Summary
static String OPERATION_NAME
          The name of this operation in the JAI registry.
protected  Combine.Transform transform
          The transform to apply on sample values before the linear combination, or null if none.
 
Fields inherited from class OpImage
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler
 
Fields inherited from class PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
Combine(Vector<? extends RenderedImage> images, double[][] matrix, Combine.Transform transform, RenderingHints hints)
          Constructs an image with the specified matrix.
 
Method Summary
 void computeRect(PlanarImage[] images, WritableRaster dest, Rectangle destRect)
          Computes one tile.
 Vector<RenderedImage> getSources()
          Returns the source images.
 
Methods inherited from class PointOpImage
computeTile, dispose, isColormapOperation, mapDestRect, mapSourceRect, permitInPlaceOperation
 
Methods inherited from class OpImage
addTileToCache, cancelTiles, computeRect, computesUniqueTiles, createTile, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize
 
Methods inherited from class PlanarImage
addPropertyChangeListener, addPropertyChangeListener, addSink, addSink, addSource, addTileComputationListener, copyData, copyData, copyExtendedData, createColorModel, createSnapshot, createWritableRaster, finalize, getAsBufferedImage, getAsBufferedImage, getBounds, getColorModel, getData, getData, getDefaultColorModel, getExtendedData, getGraphics, getHeight, getImageID, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumBands, getNumSources, getNumXTiles, getNumYTiles, getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, setProperties, setProperty, setSource, setSources, tileXToX, tileXToX, tileYToY, tileYToY, toString, wrapRenderedImage, XToTileX, XToTileX, YToTileY, YToTileY
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPERATION_NAME

public static final String OPERATION_NAME
The name of this operation in the JAI registry. This is "org.geotoolkit.Combine".

See Also:
Constant Field Values

transform

protected final Combine.Transform transform
The transform to apply on sample values before the linear combination, or null if none.

Constructor Detail

Combine

public Combine(Vector<? extends RenderedImage> images,
               double[][] matrix,
               Combine.Transform transform,
               RenderingHints hints)
        throws MismatchedSizeException
Constructs an image with the specified matrix. While this constructor is public, it should usually not be invoked directly. You should use JAI factory methods instead.

Parameters:
images - The rendered sources.
matrix - The linear combination coefficients as a matrix.
transform - The transform to apply on sample values before the linear combination, or null if none.
hints - The rendering hints.
Throws:
MismatchedSizeException - if some rows in the matrix argument doesn't have the expected length.
Method Detail

getSources

public Vector<RenderedImage> getSources()
Returns the source images.

Specified by:
getSources in interface RenderedImage
Overrides:
getSources in class PlanarImage

computeRect

public void computeRect(PlanarImage[] images,
                        WritableRaster dest,
                        Rectangle destRect)
Computes one tile.

Overrides:
computeRect in class OpImage
Parameters:
images - The source images.
dest - The raster to be filled in.
destRect - The region within the raster to be filled.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.