org.geotools.coverage.processing
Class Operations

java.lang.Object
  extended byorg.geotools.coverage.processing.Operations

public class Operations
extends java.lang.Object

Convenience, type-safe, methods for applying some common operations on coverage objects. All methods wrap their arguments in a parameter value group and delegate the work to the processor's doOperation method. This convenience class do not brings any new functionalities, but brings type-safety when the operation is know at compile time. For operation unknown at compile time (e.g. for an operation selected by users in some widget), use the processor directly.

Since:
2.2
Version:
$Id: Operations.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
org.geotools.coverage.processing.operation

Field Summary
static Operations DEFAULT
          The default instance.
 
Constructor Summary
Operations(java.awt.RenderingHints hints)
          Creates a new instance using the specified hints.
 
Method Summary
 org.opengis.coverage.Coverage absolute(org.opengis.coverage.Coverage source)
          Computes the mathematical absolute value of each sample value.
 org.opengis.coverage.Coverage add(org.opengis.coverage.Coverage source, double[] constants)
          Adds constants (one for each band) to every sample values of the source coverage.
 org.opengis.coverage.Coverage divideBy(org.opengis.coverage.Coverage source, double[] constants)
          Divides every sample values of the source coverage by constants (one for each band).
protected  org.opengis.coverage.Coverage doOperation(java.lang.String operationName, org.opengis.coverage.Coverage source)
          Applies a process operation with default parameters.
protected  org.opengis.coverage.Coverage doOperation(java.lang.String operationName, org.opengis.coverage.Coverage source, java.lang.String argumentName1, java.lang.Object argumentValue1)
          Applies a process operation with one parameter.
protected  org.opengis.coverage.Coverage doOperation(java.lang.String operationName, org.opengis.coverage.Coverage source, java.lang.String argumentName1, java.lang.Object argumentValue1, java.lang.String argumentName2, java.lang.Object argumentValue2)
          Applies process operation with two parameters.
