|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.media.jai.PlanarImage
javax.media.jai.OpImage
javax.media.jai.PointOpImage
org.jaitools.media.jai.regionalize.RegionalizeOpImage
public class RegionalizeOpImage
An operator to identify regions of uniform value, within a user-specified tolerance, in the source image. Produces a destination image of these regions where pixel values are equal to region ID.
To avoid region numbering artefacts on image tile boundaries this
operator imposes an order on tile computation (by column within row).
If an arbitrary tile is requested by the caller, the operator first
checks that all of the preceding tiles have been computed and cached,
processing any that have not. The operator creates its own
ExecutorService for sequential tile computations.
Each computed tile is cached using an instance of DiskMemTileCache.
The caller can provide this to the operator via RenderingHints, or set
it as the default TileCache using JAI.getDefaultInstance().setTileCache().
Otherwise the operator will create a DiskMemTileCache object for itself.
RegionalizeDescriptor,
RegionData| Field Summary | |
|---|---|
static int |
NO_REGION
Destination value indicating that a pixel does not belong to a region |
| 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 | |
|---|---|
RegionalizeOpImage(RenderedImage source,
Map config,
javax.media.jai.ImageLayout layout,
int band,
double tolerance,
boolean diagonal)
Creates a new instance. |
|
| Method Summary | |
|---|---|
protected void |
addTileToCache(int tileX,
int tileY,
Raster tile)
This method is overridden to prevent it being used by clients. |
Raster |
computeTile(int tileX,
int tileY)
|
Hashtable |
getProperties()
Gets the properties for this operator. |
Object |
getProperty(String name)
Gets a property associated with this operator. |
Class<?> |
getPropertyClass(String name)
|
String[] |
getPropertyNames()
|
Raster |
getTile(int tileX,
int tileY)
Returns a tile of this image as a Raster. |
protected Raster |
getTileFromCache(int tileX,
int tileY)
This method is overridden to ensure that the cache is always addressed through the DiskMemImage being used by this operator, otherwise
tile IDs calculated by the cache will vary with the perceived owner
(the image or the operator) of the tile. |
void |
setTileCache(javax.media.jai.TileCache cache)
Set the tile cache. |
| Methods inherited from class javax.media.jai.PointOpImage |
|---|
dispose, isColormapOperation, mapDestRect, mapSourceRect, permitInPlaceOperation |
| Methods inherited from class javax.media.jai.OpImage |
|---|
cancelTiles, computeRect, computeRect, computesUniqueTiles, createTile, getExpandedNumBands, getFormatTags, getOperationComputeType, getTileCache, getTileCacheMetric, getTileDependencies, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, prefetchTiles, queueTiles, recycleTile, 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, 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 |
| Field Detail |
|---|
public static final int NO_REGION
| Constructor Detail |
|---|
public RegionalizeOpImage(RenderedImage source,
Map config,
javax.media.jai.ImageLayout layout,
int band,
double tolerance,
boolean diagonal)
source - the source imageconfig - configurable attributes of the image (see AreaOpImage)layout - an optional ImageLayout or nullband - the source image band to processtolerance - the maximum absolute difference in value between the starting
pixel for a region and other subsequent pixels added to itdiagonal - if true include sub-regions with only diagonal connectedness;
if false require orthogonal connectednessRegionalizeDescriptor| Method Detail |
|---|
public Object getProperty(String name)
getProperty in interface RenderedImagegetProperty in interface javax.media.jai.PropertySourcegetProperty in class javax.media.jai.PlanarImagename - property name
public Hashtable getProperties()
getProperties in class javax.media.jai.PlanarImagepublic Class<?> getPropertyClass(String name)
getPropertyClass in interface javax.media.jai.PropertySourcegetPropertyClass in class javax.media.jai.PlanarImagepublic String[] getPropertyNames()
getPropertyNames in interface RenderedImagegetPropertyNames in interface javax.media.jai.PropertySourcegetPropertyNames in class javax.media.jai.PlanarImage
public Raster getTile(int tileX,
int tileY)
Raster. If the
requested tile is completely outside of this image's bounds,
this method returns null.
The nature of the regionalizing algorithm means that to compute any tile other than the first (top left) we must compute all tiles to avoid region numbering artefacts across tile boundaries.
getTile in interface RenderedImagegetTile in class javax.media.jai.OpImagetileX - The X index of the tile.tileY - The Y index of the tile.
public Raster computeTile(int tileX,
int tileY)
computeTile in class javax.media.jai.PointOpImage
protected void addTileToCache(int tileX,
int tileY,
Raster tile)
addTileToCache in class javax.media.jai.OpImagetileX - tile X ordinatetileY - tile Y ordinatetile - the tile
UnsupportedOperationException - if called
protected Raster getTileFromCache(int tileX,
int tileY)
DiskMemImage being used by this operator, otherwise
tile IDs calculated by the cache will vary with the perceived owner
(the image or the operator) of the tile.
getTileFromCache in class javax.media.jai.OpImagetileX - tile X coordinatetileY - tile Y coordinate
public void setTileCache(javax.media.jai.TileCache cache)
DiskMemTileCache.
setTileCache in class javax.media.jai.OpImagecache - an instance of DiskMemTileCache
IllegalArgumentException - if cache is null or not an instance
of DiskMemTileCache
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||