it.geosolutions.jaiext.zonal
Class ZonalStatsOpImage

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

public class ZonalStatsOpImage
extends javax.media.jai.OpImage

This class extends the OpImage class and executes the "ZonalStats" operation. This operation consists of calculating the image statistics on different locations, defined by their geometries, on the same image. In addition this operation supports the presence of ROI or No Data. The calculations are performed only in a rectangle that contains the union of all the input geometries. For every input geometry, a ZoneGeometry object is associated to it for storing its statistics. A spatial index is used for fast accessing the geometries that intersects the selected image pixel (in the case of overlapping). The final results can be returned by calling the getProperty() method with the ZonalStatsDescriptor.ZS_PROPERTY. This method returns a list containing all the ZoneGeometries objects associated with each input geometry object. The statistic results can be returned for each band or for each Class(if the classifier is present). It is important to remember that the classifier must be of integral data type.


Field Summary
protected static javax.media.jai.BorderExtender ROI_EXTENDER
          ROI extender
 
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
ZonalStatsOpImage(RenderedImage source, javax.media.jai.ImageLayout layout, Map configuration, RenderedImage classifier, AffineTransform transform, List<javax.media.jai.ROI> rois, Range noData, javax.media.jai.ROI mask, boolean useROIAccessor, int[] bands, Statistics.StatsType[] statsTypes, double[] minBound, double[] maxBound, int[] numBins, List<Range> rangeData, boolean localStats)
           
 
Method Summary
 void clearStatistic()
          This method is used if the user needs to perform again the statistical calculations.
 Raster computeTile(int tileX, int tileY)
           
 Object getProperty(String name)
          Get the specified property.
 String[] getPropertyNames()
          Returns a list of property names that are recognized by this image.
 Raster[] getTiles()
          Computes and returns all tiles in the image.
 Rectangle mapDestRect(Rectangle destRect, int index)
          OpImage method that returns the destination image bounds, because source and destination images are equals
 Rectangle mapSourceRect(Rectangle sourceRect, int index)
          OpImage method that returns the source image bounds, because source and destination images are equals
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, computesUniqueTiles, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, 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, getPropertyClass, getPropertyNames, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSources, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, 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

ROI_EXTENDER

protected static final javax.media.jai.BorderExtender ROI_EXTENDER
ROI extender

Constructor Detail

ZonalStatsOpImage

public ZonalStatsOpImage(RenderedImage source,
                         javax.media.jai.ImageLayout layout,
                         Map configuration,
                         RenderedImage classifier,
                         AffineTransform transform,
                         List<javax.media.jai.ROI> rois,
                         Range noData,
                         javax.media.jai.ROI mask,
                         boolean useROIAccessor,
                         int[] bands,
                         Statistics.StatsType[] statsTypes,
                         double[] minBound,
                         double[] maxBound,
                         int[] numBins,
                         List<Range> rangeData,
                         boolean localStats)
Method Detail

computeTile

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

mapDestRect

public Rectangle mapDestRect(Rectangle destRect,
                             int index)
OpImage method that returns the destination image bounds, because source and destination images are equals

Specified by:
mapDestRect in class javax.media.jai.OpImage

mapSourceRect

public Rectangle mapSourceRect(Rectangle sourceRect,
                               int index)
OpImage method that returns the source image bounds, because source and destination images are equals

Specified by:
mapSourceRect in class javax.media.jai.OpImage

getPropertyNames

public String[] getPropertyNames()
Returns a list of property names that are recognized by this image.

Specified by:
getPropertyNames in interface RenderedImage
Specified by:
getPropertyNames in interface javax.media.jai.PropertySource
Overrides:
getPropertyNames in class javax.media.jai.PlanarImage
Returns:
An array of Strings containing valid property names.

clearStatistic

public void clearStatistic()
This method is used if the user needs to perform again the statistical calculations.


getTiles

public Raster[] getTiles()
Computes and returns all tiles in the image. The tiles are returned in a sequence corresponding to the row-major order of their respective tile indices. The returned array may of course be ignored, e.g., in the case of a subclass which caches the tiles and the intent is to force their computation. This method is overridden such that can be invoked only one time by using a flag for avoiding unnecessary computations.

Overrides:
getTiles in class javax.media.jai.PlanarImage

getProperty

public Object getProperty(String name)
Get the specified property.

Use this method to retrieve the calculated statistics as an array per band and per statistic types.

Specified by:
getProperty in interface RenderedImage
Specified by:
getProperty in interface javax.media.jai.PropertySource
Overrides:
getProperty in class javax.media.jai.PlanarImage
Parameters:
name - property name
Returns:
the requested property


Copyright © 2006–2015 GeoSolutions. All rights reserved.