Class SquareStrel

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

public class SquareStrel
extends AbstractSeparableStrel
A square structuring element, obtained by decomposition into horizontal and vertical linear structuring elements with the same size.
Author:
David Legland
See Also:
OctagonStrel, LinearHorizontalStrel, LinearVerticalStrel
  • Constructor Details

    • SquareStrel

      public SquareStrel​(int size)
      Creates a new square structuring element of a given size.
      Parameters:
      size - the length of each side of the square
    • SquareStrel

      public SquareStrel​(int size, int offset)
      Creates a new square structuring element of a given size and with a given offset.
      Parameters:
      size - the length of each side of the square
      offset - the position of the reference pixel in each direction
  • Method Details

    • fromDiameter

      public static final SquareStrel fromDiameter​(int diam)
      Creates a new square-shape structuring element with the specified diameter (equal to square side length).
      Parameters:
      diam - the side length of the square
      Returns:
      a new SquareStrel instance
    • fromRadius

      public static final SquareStrel fromRadius​(int radius)
      Creates a new square-shape structuring element with the specified radius.
      Parameters:
      radius - the radius of the square
      Returns:
      a new SquareStrel instance
    • 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
    • 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
    • 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
    • reverse

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