Minimize Create Operator

The Operator interface is simple to extend. An Operator basically takes a source product as input and creates a new target product within initialize(). The algorithm implementation for what your operator does will go inside computTile() or computeTiles(). Operators work on the data tile by tile. The size of the tile may be dependent on the requests of other Operators in the graph.
N.B.: Please be aware that classes' name could be modified along the time.

 public interface Operator {
            OperatorSpi getSpi();
            Product initialize(OperatorContext context);
            void computeTile(Tile targetTile, ProgressMonitor pm);
            void computeTileStack(Rectangle targetTileRectangle, ProgressMonitor pm);
            void dispose();
            }

The computeTile and computeTileStack methods express different application requirements. Clients may either implement computeTile or computeTileStack or both. In general, the algorithm dictates which of the methods will be implemented. Some algorithms can compute their output bands independently (band-arithmetic, radiance to reflectance conversion), other cannot.

The GPF selects the method which best fits the application requirements:

  • In order to display an image of a band, the GPF is asked to compute tiles of single bands. The GPF therefore will prefer calling the computeTile method, if implemented. Otherwise it has to call computeTileStack, which might not be the best choice in this case.
  • In order to process in batch-mode or to save a product to disk, the GPF is asked to compute the tiles of all bands of a product. The GPF therefore will prefer calling the computeTileStack method, if implemented. Otherwise it will consecutively call the computeTile for each output band

Maven GPF Archetype

The Maven 2 Archetype Plugin for NEST GPF modules is used to create archetypes for NEST GPF modules.


A Maven Archetype is a template toolkit for generating a new module package. By using the Maven Archetype you can create a module structure easily and get started adding your code to the module.


A GPF Archetype will generate a single tile and a multi tile Operator within the same package.

Before beginning, make sure that you have built the NEST source code and do a maven install to ensure that all dependencies are in the repository.


From the command line type the following from the NEST source code root folder:

 

mvn archetype:create

-DarchetypeGroupId=org.esa.
nest.maven

-DarchetypeArtifactId=maven-
nest-gpf-archetype

-DarchetypeVersion=1.0

-DgroupId=myGroupId

-DartifactId=myArtifactId

-Dversion=myVersion

-DpackageName=myPackageName

where

  • myGroupId will become the groupId of the generated POM
  • myArtifactId will become the artifactId of the generated POM and the NEST module's symbolicName.
  • myVersion will become the version of the generated POM and NEST module. Defaults to 1.0-SNAPSHOT.
  • myPackageName will become the source package name. Defaults to the value of myGroupId
    .

Please also refer to the documentation of the Maven 2 Archetype Plugin.

Example

mvn archetype:create
-DarchetypeGroupId=org.esa.nest.maven
-DarchetypeArtifactId=maven-nest-gpf-archetype
-DarchetypeVersion=1.0
-DgroupId=org.esa.nest
-DartifactId=nest-sar-op

Publishing an Operator

Operator implementations are published via the Java service provider interface (SPI). A JAR publishes its operators in the resource file META-INF/services/org.esa.beam.framework.gpf.OperatorSpi. In this file add your operator SPI eg: org.esa.nest.gpf.MultilookOp$Spi


In your Operator package add a class to extend the OperatorSpi interface. This class may also serve as a factory for new operator instances.

 

    public static class Spi extends OperatorSpi {

         public Spi() {

             super(MultilookOp.class);

         }

    }

Adding Menu Item Actions

In the modules.xml file found in the resources folder of the package, add an Action to create a menu item in the DAT. State the class of the Action to be called and the text to show in the menu item.  

 

         <action>

             <id>SlantRangeGroundRangeOp</id>

             <class>org.esa.nest.dat.SRGROpAction</class>

             <text>Slant Range to Ground Range</text>

             <shortDescr>Converts a product to/from slant range to/from ground range</shortDescr>

             <parent>geometry</parent>

             <helpId>SRGROp</helpId>

         </action>

 

The Action class should extend AbstractVisatAction and override the handler for actionPerformed


public class SRGROpAction extends AbstractVisatAction {

    private DefaultSingleTargetProductDialog dialog;

    @Override

    public void actionPerformed(CommandEvent event) {

        if (dialog == null) {

            dialog = new DefaultSingleTargetProductDialog("SRGR", getAppContext(), "Slant Range to Ground Range", getHelpId());

            dialog.setTargetProductNameSuffix("_GR");

        }

        dialog.show();

    }

 

Minimize Resources

The European Space Agency is making NEST available free of charge to the user community