Package inra.ijpb.morphology.strel
Class OctagonStrel
java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.morphology.strel.AbstractStrel3D
inra.ijpb.morphology.strel.AbstractStrel
inra.ijpb.morphology.strel.AbstractSeparableStrel
inra.ijpb.morphology.strel.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
-
Nested Class Summary
Nested classes/interfaces inherited from interface inra.ijpb.morphology.Strel
Strel.Shape
Nested classes/interfaces inherited from interface inra.ijpb.morphology.Strel3D
Strel3D.Shape
-
Field Summary
Fields inherited from interface inra.ijpb.morphology.Strel
BACKGROUND, FOREGROUND
Fields inherited from interface inra.ijpb.morphology.Strel3D
BACKGROUND, FOREGROUND
-
Constructor Summary
Constructors Constructor Description OctagonStrel(int size)
Creates a new octagonal structuring element of a given orthogonal diameter.OctagonStrel(int size, int offset)
Creates a new octagonal structuring element of a given orthogonal diameter and with a given offset. -
Method Summary
Modifier and Type Method Description java.util.Collection<InPlaceStrel>
decompose()
Returns a decomposition into four structuring elements, corresponding to horizontal, vertical, and diagonal linear structuring elements.static OctagonStrel
fromDiameter(int diam)
Creates an octagon-shape structuring element with specified diameter.static OctagonStrel
fromRadius(int radius)
Creates an octagon-shape structuring element with specified radius.int[][]
getMask()
Returns the structuring element as a mask.int[]
getOffset()
Returns the offset in the mask.int[][]
getShifts()
Returns the structuring element as a set of shifts.int[]
getSize()
Returns the size of the structuring element, as an array of size in each direction.OctagonStrel
reverse()
The reversed structuring element of a separable strel is also separable.Methods inherited from class inra.ijpb.morphology.strel.AbstractSeparableStrel
algoProgressChanged, algoStatusChanged, closing, dilation, erosion, opening
Methods inherited from class inra.ijpb.morphology.strel.AbstractStrel
addBorder, closing, cropBorder, dilation, erosion, getChannelName, getMask3D, getShifts3D, opening, setChannelName
Methods inherited from class inra.ijpb.morphology.strel.AbstractStrel3D
addBorder, cropBorder, showProgress, showProgress
Methods inherited from class inra.ijpb.algo.AlgoStub
addAlgoListener, removeAlgoListener
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface inra.ijpb.algo.Algo
addAlgoListener, removeAlgoListener
Methods inherited from interface inra.ijpb.morphology.Strel
getChannelName, setChannelName
Methods inherited from interface inra.ijpb.morphology.Strel3D
closing, dilation, erosion, getMask3D, getShifts3D, opening, showProgress, showProgress
-
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 octagonoffset
- the position of the reference pixel in each direction- Throws:
java.lang.IllegalArgumentException
- if size is negative or zerojava.lang.IllegalArgumentException
- if offset is negative or greater than size
-
-
Method Details
-
fromDiameter
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
Creates an octagon-shape structuring element with specified radius.- Parameters:
radius
- the radius of the octagon- Returns:
- a new octagon-shape structuring element
-
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
Description copied from interface:SeparableStrel
The reversed structuring element of a separable strel is also separable.- Returns:
- the reversed structuring element
-