An OperationDescriptor describing the "Extrema" operation.
The Extrema operation scans a specific region of a rendered
image and finds the maximum and minimum pixel values for each band
within that region of the image. The image data pass through this
operation unchanged.
The region-wise maximum and minimum pixel values may be obtained
as properties. Calling the getProperty method on this
operation with "extrema" as the property name retrieves both the
region-wise maximum and minimum pixel values. Calling it with
"maximum" as the property name retrieves the region-wise maximum
pixel value, and with "minimum" as the property name retrieves the
region-wise minimum pixel value. The return value for "extrema" has
type double[2][#bands] , and those for "maximum"
and "minimum" have type double[#bands] .
The region of interest (ROI) does not have to be a rectangle.
It may be null , in which case the entire image is
scanned to find the image-wise maximum and minimum pixel values
for each band.
The set of pixels scanned may be further reduced by
specifying the "xPeriod" and "yPeriod" parameters that represent
the sampling rate along each axis. These variables may not be
less than 1. However, they may be null , in which
case the sampling rate is set to 1; that is, every pixel in the
ROI is processed.
The Boolean parameter "saveLocations" indicates whether
the locations of the extrema will be computed. If TRUE , the
locations are computed and stored in the properties "minLocations" and
"maxLocations" in the form of lists of run length codes. Each run length
code is stored as a three-entry integer array (xStart, yStart,
length) . Because the statistics are implemented on the
low-resolution image, this length is defined on the image
coordinate system of the low-resolution image. Thus, the run length code
above means the pixels (xStart, yStart), (xStart + xPeriod, yStart),
..., (xStart + (length - 1) * xPeriod, yStart) of the original
image have a value of the maximum or minimum, depending on whether this
run exists in the property "maxLocations" or "minLocations". The run length
code is row-based, thus the run doesn't wrap on the image boundaries.
Runs are not guaranteed to be maximal, e.g. a run that crosses tile
boundaries might be broken at the boundary into multiple runs. The order
of the runs is not guaranteed.
The value objects of the properties "minLocations" and "maxLocations"
are arrays of java.util.List . Each array entry contains
the minimum/maximum locations of one band. The elements in
a list can be accessed using the iterator of
the java.util.List . For example, the sample code below
demonstrates how to retrieve the minimum locations of the first band:
List minLocations = ((List[])extremaOp.getProperty("minLocations"))[0];
Iterator iter = minLocations.iterator();
while(iter.hasNext()) {
int[] runLength = (int[])iter.next();
int xStart = runLength[0];
int yStart = runLength[1];
int length = runLength[2];
}
In the implementation of this operator, the proper use of the parameter
"saveLocations" also helps to keep the efficiency of the operator in the
common case: when only the extremal values are computed.
The parameter "maxRuns" is the maximum number of run length codes that
the user would like to store. It is defined to reduce memory
consumption on very large images. If the parameter "saveLocations" is
FALSE , this parameter will be ignored. If this parameter is
equal to Integer.MAX_VALUE , all the locations will be saved.
Resource List
Name | Value |
GlobalName | Extrema |
LocalName | Extrema |
Vendor | com.sun.media.jai |
Description | Finds the maximum and minimum pixel value
in each band of an image. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ExtremaDescriptor.html |
Version | 1.0 |
arg0Desc | The region of the image to scan. |
arg1Desc | The horizontal sampling rate,
may not be less than 1. |
arg2Desc | The vertical sampling rate,
may not be less than 1. |
arg3Desc | Whether to store extrema locations. |
arg4Desc | Maximum number of run length codes to store. |
Parameter List
Name | Class Type |
Default Value |
roi | javax.media.jai.ROI |
null |
xPeriod | java.lang.Integer |
1 |
yPeriod | java.lang.Integer |
1 |
saveLocations | java.lang.Boolean |
Boolean.FALSE |
maxRuns | java.lang.Integer |
1 |
See Also: javax.media.jai.OperationDescriptor |