Module org.scijava.ops.image
Class Abstract3x3NeighbourhoodThinning
- java.lang.Object
-
- org.scijava.ops.image.morphology.thin.Abstract3x3NeighbourhoodThinning
-
- All Implemented Interfaces:
ThinningStrategy
- Direct Known Subclasses:
GuoHallThinningStrategy,HilditchThinningStrategy,MorphologicalThinningStrategy,ZhangSuenThinningStrategy
public abstract class Abstract3x3NeighbourhoodThinning extends Object implements ThinningStrategy
This abstract class represents an rough framework for a Thinning algorithm operating on a 3x3 neighbourhood by providing some often needed functions.- Author:
- Andreas Burger, University of Konstanz
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_backgroundBoolean value of the background.protected booleanm_foregroundBoolean value of the foreground.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstract3x3NeighbourhoodThinning()protectedAbstract3x3NeighbourhoodThinning(boolean foreground)Create a new abstract thinning strategy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterCycle()Called by the ThinningOp after each cycle, and thus exactly getIterationsPerCycle()-times per iteration.protected intfindPatternSwitches(boolean[] vals)Returns the amount of switches from foreground to background occurring in the circle around vals[1]intgetIterationsPerCycle()Returns the minimum number of iterations necessary for the algorithm to run.protected boolean[]getNeighbourhood(RandomAccess<BitType> access)Returns all booleans in a 3x3 neighbourhood of the pixel the RandomAccess points to.protected <T> RandomAccess<T>randomAccess(RandomAccessible<T> ra)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.scijava.ops.image.morphology.thin.ThinningStrategy
copy, removePixel
-
-
-
-
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:ThinningStrategyCalled 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:
afterCyclein interfaceThinningStrategy
-
getIterationsPerCycle
public int getIterationsPerCycle()
Description copied from interface:ThinningStrategyReturns 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:
getIterationsPerCyclein interfaceThinningStrategy- Returns:
- The number of iterations per cycle.
-
randomAccess
protected <T> RandomAccess<T> randomAccess(RandomAccessible<T> ra)
-
-