OOF2: The Manual

Name

OOF.Graphics_n.Toolbox.Pixel_Select.Burn — Select a contiguous set of similar pixels, using a forest fire algorithm.

Synopsis

OOF.Graphics_n.Toolbox.Pixel_Select.Burn(source,local_flammability,global_flammability,color_space_norm,next_nearest,points,shift,ctrl)

Details

  • Parent Menu: OOF.Graphics_n.Toolbox.Pixel_Select
  • Callback: function PixelSelectToolbox.selectCB in module ooflib.common.IO.genericselecttoolbox
  • Parameters:

    source
    Microstructure or Image Type: The path to an OOF2 object.
    local_flammability
    Maximum difference in neighboring pixel values across which a burn will extend. Type: A real number in the range [0, 1].
    global_flammability
    Difference from initial pixel value beyond which a burn will not spread. Type: A real number in the range [0, 1].
    color_space_norm
    How to compute the difference between two colors in RGB space. Type: An object from the ColorNorm enumerated class.
    next_nearest
    Burn next-nearest neighbors? Type: Boolean, 0 (false) or 1 (true).
    points
    Type: A list of Point objects.
    shift
    True for addition. Type: Boolean, 0 (false) or 1 (true).
    ctrl
    True for toggle. Type: Boolean, 0 (false) or 1 (true).

Description

Select a contiguous set of similarly colored pixels, using an algorithm sometimes used to model forest fires. This can be a powerful way of selecting features in a Microstructure.

The source parameter must be the path to an Image. The selection is made in the Microstructure in which the Image resides.

The algorithm first selects the pixel located at the first Point in the points list. The selection spreads like a forest fire from one pixel to its neighbors, if the difference in intensity between the selected pixel and its neighbor is less than local_flammability, and the difference in intensity between the neighbor and the first point is less than global_flammability.

The color_space_norm parameter governs how differences in intensity are computed. It doesn't have a big effect on the behavior of the algorithm.

The next_nearest parameter determines whether the selection spreads diagonally from pixel to pixel in the Image, or only along the x and y axes. A burn started at one square on a checkerboard will spread to all the squares of the same color if next_nearest is 1, but will not spread beyond the initial square if next_nearest is 0.

The shift and ctrl parameters govern how the current selection (i.e, the set of objects defined by this operation) is merged with the previous selection (the objects already selected) to form a new selection, as shown in Table 6.1. They indicate whether (1) or not (0) the shift and control keys were depressed during the mouse click that initiated this command.

Figure 6.12. Selecting Pixels with the Burn Algorithm

Selecting Pixels with the Burn Algorithm

Pixels selected with the Burn selector with local_flammability=0.03, global_flammability=0.1, color_space_norm='L1', and next_nearest=0.

Selecting Pixels with the Burn Algorithm

The same selection made with both flammabilities set to 0.2. The fire has spread further and selected more pixels.