Skip to content

New JAI Mosaic Operation

n-lagomarsini edited this page Jun 7, 2013 · 24 revisions

In this page will be described a modified implementation of the JAI Mosaic Operation that supports noData values and doesn't use threshold values. In this new Mosaic class the threshold is not used because it doesn't fit our requests.

NoData values are special values like -9999, Integer. MIN_VALUE , etc... which indicates the absence of informations in that pixel. There is no standard for these values so in every image there could be a different type of noData. In the old Mosaic operation behaviour, one way to avoid a single type of noData value was to set a specific threshold(equal to the noData value) and any value below it, was considered a background value. If there were multiple images with multiple different noData values, the above behaviour could not be correct. For example, if there are 2 images with 2 different noData value types, the threshold could be set to the bigger value but, in this way, even the image pixel of the lowest noData value image that lays below the selected threshold are set to background value, unless you set two different threshold per image.

A simple way to avoid all of these inconvenients is to set an initial range of noData values to check when the Mosaic operation is performed. This multiple values are saved into an array of Range objects or in a singular Range objects, if they are contiguous. The new Mosaic operation should take this array of values and than use it for checking if there is or not noData values and then handle them.

For extending the old Mosaic class behaviour some operations have to be added or overridden:

  • Constructor : the range array must be added for the noData handling;
  • computeRect : the multiple computeRectXXX methods must be overridden for using noData check.

The noData control in the computeRect method should be done for every pixel but only if all the image alpha channels or eventual image ROIs are not present. This happened because if the alpha channel was present, the pixel value in the classic mosaic operations was used without threshold control; in the other case, if an image ROI were present, the mosaic implementations cheked if the pixel was part of the selected ROI and, if true, was used without threshold control. In substitution of the threshold control, the noData control permits to use every data without choosing a specific threshold but only by setting specific noData values.