Package org.geotools.gp

Grid coverage processing implementation.

See:
          Description

Class Summary
Adapters Deprecated. The legacy OpenGIS GP package is deprecated.
GridCoverageProcessor Deprecated. Replaced by DefaultProcessor.
Hints Deprecated. Replaced by Hints.
Operation Deprecated. Replaced by Operation2D.
OperationJAI Wrap an OperationDescriptor for interoperability with Java Advanced Imaging.
OperationJAI.Parameters A block of parameters for a GridCoverage processed by a OperationJAI.
RangeSpecifier Deprecated. Replaced by RangeSpecifier.
 

Exception Summary
CannotReprojectException Deprecated. Replaced by CannotReprojectException.
OperationNotFoundException Deprecated. Replaced by OperationNotFoundException.
 

Package org.geotools.gp Description

Grid coverage processing implementation. The following is adapted from OpenGIS? Grid Coverages Implementation Specification:

This optional interface provides operations for different ways of accessing the grid coverage values as well as image processing functionality. The list of available processing operations is implementation dependent. The interface has a discovery mechanism to determine the available processing operations. These processing operations will transform values within a single sample dimension, and leave the values in other sample dimensions unaffected. The modified sample dimension may also change its type (e.g. from 4BIT to 1BIT). The actual underlying grid data remains unchanged. The interface has been designed to allow the adaptations to be done in a "pipe-lined" manner. The interface operates on GridCoverage to create a new GridCoverage. The interface does not need to make a copy of the source grid data. Instead, it can return a grid coverage object which applies the adaptations on the original grid coverage whenever a block of data is requested. In this way, a pipeline of several grid coverages can be constructed cheaply.

This interface can perform any of the following:

  1. Change the number of bands being accessed.
  2. Change the value sequencing in which the grid values are retrieved.
  3. Allow re-sampling of the grid coverage for a different geometry. Creating a new GridCoverage with different grid geometry allows for reprojecting the grid coverage to another projection and another georeferencing type, resampling to another cell resolution and subsetting the grid coverage.
  4. Modify the way the grid values are accessed (filtered, classified...).
  5. Change the interpolation method used when evaluating points which fall between grid cells.
  6. Filtering
  7. Image enhancements.
  8. etc.

 

 

Supported operations

The default GridCoverageProcessor supports the following operations:

 


 

Convolve

Computes each output sample by multiplying elements of a kernel with the samples surrounding a particular source sample.

Name: "Convolve"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"kernel" KernelJAI N/A N/A N/A

Back to summary

 


 

GradientMagnitude

Edge detector which computes the magnitude of the image gradient vector in two orthogonal directions. The result of the "GradientMagnitude" operation may be defined as:

dst[x][y][b] = sqrt( SH(x,y,b)2 + SV(x,y,b)2 )

where SH(x,y,b) and SV(x,y,b) are the horizontal and vertical gradient images generated from band b of the source image by correlating it with the supplied orthogonal (horizontal and vertical) gradient masks.

Name: "GradientMagnitude"
JAI operator: "GradientMagnitude"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"Mask1" KernelJAI KernelJAI.GRADIENT_MASK_SOBEL_HORIZONTAL N/A N/A
"Mask2" KernelJAI KernelJAI.GRADIENT_MASK_SOBEL_VERTICAL N/A N/A
"TargetRange" RangeSpecifier (automatic) N/A N/A

Before to compute the gradients, the kernels are tested against artificials horizontal and vertical gradients of one unit of sample / unit of localization. For example:

Kernels are normalized by dividing all their coefficients by the result of this test. In other words, kernels are normalized in such a way that applying the "GradientMagnitude" operation on a horizontal or vertical gradient of 1 such "geophysical" units will give a result of 1. This is an attempt to give geophysical meaning to the numbers produced by the "GradientMagnitude" operation. This normalization depends of the coverage's grid geometry.

Back to summary

 


 

Interpolate

This operation specifies the interpolation type to be used to interpolate values for points which fall between grid cells. The default value is nearest neighbor. The new interpolation type operates on all sample dimensions.

Name: "Interpolate"
JAI operator: N/A
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"Type" CharSequence "NearestNieghbor" N/A N/A

Possible values for type are: "NearestNeighbor", "Bilinear" and "Bicubic" (the "Optimal" interpolation type is currently not supported). The Geotools implementation provides two extensions to OpenGIS specification: First, it accepts also an Interpolation argument type, for interoperability with Java Advanced Imaging. Second, it accepts also an array of String or Interpolation objects. When an array is specified, the first interpolation in the array is applied. If this interpolation returns a NaN value, then the second interpolation is tried as a fallback. If the second interpolation returns also a NaN value, then the third one is tried and so on until an interpolation returns a real number or until we reach the end of interpolation list. This behavior is convenient when processing remote sensing images of geophysics data, for example Sea Surface Temperature (SST), in which clouds may mask many pixels (i.e. set them to some NaN values). Because "Bicubic" interpolation needs 4×4 pixels while "Bilinear" interpolation needs only 2x2 pixels, the "Bilinear" interpolation is less likely to fails because of clouds (NaN values) than "Bicubic" (only one NaN value is enough to make an interpolation fails). One cans workaround the problem by trying a bicubic interpolation first, then a linear interpolation if "Bicubic" failed at a particular location, etc. This behavior can be provided with the following "Type" argument: new String[]{"Bicubic", "Bilinear", "NearestNeighbor"}.

Back to summary

 


 

Invert

Inverts the pixel values of a coverage. For source coverages with signed data types, the pixel values of the destination coverage are defined by the pseudocode:

    dst[x][y][b] = -src[x][y][b]
    

