Function File: strel (shape, parameters)

Create a strel (structuring element) object for morphology operations.

The structuring element can have any type of shape as specified by shape, each one with its parameters.

Function File: strel ("arbitrary", nhood)
Function File: strel ("arbitrary", nhood, height)

Create arbitrary shaped structuring elements.

nhood must be a matrix of 0’s and 1’s. Any number with of dimensions are possible. To create a non-flat SE, the height can be specified. See individual functions that use the strel object for an interpretation of non-flat SEs.

Note that if an arbitrary shape is used, it may not be possible to guess it which may prevent shape-based optimizations (structuring element decomposition, see @strel/getsequence for details).

Function File: strel ("ball", radius, height)

Create ball shaped nonflat structuring element. radius must be a nonnegative integer that specifies the ray of a circle in X-Y plane. height is a real number that specifies the height of the center of the circle.

Function File: strel ("cube", edge)

Create cube shaped flat structuring element. edge must be a positive integer that specifies the length of its edges. This shape meant to perform morphology operations in volumes, see the square shape for 2 dimensional images.

Function File: strel ("diamond", radius)

Create diamond shaped flat structuring element. radius must be a positive integer.

Function File: strel ("disk", radius)
Function File: strel ("disk", radius, n)

Create disk shaped flat structuring element. radius must be a positive integer.

The optional n argument *must* have a value of zero but the default value is 4. This is to prevent future backwards incompatibilty since MATLAB default is also 4 but at the moment only 0 has been implemented.

Function File: strel ("hypercube", n, edge)

Create n dimensional cube (n-cube) shaped flat structuring element. edge must be a positive integer that specifies the length of its edges.

Function File: strel ("hyperrectangle", dimensions)

Create n dimensional hyperrectangle (or orthotope) shaped flat structuring element. dimensions must be a vector of positive integers with its lengtht at each of the dimensions.

Function File: strel ("line", len, deg)

Create line shaped flat structuring element. len must be a positive real number. deg must be a 1 or 2 elements real number, for a line in in 2D or 3D space. The first element of deg is the angle from X-axis to X-Y projection of the line while the second is the angle from Z-axis to the line.

Function File: strel ("octagon", apothem)

Create octagon shaped flat structuring element. apothem must be a non-negative integer, multiple of 3, that specifies the distance from the origin to the sides of the octagon.

Function File: strel ("pair", offset)

Create flat structuring element with two members. One member is placed at the origin while the other is placed with offset in relation to the origin. offset must then be a 2 element vector for the coordinates.

Function File: strel ("periodicline", p, v)

Create periodic line shaped flat structuring element. A periodic line will be built with 2*p+1 points around the origin included. These points will be displaced in accordance with the offset v at distances: 1*v, -1*v, 2*v, -2*v, ..., p*v, -p*v. Therefore v must be a 2 element vector for the coordinates.

Function File: strel ("rectangle", dimensions)

Create rectangular shaped flat structuring element. dimensions must be a two element vector of positive integers with the number of rows and columns of the rectangle.

Function File: strel ("square", edge)

Create square shaped flat structuring element. edge must be a positive integer that specifies the length of its edges. For use in volumes, see the cube shape.

The actual structuring element neighborhood, the logical matrix used for the operations, can be accessed with the getnhood method. However, most morphology functions in the image package will have an improved performance if the actual strel object is used, and not its element neighborhood.

se = strel ("square", 5);
getnhood (se)
    ⇒
        1  1  1  1  1
        1  1  1  1  1
        1  1  1  1  1
        1  1  1  1  1
        1  1  1  1  1

See also: imdilate, imerode.

Package: image