Package org.geotools.coverage.processing
If the operation to apply is know at compile time, then the easiest
way to use this package is to use the Operations
convenience class. For example a grid
coverage can be resampled to a different
coordinate reference
system using the following code:
Coverage reprojected = Operations.DEFAULT.resample(myCoverage, newCRS);
If the operation to apply is unknow at compile time (for example because it is selected
at runtime by the user in some widget), or if the operation is not listed in the Operations
convenience
class, then the generic way is to invoke the doOperation
method on the default
processor instance. Available operations are listed in the
operation package.
Supported operations
- Convolve
- GradientMagnitude
- Invert
- LaplaceType1Filter
- LaplaceType2Filter
- MaxFilter
- MedianFilter
- MinFilter
- Recolor
- Threshold
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" |
GridCoverage2D |
N/A | N/A | N/A |
"kernel" |
KernelJAI |
N/A | N/A | N/A |
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" |
GridCoverage2D |
N/A | N/A | N/A |
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" |
GridCoverage2D |
N/A | N/A | N/A |
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" |
GridCoverage2D |
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).
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" |
GridCoverage2D |
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).
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" |
GridCoverage2D |
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).
Recolor
Changes the colors associated to arbitrary
categories in arbitrary bands.
The ColorMaps
arguments must be an array of Map
s
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" |
GridCoverage2D |
N/A | N/A | N/A |
"ColorMaps" |
Map[] |
A gray scale | N/A | N/A |
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" |
GridCoverage2D |
N/A | N/A | N/A |
"threshold" |
double[] |
N/A | N/A | N/A |
-
Class Summary Class Description AbstractOperation Provides descriptive information for a coverage processing operation.BaseMathOperationJAI This class is the root class for the Maths operations.BaseScaleOperationJAI Base class for providing capabilities to scaleGridCoverage2D
objects using JAI scale operations.BaseStatisticsOperationJAI This class is the root class for the Statistics operations based onJAI
'sStatisticsOpImage
like Extrema and Histogram.BilevelOperation Wraps any JAI operation producing a bilevel image.CoverageProcessor Base class for coverage processor implementations.ExtendedImagingParameterDescriptors Extension of theImagingParameterDescriptors
class used for setting the right operation name for the operation associated to the inputRegistryElementDescriptor
.FilterOperation Common super-class for filter operation.Operation2D An operation working onGridCoverage2D
sources.OperationJAI Wraps a JAI'sOperationDescriptor
for interoperability with Java Advanced Imaging.OperationJAI.Parameters A block of parameters for aGridCoverage2D
processed by aOperationJAI
.Operations Convenience, type-safe, methods for applying some common operations on coverage objects.RangeSpecifier Argument type forDefaultProcessor
operations for specifying the range, colors and units of a computation result. -
Exception Summary Exception Description CannotCropException Throws when a "crop" operation has been requested but the specified grid coverage can't be scaled.CannotReprojectException Throws when a "resample" operation has been requested but the specified grid coverage can't be reprojected.CannotScaleException Throws when a "scale" operation has been requested but the specified grid coverage can't be scaled.CoverageProcessingException Throws when a coverage operation failed.EmptyIntersectionException Special subclass ofCannotCropException
reporting that the raster space intersection between the crop area and the coverage one was found to be empty