javax.media.jai.operator
Class MaxFilterDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.MaxFilterDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class MaxFilterDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "MaxFilter" operation.

The "MaxFilter" operation is a non-linear filter which is useful for removing isolated lines or pixels while preserving the overall appearance of an image. The filter is implemented by moving a mask over the image. For each position of the mask, the center pixel is replaced by the max of the pixel values covered by the mask.

There are several shapes possible for the mask. The MaxFilter operation supports three shapes, as follows:

Square Mask:

                       x x x
                       x x x
                       x x x
 

Plus Mask:

                         x
                       x x x
                         x
 

X Mask:

                       x   x
                         x
                       x   x
 

Example:

 	SeekableStream s = new FileSeekableStream(new File(imagefilename); 
	ParameterBlock pb = new ParameterBlock();
      pb.add(s);
      RenderedImage src = (RenderedImage)JAI.create("stream", pb);

      pb = new ParameterBlock();
      pb.addSource(src);
      pb.add(MaxFilterDescriptor.MAX_MASK_PLUS);    // mask Type
      pb.add(new Integer(5));                       // mask size
      
      RenderedImage dst = (RenderedImage)JAI.create("maxfilter", pb);
 

A RenderingHints can also be added to the above. It should be noted that this operation automatically adds a value of Boolean.TRUE for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL to the given configuration so that the operation is performed on the pixel values instead of being performed on the indices into the color map if the source(s) have an IndexColorModel. This addition will take place only if a value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL has not already been provided by the user. Note that the configuration Map is cloned before the new hint is added to it. The operation can be smart about the value of the JAI.KEY_REPLACE_INDEX_COLOR_MODEL RenderingHints, i.e. while the default value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL is Boolean.TRUE, in some cases the operator could set the default.

Resource List
Name Value
GlobalName MaxFilter
LocallName MaxFilter
Vendor com.sun.media.jai
Description Performs max filtering on an image.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jaiapi/javax.media.jai.operator.MaxFilterDescriptor.html
Version 1.0
arg0Desc The shape of the mask to be used for Max Filtering.
arg1Desc The size (width/height) of the mask to be used in Max Filtering.

Parameter List
Name Class Type Default Value
maskShape javax.media.jai.operator.MaxFilterShape MAX_MASK_SQUARE
maskSize java.lang.Integer 3

Since:
JAI 1.1
See Also:
OperationDescriptor, MaxFilterShape, Serialized Form

Field Summary
static MaxFilterShape MAX_MASK_PLUS
          Plus shaped mask.
static MaxFilterShape MAX_MASK_SQUARE
          Square shaped mask.
static MaxFilterShape MAX_MASK_SQUARE_SEPARABLE
          Separable square mask.
static MaxFilterShape MAX_MASK_X
          X shaped mask.
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
MaxFilterDescriptor()
          Constructor for the MaxFilterDescriptor.
 
Method Summary
static RenderedOp create(RenderedImage source0, MaxFilterShape maskShape, Integer maskSize, RenderingHints hints)
          Performs max filtering on an image.
 Number getParamMaxValue(int index)
          Returns the maximum legal value of a specified numeric parameter for this operation.
 Number getParamMinValue(int index)
          Returns the minimum legal value of a specified numeric parameter for this operation.
 PropertyGenerator[] getPropertyGenerators()
          Returns an array of PropertyGenerators implementing property inheritance for the "MaxFilter" operation.
 
Methods inherited from class javax.media.jai.OperationDescriptorImpl
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamNames, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, 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
 

Field Detail

MAX_MASK_SQUARE

public static final MaxFilterShape MAX_MASK_SQUARE
Square shaped mask.


MAX_MASK_PLUS

public static final MaxFilterShape MAX_MASK_PLUS
Plus shaped mask.


MAX_MASK_X

public static final MaxFilterShape MAX_MASK_X
X shaped mask.


MAX_MASK_SQUARE_SEPARABLE

public static final MaxFilterShape MAX_MASK_SQUARE_SEPARABLE
Separable square mask.

Constructor Detail

MaxFilterDescriptor

public MaxFilterDescriptor()
Constructor for the MaxFilterDescriptor.

Method Detail

getParamMinValue

public Number getParamMinValue(int index)
Returns the minimum legal value of a specified numeric parameter for this operation.

Specified by:
getParamMinValue in interface OperationDescriptor
Overrides:
getParamMinValue in class OperationDescriptorImpl
Parameters:
index - The index of the parameter to be queried.
Returns:
A Number representing the minimum legal value, or null if the specified parameter is not numeric.
See Also:
ParameterListDescriptor.getParamValueRange(java.lang.String), ParameterListDescriptor.getEnumeratedParameterValues(java.lang.String), ParameterListDescriptor.isParameterValueValid(java.lang.String, java.lang.Object)

getParamMaxValue

public Number getParamMaxValue(int index)
Returns the maximum legal value of a specified numeric parameter for this operation.

Specified by:
getParamMaxValue in interface OperationDescriptor
Overrides:
getParamMaxValue in class OperationDescriptorImpl
Parameters:
index - The index of the parameter to be queried.
Returns:
A Number representing the maximum legal value, or null if the specified parameter is not numeric.
See Also:
ParameterListDescriptor.getParamValueRange(java.lang.String), ParameterListDescriptor.getEnumeratedParameterValues(java.lang.String), ParameterListDescriptor.isParameterValueValid(java.lang.String, java.lang.Object)

getPropertyGenerators

public PropertyGenerator[] getPropertyGenerators()
Returns an array of PropertyGenerators implementing property inheritance for the "MaxFilter" operation.

Specified by:
getPropertyGenerators in interface OperationDescriptor
Overrides:
getPropertyGenerators in class OperationDescriptorImpl
Returns:
An array of property generators.
See Also:
OperationDescriptorImpl.getPropertyGenerators(java.lang.String)

create

public static RenderedOp create(RenderedImage source0,
                                MaxFilterShape maskShape,
                                Integer maskSize,
                                RenderingHints hints)
Performs max filtering on an image.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderedImage source 0.
maskShape - The shape of the mask to be used for Max Filtering. May be null.
maskSize - The size (width/height) of the mask to be used in Max Filtering. 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