Enum Class BoundaryCondition

java.lang.Object
java.lang.Enum<BoundaryCondition>
com.xinapse.image.BoundaryCondition
All Implemented Interfaces:
Serializable, Comparable<BoundaryCondition>, Constable

public enum BoundaryCondition extends Enum<BoundaryCondition>
An enumeration of possible boundary conditions when applying, for example, spatial filters and interpolators. The BoundaryCondition determines the behaviour when accessing values outside the array of pixel values (e.g., when filtering images, it determines the filtered pixel values that are near the boundary of the image).

The examples given for each boundary condition illustrate the behaviour for 1-D kernel filter with a kernel of width 5. An array of pixel values on the left behaves as the array on the right when that boundary condition is applied.

  • Enum Constant Details

    • NEAREST

      public static final BoundaryCondition NEAREST
      Use the value at the boundary: [1 2 3 4 5] → [1 1 1 2 3 4 5 5 5].
    • PERIODIC

      public static final BoundaryCondition PERIODIC
      Periodically replicate the array: [1 2 3 4 5] → [4 5 1 2 3 4 5 1 2]. Also known as a "circulant" boundary condition.
    • REFLECT

      public static final BoundaryCondition REFLECT
      Reflect the array at the boundary: [1 2 3 4 5] → [2 1 1 2 3 4 5 5 4].
    • FIXED

      public static final BoundaryCondition FIXED
      Use a fixed value, for example if zero is used: [1 2 3 4 5] → [0 0 1 2 3 4 5 0 0].
  • Method Details

    • values

      public static BoundaryCondition[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BoundaryCondition valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static BoundaryCondition getInstance(String bc) throws IllegalArgumentException
      Returns the BoundaryCondition corresponding to the supplied string.
      Parameters:
      bc - a String which is one of "NEAREST", "PERIODIC", "REFLECT", or "FIXED".
      Returns:
      the BoundaryCondition corresponding to the supplied string.
      Throws:
      IllegalArgumentException - if bc does not match any of these,
    • getIndex

      public int getIndex(int i, int size)
      For this BoundaryCondition, returns the index into an array of values for an index that is possibly outside the array of values.
      Parameters:
      i - the index.
      size - the size of the array.
      Returns:
      the index that is inside the array of values according to the BoundaryCondition. For FIXED, -1 is returned if the the supplied index is less than zero, or size if the the supplied index is greater than or equal to size.
      Throws:
      IllegalArgumentException - if size is not positive.
    • main

      public static void main(String[] args)
      Runs the self-test for this class.
      Parameters:
      args - ignored.