protected  org.opengis.coverage.Coverage doOperation(java.lang.String operationName, org.opengis.coverage.Coverage source, java.lang.String argumentName1, java.lang.Object argumentValue1, java.lang.String argumentName2, java.lang.Object argumentValue2, java.lang.String argumentName3, java.lang.Object argumentValue3)
          Applies a process operation with three parameters.
 org.opengis.coverage.Coverage exp(org.opengis.coverage.Coverage source)
          Takes the exponential of the sample values of a coverage.
 org.opengis.coverage.Coverage gradientMagnitude(org.opengis.coverage.Coverage source)
          Edge detector which computes the magnitude of the image gradient vector in two orthogonal directions.
 org.opengis.coverage.Coverage gradientMagnitude(org.opengis.coverage.Coverage source, javax.media.jai.KernelJAI mask1, javax.media.jai.KernelJAI mask2)
          Edge detector which computes the magnitude of the image gradient vector in two orthogonal directions.
 org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source, javax.media.jai.Interpolation type)
          Specifies the interpolation type to be used to interpolate values for points which fall between grid cells.
 org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source, javax.media.jai.Interpolation[] types)
          Specifies the interpolation types to be used to interpolate values for points which fall between grid cells.
 org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source, java.lang.String type)
          Specifies the interpolation type to be used to interpolate values for points which fall between grid cells.
 org.opengis.coverage.Coverage invert(org.opengis.coverage.Coverage source)
          Inverts the sample values of a coverage.
 org.opengis.coverage.Coverage log(org.opengis.coverage.Coverage source)
          Takes the natural logarithm of the sample values of a coverage.
 org.opengis.coverage.Coverage multiply(org.opengis.coverage.Coverage source, double[] constants)
          Multiplies every sample values of the source coverage by constants (one for each band).
 org.opengis.coverage.grid.GridCoverage nodataFilter(org.opengis.coverage.grid.GridCoverage source)
          Replaces NaN values by the weighted average of neighbors values.
 org.opengis.coverage.grid.GridCoverage nodataFilter(org.opengis.coverage.grid.GridCoverage source, int padding, int validityThreshold)
          Replaces NaN values by the weighted average of neighbors values.
 org.opengis.coverage.Coverage resample(org.opengis.coverage.Coverage source, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Resamples a coverage to the specified coordinate reference system.
 org.opengis.coverage.Coverage resample(org.opengis.coverage.grid.GridCoverage source, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.coverage.grid.GridGeometry gridGeometry, javax.media.jai.Interpolation interpolationType)
          Resamples a grid coverage to the specified coordinate reference system and grid geometry.
 org.opengis.coverage.Coverage rescale(org.opengis.coverage.Coverage source, double[] constants, double[] offsets)
          Maps the sample values of a coverage from one range to another range.
 org.opengis.coverage.Coverage selectSampleDimension(org.opengis.coverage.Coverage source, int[] sampleDimensions)
          Chooses N sample dimensions from a coverage and copies their sample data to the destination grid coverage in the order specified.
 org.opengis.coverage.Coverage subtract(org.opengis.coverage.Coverage source, double[] constants)
          Subtracts constants (one for each band) from every sample values of the source coverage.
 org.opengis.coverage.Coverage subtractFrom(org.opengis.coverage.Coverage source, double[] constants)
          Subtracts every sample values of the source coverage from constants (one for each band).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final Operations DEFAULT
The default instance.

Constructor Detail

Operations

public Operations(java.awt.RenderingHints hints)
Creates a new instance using the specified hints.

Parameters:
hints - The hints, or if none.
Method Detail

add

public org.opengis.coverage.Coverage add(org.opengis.coverage.Coverage source,
                                         double[] constants)
Adds constants (one for each band) to every sample values of the source coverage.

Parameters:
source - The source coverage.
constants - The constants to add to each band.
See Also:
AddConst

subtract

public org.opengis.coverage.Coverage subtract(org.opengis.coverage.Coverage source,
                                              double[] constants)
Subtracts constants (one for each band) from every sample values of the source coverage.

Parameters:
source - The source coverage.
constants - The constants to subtract to each band.
See Also:
SubtractConst

subtractFrom

public org.opengis.coverage.Coverage subtractFrom(org.opengis.coverage.Coverage source,
                                                  double[] constants)
Subtracts every sample values of the source coverage from constants (one for each band).

Parameters:
source - The source coverage.
constants - The constants to subtract from.
See Also:
SubtractFromConst

multiply

public org.opengis.coverage.Coverage multiply(org.opengis.coverage.Coverage source,
                                              double[] constants)
Multiplies every sample values of the source coverage by constants (one for each band).

Parameters:
source - The source coverage.
constants - The constants to multiply to each band.
See Also:
MultiplyConst

divideBy

public org.opengis.coverage.Coverage divideBy(org.opengis.coverage.Coverage source,
                                              double[] constants)
Divides every sample values of the source coverage by constants (one for each band).

Parameters:
source - The source coverage.
constants - The constants to divides by.
See Also:
DivideByConst

rescale

public org.opengis.coverage.Coverage rescale(org.opengis.coverage.Coverage source,
                                             double[] constants,
                                             double[] offsets)
Maps the sample values of a coverage from one range to another range.

Parameters:
source - The source coverage.
constants - The constants to multiply to each band.
offsets - The constants to add to each band.
See Also:
Rescale

invert

public org.opengis.coverage.Coverage invert(org.opengis.coverage.Coverage source)
Inverts the sample values of a coverage.

Parameters:
source - The source coverage.
See Also:
Invert

absolute

public org.opengis.coverage.Coverage absolute(org.opengis.coverage.Coverage source)
Computes the mathematical absolute value of each sample value.

Parameters:
source - The source coverage.
See Also:
Absolute

log

public org.opengis.coverage.Coverage log(org.opengis.coverage.Coverage source)
Takes the natural logarithm of the sample values of a coverage.

Parameters:
source - The source coverage.
See Also:
Log

exp

public org.opengis.coverage.Coverage exp(org.opengis.coverage.Coverage source)
Takes the exponential of the sample values of a coverage.

Parameters:
source - The source coverage.
See Also:
Exp

interpolate

public org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source,
                                                          java.lang.String type)
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.

Parameters:
source - The source coverage.
type - The interpolation type. Possible values are , and .
See Also:
Interpolate

interpolate

public org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source,
                                                          javax.media.jai.Interpolation type)
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.

Parameters:
source - The source coverage.
type - The interpolation type as a JAI interpolation object.
See Also:
Interpolate

interpolate

public org.opengis.coverage.grid.GridCoverage interpolate(org.opengis.coverage.grid.GridCoverage source,
                                                          javax.media.jai.Interpolation[] types)
Specifies the interpolation types to be used to interpolate values for points which fall between grid cells. The first element in the array is the primary interpolation. All other elements are fallback to be used if the primary interpolation returns a value. See Interpolate operation for details.

Parameters:
source - The source coverage.
types - The interpolation types and their fallback.
See Also:
Interpolate

resample

