Class DiamondStrel

All Implemented Interfaces:
Algo, AlgoListener, Strel, SeparableStrel, Strel3D

public class DiamondStrel
extends AbstractSeparableStrel
Structuring element representing a diamond of a given diameter. The diamond is decomposed into linear diagonal and 3x3 cross structuring elements.
Author:
David Legland
See Also:
LinearDiagDownStrel, LinearDiagUpStrel, ShiftedCross3x3Strel
  • Constructor Details

    • DiamondStrel

      public DiamondStrel​(int size)
      Creates a new diamond structuring element of given diameter. Diameter must be odd.
      Parameters:
      size - the diameter of the diamond, that must be odd
      Throws:
      java.lang.IllegalArgumentException - if size is negative or zero
      java.lang.IllegalArgumentException - if size is even
    • DiamondStrel

      public DiamondStrel​(int size, int offset)
      Creates a new diamond structuring element with a given diameter and offset. Diameter must be odd and positive. Offset must be comprised between 0 and size-1.
      Parameters:
      size - the diameter of the diamond, that must be odd
      offset - the position of the reference point
      Throws:
      java.lang.IllegalArgumentException - if size is negative or zero
      java.lang.IllegalArgumentException - if size is even
      java.lang.IllegalArgumentException - if offset is negative or greater than size
  • Method Details

    • fromDiameter

      public static final DiamondStrel fromDiameter​(int diam)
      Creates a new diamond-shape structuring element with the specified diameter.
      Parameters:
      diam - the diameter of the diamond
      Returns:
      a new DiamondStrel instance
    • fromRadius

      public static final DiamondStrel fromRadius​(int radius)
      Creates a new diamond-shape structuring element with the specified radius (such that diameter equals 2 * radius + 1).
      Parameters:
      radius - the radius of the diamond
      Returns:
      a new DiamondStrel instance
    • getSize

      public int[] getSize()
      Description copied from interface: Strel
      Returns the size of the structuring element, as an array of size in each direction. The first index corresponds to the number of pixels in the x direction.
      Returns:
      the size of the structuring element
    • getMask

      public int[][] getMask()
      Description copied from interface: Strel
      Returns the structuring element as a mask. Each value is either 0 or 255. The first index corresponds to the y position, and the second index to the x direction.
      Returns:
      the mask of the structuring element
    • getOffset

      public int[] getOffset()
      Description copied from interface: Strel
      Returns the offset in the mask. The first value corresponds to the shift in the x direction.
      Returns:
      the offset in the mask
    • getShifts

      public int[][] getShifts()
      Description copied from interface: Strel
      Returns the structuring element as a set of shifts. The size of the result is N-by-2, where N is the number of elements of the structuring element. The first value corresponds to the shift in the x direction.
      Returns:
      a set of shifts
    • reverse

      public SeparableStrel reverse()
      Description copied from interface: SeparableStrel
      The reversed structuring element of a separable strel is also separable.
      Returns:
      the reversed structuring element
    • decompose

      public java.util.Collection<InPlaceStrel> decompose()
      Description copied from interface: SeparableStrel
      Decompose this separable structuring element into a set of smaller structuring elements that can be used to accelerate processing.
      Returns:
      a set of elementary structuring elements