it.geosolutions.jaiext.warp
Class WarpOpImage

java.lang.Object
  extended by javax.media.jai.PlanarImage
      extended by javax.media.jai.OpImage
          extended by javax.media.jai.GeometricOpImage
              extended by javax.media.jai.WarpOpImage
                  extended by it.geosolutions.jaiext.warp.WarpOpImage
All Implemented Interfaces:
RenderedImage, javax.media.jai.ImageJAI, javax.media.jai.PropertyChangeEmitter, javax.media.jai.PropertySource, javax.media.jai.WritablePropertySource

public abstract class WarpOpImage
extends javax.media.jai.WarpOpImage

Subclass of WarpOpImage that makes use of the provided ROI and NoData.

Author:
Simone Giannecchini, GeoSolutions SAS

Field Summary
protected static boolean ARRAY_CALC
          Constant indicating that the inner random iterators must pre-calculate an array of the image positions
protected  int bottomPad
          Bottom padding
protected  boolean caseA
          Boolean indicating absence of both NoData and ROI
protected  boolean caseB
          Boolean indicating absence of NoData and presence of ROI
protected  boolean caseC
          Boolean indicating absence of ROI and presence of NoData
protected  byte destinationNoDataByte
          Destination No Data value associated to Byte data type
protected  double destinationNoDataDouble
          Destination No Data value associated to Double data type
protected  float destinationNoDataFloat
          Destination No Data value associated to Float data type
protected  int destinationNoDataInt
          Destination No Data value associated to Integer data type
protected  short destinationNoDataShort
          Destination No Data value associated to UShort/Short data type
protected  boolean extended
          Boolean indicating the presence of a border extender
protected  boolean hasNoData
          Boolean indicating if NoData values are present
protected  boolean hasROI
          Boolean indicating if ROI is used
protected  int leftPad
          Left padding
protected  Range noDataRange
          Current NoData Range object
protected  int rightPad
          Right padding
protected  javax.media.jai.ROI roi
          Current ROI object
protected  Rectangle roiBounds
          Rectangle associated to the ROI bounds
protected  javax.media.jai.PlanarImage roiImage
          Image associated to the ROI
protected static boolean TILE_CACHED
          Constant indicating that the inner random iterators must cache the current tile position
protected static int TILE_EXTENDER
          Quantity used for extending the input tile dimensions
protected  int topPad
          Top padding
protected static javax.media.jai.BorderExtender ZERO_EXTENDER
          BorderExtender instance for extending roi.
 
Fields inherited from class javax.media.jai.WarpOpImage
warp
 
Fields inherited from class javax.media.jai.GeometricOpImage
backgroundValues, computableBounds, extender, intBackgroundValues, interp, setBackground
 
Fields inherited from class javax.media.jai.OpImage
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler
 
Fields inherited from class javax.media.jai.PlanarImage
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
 
Constructor Summary
WarpOpImage(RenderedImage source, javax.media.jai.ImageLayout layout, Map<?,?> configuration, boolean cobbleSources, javax.media.jai.BorderExtender extender, javax.media.jai.Interpolation interp, javax.media.jai.Warp warp, double[] backgroundValues, javax.media.jai.ROI roi, Range noData)
           
 
Method Summary
protected  void computeRect(javax.media.jai.PlanarImage[] sources, WritableRaster dest, Rectangle destRect)
          Warps a rectangle.
