Monday, March 15, 2010

New BorderExtender and Number handling classes

Two new BorderExtender classes have been added to jai-tools 1.1-SNAPSHOT:

RandomBorderExtender generates an image border with uniform random pixel values sampled from a user-specified range.

SamplingBorderExtender generates pixel values by randomly sampling the source image within a threshold distance of each border pixel.

You'll find these classes in the utils module, jaitools.imageutils package and you can use them in any JAI operation that accepts a BorderExtender in the RenderingHints. They're brand new so I'd welcome your comments, suggestions, bug reports etc.

Also in that module is the jaitools.numeric.NumberOperations class. This used by the new BorderExtenders but is also available for general use. It provides a number of static helper methods for working with Number objects without having to type-narrow them. For instance:

// Add two Number objects. The return value will be an instance of the
// highest ranking class of the two arguments (e.g. Byte + Integer will
// give an Integer result)
Number n1 = ...
Number n2 = ...
Number sum = NumberOperations.add(n1, n2);

You can checkout the source code for jai-tools 1.1-SNAPSHOT with your favourite subversion client from

See the jai-tools project site for details on how to use the 1.1-SNAPSHOT jars in your project, either using Maven or manual download.

Version 1.0.0 released

The jai-tools project is pleased to announce the release of version 1.0.0 for your Java programming pleasure.
--- General modules ---
utilsSupport classes including DiskMemTileCache and DiskMemImage
jiffleThe jiffle image scripting language
kernelFactory and utility classes to work with KernelJAI objects
demoA selection of example programs
--- Image operators ---
kernelstatsCalculates neighbourhood statistics
maskedconvolveExtends the standard JAI convolve operator with source and destination masking
rangelookupAn image lookup operator that can handle both integral and floating point data types and work with value ranges
regionalizeIdentifies regions of (sufficiently) uniform value in a source image
zonalstatsCalculates statistics for values in a source image, optionally grouped by zones in a control image

You can checkout the sources with your favourite subversion client from:

If you use Maven as your build tool you can download the jai-tools binary, source and javadoc jars from the central Maven repository.

If you prefer to add the jars to your project manually they can be downloaded from: