Class ConfigGridCoefND

java.lang.Object
org.ddogleg.chainrule.grid.ConfigGridCoefND
All Implemented Interfaces:
MapFormattable

public class ConfigGridCoefND extends Object implements MapFormattable

Configuration for a polynomial grid where each cell in the grid has a numOut polynomials with coefs coefficients each.

Padding says how many of the outermost rows and columns sit outside the image. The totals do not change, so neither does dof() or where anything lives in the parameter array. What changes is the coordinate transform: the interior shrinks to cols - 2*padding knots and the cells grow to match, which buys coverage for points outside the image at the cost of resolution inside it.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Number of coefficients in each output polynomial
    int
    Number of columns and rows in the grid, padding included
    static final int
    How many weights are produced, one per knot of the cell
    int
    Number of outputs for cell
    int
    How many of the outermost rows and columns lie outside the image
    int
    Number of columns and rows in the grid, padding included
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    cellIndex(double gridCoor, int count)
    Cell a fractional grid coordinate falls in.
    void
    Makes sure valid values have been entered for all parameters.
    void
    checkValid(int minAxis)
    checkValid() with the per-axis knot minimum given.
    int
    dof()
    Number of parameters needed to describe this polynomial grid
     
    boolean
    True if every field matches exactly
    void
    knotOffsets(int col, int row, int offset, int[] knotOffsets)
    Where each of a cell's four knots starts in the parameter array
    int
    How many parameters one knot holds
    static int
    nearestIndex(double pixel, int count, int size)
    Knot a pixel is nearest to when the axis tiles the image as count equal bands rather than a bilinear lattice of corner knots: band k owns [k*size/count, (k+1)*size/count), so the knot sits at the band's center.
    double
    pixelToGridX(double pixelX, int width)
    Fractional grid coordinate of a pixel, where a whole number is a knot.
    double
    pixelToGridY(double pixelY, int height)
     
    Resets parameters to an invalid value so you will know if they have been initialled
     
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface MapFormattable

    formatMap
  • Field Details

    • NUM_KNOTS

      public static final int NUM_KNOTS
      How many weights are produced, one per knot of the cell
      See Also:
    • cols

      public int cols
      Number of columns and rows in the grid, padding included
    • rows

      public int rows
      Number of columns and rows in the grid, padding included
    • coefs

      public int coefs
      Number of coefficients in each output polynomial
    • numOut

      public int numOut
      Number of outputs for cell
    • padding

      public int padding
      How many of the outermost rows and columns lie outside the image
  • Constructor Details

    • ConfigGridCoefND

      public ConfigGridCoefND()
  • Method Details

    • checkValid

      public void checkValid()
      Makes sure valid values have been entered for all parameters. Two knots per axis is the minimum a bilinear read needs, which is what every consumer here does
    • checkValid

      public void checkValid(int minAxis)
      checkValid() with the per-axis knot minimum given. Bilinear needs 2, but a nearest-neighbor field reads a single knot and so can run on a 1x1 grid
    • reset

      public ConfigGridCoefND reset()
      Resets parameters to an invalid value so you will know if they have been initialled
    • setTo

      public ConfigGridCoefND setTo(ConfigGridCoefND src)
    • isIdentical

      public boolean isIdentical(ConfigGridCoefND o)
      True if every field matches exactly
    • dof

      public int dof()
      Number of parameters needed to describe this polynomial grid
    • knotStride

      public int knotStride()
      How many parameters one knot holds
    • pixelToGridX

      public double pixelToGridX(double pixelX, int width)
      Fractional grid coordinate of a pixel, where a whole number is a knot. 0 and width land on the first and last knot inside the image, which padding moves inwards
    • pixelToGridY

      public double pixelToGridY(double pixelY, int height)
      See Also:
    • cellIndex

      public static int cellIndex(double gridCoor, int count)
      Cell a fractional grid coordinate falls in. The last knot along an axis starts no cell of its own, and a coordinate outside the grid is given the nearest cell to extrapolate from
    • nearestIndex

      public static int nearestIndex(double pixel, int count, int size)
      Knot a pixel is nearest to when the axis tiles the image as count equal bands rather than a bilinear lattice of corner knots: band k owns [k*size/count, (k+1)*size/count), so the knot sits at the band's center. Unlike cellIndex(double, int) every knot owns a band and the result spans [0, count-1]. Padding plays no part; the bands cover the whole image
    • knotOffsets

      public void knotOffsets(int col, int row, int offset, int[] knotOffsets)
      Where each of a cell's four knots starts in the parameter array
      Parameters:
      col - Column of the cell's low corner
      row - Row of the cell's low corner
      offset - Where this grid's parameters start in the array
      knotOffsets - Output, the four locations in the order CROperatorGridBilinearWeights expects
    • formatMap

      public String formatMap(MapPrintFormat format)
      Specified by:
      formatMap in interface MapFormattable
    • toString

      public String toString()
      Overrides:
      toString in class Object