extract_regions

extract_regions(regions, labels: list, trim=True)[source]

Combine given regions into a single boolean mask

Parameters
  • regions (ND-array) – An image containing an arbitrary number of labeled regions

  • labels (array_like or scalar) – A list of labels indicating which region or regions to extract

  • trim (bool) – If True then image shape will trimmed to a bounding box around the given regions.

Returns

im – A boolean mask with True values indicating where the given labels exist

Return type

ND-array

Examples

Click here to view online example.