it.geosolutions.jaiext.affine
Class AffineBicubicOpImage

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

public class AffineBicubicOpImage
extends javax.media.jai.GeometricOpImage


Field Summary
protected  int bpad
          Padding values for interpolation
protected  byte[] byteLookupTable
          Byte lookuptable used if no data are present
protected  boolean caseA
          Boolean indicating if No Data and ROI are not used
protected  boolean caseB
          Boolean indicating if only the ROI is used
protected  boolean caseC
          Boolean indicating if only the No Data are used
protected  byte destinationNoDataByte
          Destination value for No Data byte
protected  double destinationNoDataDouble
          Destination value for No Data double
protected  float destinationNoDataFloat
          Destination value for No Data float
protected  int destinationNoDataInt
          Destination value for No Data int
protected  short destinationNoDataShort
          Destination value for No Data short
protected  short destinationNoDataUShort
          Destination value for No Data ushort
protected  javax.media.jai.BorderExtender extender
          The BorderExtender
protected  AffineTransform f_transform
          The forward AffineTransform describing the image transformation.
protected static int geom_frac_max
          The fixed-point denominator of the fractional offsets.
protected  boolean hasNoData
          Boolean for checking if no data range is present
protected  boolean hasROI
          Boolean indicating if a ROI object is used
protected  AffineTransform i_transform
          The inverse AffineTransform describing the image transformation.
protected  javax.media.jai.Interpolation interp
          The Interpolation object.
protected  InterpolationBicubic interpBN
          Nearest-Neighbor interpolator
protected  boolean isBicubicNew
          Boolean for checking if the interpolator is Bicubic
protected  boolean isBilinearNew
          Boolean for checking if the interpolator is Bilinear
protected  boolean isNearestNew
          Boolean for checking if the interpolator is Nearest
protected  javax.media.jai.util.ImagingListener listener
          Cache the ImagingListener.
protected  int lpad
          Padding values for interpolation
protected  Range noData
          No Data Range
protected  Rectangle padimg
           
protected  Rectangle roiBounds
          Rectangle containing ROI bounds
protected  javax.media.jai.iterator.RandomIter roiIter
          Random Iterator used iterating on the ROI data
protected  int rpad
          Padding values for interpolation
protected  Rectangle srcimg
          Store source & padded rectangle info
protected  javax.media.jai.ROI srcROI
          Source ROI
protected  javax.media.jai.PlanarImage srcROIImage
          ROI image
protected  int subsampleBits
          Subsample bits used for bicubic interpolation
protected  Rectangle theDest
          The true writable area
protected  int tpad
          Padding values for interpolation
protected  boolean useROIAccessor
          Value indicating if roi RasterAccessor should be used on computations
protected static int USHORT_MAX_VALUE
          Unsigned short Max Value
 
Fields inherited from class javax.media.jai.GeometricOpImage
backgroundValues, computableBounds, intBackgroundValues, 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
AffineBicubicOpImage(RenderedImage source, javax.media.jai.BorderExtender extender, Map config, javax.media.jai.ImageLayout layout, AffineTransform transform, javax.media.jai.Interpolation interp, double[] backgroundValues, boolean setDestinationNoData, boolean useROIAccessor)
           
 
Method Summary
protected  Point[] advanceToStartOfScanline(int dst_min_x, int clipMinX, int s_ix, int s_iy, int ifracx, int ifracy)
          Sets s_ix, s_iy, ifracx, ifracy to their values at x == clipMinX from their initial values at x == dst_min_x.
protected  Rectangle backwardMapRect(Rectangle destRect, int sourceIndex)
          Backward map the destination Rectangle.
protected static int ceilRatio(long num, long denom)
          Computes ceil(num/denom) using integer arithmetic. denom must not be equal to 0.
protected  void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect)
          Method for evaluating the destination image tile without ROI
protected  void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect, Raster[] rois)
          Method for evaluating the destination image tile with ROI
 Raster computeTile(int tileX, int tileY)
           
 void dispose()
           
protected static int floorRatio(long num, long denom)
          Computes floor(num/denom) using integer arithmetic. denom must not be equal to 0.
