Class Extrema
-
- All Implemented Interfaces:
Serializable
,Operation
public class Extrema extends BaseStatisticsOperationJAI
This operation simply wraps JAI Extrema operations described byExtremaDescriptor
inside a GeoTools operation in order to make it spatial-aware.For the moment this is a very simple wrap. Plans on the 2.4 and successive versions of this operation are to add the ability to use spatial ROIs and to specific Spatial subsampling. As of now, ROI has to be a Java2D
Shape
subclass and the parameters to control x and y subsamplings got to be Integer, which means pixel-aware.For more information on how the underlying
JAI
operators works you can have a look here: ExtremaDescriptorHow to use this operation Here is a very simple example on how to use this operation in order to the minimum and maximum of the source coverage.
final OperationJAI op=new OperationJAI("Extrema"); ParameterValueGroup params = op.getParameters(); params.parameter("Source").setValue(coverage); coverage=(GridCoverage2D) op.doOperation(params,null); System.out.println(((double[])coverage.getProperty("minimum"))[0]); System.out.println(((double[])coverage.getProperty("minimum"))[1]); System.out.println(((double[])coverage.getProperty("minimum"))[2]); System.out.println(((double[])coverage.getProperty("maximum"))[0]); System.out.println(((double[])coverage.getProperty("maximum"))[1]); System.out.println(((double[])coverage.getProperty("maximum"))[2]);
- Since:
- 2.4
- Author:
- Simone Giannecchini
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class OperationJAI
OperationJAI.Parameters
-
-
Field Summary
Fields Modifier and Type Field Description static String
GT_SYNTHETIC_PROPERTY_MAX_LOCATIONS
Locations of max values.static String
GT_SYNTHETIC_PROPERTY_MAXIMUM
String
key for getting the maximum vector.static String
GT_SYNTHETIC_PROPERTY_MIN_LOCATIONS
Locations of min values.static String
GT_SYNTHETIC_PROPERTY_MINIMUM
String
key for getting the minimum vector.static Logger
LOGGER
Logger
for this class.-
Fields inherited from class BaseStatisticsOperationJAI
ROI, SPATIAL_SUBSAMPLING_X, SPATIAL_SUBSAMPLING_Y
-
Fields inherited from class OperationJAI
operation, RENDERED_MODE
-
Fields inherited from class Operation2D
PRIMARY_SOURCE_INDEX, SOURCE_0
-
Fields inherited from class AbstractOperation
descriptor
-
-
Constructor Summary
Constructors Constructor Description Extrema()
Constructs a default"Extrema"
operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Returns the name of the processing operation.protected Map<String,?>
getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform toCRS, GridCoverage2D[] sources, OperationJAI.Parameters parameters)
Prepare the minimum and maximum properties for this extream operation.protected void
handleJAIEXTParams(ParameterBlockJAI parameters, ParameterValueGroup parameters2)
Extension point for adding to the JAIParameterBlockJAI
object the parameters defined in theParameterValueGroup
, which can be read by the JAI-EXT operations.-
Methods inherited from class BaseStatisticsOperationJAI
convertPolygon, prepareParameters
-
Methods inherited from class OperationJAI
createRenderedImage, deriveCategory, deriveGridCoverage, deriveName, deriveRange, deriveSampleDimension, deriveUnit, doOperation, equals, extractSources, getJAI, getOperationDescriptor, getQuantitative, handleROINoDataInternal, handleROINoDataProperties, hashCode, resampleToCommonGeometry
-
Methods inherited from class Operation2D
extractSources, getFactory
-
Methods inherited from class AbstractOperation
getDescription, getDocURL, getNumSources, getParameters, getVendor, getVersion, toString
-
-
-
-
Field Detail
-
GT_SYNTHETIC_PROPERTY_MINIMUM
public static final String GT_SYNTHETIC_PROPERTY_MINIMUM
String
key for getting the minimum vector.- See Also:
- Constant Field Values
-
GT_SYNTHETIC_PROPERTY_MAXIMUM
public static final String GT_SYNTHETIC_PROPERTY_MAXIMUM
String
key for getting the maximum vector.- See Also:
- Constant Field Values
-
GT_SYNTHETIC_PROPERTY_MIN_LOCATIONS
public static final String GT_SYNTHETIC_PROPERTY_MIN_LOCATIONS
Locations of min values.- See Also:
- Constant Field Values
-
GT_SYNTHETIC_PROPERTY_MAX_LOCATIONS
public static final String GT_SYNTHETIC_PROPERTY_MAX_LOCATIONS
Locations of max values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Extrema
public Extrema() throws OperationNotFoundException
Constructs a default"Extrema"
operation.- Throws:
OperationNotFoundException
-
-
Method Detail
-
getName
public String getName()
Description copied from class:AbstractOperation
Returns the name of the processing operation. The default implementation returns the AbstractOperation.descriptor code name.- Specified by:
getName
in interfaceOperation
- Overrides:
getName
in classAbstractOperation
- Returns:
- The name of the processing operation.
-
getProperties
protected Map<String,?> getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform toCRS, GridCoverage2D[] sources, OperationJAI.Parameters parameters)
Prepare the minimum and maximum properties for this extream operation.See ExtremaDescriptor for more info.
- Overrides:
getProperties
in classOperationJAI
- Parameters:
data
- TheRenderedImage
created by this operation.crs
- The coordinate reference system assigned to the coverage thisOperationJAI
will produce.name
- The name assigned to the coverage thisOperationJAI
will produce.toCRS
- The transform from grid tocrs
to be assigned to the coverage thisOperationJAI
will produce.sources
- The sources to be assigned to the coverage thisOperationJAI
will produce.parameters
- The parameters that were used by thisOperationJAI
.- Returns:
- a
Map
with the properties generated by thisOperationJAI
or null if we haven't any.
-
handleJAIEXTParams
protected void handleJAIEXTParams(ParameterBlockJAI parameters, ParameterValueGroup parameters2)
Description copied from class:OperationJAI
Extension point for adding to the JAIParameterBlockJAI
object the parameters defined in theParameterValueGroup
, which can be read by the JAI-EXT operations.Notice that if you are using JAI, the new parameters will not be accepted by the
ParameterBlockJAI
instance.- Overrides:
handleJAIEXTParams
in classOperationJAI
- Parameters:
parameters
-ParameterBlockJAI
instance used by the current JAI-EXT/JAI operationparameters2
-ParameterValueGroup
instance containing input operation parameters
-
-