Class DiskStrel

All Implemented Interfaces:
Algo, Strel, InPlaceStrel, InPlaceStrel3D, Strel3D

public class DiskStrel
extends AbstractInPlaceStrel
implements InPlaceStrel
Disk structuring element. This class is a wrapper for the ImageJ native RankFilters() method, that uses disk neighborhood.
Author:
David Legland
  • Method Details

    • fromRadius

      public static final DiskStrel fromRadius​(int radius)
      Creates a structuring element with a circular shape of the given radius.
      Parameters:
      radius - the radius of the structuring element, in pixels
      Returns:
      a new structuring element with disk shape and specified radius
    • fromDiameter

      public static final DiskStrel fromDiameter​(int diam)
      Creates a structuring element with a circular shape of the given diameter. The diameter is converted to a radius with following relation:
      
       radius = (diameter - 1) / 2
       
      Parameters:
      diam - the diameter of the structuring element, in pixels
      Returns:
      a new structuring element with disk shape and specified diameter
    • 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.
      Specified by:
      getSize in interface Strel
      Specified by:
      getSize in interface Strel3D
      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.
      Specified by:
      getMask in interface Strel
      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.
      Specified by:
      getOffset in interface Strel
      Specified by:
      getOffset in interface Strel3D
      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.
      Specified by:
      getShifts in interface Strel
      Returns:
      a set of shifts
    • reverse

      public DiskStrel reverse()
      Description copied from interface: InPlaceStrel
      The reverse structuring element of an InPlaceStrel is also an InPlaceStrel.
      Specified by:
      reverse in interface InPlaceStrel
      Specified by:
      reverse in interface InPlaceStrel3D
      Specified by:
      reverse in interface Strel
      Specified by:
      reverse in interface Strel3D
      Returns:
      the reversed structuring element
    • inPlaceDilation

      public void inPlaceDilation​(ij.process.ImageProcessor image)
      Performs in-place dilation with a disk structuring element by calling the ImageJ native RankFilters algorithm, using RankFilters.MAX option.
      Specified by:
      inPlaceDilation in interface InPlaceStrel
      Parameters:
      image - the image to process
    • inPlaceErosion

      public void inPlaceErosion​(ij.process.ImageProcessor image)
      Performs in-place erosion with a disk structuring element by calling the ImageJ native RankFilters algorithm, using RankFilters.MIN option.
      Specified by:
      inPlaceErosion in interface InPlaceStrel
      Parameters:
      image - the image to process