Class BandMerge
Object
AbstractOperation
Operation2D
OperationJAI
BandMerge
- All Implemented Interfaces:
Serializable
,Operation
OperationJAI
subclass used for executing the "Merge" of multiple coverages into a single coverage with
multiple bands. This operation can be used also for merging coverages which are not aligned and with different
resolutions. The user should only set: *
- the Coverages (Note that they must be in the same CRS).
- the optional Geometry to use as ROI.
- The optional policy for choosing the Grid To World transformation(FIRST for that of the first coverage, LAST for the last one, INDEX for that of a coverage defined by the "index" parameter).
- the index parameter for choosing the main Coverage.
- Author:
- Nicola Lagomarsini, GeoSolutions S.A.S.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum used for selecting an Affine Transformation to use for backward mapping the final coverage pixel to the Model Space.Nested classes/interfaces inherited from class OperationJAI
OperationJAI.Parameters
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name for the COVERAGE_INDEX parameterstatic final String
Name for the GEOMETRY parameterstatic final ParameterDescriptor<Geometry>
The parameter descriptor for the Transformation Choice.static final ParameterDescriptor<Integer>
The parameter descriptor for the Source index to use for selecting the Affine Transformation to use.static final ParameterDescriptor<Collection>
The parameter descriptor for the Sources.static final String
Name for the TRANSFORM_CHOICE parameterstatic final ParameterDescriptor<String>
The parameter descriptor for the Transformation Choice.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 -
Method Summary
Modifier and TypeMethodDescriptionprotected GridSampleDimension[]
deriveSampleDimension
(GridSampleDimension[][] list, OperationJAI.Parameters parameters) Returns the sample dimensions for the target grid coverage.doOperation
(ParameterValueGroup parameters, Hints hints) Applies a process operation to a grid coverage.protected void
extractSources
(ParameterValueGroup parameters, Collection<GridCoverage2D> sources) Extraction of the sources from the parameter called SOURCES.protected Map
getProperties
(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform toCRS, GridCoverage2D[] sources, BandMerge.BandMergeParams parameters) Methods inherited from class OperationJAI
createRenderedImage, deriveCategory, deriveGridCoverage, deriveName, deriveRange, deriveUnit, equals, extractSources, getJAI, getOperationDescriptor, getProperties, getQuantitative, handleJAIEXTParams, handleROINoDataInternal, handleROINoDataProperties, hashCode, prepareParameters, resampleToCommonGeometry
Methods inherited from class Operation2D
extractSources, getFactory
Methods inherited from class AbstractOperation
getDescription, getDocURL, getName, getNumSources, getParameters, getVendor, getVersion, toString
-
Field Details
-
TRANSFORM_CHOICE
Name for the TRANSFORM_CHOICE parameter- See Also:
-
COVERAGE_INDEX
Name for the COVERAGE_INDEX parameter- See Also:
-
GEOMETRY
Name for the GEOMETRY parameter- See Also:
-
SOURCES
The parameter descriptor for the Sources. -
TRANSFORM_CHOICE_PARAM
The parameter descriptor for the Transformation Choice. -
INDEX
The parameter descriptor for the Source index to use for selecting the Affine Transformation to use. -
GEOMETRY_PARAM
The parameter descriptor for the Transformation Choice.
-
-
Constructor Details
-
BandMerge
public BandMerge()
-
-
Method Details
-
doOperation
public Coverage doOperation(ParameterValueGroup parameters, Hints hints) throws CoverageProcessingException Description copied from class:OperationJAI
Applies a process operation to a grid coverage. The default implementation performs the following steps:- Ensures that every sources
GridCoverage2D
s use the same coordinate reference system (at least for the two-dimensional part) with the samegridToCRS
relationship. - Invokes
OperationJAI.deriveGridCoverage(org.geotools.coverage.grid.GridCoverage2D[], org.geotools.coverage.processing.OperationJAI.Parameters)
. The sources in theParameterBlock
areRenderedImage
objects obtained fromGridCoverage2D.getRenderedImage()
. - If a changes from non-geophysics to geophysics view were performed at step 1, converts the result back to
the original view using
GridCoverage2D.geophysics(false)
.
- Overrides:
doOperation
in classOperationJAI
- Parameters:
parameters
- List of name value pairs for the parameters required for the operation.hints
- A set of rendering hints, ornull
if none.- Returns:
- The result as a grid coverage.
- Throws:
CoverageProcessingException
- if the operation can't be applied.- See Also:
- Ensures that every sources
-
extractSources
protected void extractSources(ParameterValueGroup parameters, Collection<GridCoverage2D> sources) throws ParameterNotFoundException, InvalidParameterValueException Extraction of the sources from the parameter called SOURCES. The sources are stored inside a List. -
getProperties
protected Map getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform toCRS, GridCoverage2D[] sources, BandMerge.BandMergeParams parameters) -
deriveSampleDimension
protected GridSampleDimension[] deriveSampleDimension(GridSampleDimension[][] list, OperationJAI.Parameters parameters) Description copied from class:OperationJAI
Returns the sample dimensions for the target grid coverage. This method is invoked automatically byderiveGridCoverage
with abandLists
argument initialized as below:- The
bandLists
array length is equals to the number of source coverages. - The
bandLists[i]
array length is equals to the number of sample dimensions in the source coverage i. - The sample dimension for a band at index band in the source at index source is
bandLists[source][band]
.
This method shall returns an array with a length equals to the number of bands in the target image. If the sample dimensions can't be determined, then this method is allowed to returns
null
.The default implementation iterates among all bands and invokes the
deriveCategory
andderiveUnit
methods for each of them. Subclasses should override this method if they know a more accurate algorithm for determining sample dimensions.- Overrides:
deriveSampleDimension
in classOperationJAI
- Parameters:
list
- The set of sample dimensions for each sourceGridCoverage2D
s.parameters
- Parameters, rendering hints and coordinate reference system to use.- Returns:
- The sample dimensions for each band in the destination image, or
null
if unknown. - See Also:
- The
-