Class ContourOpImage

  extended by
      extended by
          extended by
              extended by
All Implemented Interfaces:

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:

Michael Bedward

Field Summary
Fields inherited from class
roi, srcBounds
Fields inherited from class
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler
Fields inherited from class
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width
Constructor Summary
ContourOpImage(RenderedImage source, roi, int band, Collection<? extends Number> levels, Double interval, Collection<Object> noDataValues, boolean strictNodata, boolean simplify, boolean smooth)
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
computesUniqueTiles, computeTile, getProperty, getPropertyClass, getPropertyNames, getTile, getTiles, mapDestRect, mapSourceRect
Methods inherited from class
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
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


public ContourOpImage(RenderedImage source,
                      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.

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


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
name - the attribute name
the requested attribute or null if the name does not match any of the available attributes


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

Specified by:
getAttributeNames in class AttributeOpImage
attribute names


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

getAttributeClass in class AttributeOpImage
name - attribute name
the attribute class

Copyright © 2009-2013. All Rights Reserved.