Class GPF


  • public class GPF
    extends Object

    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
    • Constructor Detail

      • GPF

        protected GPF()
        Constructor.
    • Method Detail

      • createProduct

        public static Product createProduct​(String operatorName,
                                            Map<String,​Object> parameters)
                                     throws OperatorException
        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 to createProduct(). 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 OperatorException
        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 to createProduct(). 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 be null.
        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 OperatorException
        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 to createProduct(). 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 OperatorException
        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 to createProduct(). 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 be null.
        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 OperatorException
        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 to createProduct(). 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 OperatorException
        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 to createProduct(). 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 be null.
        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,​Product> sourceProducts)
                                     throws OperatorException
        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 to createProduct(). 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,​Product> sourceProducts,
                                            RenderingHints renderingHints)
                                     throws OperatorException
        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 to createProduct(). 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 be null.
        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 to createProduct(). 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 static createProduct 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 be null.
        Returns:
        the product created by the operator.
        Throws:
        OperatorException - if the product could not be created.
      • executeOperator

        public void executeOperator​(Operator operator)
        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 be null.
        Returns:
        the product created by the operator.
        Throws:
        OperatorException - if the product could not be created.
        Since:
        BEAM 4.9
      • getOperatorSpiRegistry

        public OperatorSpiRegistry getOperatorSpiRegistry()
        Gets the registry for operator SPIs.
        Returns:
        the registry for operator SPIs.
      • getUpsamplerSpiRegistry

        public UpsamplerSpiRegistry getUpsamplerSpiRegistry()
        Gets the registry for upsampler SPIs.
        Returns:
        the registry for upsampler SPIs.
      • getDownsamplerSpiRegistry

        public DownsamplerSpiRegistry getDownsamplerSpiRegistry()
        Gets the registry for downsampler SPIs.
        Returns:
        the registry for downsampler SPIs.
      • setOperatorSpiRegistry

        public void setOperatorSpiRegistry​(OperatorSpiRegistry spiRegistry)
        Sets the registry for operator SPIs.
        Parameters:
        spiRegistry - the registry for operator SPIs.
      • getDefaultInstance

        public static GPF getDefaultInstance()
        Gets the default GPF instance.
        Returns:
        the singelton instance.
      • setDefaultInstance

        public static void setDefaultInstance​(GPF defaultInstance)
        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 product
        file - the product file
        formatName - the name of a supported product format, e.g. "HDF5". If null, the default format "BEAM-DIMAP" will be used
        incremental - 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 product
        file - the product file
        formatName - the name of a supported product format, e.g. "HDF5". If null, the default format "BEAM-DIMAP" will be used
        clearCacheAfterRowWrite - 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

        public ProductManager 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

        public 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.
        Parameters:
        productManager - The new context product manager.
        Since:
        SNAP 3.0