Class SampleOperator


  • public abstract class SampleOperator
    extends PointOperator
    A SampleOperator may serve as a handy base class for an operator that computes a single target sample from any number of source samples.
    Since:
    BEAM 4.9, revised in SNAP 2.0
    • Constructor Detail

      • SampleOperator

        public SampleOperator()
    • Method Detail

      • computeSample

        protected abstract void computeSample​(int x,
                                              int y,
                                              Sample[] sourceSamples,
                                              WritableSample targetSample)
        Computes a single target sample from the given source samples.

        The number of source samples is the maximum defined source sample index plus one. Source samples are defined by using the sample configurer in the configureSourceSamples method. Attempts to read from source samples at undefined sample indices will cause undefined behaviour.

        Parameters:
        x - The current pixel's X coordinate.
        y - The current pixel's Y coordinate.
        sourceSamples - The source samples (= source pixel).
        targetSample - The single target sample.
      • computeTile

        public final void computeTile​(Band targetBand,
                                      Tile targetTile,
                                      ProgressMonitor pm)
                               throws OperatorException
        Overridden to call the computeSample method for every pixel in the given tile's rectangle.
        Overrides:
        computeTile in class Operator
        Parameters:
        targetBand - The target band.
        targetTile - The current tile associated with the target band to be computed.
        pm - A progress monitor which should be used to determine computation cancellation requests.
        Throws:
        OperatorException - If an error occurs during computation of the target raster