Developer’s Corner: JAI-Ext, the Open Source replacement for Oracle JAI
JAI-EXT is a project based on the Java Advanced Imaging (JAI) API, which is a Java framework for high performances image processing. The main feature of JAI is the ability to process image using deferred execution and tiling, which provide high performances when elaborating input data. Anyway JAI is no more supported by its original developers and has a very restricting license.
Since in many of our project we heavily rely on JAI (one for all, GeoServer), at GeoSolutions we decided to embarque in this effort with the JAI-EXT project to completely replace the JAI framework with a new one in order to have a new complete, open-source Java API for image processing. At the time of writing JAI-EXT is composed by a huge number of operations, which are (almost :)) drop-in replacements for the old JAI ones.
In addition, with JAI-EXT we look into fixing some of the outstanding problems we found in JAI but we also aim to add a few interesting and much needed features. Below you can find some of the most important features we focused on:
- Complete Open Source development
- Support for Multithreading and parallel processing
- Support for ROI
- Support for No Data
Let’s now go into more details.
Open Source development
JAI-EXT project has been developed as an Open Source project in order to be accessible by its users and to grow with their help. The project is hosted at GitHub: https://github.com/geosolutions-it/jai-ext.
Actually a new minor release 1.01 has been released and is available at the following link.
Support for Multithreading and parallel processing
Since JAI-EXT started from the JAI project, it fully supports multithreaded, parallel processing of image tiles. The main difference of the JAI-EXT project is a better use of the Concurrency Java API introduced in Java 5 in order to increase concurrency throughput.
Support for ROI
Sometimes it is helpful to define an active area on the source raster data where the computations must be executed leaving the pixels outside untocuhed. This feature is available in JAI-EXT as it supports the usage of ROIs (both vector and raster) for all of its operations.
Support for NoData
Geospatial data sometimes may contain pixel values which do not represent valid data, such values are called NoData. JAI is unable to deal with NoData, since it has been developed for working with photographic images. The biggest problem of not having the capability to take NoData into account with doing raser processing is with image interpolation; interpolating raster data that contains NoData may result in artifacts when using higher order interpolations like bilinear or bicubic interpolation if proper management of NoData pixels is not performed.
Since one of our main areas of expertise is remote sensing andMetOc raster data management where NoData values are extensively used, we decide to focus on adding support for NoData values in all the JAI-EXT operations like Affine, Warp and so on.
As we speak, GeoTools and GeoServer master branches have been updated in order to use JAI-EXT. We do expect a short period of instability since the changes we have performed are extensive and deep, hence help us testing by grabbing a recent nightly of GeoServer from the master branch.
That said, this means that GeoServer 2.8 will enjoy full support for NoData and ROI!
There is still work to be performed though, as an instance:
- Rewrite the missing JAI Operators
- Rewrite the JAI Tile Scheduler
- Introduce Support for Progress Report and Cancellation of running operations
The GeoSolutions team,