org.jaitools.media.jai.contour
Class ContourOpImage

java.lang.Object
  extended by javax.media.jai.PlanarImage
      extended by javax.media.jai.OpImage
          extended by org.jaitools.media.jai.AttributeOpImage
              extended by org.jaitools.media.jai.contour.ContourOpImage
All Implemented Interfaces:
RenderedImage, javax.media.jai.ImageJAI, javax.media.jai.PropertyChangeEmitter, javax.media.jai.PropertySource, javax.media.jai.WritablePropertySource

public class ContourOpImage
extends AttributeOpImage

Generates contours for user-specified levels of values in the source image. The contours are returned as a Collection of LineStrings.

The interpolation algorithm used is that of Paul Bourke: originally published in Byte magazine (1987) as the CONREC contouring subroutine written in FORTRAN. The implementation here was adapted from Paul Bourke's C code for the algorithm available at: http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/

Since:
1.1
Version:
$Id$
Author:
Michael Bedward

Field Summary
 
Fields inherited from class org.jaitools.media.jai.AttributeOpImage
roi, srcBounds
 
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
ContourOpImage(RenderedImage source, javax.media.jai.ROI roi, int band, Collection<? extends Number> levels, Double interval, Collection<Object> noDataValues, boolean strictNodata, boolean simplify, boolean smooth)
          Constructor.
 
Method Summary
protected  Object getAttribute(String name)
          Retrieves an attribute by name.
protected  Class<?> getAttributeClass(String name)
          Returns the class of the specified attribute.
protected  String[] getAttributeNames()
          Returns the names of available attributes.
 
Methods inherited from class org.jaitools.media.jai.AttributeOpImage
computesUniqueTiles, computeTile, getProperty, getPropertyClass, getPropertyNames, getTile, getTiles, mapDestRect, mapSourceRect
 
Methods inherited from class javax.media.jai.OpImage
addTileToCache, cancelTiles, computeRect, computeRect, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, 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, 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
 

Constructor Detail

ContourOpImage

public ContourOpImage(RenderedImage source,
                      javax.media.jai.ROI roi,
                      int band,
                      Collection<? extends Number> levels,
                      Double interval,
                      Collection<Object> noDataValues,
                      boolean strictNodata,
                      boolean simplify,
                      boolean smooth)
Constructor. Note that one of levels or interval must be supplied. If both are supplied interval is ignored.

Parameters:
source - the source image
roi - an optional ROI to constrain the areas for which contours are generated
band - the band of the source image to process
levels - values for which to generate contours
interval - interval between contour levels (ignored if levels is supplied)
noDataValues - an optional Collection of values and/or Ranges to treat as NO_DATA
simplify - whether to simplify contour lines by removing colinear vertices
strictNodata - if true any NO_DATA values in a 2x2 data window will cause that window to be skipped; if false a single NO_DATA value is permitted
smooth - whether contour lines should be smoothed using Bezier interpolation
Method Detail

getAttribute

protected Object getAttribute(String name)
Retrieves an attribute by name. Calling this method will fire a request for it to be generated if it has not already been so, or if the sub-class does not cache the attribute.

Specified by:
getAttribute in class AttributeOpImage
Parameters:
name - the attribute name
Returns:
the requested attribute or null if the name does not match any of the available attributes

getAttributeNames

protected String[] getAttributeNames()
Returns the names of available attributes.

Specified by:
getAttributeNames in class AttributeOpImage
Returns:
attribute names

getAttributeClass

protected Class<?> getAttributeClass(String name)
Returns the class of the specified attribute. For ContourDescriptor.CONTOUR_PROPERTY_NAME this will be List.

Overrides:
getAttributeClass in class AttributeOpImage
Parameters:
name - attribute name
Returns:
the attribute class


Copyright © 2009-2013. All Rights Reserved.