protected  Rectangle forwardMapRect(Rectangle sourceRect, int sourceIndex)
          Forward map the source Rectangle.
 Point2D mapDestPoint(Point2D destPt)
          Computes the source point corresponding to the supplied point.
 void mapDestPoint(Point2D destPoint, Point2D srcPoint)
          Backward map a destination coordinate (using inverse_transform) to get the corresponding source coordinate.
 Point2D mapSourcePoint(Point2D sourcePt)
          Computes the destination point corresponding to the supplied point.
protected  javax.media.jai.util.Range performScanlineClipping(float src_rect_x1, float src_rect_y1, float src_rect_x2, float src_rect_y2, int s_ix, int s_iy, int ifracx, int ifracy, int dst_min_x, int dst_max_x, int lpad, int rpad, int tpad, int bpad)
          Sets clipMinX, clipMaxX based on s_ix, s_iy, ifracx, ifracy, dst_min_x, and dst_min_y.
 
Methods inherited from class javax.media.jai.GeometricOpImage
getBorderExtender, getInterpolation, mapDestPoint, mapDestRect, mapSourcePoint, mapSourceRect
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computesUniqueTiles, createTile, 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

interpBN

protected InterpolationBicubic interpBN
Nearest-Neighbor interpolator


byteLookupTable

protected final byte[] byteLookupTable
Byte lookuptable used if no data are present


subsampleBits

protected int subsampleBits
Subsample bits used for bicubic interpolation


USHORT_MAX_VALUE

protected static final int USHORT_MAX_VALUE
Unsigned short Max Value

See Also:
Constant Field Values

f_transform

protected AffineTransform f_transform
The forward AffineTransform describing the image transformation.


i_transform

protected AffineTransform i_transform
The inverse AffineTransform describing the image transformation.


interp

protected javax.media.jai.Interpolation interp
The Interpolation object.


srcimg

protected Rectangle srcimg
Store source & padded rectangle info


padimg

protected Rectangle padimg

extender

protected javax.media.jai.BorderExtender extender
The BorderExtender


theDest

protected Rectangle theDest
The true writable area


listener

protected javax.media.jai.util.ImagingListener listener
Cache the ImagingListener.


destinationNoDataByte

protected byte destinationNoDataByte
Destination value for No Data byte


destinationNoDataUShort

protected short destinationNoDataUShort
Destination value for No Data ushort


destinationNoDataShort

protected short destinationNoDataShort
Destination value for No Data short


destinationNoDataInt

protected int destinationNoDataInt
Destination value for No Data int


destinationNoDataFloat

protected float destinationNoDataFloat
Destination value for No Data float


destinationNoDataDouble

protected double destinationNoDataDouble
Destination value for No Data double


isNearestNew

protected boolean isNearestNew
Boolean for checking if the interpolator is Nearest


isBilinearNew

protected boolean isBilinearNew
Boolean for checking if the interpolator is Bilinear


isBicubicNew

protected boolean isBicubicNew
Boolean for checking if the interpolator is Bicubic


useROIAccessor

protected boolean useROIAccessor
Value indicating if roi RasterAccessor should be used on computations


geom_frac_max

protected static final int geom_frac_max
The fixed-point denominator of the fractional offsets.

See Also:
Constant Field Values

lpad

protected int lpad
Padding values for interpolation


rpad

protected int rpad
Padding values for interpolation


tpad

protected int tpad
Padding values for interpolation


bpad

protected int bpad
Padding values for interpolation


srcROI

protected final javax.media.jai.ROI srcROI
Source ROI


srcROIImage

protected final javax.media.jai.PlanarImage srcROIImage
ROI image


roiIter

protected final javax.media.jai.iterator.RandomIter roiIter
Random Iterator used iterating on the ROI data


roiBounds

protected final Rectangle roiBounds
Rectangle containing ROI bounds


hasROI

protected final boolean hasROI
Boolean indicating if a ROI object is used


hasNoData

protected boolean hasNoData
Boolean for checking if no data range is present


noData

protected Range noData
No Data Range


caseA

protected boolean caseA
Boolean indicating if No Data and ROI are not used


caseB

protected boolean caseB
Boolean indicating if only the ROI is used


caseC

