org.jaitools.media.jai.classifiedstats
Class ClassifiedStatsOpImage

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 org.jaitools.media.jai.classifiedstats.ClassifiedStatsOpImage
All Implemented Interfaces:
RenderedImage, javax.media.jai.ImageJAI, javax.media.jai.PropertyChangeEmitter, javax.media.jai.PropertySource, javax.media.jai.WritablePropertySource

public class ClassifiedStatsOpImage
extends javax.media.jai.NullOpImage

Calculates image classified summary statistics for a data image.

Since:
1.2
Author:
Daniele Romagnoli, GeoSolutions S.A.S.
See Also:
for 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
ClassifiedStatsOpImage(RenderedImage dataImage, RenderedImage[] classifierImages, RenderedImage[] pivotClassifierImages, Map<?,?> config, javax.media.jai.ImageLayout layout, Statistic[] stats, Integer[] bands, javax.media.jai.ROI roi, Collection<Range<Double>> ranges, Range.Type rangesType, boolean rangeLocalStats, Collection<Range<Double>> noDataRanges, Double[] noDataClassifiers, Double[] noDataPivotClassifiers)
          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 setupStats(Map<org.apache.commons.collections.keyvalue.MultiKey,StreamingSampleStats> resultsPerBand, org.apache.commons.collections.keyvalue.MultiKey classifierKey, Range.Type rangesType, List<Range<Double>> ranges)
          Called by #compileClassifiedStatistics() to lazily create a StreamingSampleStats object for each classifier.
 
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

ClassifiedStatsOpImage

public ClassifiedStatsOpImage(RenderedImage dataImage,
                              RenderedImage[] classifierImages,
                              RenderedImage[] pivotClassifierImages,
                              Map<?,?> config,
                              javax.media.jai.ImageLayout layout,
                              Statistic[] stats,
                              Integer[] bands,
                              javax.media.jai.ROI roi,
                              Collection<Range<Double>> ranges,
                              Range.Type rangesType,
                              boolean rangeLocalStats,
                              Collection<Range<Double>> noDataRanges,
                              Double[] noDataClassifiers,
                              Double[] noDataPivotClassifiers)
Constructor.

Parameters:
dataImage - a RenderedImage from which data values will be read.
classifierImages - a RenderedImage's array of integral data type that defines the classification for which to calculate summary data.
pivotClassifierImages - an optional RenderedImage's array of integral data type that defines the pivot classification for which to calculate summary data. Elements of this array are used to form group with the standard classifiers. As an instance, suppose the classifiers are [classifier1, classifier2] and the pivot classifiers are [pivot1, pivot2], then the stats will be computed on classifiers [pivot1, classifier1, classifier2] and [pivot2, classifier1, classifier2].
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.
ranges - an optional list of Range objects defining values to include or exclude (depending on rangesType from the calculations; may be null or empty
rangesType - specifies whether the ranges argument defines values to include or exclude
rangeLocalStats - if true, the statistics should be computed for ranges, separately.
noDataRanges - an optional list of Range objects defining values to treat as NODATA
noDataClassifiers - an optional array of Doubles defining values to treat as NODATA for the related classifierImage. Note that classifier images will always leverage on integer types (BYTE, INTEGER, SHORT, ...). Such noData are specified as Double to allow the users to provide NaN in case a NoData is unavailable for a specific classifierImage.
noDataPivotClassifiers - an optional array of Doubles defining values to treat as NODATA for the related pivotClassifierImage. Note that classifier images will always leverage on integer types (BYTE, INTEGER, SHORT, ...). Such noData are specified as Double to allow the users to provide NaN in case a NoData is unavailable for a specific pivotClassifierImage.
See Also:
ClassifiedStatsDescriptor, Statistic
Method Detail

setupStats

protected StreamingSampleStats setupStats(Map<org.apache.commons.collections.keyvalue.MultiKey,StreamingSampleStats> resultsPerBand,
                                          org.apache.commons.collections.keyvalue.MultiKey classifierKey,
                                          Range.Type rangesType,
                                          List<Range<Double>> ranges)
Called by #compileClassifiedStatistics() to lazily create a StreamingSampleStats object for each classifier. The new object is added to the provided resultsPerBand Map.

Parameters:
resultsPerBand - Map of results by classifier
classifierKey - the classifier key referring to this statistic
rangesType - the range type
ranges - a List of Range to be added to these stats.
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 ClassifiedStats per band by setting name to ClassifiedStatsDescriptor.CLASSIFIED_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 ClassifiedStatsDescriptor.CLASSIFIED_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-2015. All Rights Reserved.