Package org.apache.sis.coverage.grid
Class GridCoverageProcessor
Object
GridCoverageProcessor
- All Implemented Interfaces:
Cloneable
A predefined set of operations on grid coverages as convenience methods.
Thread-safety
GridCoverageProcessor
is safe for concurrent use in multi-threading environment.- Since:
- 1.1
- See Also:
Defined in the sis-feature
module
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ImageProcessor
The processor to use for operations on two-dimensional slices. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new processor with default configuration.GridCoverageProcessor
(ImageProcessor processor) Creates a new processor initialized to the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a coverage processor with the same configuration than this processor.boolean
Returnstrue
if the given object is a coverage processor of the same class with the same configuration.Number[]
Returns the values to use for pixels that can not be computed.Returns the interpolation method to use for resampling operations.Quantity<?>[]
Returns hints about the desired positional accuracy, in "real world" units or in pixel units.int
Returns a hash code value for this coverage processor based on its current configuration.mask
(GridCoverage source, RegionOfInterest mask, boolean maskInside) Applies a mask defined by a region of interest (ROI).resample
(GridCoverage source, GridGeometry target) Creates a new coverage with a different grid extent, resolution or coordinate reference system.void
setFillValues
(Number... values) Sets the values to use for pixels that can not be computed.void
setInterpolation
(Interpolation method) Sets the interpolation method to use for resampling operations.void
setPositionalAccuracyHints
(Quantity<?>... hints) Sets hints about desired positional accuracy, in "real world" units or in pixel units.
-
Field Details
-
imageProcessor
The processor to use for operations on two-dimensional slices.
-
-
Constructor Details
-
GridCoverageProcessor
public GridCoverageProcessor()Creates a new processor with default configuration. -
GridCoverageProcessor
Creates a new processor initialized to the given configuration.- Parameters:
processor
- the processor to use for operations on two-dimensional slices.
-
-
Method Details
-
getInterpolation
Returns the interpolation method to use for resampling operations. The default implementation delegates to the image processor.- Returns:
- interpolation method to use in resampling operations.
- See Also:
-
setInterpolation
Sets the interpolation method to use for resampling operations. The default implementation delegates to the image processor.- Parameters:
method
- interpolation method to use in resampling operations.- See Also:
-
getPositionalAccuracyHints
Returns hints about the desired positional accuracy, in "real world" units or in pixel units. The default implementation delegates to the image processor.- Returns:
- desired accuracy in no particular order, or an empty array if none.
- See Also:
-
setPositionalAccuracyHints
Sets hints about desired positional accuracy, in "real world" units or in pixel units. The default implementation delegates to the image processor.- Parameters:
hints
- desired accuracy in no particular order, or anull
array if none. Null elements in the array are ignored.- See Also:
-
getFillValues
Returns the values to use for pixels that can not be computed. The default implementation delegates to the image processor.- Returns:
- fill values to use for pixels that can not be computed, or
null
for the defaults. - Since:
- 1.2
- See Also:
-
setFillValues
Sets the values to use for pixels that can not be computed. The default implementation delegates to the image processor.- Parameters:
values
- fill values to use for pixels that can not be computed, ornull
for the defaults.- Since:
- 1.2
- See Also:
-
mask
public GridCoverage mask(GridCoverage source, RegionOfInterest mask, boolean maskInside) throws TransformException Applies a mask defined by a region of interest (ROI). IfmaskInside
istrue
, then all pixels inside the given ROI are set to the fill values. IfmaskInside
isfalse
, then the mask is reversed: the pixels set to fill values are the ones outside the ROI.- Parameters:
source
- the coverage on which to apply a mask.mask
- region (in arbitrary CRS) of the mask.maskInside
-true
for masking pixels inside the shape, orfalse
for masking outside.- Returns:
- a coverage with mask applied.
- Throws:
TransformException
- if ROI coordinates can not be transformed to grid coordinates.- Since:
- 1.2
-
resample
Creates a new coverage with a different grid extent, resolution or coordinate reference system. The desired properties are specified by theGridGeometry
argument, which may be incomplete. The missing grid geometry components are completed as below:Default values for undefined grid geometry components Component Default value Grid extent A default size preserving resolution at source point of interest. Grid to CRS transform Whatever it takes for fitting data inside the supplied extent. Coordinate reference system Same as source coverage. setInterpolation(Interpolation)
. If the grid coverage values are themselves interpolated, this method tries to use the original data. The intent is to avoid adding interpolations on top of other interpolations.- Parameters:
source
- the grid coverage to resample.target
- the desired geometry of returned grid coverage. May be incomplete.- Returns:
- a grid coverage with the characteristics specified in the given grid geometry.
- Throws:
IncompleteGridGeometryException
- if the source grid geometry is missing an information. It may be the source CRS, the source extent, etc. depending on context.TransformException
- if some coordinates can not be transformed to the specified target.
-
equals
Returnstrue
if the given object is a coverage processor of the same class with the same configuration. -
hashCode
public int hashCode()Returns a hash code value for this coverage processor based on its current configuration. -
clone
Returns a coverage processor with the same configuration than this processor.
-