Package inra.ijpb.morphology.strel
Class SquareStrel
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.SquareStrel
- All Implemented Interfaces:
Algo,AlgoListener,Strel,SeparableStrel,Strel3D
public class SquareStrel extends AbstractSeparableStrel
A square structuring element, obtained by decomposition into horizontal
and vertical linear structuring elements with the same size.
- Author:
- David Legland
- See Also:
OctagonStrel,LinearHorizontalStrel,LinearVerticalStrel
-
Nested Class Summary
Nested classes/interfaces inherited from interface inra.ijpb.morphology.Strel
Strel.ShapeNested classes/interfaces inherited from interface inra.ijpb.morphology.Strel3D
Strel3D.Shape -
Field Summary
Fields inherited from interface inra.ijpb.morphology.Strel
BACKGROUND, FOREGROUNDFields inherited from interface inra.ijpb.morphology.Strel3D
BACKGROUND, FOREGROUND -
Constructor Summary
Constructors Constructor Description SquareStrel(int size)Creates a new square structuring element of a given size.SquareStrel(int size, int offset)Creates a new square structuring element of a given size and with a given 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 SquareStrelfromDiameter(int diam)Creates a new square-shape structuring element with the specified diameter (equal to square side length).static SquareStrelfromRadius(int radius)Creates a new square-shape structuring element with the 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.SquareStrelreverse()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, openingMethods inherited from class inra.ijpb.morphology.strel.AbstractStrel
addBorder, closing, cropBorder, dilation, erosion, getChannelName, getMask3D, getShifts3D, opening, setChannelNameMethods inherited from class inra.ijpb.morphology.strel.AbstractStrel3D
addBorder, cropBorder, showProgress, showProgressMethods inherited from class inra.ijpb.algo.AlgoStub
addAlgoListener, removeAlgoListenerMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface inra.ijpb.algo.Algo
addAlgoListener, removeAlgoListenerMethods inherited from interface inra.ijpb.morphology.Strel
getChannelName, setChannelNameMethods inherited from interface inra.ijpb.morphology.Strel3D
closing, dilation, erosion, getMask3D, getShifts3D, opening, showProgress, showProgress
-
Constructor Details
-
SquareStrel
public SquareStrel(int size)Creates a new square structuring element of a given size.- Parameters:
size- the length of each side of the square
-
SquareStrel
public SquareStrel(int size, int offset)Creates a new square structuring element of a given size and with a given offset.- Parameters:
size- the length of each side of the squareoffset- the position of the reference pixel in each direction
-
-
Method Details
-
fromDiameter
Creates a new square-shape structuring element with the specified diameter (equal to square side length).- Parameters:
diam- the side length of the square- Returns:
- a new SquareStrel instance
-
fromRadius
Creates a new square-shape structuring element with the specified radius.- Parameters:
radius- the radius of the square- Returns:
- a new SquareStrel instance
-
decompose
Description copied from interface:SeparableStrelDecompose 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
-
getMask
public int[][] getMask()Description copied from interface:StrelReturns 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:StrelReturns 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:StrelReturns 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:StrelReturns 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
-
reverse
Description copied from interface:SeparableStrelThe reversed structuring element of a separable strel is also separable.- Returns:
- the reversed structuring element
-