public class StructuringElements extends Object
Constructor and Description |
---|
StructuringElements() |
Modifier and Type | Method and Description |
---|---|
static List<Shape> |
diamond(int radius,
int dimensionality)
Generates a centered flat diamond structuring element for morphological
operations.
|
static List<Shape> |
diamond(int radius,
int dimensionality,
boolean decompose)
Generates a centered flat diamond structuring element for morphological
operations.
|
static List<Shape> |
disk(long radius,
int dimensionality)
Generates a centered disk flat structuring element for morphological
operations.
|
static List<Shape> |
disk(long radius,
int dimensionality,
int decomposition)
Generates a centered disk flat structuring element for morphological
operations.
|
static Shape |
periodicLine(long span,
int[] increments)
Creates a new periodic line structuring element, that will iterate over
2 × span + 1 pixels as follow: |
static List<Shape> |
rectangle(int[] halfSpans)
Generates a symmetric, centered, rectangular flat structuring element for
morphological operations.
|
static List<Shape> |
rectangle(int[] halfSpans,
boolean decompose)
Generates a symmetric, centered, rectangular flat structuring element for
morphological operations.
|
static List<Shape> |
square(int radius,
int dimensionality)
Generates a centered square flat structuring element for morphological
operations.
|
static List<Shape> |
square(int radius,
int dimensionality,
boolean decompose)
Generates a centered square flat structuring element for morphological
operations.
|
public static final List<Shape> disk(long radius, int dimensionality)
The structuring element (strel) is returned as a List
of
Shape
s, for structuring elements can be decomposed to yield a
better performance. In 2D, the disk strel can be
approximated by several periodic lines. The resulting strel is
only an approximation of a disk, and this method offers a parameter to
select the level of approximation. For other dimensionalities, no
optimization are available yet and the parameter is ignored.
This methods relies on heuristics to determine automatically what decomposition level to use.
radius
- the radius of the disk, so that it extends over
2 × radius + 1
in all dimensionsdimensionality
- the dimensionality of the target problem.Shape
s.public static final List<Shape> disk(long radius, int dimensionality, int decomposition)
The structuring element (strel) is returned as a List
of
Shape
s, for structuring elements can be decomposed to yield a
better performance. In 2D, the disk strel can be
approximated by several periodic lines. The resulting strel is
only an approximation of a disk, and this method offers a parameter to
select the level of approximation. For other dimensionalities, no
optimization are available yet and the parameter is ignored.
radius
- the radius of the disk, so that it extends over
2 × radius + 1
in all dimensionsdimensionality
- the dimensionality of the target problem.decomposition
- the decomposition to use. Only values 0, 4, 6 and 8 are
accepted:
Shape
s.public static final List<Shape> square(int radius, int dimensionality, boolean decompose)
This method specify the square size using its radius to comply to
sibling methods. The extend of the generated square is
2 × radius + 1
in all dimensions.
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. The square strel can be decomposed in a succession of
orthogonal lines and yield the exact same results on any of the
morphological operations. Because the decomposition becomes
dimension-specific, the dimensionality of the target problem must be
specified. Warning: Undesired effects will occur if the specified
dimensionality and target dimensionality do not match. Non-decomposed
version are dimension-generic.
radius
- the radius of the square.dimensionality
- the dimensionality of the target problem.decompose
- if true
, the structuring element will be
optimized through decomposition.Shape
s.public static final List<Shape> square(int radius, int dimensionality)
This method specify the square size using its radius to comply to
sibling methods. The extend of the generated square is
2 × radius + 1
in all dimensions.
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. The square strel can be decomposed in a succession of
orthogonal lines and yield the exact same results on any of the
morphological operations. Because the decomposition becomes
dimension-specific, the dimensionality of the target problem must be
specified. Warning: Undesired effects will occur if the specified
dimensionality and target dimensionality do not match. Non-decomposed
version are dimension-generic.
This method determines whether it is worth returning a decomposed strel based on simple heuristics.
radius
- the radius of the square.dimensionality
- the dimensionality of the target problem.Shape
s.public static final List<Shape> rectangle(int[] halfSpans, boolean decompose)
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. The rectangle strel can be decomposed in a succession
of orthogonal lines and yield the exact same results on any of the
morphological operations.
halfSpans
- an int[]
array containing the half-span of the
symmetric rectangle in each dimension. The total extent of the
rectangle will therefore be 2 × halfSpan[d] + 1
in each dimension.decompose
- if true
, the strel will be returned as a
List
of HorizontalLineShape
, indeed performing
the rectangle decomposition. If false
, the list
will be made of a single CenteredRectangleShape
.List
of
Shape
s.public static final List<Shape> rectangle(int[] halfSpans)
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. The rectangle strel can be decomposed in a succession
of orthogonal lines and yield the exact same results on any of the
morphological operations. This method uses a simple heuristic to decide
whether to decompose the rectangle or not.
public static final List<Shape> diamond(int radius, int dimensionality)
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. Because the decomposition is dimension-specific, this
methods requires it to be specified. Warning: using a structuring
element built with the wrong dimension can and will lead to undesired
(and sometimes hard to detect) defects in subsequent morphological
operations.
The diamond strel can be effectively decomposed in 2D (and 1D) using the logarithmic decomposition in extreme sets, as explained in [1]. For other dimensions, the theorem does not hold (even in practice), and we have to fall back on a linear decomposition, still very effective (see [1] as well).
radius
- the desired radius of the diamond structuring element. The
strel will extend over 2 × radius + 1
in all
dimensions.dimensionality
- the target dimensionality this structuring element will be
used with. A structuring element build for one dimension will
not work properly for any other dimensions.Shape
s.public static final List<Shape> diamond(int radius, int dimensionality, boolean decompose)
The structuring element (strel) is returned as a List
of
Shape
s, for Structuring elements can be decomposed to yield a
better performance. Because the decomposition is dimension-specific, this
methods requires it to be specified. Warning: using a structuring
element built with the wrong dimension can and will lead to undesired
(and sometimes hard to detect) defects in subsequent morphological
operations. Non-optimized versions of this strel are dimension-generic.
The diamond strel can be effectively decomposed in 2D (and 1D) using the logarithmic decomposition in extreme sets, as explained in [1]. For other dimensions, the theorem does not hold (even in practice), and we have to fall back on a linear decomposition, still very effective (see [1] as well).
radius
- the desired radius of the diamond structuring element. The
strel will extend over 2 × radius + 1
in all
dimensions.dimensionality
- the target dimensionality this structuring element will be
used with. A structuring element build for one dimension will
not work properly for any other dimensions.decompose
- if true
, this strel will be optimized through
decomposition.Shape
s.public static final Shape periodicLine(long span, int[] increments)
2 × span + 1
pixels as follow:
position - span x increments, ... position - 2 × increments, position - increments, position, position + increments, position + 2 × increments, ... position + span x incrementsThe importance of periodic lines is explained in [1].
span
- the span of the neighborhood, so that it will iterate over
2 × span + 1
pixels.increments
- the values by which each element of the position vector is to
be incremented when iterating.Copyright © 2015–2022 ImgLib2. All rights reserved.