protected boolean caseC
Boolean indicating if only the No Data are used

Constructor Detail

AffineBicubicOpImage

public AffineBicubicOpImage(RenderedImage source,
                            javax.media.jai.BorderExtender extender,
                            Map config,
                            javax.media.jai.ImageLayout layout,
                            AffineTransform transform,
                            javax.media.jai.Interpolation interp,
                            double[] backgroundValues,
                            boolean setDestinationNoData,
                            boolean useROIAccessor)
Method Detail

computeRect

protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect)
Method for evaluating the destination image tile without ROI

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

computeRect

protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect,
                           Raster[] rois)
Method for evaluating the destination image tile with ROI


floorRatio

protected static int floorRatio(long num,
                                long denom)
Computes floor(num/denom) using integer arithmetic. denom must not be equal to 0.


ceilRatio

protected static int ceilRatio(long num,
                               long denom)
Computes ceil(num/denom) using integer arithmetic. denom must not be equal to 0.


mapDestPoint

public Point2D mapDestPoint(Point2D destPt)
Computes the source point corresponding to the supplied point.

Parameters:
destPt - the position in destination image coordinates to map to source image coordinates.
Returns:
a Point2D of the same class as destPt.
Throws:
IllegalArgumentException - if destPt is null.
Since:
JAI 1.1.2

mapSourcePoint

public Point2D mapSourcePoint(Point2D sourcePt)
Computes the destination point corresponding to the supplied point.

Parameters:
sourcePt - the position in source image coordinates to map to destination image coordinates.
Returns:
a Point2D of the same class as sourcePt.
Throws:
IllegalArgumentException - if destPt is null.
Since:
JAI 1.1.2

forwardMapRect

protected Rectangle forwardMapRect(Rectangle sourceRect,
                                   int sourceIndex)
Forward map the source Rectangle.

Specified by:
forwardMapRect in class javax.media.jai.GeometricOpImage

backwardMapRect

protected Rectangle backwardMapRect(Rectangle destRect,
                                    int sourceIndex)
Backward map the destination Rectangle.

Specified by:
backwardMapRect in class javax.media.jai.GeometricOpImage

mapDestPoint

public void mapDestPoint(Point2D destPoint,
                         Point2D srcPoint)
Backward map a destination coordinate (using inverse_transform) to get the corresponding source coordinate. We need not worry about interpolation here.

Parameters:
destPt - the destination point to backward map

computeTile

public Raster computeTile(int tileX,
                          int tileY)
Overrides:
computeTile in class javax.media.jai.GeometricOpImage

dispose

public void dispose()
Overrides:
dispose in class javax.media.jai.OpImage

performScanlineClipping

protected javax.media.jai.util.Range performScanlineClipping(float src_rect_x1,
                                                             float src_rect_y1,
                                                             float src_rect_x2,
                                                             float src_rect_y2,
                                                             int s_ix,
                                                             int s_iy,
                                                             int ifracx,
                                                             int ifracy,
                                                             int dst_min_x,
                                                             int dst_max_x,
                                                             int lpad,
                                                             int rpad,
                                                             int tpad,
                                                             int bpad)
Sets clipMinX, clipMaxX based on s_ix, s_iy, ifracx, ifracy, dst_min_x, and dst_min_y. Padding factors are added and subtracted from the source bounds as given by src_rect_{x,y}{1,2}. For example, for nearest-neighbor interpo the padding factors should be set to (0, 0, 0, 0); for bilinear, (0, 1, 0, 1); and for bicubic, (1, 2, 1, 2).

The returned Range object will be for the Integer class and will contain extrema equivalent to clipMinX and clipMaxX.


advanceToStartOfScanline

protected Point[] advanceToStartOfScanline(int dst_min_x,
                                           int clipMinX,
                                           int s_ix,
                                           int s_iy,
                                           int ifracx,
                                           int ifracy)
Sets s_ix, s_iy, ifracx, ifracy to their values at x == clipMinX from their initial values at x == dst_min_x.

The return Point array will contain the updated values of s_ix and s_iy in the first element and those of ifracx and ifracy in the second element.



Copyright © 2006–2014 GeoSolutions. All rights reserved.