public org.opengis.coverage.Coverage resample(org.opengis.coverage.Coverage source,
                                              org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Resamples a coverage to the specified coordinate reference system.

Parameters:
source - The source coverage.
crs - The target coordinate reference system.
See Also:
Resample

resample

public org.opengis.coverage.Coverage resample(org.opengis.coverage.grid.GridCoverage source,
                                              org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                                              org.opengis.coverage.grid.GridGeometry gridGeometry,
                                              javax.media.jai.Interpolation interpolationType)
Resamples a grid coverage to the specified coordinate reference system and grid geometry.

Parameters:
source - The source coverage.
crs - The target coordinate reference system, or for keeping it unchanged.
gridGeometry - The grid geometry, or for a default one.
interpolationType - The interpolation type, or for the default one.
See Also:
Resample

selectSampleDimension

public org.opengis.coverage.Coverage selectSampleDimension(org.opengis.coverage.Coverage source,
                                                           int[] sampleDimensions)
Chooses N sample dimensions from a coverage and copies their sample data to the destination grid coverage in the order specified.

Parameters:
source - The source coverage.
sampleDimensions - The sample dimensions to select.
See Also:
SelectSampleDimension

nodataFilter

public org.opengis.coverage.grid.GridCoverage nodataFilter(org.opengis.coverage.grid.GridCoverage source)
Replaces NaN values by the weighted average of neighbors values. This method uses the default padding and validity threshold.

Parameters:
source - The source coverage.
See Also:
NodataFilter

nodataFilter

public org.opengis.coverage.grid.GridCoverage nodataFilter(org.opengis.coverage.grid.GridCoverage source,
                                                           int padding,
                                                           int validityThreshold)
Replaces NaN values by the weighted average of neighbors values.

Parameters:
source - The source coverage.
See Also:
NodataFilter

gradientMagnitude

public org.opengis.coverage.Coverage gradientMagnitude(org.opengis.coverage.Coverage source)
Edge detector which computes the magnitude of the image gradient vector in two orthogonal directions. The default masks are the Sobel ones.

Parameters:
source - The source coverage.
See Also:
GradientMagnitude

gradientMagnitude

public org.opengis.coverage.Coverage gradientMagnitude(org.opengis.coverage.Coverage source,
                                                       javax.media.jai.KernelJAI mask1,
                                                       javax.media.jai.KernelJAI mask2)
Edge detector which computes the magnitude of the image gradient vector in two orthogonal directions.

Parameters:
source - The source coverage.
mask1 - The first mask.
mask2 - The second mask, orthogonal to the first one.
See Also:
GradientMagnitude

doOperation

protected final org.opengis.coverage.Coverage doOperation(java.lang.String operationName,
                                                          org.opengis.coverage.Coverage source)
                                                   throws org.opengis.coverage.processing.OperationNotFoundException
Applies a process operation with default parameters. This is a helper method for implementation of various convenience methods in this class.

Parameters:
operationName - Name of the operation to be applied to the coverage.
source - The source coverage.
Returns:
The result as a coverage.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation named .

doOperation

protected final org.opengis.coverage.Coverage doOperation(java.lang.String operationName,
                                                          org.opengis.coverage.Coverage source,
                                                          java.lang.String argumentName1,
                                                          java.lang.Object argumentValue1)
                                                   throws org.opengis.coverage.processing.OperationNotFoundException,
                                                          org.opengis.parameter.InvalidParameterNameException
Applies a process operation with one parameter. This is a helper method for implementation of various convenience methods in this class.

Parameters:
operationName - Name of the operation to be applied to the coverage.
source - The source coverage.
argumentName1 - The name of the first parameter to set.
argumentValue1 - The value for the first parameter.
Returns:
The result as a coverage.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation named .
org.opengis.parameter.InvalidParameterNameException - if there is no parameter with the specified name.

doOperation

protected final org.opengis.coverage.Coverage doOperation(java.lang.String operationName,
                                                          org.opengis.coverage.Coverage source,
                                                          java.lang.String argumentName1,
                                                          java.lang.Object argumentValue1,
                                                          java.lang.String argumentName2,
                                                          java.lang.Object argumentValue2)
                                                   throws org.opengis.coverage.processing.OperationNotFoundException,
                                                          org.opengis.parameter.InvalidParameterNameException
Applies process operation with two parameters. This is a helper method for implementation of various convenience methods in this class.

Parameters:
operationName - Name of the operation to be applied to the coverage.
source - The source coverage.
argumentName1 - The name of the first parameter to set.
argumentValue1 - The value for the first parameter.
argumentName2 - The name of the second parameter to set.
argumentValue2 - The value for the second parameter.
Returns:
The result as a coverage.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation named .
org.opengis.parameter.InvalidParameterNameException - if there is no parameter with the specified name.

doOperation

protected final org.opengis.coverage.Coverage doOperation(java.lang.String operationName,
                                                          org.opengis.coverage.Coverage source,
                                                          java.lang.String argumentName1,
                                                          java.lang.Object argumentValue1,
                                                          java.lang.String argumentName2,
                                                          java.lang.Object argumentValue2,
                                                          java.lang.String argumentName3,
                                                          java.lang.Object argumentValue3)
                                                   throws org.opengis.coverage.processing.OperationNotFoundException,
                                                          org.opengis.parameter.InvalidParameterNameException
Applies a process operation with three parameters. This is a helper method for implementation of various convenience methods in this class.

Parameters:
operationName - Name of the operation to be applied to the coverage.
source - The source coverage.
argumentName1 - The name of the first parameter to set.
argumentValue1 - The value for the first parameter.
argumentName2 - The name of the second parameter to set.
argumentValue2 - The value for the second parameter.
argumentName3 - The name of the third parameter to set.
argumentValue3 - The value for the third parameter.
Returns:
The result as a coverage.
Throws:
org.opengis.coverage.processing.OperationNotFoundException - if there is no operation named .
org.opengis.parameter.InvalidParameterNameException - if there is no parameter with the specified name.


Copyright © GeoTools. All Rights Reserved.