jaitools.media.jai.zonalstats
Class ZonalStatsOpImage

java.lang.Object
  extended by javax.media.jai.PlanarImage
      extended by javax.media.jai.OpImage
          extended by javax.media.jai.PointOpImage
              extended by javax.media.jai.NullOpImage
                  extended by jaitools.media.jai.zonalstats.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.NullOpImage

Calculates image summary statistics for a data image within zones defined by a integral valued zone image. If a zone image is not provided all data image pixels are treated as being in the same zone (zone 0).

Since:
1.0
Version:
$Id: ZonalStatsOpImage.java 1383 2011-02-10 11:22:29Z michael.bedward $
Author:
Michael Bedward, Andrea Antonello, Daniele Romagnoli, GeoSolutions S.A.S.
See Also:
Description of the algorithm and example

Field Summary
 
Fields inherited from class javax.media.jai.NullOpImage
computeType
 
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 dataImage, RenderedImage zoneImage, Map<?,?> config, javax.media.jai.ImageLayout layout, Statistic[] stats, Integer[] bands, javax.media.jai.ROI roi, AffineTransform zoneTransform, List<Range<Double>> excludedRanges)
          Constructor.
ZonalStatsOpImage(RenderedImage dataImage, RenderedImage zoneImage, Map<?,?> config, javax.media.jai.ImageLayout layout, Statistic[] stats, Integer[] bands, javax.media.jai.ROI roi, AffineTransform zoneTransform, List<Range<Double>> ranges, Range.Type rangesType, boolean rangeLocalStats, List<Range<Double>> noDataRanges)
          Constructor.
 
Method Summary
 Object getProperty(String name)
          Get the specified property.
 Class<?> getPropertyClass(String name)
          Get the class of the given property.
 String[] getPropertyNames()
          Get all property names
protected  StreamingSampleStats setupZoneStats(Map<Integer,StreamingSampleStats> resultsPerBand, Integer zone)
          Called by compileZonalStatistics() to lazily create a StreamingSampleStats object for each zone as it is encountered in the zone image.
 
Methods inherited from class javax.media.jai.NullOpImage
computesUniqueTiles, computeTile, getOperationComputeType, getProperties, getPropertyNames, removeProperty, setProperties, setProperty
 
Methods inherited from class javax.media.jai.PointOpImage
dispose, isColormapOperation, mapDestRect, mapSourceRect, permitInPlaceOperation
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, createTile, getExpandedNumBands, getFormatTags, 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, getSampleModel, getSinks, getSource, getSourceImage, getSourceObject, getSources, getSplits, getTileComputationListeners, getTileFactory, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileIndices, getTileRect, getTiles, getTileWidth, getWidth, overlapsMultipleTiles, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSink, removeSinks, removeSource, removeSources, removeTileComputationListener, setImageLayout, 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
 

Constructor Detail

ZonalStatsOpImage

public ZonalStatsOpImage(RenderedImage dataImage,
                         RenderedImage zoneImage,
                         Map<?,?> config,
                         javax.media.jai.ImageLayout layout,
                         Statistic[] stats,
                         Integer[] bands,
                         javax.media.jai.ROI roi,
                         AffineTransform zoneTransform,
                         List<Range<Double>> excludedRanges)
Constructor.

Parameters:
dataImage - a RenderedImage from which data values will be read.
zoneImage - an optional RenderedImage of integral data type that defines the zones for which to calculate summary data.
config - configurable attributes of the image (see AreaOpImage).
layout - an optional ImageLayout object.
stats - an array of Statistic constants specifying the data required.
bands - the data image band to process.
roi - an optional ROI for data image masking.
zoneTransform -
excludedRanges - a List of Ranges, that will be filtered out of the process. This means that values inside the supplied ranges will not be considered as valid and discarded.
See Also:
ZonalStatsDescriptor, Statistic

ZonalStatsOpImage

public ZonalStatsOpImage(RenderedImage dataImage,
                         RenderedImage zoneImage,
                         Map<?,?> config,
                         javax.media.jai.ImageLayout layout,
                         Statistic[] stats,
                         Integer[] bands,
                         javax.media.jai.ROI roi,
                         AffineTransform zoneTransform,
                         List<Range<Double>> ranges,
                         Range.Type rangesType,
                         boolean rangeLocalStats,
                         List<Range<Double>> noDataRanges)
Constructor.

Parameters:
dataImage - a RenderedImage from which data values will be read.
zoneImage - an optional RenderedImage of integral data type that defines the zones for which to calculate summary data.
config - configurable attributes of the image (see AreaOpImage).
layout - an optional ImageLayout object.
stats - an array of Statistic constants specifying the data required.
bands - the data image band to process.
roi - an optional ROI for data image masking.
zoneTransform -
ranges - a List of Ranges, that will be filtered out/in of the process. This means that values inside the supplied ranges will be considered as invalid/valid and discarded/accepted.
rangesType - specify if the provided ranges argument should be considered as Included or Excluded. See Range.Type.
rangeLocalStats - if true, the statistics should be computed for ranges, separately.
See Also:
ZonalStatsDescriptor, Statistic
Method Detail

setupZoneStats

protected StreamingSampleStats setupZoneStats(Map<Integer,StreamingSampleStats> resultsPerBand,
                                              Integer zone)
Called by compileZonalStatistics() to lazily create a StreamingSampleStats object for each zone as it is encountered in the zone image. The new object is added to the provided resultsPerBand Map.

Parameters:
resultsPerBand - Map of results by zone id
zone - integer zone id
Returns:
a new StreamingSampleStats object

getProperty

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

Use this method to retrieve the calculated statistics as a map of ZonalStats per band by setting name to ZonalStatsDescriptor.ZONAL_STATS_PROPERTY.

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

getPropertyClass

public Class<?> getPropertyClass(String name)
Get the class of the given property. For ZonalStatsDescriptor.ZONAL_STATS_PROPERTY this will return Map.class.

Specified by:
getPropertyClass in interface javax.media.jai.PropertySource
Overrides:
getPropertyClass in class javax.media.jai.NullOpImage
Parameters:
name - property name
Returns:
the property class

getPropertyNames

public String[] getPropertyNames()
Get all property names

Specified by:
getPropertyNames in interface RenderedImage
Specified by:
getPropertyNames in interface javax.media.jai.PropertySource
Overrides:
getPropertyNames in class javax.media.jai.NullOpImage
Returns:
property names as an array of Strings


Copyright © 2009-2011. All Rights Reserved.