Class GPF
The facade for the Graph Processing Framework.
The Graph Processing Framework makes extensive use of Java Advanced Imaging (JAI).
Therefore, configuring the JAI TileCache
and
TileScheduler
will also affect the overall performance of
the Graph Processing Framework.
This class may be overridden in order to alter product creation behaviour of the static
createProduct
methods of the GPF instance.
The current instance can be set by setDefaultInstance(GPF)
.
- Since:
- 4.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOperator
(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts, RenderingHints renderingHints) Creates an operator instance by using the given operator (alias) name.static Product
createProduct
(String operatorName, Map<String, Object> parameters) Creates a product by using the operator specified by the given name.static Product
createProduct
(String operatorName, Map<String, Object> parameters, RenderingHints renderingHints) Creates a product by using the operator specified by the given name.static Product
createProduct
(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts) Creates a product by using the operator specified by the given name.static Product
createProduct
(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts, RenderingHints renderingHints) Creates a product by using the operator specified by the given name.static Product
Creates a product by using the operator specified by the given name.static Product
Creates a product by using the operator specified by the given name.static Product
createProduct
(String operatorName, Map<String, Object> parameters, Product[] sourceProducts, RenderingHints renderingHints) Creates a product by using the operator specified by the given name.static Product
createProduct
(String operatorName, Map<String, Object> parameters, Product sourceProduct, RenderingHints renderingHints) Creates a product by using the operator specified by the given name.createProductNS
(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts, RenderingHints renderingHints) Creates a product by using the operator specified by the given name.void
executeOperator
(Operator operator) Calls the execute method of an operator and sets an appropriate progress monitor.static GPF
Gets the default GPF instance.Gets the registry for downsampler SPIs.Gets the registry for operator SPIs.Gets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.Gets the registry for upsampler SPIs.static void
setDefaultInstance
(GPF defaultInstance) Sets the default GPF instance.void
setOperatorSpiRegistry
(OperatorSpiRegistry spiRegistry) Sets the registry for operator SPIs.void
setProductManager
(ProductManager productManager) Sets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.void
setProgressMonitoredOperatorExecutor
(ProgressMonitoredOperatorExecutor operatorExecutor) static void
writeProduct
(Product product, File file, String formatName, boolean clearCacheAfterRowWrite, boolean incremental, ProgressMonitor pm) Writes a product with the specified format to the given file.static void
writeProduct
(Product product, File file, String formatName, boolean incremental, ProgressMonitor pm) Writes a product with the specified format to the given file.
-
Field Details
-
DISABLE_TILE_CACHE_PROPERTY
- See Also:
-
USE_FILE_TILE_CACHE_PROPERTY
- See Also:
-
TILE_COMPUTATION_OBSERVER_PROPERTY
- See Also:
-
BEEP_AFTER_PROCESSING_PROPERTY
- See Also:
-
SNAP_GPF_ALLOW_AUXDATA_DOWNLOAD
- See Also:
-
SOURCE_PRODUCT_FIELD_NAME
- See Also:
-
TARGET_PRODUCT_FIELD_NAME
- See Also:
-
KEY_TILE_SIZE
Key for GPF tile sizeRenderingHints
.The value for this key must be an instance of
Dimension
with both width and height positive. -
NO_PARAMS
An unmodifiable emptyMap
.Can be used for convenience as a parameter for
createProduct()
if no parameters are needed for the operator.- See Also:
-
NO_SOURCES
An unmodifiable emptyMap
.Can be used for convenience as a parameter for
createProduct(String, Map, Map)
if no source products are needed for the operator.- See Also:
-
-
Constructor Details
-
GPF
protected GPF()Constructor.
-
-
Method Details
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, RenderingHints renderingHints) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Product sourceProduct) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProduct
- a source product.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Product sourceProduct, RenderingHints renderingHints) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProduct
- the source product.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Product... sourceProducts) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the source products.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Product[] sourceProducts, RenderingHints renderingHints) throws OperatorExceptionCreates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the source products.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Map<String, throws OperatorExceptionProduct> sourceProducts) Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String, Object> parameters, Map<String, throws OperatorExceptionProduct> sourceProducts, RenderingHints renderingHints) Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProductNS
public Product createProductNS(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts, RenderingHints renderingHints) Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.All static
createProduct
methods delegate to this non-static (= NS) version. It can be overriden by clients in order to alter product creation behaviour of the staticcreateProduct
methods of the current GPF instance.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
executeOperator
Calls the execute method of an operator and sets an appropriate progress monitor.- Parameters:
operator
- The operator on which the execute method shall be called
-
createOperator
public Operator createOperator(String operatorName, Map<String, Object> parameters, Map<String, Product> sourceProducts, RenderingHints renderingHints) Creates an operator instance by using the given operator (alias) name.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.- Since:
- BEAM 4.9
-
getOperatorSpiRegistry
Gets the registry for operator SPIs.- Returns:
- the registry for operator SPIs.
-
getUpsamplerSpiRegistry
Gets the registry for upsampler SPIs.- Returns:
- the registry for upsampler SPIs.
-
getDownsamplerSpiRegistry
Gets the registry for downsampler SPIs.- Returns:
- the registry for downsampler SPIs.
-
setOperatorSpiRegistry
Sets the registry for operator SPIs.- Parameters:
spiRegistry
- the registry for operator SPIs.
-
getDefaultInstance
Gets the default GPF instance.- Returns:
- the singelton instance.
-
setDefaultInstance
Sets the default GPF instance.- Parameters:
defaultInstance
- the GPF default instance.
-
writeProduct
public static void writeProduct(Product product, File file, String formatName, boolean incremental, ProgressMonitor pm) Writes a product with the specified format to the given file.- Parameters:
product
- the productfile
- the product fileformatName
- the name of a supported product format, e.g. "HDF5". Ifnull
, the default format "BEAM-DIMAP" will be usedincremental
- switch the product writer in incremental mode or not.pm
- a monitor to inform the user about progress
-
writeProduct
public static void writeProduct(Product product, File file, String formatName, boolean clearCacheAfterRowWrite, boolean incremental, ProgressMonitor pm) Writes a product with the specified format to the given file.- Parameters:
product
- the productfile
- the product fileformatName
- the name of a supported product format, e.g. "HDF5". Ifnull
, the default format "BEAM-DIMAP" will be usedclearCacheAfterRowWrite
- if true, the internal tile cache is cleared after a tile row has been written.incremental
- switch the product writer in incremental mode or not.pm
- a monitor to inform the user about progress
-
getProductManager
Gets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.- Returns:
- The context product manager.
- Since:
- SNAP 3.0
-
setProductManager
Sets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.- Parameters:
productManager
- The new context product manager.- Since:
- SNAP 3.0
-
setProgressMonitoredOperatorExecutor
public void setProgressMonitoredOperatorExecutor(ProgressMonitoredOperatorExecutor operatorExecutor)
-