Class Abstract3x3NeighbourhoodThinning

    • Field Detail

      • m_foreground

        protected boolean m_foreground
        Boolean value of the foreground.
      • m_background

        protected boolean m_background
        Boolean value of the background.
    • Constructor Detail

      • Abstract3x3NeighbourhoodThinning

        protected Abstract3x3NeighbourhoodThinning()
      • Abstract3x3NeighbourhoodThinning

        protected Abstract3x3NeighbourhoodThinning​(boolean foreground)
        Create a new abstract thinning strategy. The passed boolean will represent the foreground-value of the image.
        Parameters:
        foreground - Value determining the boolean value of foreground pixels.
    • Method Detail

      • getNeighbourhood

        protected boolean[] getNeighbourhood​(RandomAccess<BitType> access)
        Returns all booleans in a 3x3 neighbourhood of the pixel the RandomAccess points to. These booleans are stored in an Array in the following order:
        8 1 2
        7 0 3
        6 5 4
        Parameters:
        access - A RandomAccess pointing to a pixel of the image
        Returns:
        A boolean Array holding the values of the neighbourhood in clockwise order.
      • findPatternSwitches

        protected int findPatternSwitches​(boolean[] vals)
        Returns the amount of switches from foreground to background occurring in the circle around vals[1]
        Parameters:
        vals - Boolean Array holding the neighbourhood.
        Returns:
        Amount of true-false switches in the neighbourhood.
      • afterCycle

        public void afterCycle()
        Description copied from interface: ThinningStrategy
        Called by the ThinningOp after each cycle, and thus exactly getIterationsPerCycle()-times per iteration. Used for performing different calculations in each step of the cycle.
        Specified by:
        afterCycle in interface ThinningStrategy
      • getIterationsPerCycle

        public int getIterationsPerCycle()
        Description copied from interface: ThinningStrategy
        Returns the minimum number of iterations necessary for the algorithm to run. This delays termination of the thinning algorithm until the end of the current cycle. If, for example, no changes occur during the second iteration of a 4-iteration-cycle, iterations 3 and 4 still take place.
        Specified by:
        getIterationsPerCycle in interface ThinningStrategy
        Returns:
        The number of iterations per cycle.