protected abstract  void computeRectByte(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on Byte images
protected abstract  void computeRectDouble(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on Double images
protected abstract  void computeRectFloat(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on Float images
protected abstract  void computeRectInt(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on Integer images
protected abstract  void computeRectShort(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on Short images
protected abstract  void computeRectUShort(javax.media.jai.PlanarImage src, javax.media.jai.RasterAccessor dst, javax.media.jai.iterator.RandomIter roiIter, boolean roiContainsTile)
          Computation of the Warp operation on UShort images
 Raster computeTile(int tileX, int tileY)
          Computes a tile.
static int floor(float f)
          Returns the "floor" value of a float.
protected  javax.media.jai.iterator.RandomIter getRandomIterator(javax.media.jai.PlanarImage src, javax.media.jai.BorderExtender extender)
          Returns a RandomIterator on the input image.
protected  javax.media.jai.iterator.RandomIter getRandomIterator(javax.media.jai.PlanarImage src, int leftPad, int rightPad, int topPad, int bottomPad, javax.media.jai.BorderExtender extender)
          Returns a RandomIterator on the input image.
static double[] prepareBackground(RenderedImage source, javax.media.jai.ImageLayout layout, javax.media.jai.Interpolation interp, double[] backgroundValues)
          Utility method used for creating an array of background values from a single value, taken from the interpolator.
static int round(float f)
          Returns the "round" value of a float.
 
Methods inherited from class javax.media.jai.WarpOpImage
backwardMapRect, forwardMapRect, getBottomPadding, getLeftPadding, getRightPadding, getTopPadding, mapDestPoint, mapSourcePoint
 
Methods inherited from class javax.media.jai.GeometricOpImage
getBorderExtender, getInterpolation, mapDestRect, mapSourceRect
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computesUniqueTiles, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize
 
Methods inherited from class javax.media.jai.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, getSources, 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 java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO_EXTENDER

protected static final javax.media.jai.BorderExtender ZERO_EXTENDER
BorderExtender instance for extending roi.


TILE_EXTENDER

protected static final int TILE_EXTENDER
Quantity used for extending the input tile dimensions

See Also:
Constant Field Values

ARRAY_CALC

protected static final boolean ARRAY_CALC
Constant indicating that the inner random iterators must pre-calculate an array of the image positions

See Also:
Constant Field Values

TILE_CACHED

protected static final boolean TILE_CACHED
Constant indicating that the inner random iterators must cache the current tile position

See Also:
Constant Field Values

destinationNoDataByte

protected byte destinationNoDataByte
Destination No Data value associated to Byte data type


destinationNoDataShort

protected short destinationNoDataShort
Destination No Data value associated to UShort/Short data type


destinationNoDataInt

protected int destinationNoDataInt
Destination No Data value associated to Integer data type


destinationNoDataFloat

protected float destinationNoDataFloat
Destination No Data value associated to Float data type


destinationNoDataDouble

protected double destinationNoDataDouble
Destination No Data value associated to Double data type


roi

protected final javax.media.jai.ROI roi
Current ROI object


hasROI

protected final boolean hasROI
Boolean indicating if ROI is used


hasNoData

protected final boolean hasNoData
Boolean indicating if NoData values are present


caseA

protected final boolean caseA
Boolean indicating absence of both NoData and ROI


caseB

protected final boolean caseB
Boolean indicating absence of NoData and presence of ROI


caseC

protected final boolean caseC
Boolean indicating absence of ROI and presence of NoData


noDataRange

protected Range noDataRange
Current NoData Range object


extended

protected boolean extended
Boolean indicating the presence of a border extender


leftPad

protected int leftPad
Left padding


rightPad

protected int rightPad
Right padding


topPad

protected int topPad
Top padding


bottomPad

protected int bottomPad
Bottom padding


roiImage

protected volatile javax.media.jai.PlanarImage roiImage
Image associated to the ROI


roiBounds

protected Rectangle roiBounds
Rectangle associated to the ROI bounds

Constructor Detail

WarpOpImage

public WarpOpImage(RenderedImage source,
                   javax.media.jai.ImageLayout layout,
                   Map<?,?> configuration,
                   boolean cobbleSources,
                   javax.media.jai.BorderExtender extender,
                   javax.media.jai.Interpolation interp,
                   javax.media.jai.Warp warp,
                   double[] backgroundValues,
                   javax.media.jai.ROI roi,
                   Range noData)
Method Detail

computeTile

public Raster computeTile(int tileX,
                          int tileY)
Computes a tile. A new WritableRaster is created to represent the requested tile. Its width and height equals to this image's tile width and tile height respectively. This method assumes that the requested tile either intersects or is within the bounds of this image.

Whether or not this method performs source cobbling is determined by the cobbleSources variable set at construction time. If cobbleSources is true, cobbling is performed on the source for areas that intersect multiple tiles, and computeRect(Raster[], WritableRaster, Rectangle) is called to perform the actual computation. Otherwise, computeRect(PlanarImage[], WritableRaster, Rectangle) is called to perform the actual computation. If ROI is present, then the source mapped rectangle is checked if it intersects the input ROI; if this condition is not satisfied, then the tile is not elaborated.

Overrides:
computeTile in class javax.media.jai.WarpOpImage
Parameters:
tileX - The X index of the tile.
tileY - The Y index of the tile.
Returns:
The tile as a Raster.

computeRect

protected void computeRect(javax.media.jai.PlanarImage[] sources,
                           WritableRaster dest,
                           Rectangle destRect)
Warps a rectangle. If ROI is present, the intersection between ROI and tile bounds is calculated; The result ROI will be used for calculations inside the computeRect() method.

Overrides:
computeRect in class javax.media.jai.OpImage

computeRectByte

protected abstract void computeRectByte(javax.media.jai.PlanarImage src,
                                        javax.media.jai.RasterAccessor dst,
                                        javax.media.jai.iterator.RandomIter roiIter,
                                        boolean roiContainsTile)
Computation of the Warp operation on Byte images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

computeRectUShort

protected abstract void computeRectUShort(javax.media.jai.PlanarImage src,
                                          javax.media.jai.RasterAccessor dst,
                                          javax.media.jai.iterator.RandomIter roiIter,
                                          boolean roiContainsTile)
Computation of the Warp operation on UShort images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

computeRectShort

protected abstract void computeRectShort(javax.media.jai.PlanarImage src,
                                         javax.media.jai.RasterAccessor dst,
                                         javax.media.jai.iterator.RandomIter roiIter,
                                         boolean roiContainsTile)
Computation of the Warp operation on Short images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

computeRectInt

protected abstract void computeRectInt(javax.media.jai.PlanarImage src,
                                       javax.media.jai.RasterAccessor dst,
                                       javax.media.jai.iterator.RandomIter roiIter,
                                       boolean roiContainsTile)
Computation of the Warp operation on Integer images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

computeRectFloat

protected abstract void computeRectFloat(javax.media.jai.PlanarImage src,
                                         javax.media.jai.RasterAccessor dst,
                                         javax.media.jai.iterator.RandomIter roiIter,
                                         boolean roiContainsTile)
Computation of the Warp operation on Float images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

computeRectDouble

protected abstract void computeRectDouble(javax.media.jai.PlanarImage src,
                                          javax.media.jai.RasterAccessor dst,
                                          javax.media.jai.iterator.RandomIter roiIter,
                                          boolean roiContainsTile)
Computation of the Warp operation on Double images

Parameters:
src -
dst -
roiIter -
roiContainsTile -

prepareBackground

public static double[] prepareBackground(RenderedImage source,
                                         javax.media.jai.ImageLayout layout,
                                         javax.media.jai.Interpolation interp,
                                         double[] backgroundValues)
Utility method used for creating an array of background values from a single value, taken from the interpolator. If the interpolation object is not an instance of InterpolationNoData, then the optional background values array is taken. If the array is null, then an array with 0 value is used.

Parameters:
source -
layout -
interp -
backgroundValues -
Returns:

floor

public static final int floor(float f)
Returns the "floor" value of a float.


round

public static final int round(float f)
Returns the "round" value of a float.


getRandomIterator

protected javax.media.jai.iterator.RandomIter getRandomIterator(javax.media.jai.PlanarImage src,
                                                                javax.media.jai.BorderExtender extender)
Returns a RandomIterator on the input image.

Parameters:
src -
Returns:

getRandomIterator

protected javax.media.jai.iterator.RandomIter getRandomIterator(javax.media.jai.PlanarImage src,
                                                                int leftPad,
                                                                int rightPad,
                                                                int topPad,
                                                                int bottomPad,
                                                                javax.media.jai.BorderExtender extender)
Returns a RandomIterator on the input image. Also it handles padding if present.

Parameters:
src -
Returns:


Copyright © 2006–2014 GeoSolutions. All rights reserved.