javax.media.jai.operator
Class PiecewiseDescriptor
java.lang.Object
|
+--javax.media.jai.OperationDescriptorImpl
|
+--javax.media.jai.operator.PiecewiseDescriptor
- All Implemented Interfaces:
- OperationDescriptor, RegistryElementDescriptor, Serializable
- public class PiecewiseDescriptor
- extends OperationDescriptorImpl
An OperationDescriptor
describing the "Piecewise" operation.
The "Piecewise" operation performs a piecewise linear mapping of the
pixel values of an image. The piecewise linear mapping is described by a
set of breakpoints which are provided as an array of the form
float breakPoints[N][2][numBreakPoints]
where the value of
N may be either unity or the number of bands in the source image.
If N is unity then the same set of breakpoints will be applied to
all bands in the image. The abscissas of the supplied breakpoints must
be monotonically increasing.
The pixel values of the destination image are defined by the pseudocode:
if (src[x][y][b] < breakPoints[b][0][0]) {
dst[x][y][b] = breakPoints[b][1][0]);
} else if (src[x][y][b] > breakPoints[b][0][numBreakPoints-1]) {
dst[x][y][b] = breakPoints[b][1][numBreakPoints-1]);
} else {
int i = 0;
while(breakPoints[b][0][i+1] < src[x][y][b]) {
i++;
}
dst[x][y][b] = breakPoints[b][1][i] +
(src[x][y][b] - breakPoints[b][0][i])*
(breakPoints[b][1][i+1] - breakPoints[b][1][i])/
(breakPoints[b][0][i+1] - breakPoints[b][0][i]);
}
Resource List
Name | Value |
GlobalName | Piecewise |
LocalName | Piecewise |
Vendor | com.sun.media.jai |
Description | Applies a piecewise pixel value mapping. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/PiecewiseDescriptor.html |
Version | 1.0 |
arg0Desc | The breakpoint array. |
Parameter List
Name | Class Type |
Default Value |
breakPoints | float[][][] |
identity mapping on [0, 255] |
- See Also:
DataBuffer
,
ImageLayout
,
OperationDescriptor
, Serialized Form
Methods inherited from class javax.media.jai.OperationDescriptorImpl |
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PiecewiseDescriptor
public PiecewiseDescriptor()
- Constructor.
validateArguments
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer msg)
- Validates the input source and parameter.
In addition to the standard checks performed by the
superclass method, this method checks that the number of bands
in "breakPoints" is either 1 or the number of bands in the
source image, the second breakpoint array dimension is 2,
the third dimension is the same for abscissas and ordinates,
and that the absicssas are monotonically increasing.
- Overrides:
validateArguments
in class OperationDescriptorImpl
- Following copied from class:
javax.media.jai.OperationDescriptorImpl
- Parameters:
modeName
- the operation mode nameargs
- Input arguments, including source(s) and/or parameter(s).msg
- A string that may contain error messages.- Throws:
IllegalArgumentException
- if modeName
is null
- See Also:
OperationDescriptorImpl.validateSources(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
,
OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
create
public static RenderedOp create(RenderedImage source0,
float[][][] breakPoints,
RenderingHints hints)
- Applies a piecewise pixel value mapping.
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.create(String,ParameterBlock,RenderingHints)
.
- Parameters:
source0
- RenderedImage
source 0.breakPoints
- The breakpoint array.
May be null
.hints
- The RenderingHints
to use.
May be null
.- Returns:
- The
RenderedOp
destination. - Throws:
IllegalArgumentException
- if source0
is null
.- See Also:
JAI
,
ParameterBlockJAI
,
RenderedOp
createRenderable
public static RenderableOp createRenderable(RenderableImage source0,
float[][][] breakPoints,
RenderingHints hints)
- Applies a piecewise pixel value mapping.
Creates a ParameterBlockJAI
from all
supplied arguments except hints
and invokes
JAI.createRenderable(String,ParameterBlock,RenderingHints)
.
- Parameters:
source0
- RenderableImage
source 0.breakPoints
- The breakpoint array.
May be null
.hints
- The RenderingHints
to use.
May be null
.- Returns:
- The
RenderableOp
destination. - Throws:
IllegalArgumentException
- if source0
is null
.- See Also:
JAI
,
ParameterBlockJAI
,
RenderableOp