jaitools.media.jai.maskedconvolve
Class MaskedConvolveDescriptor

java.lang.Object
  extended by javax.media.jai.OperationDescriptorImpl
      extended by jaitools.media.jai.maskedconvolve.MaskedConvolveDescriptor
All Implemented Interfaces:
java.io.Serializable, javax.media.jai.OperationDescriptor, javax.media.jai.RegistryElementDescriptor

public class MaskedConvolveDescriptor
extends javax.media.jai.OperationDescriptorImpl

An OperationDescriptor describing the "MaskedConvolve" operation. This is a variant of JAI's convolve operator which constrains the convolution to pixels that are included in an ROI.

Two masking options are provided:

The two options may be used together. If neither masking option is required it is prefereable to use the "Convolve" operator for faster processing.

If there is no convolution result for a destination image pixel, either because it was not included in a destination mask or had no kernel values included in a source mask, it will be set to a flag value. This can be set using the nilValue parameter (default is 0).

Since:
1.0
Version:
$Id: MaskedConvolveDescriptor.java 1030 2009-11-11 07:31:50Z michael.bedward $
Author:
Michael Bedward
See Also:
ConvolveDescriptor, Serialized Form

Field Summary
static java.lang.Number DEFAULT_NIL_VALUE
          Default value for nilValue parameter (0)
static java.lang.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 java.lang.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
static javax.media.jai.RenderedOp create(java.awt.image.RenderedImage source0, javax.media.jai.KernelJAI kernel, javax.media.jai.ROI roi, java.lang.Boolean maskSource, java.lang.Boolean maskDest, java.lang.Number nilValue, int minCells, java.awt.RenderingHints hints)
          Constructs a ParameterBlockJAI and invokes JAI.create("maskedconvolve", params) .
protected  boolean validateParameters(java.lang.String modeName, java.awt.image.renderable.ParameterBlock pb, java.lang.StringBuffer msg)
           
 
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

MIN_CELLS_ANY

public static final java.lang.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. This is the default parameter value.

See Also:
Constant Field Values

MIN_CELLS_ALL

public static final java.lang.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

See Also:
Constant Field Values

DEFAULT_NIL_VALUE

public static final java.lang.Number DEFAULT_NIL_VALUE
Default value for nilValue parameter (0)

Constructor Detail

MaskedConvolveDescriptor

public MaskedConvolveDescriptor()
Constructor.

Method Detail

create

public static javax.media.jai.RenderedOp create(java.awt.image.RenderedImage source0,
                                                javax.media.jai.KernelJAI kernel,
                                                javax.media.jai.ROI roi,
                                                java.lang.Boolean maskSource,
                                                java.lang.Boolean maskDest,
                                                java.lang.Number nilValue,
                                                int minCells,
                                                java.awt.RenderingHints hints)
Constructs a ParameterBlockJAI and invokes JAI.create("maskedconvolve", params) .

Note: with this method only integer values can be passed for the minCells argument. To use the Strings "ANY" or "ALL" or the constants described in the class docs use the JAI.create method with a parameter block rather than this method.

Parameters:
source0 - the image to be convolved
kernel - convolution kernel
roi - the roi controlling convolution (must have the same pixel bounds as the source image)
maskSource - if TRUE only the values of source pixels where roi.contains is true contribute to the convolution
maskDest - if TRUE convolution is only performed for pixels where roi.contains is true
nilValue - value to write to the destination image for pixels where there is no convolution result
minCells - the minimum number of non-zero kernel cells that be positioned over unmasked source image cells for convolution to be performed for the target cell
hints - useful for specifying a border extender; may be null
Returns:
the RenderedOp destination
Throws:
java.lang.IllegalArgumentException - if any args are null

validateParameters

protected boolean validateParameters(java.lang.String modeName,
                                     java.awt.image.renderable.ParameterBlock pb,
                                     java.lang.StringBuffer msg)
Overrides:
validateParameters in class javax.media.jai.OperationDescriptorImpl


Copyright © 2009-2010. All Rights Reserved.