Class BandMerge
- Object
-
- AbstractOperation
-
- Operation2D
-
- OperationJAI
-
- BandMerge
-
- All Implemented Interfaces:
Serializable
,Operation
public class BandMerge extends OperationJAI
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BandMerge.TransformList
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
Fields Modifier and Type Field Description static String
COVERAGE_INDEX
Name for the COVERAGE_INDEX parameterstatic String
GEOMETRY
Name for the GEOMETRY parameterstatic ParameterDescriptor<Geometry>
GEOMETRY_PARAM
The parameter descriptor for the Transformation Choice.static ParameterDescriptor<Integer>
INDEX
The parameter descriptor for the Source index to use for selecting the Affine Transformation to use.static ParameterDescriptor<Collection>
SOURCES
The parameter descriptor for the Sources.static String
TRANSFORM_CHOICE
Name for the TRANSFORM_CHOICE parameterstatic ParameterDescriptor<String>
TRANSFORM_CHOICE_PARAM
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 Constructor Description BandMerge()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GridSampleDimension[]
deriveSampleDimension(GridSampleDimension[][] list, OperationJAI.Parameters parameters)
Returns the sample dimensions for the target grid coverage.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 Detail
-
TRANSFORM_CHOICE
public static final String TRANSFORM_CHOICE
Name for the TRANSFORM_CHOICE parameter- See Also:
- Constant Field Values
-
COVERAGE_INDEX
public static final String COVERAGE_INDEX
Name for the COVERAGE_INDEX parameter- See Also:
- Constant Field Values
-
GEOMETRY
public static final String GEOMETRY
Name for the GEOMETRY parameter- See Also:
- Constant Field Values
-
SOURCES
public static final ParameterDescriptor<Collection> SOURCES
The parameter descriptor for the Sources.
-
TRANSFORM_CHOICE_PARAM
public static final ParameterDescriptor<String> TRANSFORM_CHOICE_PARAM
The parameter descriptor for the Transformation Choice.
-
INDEX
public static final ParameterDescriptor<Integer> INDEX
The parameter descriptor for the Source index to use for selecting the Affine Transformation to use.
-
GEOMETRY_PARAM
public static final ParameterDescriptor<Geometry> GEOMETRY_PARAM
The parameter descriptor for the Transformation Choice.
-
-
Method Detail
-
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:
OperationJAI.deriveGridCoverage(org.geotools.coverage.grid.GridCoverage2D[], org.geotools.coverage.processing.OperationJAI.Parameters)
- 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:
OperationJAI.deriveCategory(org.geotools.coverage.Category[], org.geotools.coverage.processing.OperationJAI.Parameters)
,OperationJAI.deriveUnit(javax.measure.Unit<?>[], org.geotools.coverage.processing.OperationJAI.Parameters)
- The
-
-