Name: "Invert"
JAI operator: "Invert"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A

Back to summary

 


 

LaplaceType1Filter

Perform a laplacian filter operation on a grid coverage. This is a high pass filter which highlights the edges having positive and negative brightness slopes. This filter mulitples the co-efficients in the tabe below with the corresponding grid data value in the kernel window. The new grid value will be calculated as the sum of (grid value * co-efficient) for each kernel cell divised by 9.

0 -1 0
-1 4 -1
0 -1 0

Name: "LaplaceType1Filter"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A

Back to summary

 


 

LaplaceType2Filter

Perform a laplacian filter operation on a grid coverage. This is a high pass filter which highlights the edges having positive and negative brightness slopes. This filter mulitples the co-efficients in the tabe below with the corresponding grid data value in the kernel window. The new grid value will be calculated as the sum of (grid value * co-efficient) for each kernel cell divised by 9.

-1 -1 -1
-1 8 -1
-1 -1 -1

Name: "LaplaceType1Filter"
JAI operator: "Convolve"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A

Back to summary

 


 

MaxFilter

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, which are enumerated in the JAI documentation.

Name: "MaxFilter"
JAI operator: "MaxFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MaxFilterShape MaxFilterDescriptor.MAX_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

MedianFilter

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 median of the pixel values covered by the mask. This filter results in a smoothing of the image values. There are several shapes possible for the mask, which are enumerated in the JAI documentation.

Name: "MedianFilter"
JAI operator: "MedianFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MedianFilterShape MedianFilterDescriptor.MEDIAN_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

MinFilter

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 min of the pixel values covered by the mask. There are several shapes possible for the mask, which are enumerated in the JAI documentation.

Name: "MinFilter"
JAI operator: "MinFilter"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"Xsize" Integer 3 1 N/A
"Ysize" Integer 3 1 N/A
"maskShape" MinFilterShape MinFilterDescriptor.MIN_MASK_SQUARE N/A N/A

Note: In current implementation, Xsize and Ysize must have the same value (i.e. rectangular shapes are not supported).

Back to summary

 


 

Recolor

Changes the colors associated to arbitrary categories in arbitrary bands. The ColorMaps arguments must be an array of Maps with a minimal length of 1. The Map in array element 0 is used for band 0; the Map in array element 1 is used for band 1, etc. If there is more bands than array elements in ColorMaps, then the last Map is reused for all remaining bands.

For each Map in ColorMaps, the keys are category names as String and the values are colors as an array of type Color[]. All categories with a name matching a key in the Map will be recolored with the associated colors. All categories with no corresponding entries in the Map will be left unchanged. The null key is a special value meaning "any quantitative category". For example in order to repaint forest in green, river in blue and lets other categories unchanged, one can write:

    Map map = new HashMap();
    map.put("Forest", new Color[]{Color.GREEN});
    map.put("River",  new Color[]{Color.BLUE });
    Map[] colorMaps = new Map[] {
        map  // Use for all bands
    }
    

Name: "Recolor"
JAI operator: N/A
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"ColorMaps" Map[] A gray scale N/A N/A

Back to summary

 


 

Resample

Resample a grid coverage using a different grid geometry. This operation provides the following functionality:

Name: "Resample"
JAI operator: "Affine" or "Warp"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"InterpolationType" CharSequence "NearestNieghbor" N/A N/A
"CoordinateSystem" CoordinateSystem Same as source grid coverage N/A N/A
"GridGeometry" GridGeometry (automatic) N/A N/A

The "Resample" operation use the default CoordinateTransformationFactory for creating a transformation from the source to the destination coordinate systems. If a custom factory is desired, it may be supplied as a rendering hint with the Hints.COORDINATE_TRANSFORMATION_FACTORY key. Rendering hints can be supplied to GridCoverageProcessor at construction time.

Back to summary

 


 

Rescale

Maps the pixel values of an image from one range to another range by multiplying each pixel value by one of a set of constants and then adding another constant to the result of the multiplication. The destination pixel values are defined by the pseudocode:

dst[x][y][b] = src[x][y][b]*constant + offset;

Name: "Rescale"
JAI operator: "Rescale"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"constants" double[] N/A N/A N/A
"offsets" double[] N/A N/A N/A

Back to summary

 


 

SelectSampleDimension

Chooses N sample dimensions from a grid coverage and copies their sample data to the destination grid coverage in the order specified. The SampleDimensions parameter specifies the source SampleDimension indices, and its size (SampleDimensions.length) determines the number of sample dimensions of the destination grid coverage. The destination coverage may have any number of sample dimensions, and a particular sample dimension of the source coverage may be repeated in the destination coverage by specifying it multiple times in the SampleDimensions parameter.

This operation can also be used for selecting a different "visible sample dimension". Some images may contain useful data in more than one sample dimension, but renderer the content of only 1 sample dimension at once. The VisibleSampleDimension parameter can be used for selecting this sample dimension. If ommited, then the new grid coverage will inherit its source's visible sample dimension.

Name: "SelectSampleDimension"
JAI operator: "BandSelect"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"SampleDimensions" int[] Same as source N/A N/A
"VisibleSampleDimension" Integer Same as source 0 N/A

Back to summary

 


 

Threshold

A gray scale threshold classifies the grid coverage values into a boolean value. The sample dimensions will be modified into a boolean value and the dimension type of the source sample dimension will be represented as 1 bit.

Name: "Threshold"
JAI operator: "Binarize"
Parameters:

Name Class Default value Minimum value Maximum value
"Source" GridCoverage N/A N/A N/A
"threshold" double N/A N/A N/A

Back to summary



Copyright © GeoTools. All Rights Reserved.