OOF2: The Manual
Name
OOF.PixelSelection.Despeckle — Recursively select all pixels with a minimum number of selected neighbors. This fills in small holes in the selection.
Synopsis
OOF.PixelSelection.Despeckle(microstructure
,neighbors
)
Details
- Parent Menu: OOF.PixelSelection
-
Callback: function
doSelectionMod
in moduleooflib.common.pixelselectionmod
-
Parameters:
microstructure
- Type: The path to an existing
Microstructure
object. neighbors
- Select pixels with at least this many selected neighbors Type: An integer in the range [4, 8].
Description
Some pixel selection tools such as OOF.Graphics_n.Toolbox.Pixel_Select.Burn or OOF.Graphics_n.Toolbox.Pixel_Select.Color tend to leave small holes in the selection due to imperfection of the micrograph or other reasons. With only a few holes, it's possible to fill them manually other tools in the Pixel Selection toolbox, but this quickly gets tedious. The Despeckle fills these holes efficiently.
![]() |
Note |
---|---|
Note that it's the pixel selection that is
being despeckled, not the |
The end result of a despeckling is a solidification of the selecting region. Compare to Elkcepsed, which achieves a similar effect by deselecting pixels.
The microstructure
parameter specifies the Microstructure
where the selection resides.
The parameter neighbors
controls the
despeckling operation. Smaller values mean stronger filling power.
The algorithm examines each unselected pixel, counts its selected
neighbors (examining the 8 immediately adjacent pixels), and
selects the target pixels if at least neighbors
neighboring pixels were selected. The process repeats recursively
until no more pixels are selected. The value of
neighbors
must be between 4 and 8 inclusive:
values higher than 8 are meaningless, and values lower than 4 will
cause all pixels to be selected. 4 itself is of dubious utility.
See Figure 6.45 for examples.
Figure 6.45. Despeckling the Pixel Selection

A pixel selection (in red) containing some holes to be filled with Despeckle.

The result of despeckling with
neighbors
=8. Only single pixel holes
have been filled.

The result of despeckling with
neighbors
=7. One and two pixel holes
have been filled.

The result of despeckling with
neighbors
=6. Larger holes have been
filled.

The result of despeckling with
neighbors
=5. Holes
have been filled and the boundary has
been smoothed.

The result of despeckling with
neighbors
=4. Almost everything has been
obliterated.