Package inra.ijpb.morphology.strel
Class DiamondStrel
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.DiamondStrel
- All Implemented Interfaces:
Algo
,AlgoListener
,Strel
,SeparableStrel
,Strel3D
public class DiamondStrel extends AbstractSeparableStrel
Structuring element representing a diamond of a given diameter.
The diamond is decomposed into linear diagonal and 3x3 cross structuring
elements.
- Author:
- David Legland
- See Also:
LinearDiagDownStrel
,LinearDiagUpStrel
,ShiftedCross3x3Strel
-
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 DiamondStrel(int size)
Creates a new diamond structuring element of given diameter.DiamondStrel(int size, int offset)
Creates a new diamond structuring element with a given diameter and offset. -
Method Summary
Modifier and Type Method Description java.util.Collection<InPlaceStrel>
decompose()
Decompose this separable structuring element into a set of smaller structuring elements that can be used to accelerate processing.static DiamondStrel
fromDiameter(int diam)
Creates a new diamond-shape structuring element with the specified diameter.static DiamondStrel
fromRadius(int radius)
Creates a new diamond-shape structuring element with the specified radius (such that diameter equals 2 * radius + 1).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.SeparableStrel
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
-
DiamondStrel
public DiamondStrel(int size)Creates a new diamond structuring element of given diameter. Diameter must be odd.- Parameters:
size
- the diameter of the diamond, that must be odd- Throws:
java.lang.IllegalArgumentException
- if size is negative or zerojava.lang.IllegalArgumentException
- if size is even
-
DiamondStrel
public DiamondStrel(int size, int offset)Creates a new diamond structuring element with a given diameter and offset. Diameter must be odd and positive. Offset must be comprised between 0 and size-1.- Parameters:
size
- the diameter of the diamond, that must be oddoffset
- the position of the reference point- Throws:
java.lang.IllegalArgumentException
- if size is negative or zerojava.lang.IllegalArgumentException
- if size is evenjava.lang.IllegalArgumentException
- if offset is negative or greater than size
-
-
Method Details
-
fromDiameter
Creates a new diamond-shape structuring element with the specified diameter.- Parameters:
diam
- the diameter of the diamond- Returns:
- a new DiamondStrel instance
-
fromRadius
Creates a new diamond-shape structuring element with the specified radius (such that diameter equals 2 * radius + 1).- Parameters:
radius
- the radius of the diamond- Returns:
- a new DiamondStrel instance
-
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
-
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
-
reverse
Description copied from interface:SeparableStrel
The reversed structuring element of a separable strel is also separable.- Returns:
- the reversed structuring element
-
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
-