Class OctagonStrel

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

public class OctagonStrel
extends AbstractSeparableStrel
An Octagonal structuring element, obtained by decomposition into horizontal, vertical, and diagonal linear structuring elements.
Author:
David Legland
See Also:
SquareStrel
  • Constructor Details

    • OctagonStrel

      public OctagonStrel​(int size)
      Creates a new octagonal structuring element of a given orthogonal diameter.
      Parameters:
      size - the orthogonal diameter of the octagon
    • OctagonStrel

      public OctagonStrel​(int size, int offset)
      Creates a new octagonal structuring element of a given orthogonal diameter and with a given offset.
      Parameters:
      size - the orthogonal diameter of the octagon
      offset - the position of the reference pixel in each direction
      Throws:
      java.lang.IllegalArgumentException - if size is negative or zero
      java.lang.IllegalArgumentException - if offset is negative or greater than size
  • Method Details

    • fromDiameter

      public static final OctagonStrel fromDiameter​(int diam)
      Creates an octagon-shape structuring element with specified diameter.
      Parameters:
      diam - the orthogonal diameter of the octagon
      Returns:
      a new octagon-shape structuring element
    • fromRadius

      public static final OctagonStrel fromRadius​(int radius)
      Creates an octagon-shape structuring element with specified radius.
      Parameters:
      radius - the radius of the octagon
      Returns:
      a new octagon-shape structuring element
    • decompose

      public java.util.Collection<InPlaceStrel> decompose()
      Returns a decomposition into four structuring elements, corresponding to horizontal, vertical, and diagonal linear structuring elements.
      Returns:
      a set of elementary structuring elements
      See Also:
      SeparableStrel.decompose(), LinearHorizontalStrel, LinearVerticalStrel, LinearDiagUpStrel, LinearDiagDownStrel
    • 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
    • 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
    • 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
    • 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
    • reverse

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