fastplotlib.ImageHighlightSelector#

class ImageHighlightSelector(color='red', lut=None, alpha=0.7, lut_wrap='fixed', options_color='w', options_alpha=0.1, selection_options=None)[source]#

Highlights pixel regions of an ImageGraphic.

Can be used in two modes:

Free-selection mode, if selection_options is None:

selection is a dict with keys:

  • “rows”: list of row specs (int, list[int], or slice); selects those rows across all cols.

  • “cols”: list of col specs (int, list[int], or slice); selects those cols across all rows.

  • “pixels”: list of (n, 2) arrays of [[row, col], ...] coordinates.

When both “rows” and “cols” are given they must have the same length each pair defines a rectangle.

Options mode, if selection_options is set:

All options are shown with options_color & options_alpha. selection is an int or list[int] indexing into the options, selected items are shown with the highlight color or lut & alpha. Only the LUT is rewritten on selection change, not the mask.

Parameters:
  • color (str or array-like, default "red") – Highlight color for selected items.

  • lut (np.ndarray, optional) – RGBA colors of shape (n, 4), one for each selected item

  • alpha (float, default 1.0) – alpha blending value

  • options_color (str or array-like, default "w") – Color shown for unselected option items.

  • options_alpha (float, default 0.1) – alpha blend value for unselected items

  • selection_options (dict or None, optional) – Pool of selectable options (same dict format as selection in free-selection mode).

Examples#

Highlight Selector

Highlight Selector