Class RegionalizeDescriptor

  extended by
      extended by
All Implemented Interfaces:

public class RegionalizeDescriptor

Describes the "Regionalize" operation.

This operation takes a single source image and identifies regions of connected pixels with uniform value, where value comparisons take into account a user-specified tolerance.

Note: At present, this operator only deals with a single band.


The operator scans the source image left to right, top to bottom. When it reaches a pixel that has not been allocated to a region yet it uses that pixel as the starting point for a flood-fill search (similar to flood-filling in a paint program). The value of the starting pixel is recorded as the reference value for the new region. The search works its way outwards from the starting pixel, testing other pixels for inclusion in the region. A pixel will be included if:

      |value - reference value| <= tolerance 
where tolerance is a user-specified parameter.

If the diagonal parameter is set to true, the flood-fill search will include pixels that can only be reached via a diagonal step; if false, only orthogonal steps are taken.

The search continues until no further pixels can be added to the region. The region is then allocated a unique integer ID and summary statistics (bounds, number of pixels, reference value) are recorded for it.

The output of the operation is an image of data type TYPE_INT, where each pixel's value is its region ID. A RegionData object can be retrieved as a property of the output image using the property name REGION_DATA_PROPERTY).


 RenderedImage myImg = ...

 ParameterBlockJAI pb = new ParameterBlockJAI("regionalize");
 pb.setSource("source0", myImg);
 pb.setParameter("band", 0);
 pb.setParameter("tolerance", 0.1d);
 pb.setParameter("diagonal", false);
 RenderedOp regionImg = JAI.create("Regionalize", pb);

 // have a look at the image (this will force rendering and
 // the calculation of region data)

 // print the summary data
 RegionData regData =

 List<Region> regions = regData.getData();
 Iterator<Region> iter = regions.iterator();
 System.out.println("ID\tValue\tSize\tMin X\tMax X\tMin Y\tMax Y");
 while (iter.hasNext()) {
     Region r =;
     System.out.println( String.format("%d\t%.2f\t%d\t%d\t%d\t%d\t%d",
         r.getMaxY() ));
Summary of parameters:
Name Class Default Description
band int 0 The source image band to process
tolerance double 0 Tolerance for comparison of image values
diagonal boolean false If true diagonal connections are allowed; if false only orthogonal connections are allowed

Michael Bedward
See Also:
Serialized Form

Field Summary
          The propoerty name to retrieve the RegionData object which holds summary data for regions identified in the source image and depicted in the destination image
Fields inherited from class
resources, sourceNames, supportedModes
Fields inherited from interface
Constructor Summary
Method Summary
Methods inherited from class
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, 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 REGION_DATA_PROPERTY
The propoerty name to retrieve the RegionData object which holds summary data for regions identified in the source image and depicted in the destination image

See Also:
Constant Field Values
Constructor Detail


public RegionalizeDescriptor()

Copyright © 2009-2013. All Rights Reserved.