|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.PlanarImage | +--javax.media.jai.OpImage | +--javax.media.jai.StatisticsOpImage
An abstract base class representing image operators that compute statistics on a given region of an image, and with a given sampling period. Such operators may only have one source image.
The layout of this image is exactly the same as that of the source
image. Any user supplied layout values via the
RenderingHints
are ignored.
The StatisticsOpImage
simply passes the pixels of the
source image through unchanged. However, the desired statistics
are computed on demand and made available as a property or set of
properties on the image.
All instances of StatisticsOpImage
make use of a
region of interest, specified as a ROI
object. If this
argument is null
, the entire source image is used.
Additionally, they may perform spatial subsampling of the region of
interest according to xPeriod
and yPeriod
parameters that may vary from 1 (sample every pixel of the region
of interest) upwards. This allows the speed and quality of
statistics gathering to be traded off against one another.
Subclasses should provide implementations
of the getStatisticsNames
, createStatistics
,
and accumulateStatistics
methods.
OpImage
Field Summary | |
protected ROI |
roi
The region of interest over which to compute the statistics. |
protected int |
xPeriod
The horizontal sampling rate. |
protected int |
xStart
The X coordinate of the initial sample. |
protected int |
yPeriod
The vertical sampling rate. |
protected int |
yStart
The Y coordinate of the initial sample. |
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 | |
StatisticsOpImage(RenderedImage source,
ROI roi,
int xStart,
int yStart,
int xPeriod,
int yPeriod)
Constructor. |
Method Summary | |
protected abstract void |
accumulateStatistics(String name,
Raster source,
Object stats)
Accumulates statistics on the specified region into the previously created statistics object. |
boolean |
computesUniqueTiles()
Returns false as computeTile() invocations
are forwarded to the RenderedImage source and are
therefore not unique objects in the global sense. |
Raster |
computeTile(int tileX,
int tileY)
Computes the image data of a tile. |
protected abstract Object |
createStatistics(String name)
Returns an object that will be used to gather the named statistic. |
Object |
getProperty(String name)
Returns one of the available statistics as a property. |
String[] |
getPropertyNames()
Returns a list of property names that are recognized by this image. |
protected abstract String[] |
getStatisticsNames()
Returns a list of names of statistics understood by this class. |
Raster |
getTile(int tileX,
int tileY)
Returns a tile of this image as a Raster . |
Raster[] |
getTiles(Point[] tileIndices)
Returns a list of tiles. |
Rectangle |
mapDestRect(Rectangle destRect,
int sourceIndex)
Maps the destination rectangle into source space unchanged. |
Rectangle |
mapSourceRect(Rectangle sourceRect,
int sourceIndex)
Maps the source rectangle into destination space unchanged. |
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 java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected ROI roi
null
, the entire image is used to compute
the statistics.protected int xStart
protected int yStart
protected int xPeriod
protected int yPeriod
Constructor Detail |
public StatisticsOpImage(RenderedImage source, ROI roi, int xStart, int yStart, int xPeriod, int yPeriod)
The layout of this image is exactly the same as that of the
source image. Any user supplied layout values via the
RenderingHints
are ignored.
source
- The source image over which the statistics
is accumulated.roi
- The region of interest that specifies the region of the
source image over which to compute the statistics. If it
is null
, the entire source image is used.xStart
- The initial X sample coordinate.yStart
- The initial Y sample coordinate.xPeriod
- The horizontal sampling rate.yPeriod
- The vertical sampling rate.IllegalArgumentException
- If source
is
null
.Method Detail |
public boolean computesUniqueTiles()
false
as computeTile()
invocations
are forwarded to the RenderedImage
source and are
therefore not unique objects in the global sense.computesUniqueTiles
in class OpImage
public Raster getTile(int tileX, int tileY)
Raster
. If the
requested tile is completely outside of this image's bounds,
this method returns null
.
Statistics operators do not cache their tiles internally. Rather, the implementation of this method in this class simply forwards the request to the source image.
getTile
in class OpImage
tileX
- The X index of the tile.tileY
- The Y index of the tile.Raster
or
null
.public Raster computeTile(int tileX, int tileY)
The implementation of this method in this class simply forwards the request to the source image.
computeTile
in class OpImage
tileX
- The X index of the tile.tileY
- The Y index of the tile.public Raster[] getTiles(Point[] tileIndices)
getTiles
in class OpImage
tileIndices
- The indices of the tiles requested.IllegalArgumentException
- If tileIndices
is
null
.public Rectangle mapSourceRect(Rectangle sourceRect, int sourceIndex)
mapSourceRect
in class OpImage
sourceRect
- the Rectangle in source coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the valid destination region.IllegalArgumentException
- If sourceIndex
is not 0.IllegalArgumentException
- If sourceRect
is
null
.public Rectangle mapDestRect(Rectangle destRect, int sourceIndex)
mapDestRect
in class OpImage
destRect
- the Rectangle in destination coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the required source region.IllegalArgumentException
- If sourceIndex
is not 0.IllegalArgumentException
- If destRect
is
null
.public Object getProperty(String name)
java.awt.Image.UndefinedProperty
.getProperty
in class PlanarImage
IllegalArgumentException
- If name
is
null
.public String[] getPropertyNames()
getPropertyNames
in class PlanarImage
String
s containing valid
property names.protected abstract String[] getStatisticsNames()
protected abstract Object createStatistics(String name)
name
- The name of the statistic to be gathered.protected abstract void accumulateStatistics(String name, Raster source, Object stats)
name
- The name of the statistic to be gathered.source
- A Raster
containing source pixels.
The dimensions of the Raster will not
exceed maxWidth x maxHeight.stats
- A statistics object generated by a previous call
to createStatistics.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |