|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.media.jai.OperationDescriptorImpl
org.jaitools.media.jai.maskedconvolve.MaskedConvolveDescriptor
public class MaskedConvolveDescriptor
The "MaskedConvolve" operation extends JAI's convolve operator by providing
the option to select which source and or destination pixels are included in processing
using an associated ROI object.
Two masking options are provided:
With this operator, a given destination pixel will have a nil result if any of the following are true:
minCells parameter).
nilValue
parameter (the default is 0).
You can specify the minimum number of non-zero kernel cells that must be positioned over
unmasked source image pixels for convolution to be performed via the minCells
parameter. If there are NO_DATA values defined (see nodata parameter below) then
this parameter refers to the number of unmasked source image pixels with data.
Any of the following are accepted:
Number with value between one and the number of non-zero kernel cells (inclusive).
String representing a numeric value.
RenderedImage img = ...
float[] kernelData = new float[]{ // for neighbourhood sum
0, 0, 1, 0, 0,
0, 1, 1, 1, 0,
1, 1, 1, 1, 1,
0, 1, 1, 1, 0,
0, 0, 1, 0, 0,
};
KernelJAI kernel = new KernelJAI(5, 5, kernelData);
ROI roi = new ROI(img, thresholdValue);
ParameterBlockJAI pb = new ParameterBlockJAI("maskedconvolve");
pb.setSource("source0", op0);
pb.setParameter("kernel", kernel);
pb.setParameter("roi", roi);
pb.setParameter("nilValue", Integer.valueOf(-1));
// no need to set masksource and maskdest params if we want to
// use their default values (TRUE)
BorderExtender extender = BorderExtender.createInstance(BorderExtender.BORDER_ZERO);
RenderingHints hints = new RenderingHints(JAI.KEY_BORDER_EXTENDER, extender);
RenderedOp dest = JAI.create("maskedconvolve", pb, hints);
Summary of parameters:
| Name | Class | Default | Description |
|---|---|---|---|
| kernel | KernelJAI | No default | Kernel defining the convolution neighbourhood |
| roi | ROI | No default | ROI to use for source and/or destination masking |
| maskSource | Boolean | true | Whether to apply source masking |
| maskDest | Boolean | true | Whether to apply destination masking |
| nilValue | Number | 0 | Value to return for pixels with no convolution result |
| minCells | See note above | MIN_CELLS_ANY | Minimun number of non-zero kernel cells over unmasked source image pixels for convolution to be performed |
| nodata | Collection | null |
Values to be treated as NO_DATA. A value can be either a Number or a
Range (mixtures of both are permitted).
|
| strictNodata | Boolean | false |
If true, convolution will no be performed for a target pixel with
any NODATA values in its neighbourhood (non-zero kernel cells); if false
convolution can occur, subject to masking and minCells criteria, with
NODATA values being ignored.
|
KernelFactory,
Serialized Form| Field Summary | |
|---|---|
static Number |
DEFAULT_NIL_VALUE
Default value for nilValue parameter (0) |
static String |
MIN_CELLS_ALL
Constant that can be used for the minCells parameter to require all non-zero kernel cells to overlap with unmasked source image cells for convolution to be performed for a terget cell |
static String |
MIN_CELLS_ANY
Constant that can be used for the minCells parameter to specify convolution will be performed for a terget cell if any non-zero kernel cells overlap with unmasked source image cells. |
| Fields inherited from class javax.media.jai.OperationDescriptorImpl |
|---|
resources, sourceNames, supportedModes |
| Fields inherited from interface javax.media.jai.OperationDescriptor |
|---|
NO_PARAMETER_DEFAULT |
| Constructor Summary | |
|---|---|
MaskedConvolveDescriptor()
Constructor. |
|
| Method Summary | |
|---|---|
protected boolean |
validateParameters(String modeName,
ParameterBlock pb,
StringBuffer msg)
Validates the supplied parameters. |
| 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, validateArguments, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MIN_CELLS_ANY
public static final String MIN_CELLS_ALL
public static final Number DEFAULT_NIL_VALUE
| Constructor Detail |
|---|
public MaskedConvolveDescriptor()
| Method Detail |
|---|
protected boolean validateParameters(String modeName,
ParameterBlock pb,
StringBuffer msg)
validateParameters in class javax.media.jai.OperationDescriptorImplmodeName - the rendering modepb - the input parametersmsg - a StringBuffer instance to receive error messages
true if parameters are valid; false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||