Studio Yotsuba
Back to Node List

Region Filter

region_filter

Keeps only the regions that match a condition (id, size, random pick, edge contact) - drop the tiny islands, keep inner faces only. The output stays a RegionMap, so region processing can continue

Reviewed
Guide available

Input Ports

NameTypeDescription
Regions
regions
RegionMap
Required
RegionMap to filter

Output Ports

NameTypeDescription
Regions
regions
RegionMap
Filtered RegionMap
Preview
preview
Image
Color preview of the filtered regions
Labels
labels
Map
UI overlay label positions for the inspector

Parameters

NameTypeDefaultRangeDescription / Options
Mode
mode
Enum
All—

How regions are selected

  • AllAll
    Keep all regions
  • IdId
    Keep one region id
  • IdRangeIdRange
    Keep ids inside the range
  • AreaRangeAreaRange
    Keep regions by pixel area
  • RandomRandom
    Keep regions by stable random chance
  • EdgeTouchEdgeTouch
    Keep regions touching an image edge
  • InteriorInterior
    Keep regions not touching any image edge
Region ID
region_id
Int
00–2147483647

Region id used by Id mode

Min ID
min_id
Int
00–2147483647

Minimum region id for IdRange mode

Max ID
max_id
Int
2550–2147483647

Maximum region id for IdRange mode

Min Area
min_area
Int
00–4294967295

Minimum region area in pixels

Max Area
max_area
Int
40960–4294967295

Maximum region area in pixels

Chance
chance
Float
0.50–1 / step 0.01

Chance to keep each region in Random mode

Seed
seed
Int
10–99999

Seed for random selection and preview colors

Invert
invert
Bool
false—

Keep non-matching regions instead

Compact IDs
compact_ids
Bool
false—

Renumber remaining regions from zero after filtering

Show IDs
show_ids
Bool
false—

Show region id labels on the inspector preview

Overview

Selects regions by a condition such as ID, area, randomness, or edge contact. Unselected pixels become outside pixels. It can keep only large islands, remove regions that touch an edge, or randomly thin regions into a pattern while preserving the RegionMap type.

  • Category: Generate / Region / Select
  • Uses: keeping only small regions, removing edge-touching regions, and randomly thinning regions

Usage tips

  • Random thinning is visually useful: thin Voronoi regions into scattered stones, or noise islands into isolated shrubs.
  • Think of it as the Region counterpart to list_filter, retaining elements that meet a condition.
  • The output remains a RegionMap, so fill, boundary, and distance nodes work downstream. If you only need a black-and-white mask, region_mask is more direct.

Related nodes

  • region_mask — extracts the result as a mask image
  • region_neighbor_select — selects by adjacency
  • region_grow_shrink — fills outside pixels after filtering
  • region_merge_small — merges regions instead of removing them

Modes

Value Description
All Keep every region
Id Keep only the specified ID
IdRange Keep the specified ID range
AreaRange Keep regions within the specified area range
Random Keep regions using a stable random value per region
EdgeTouch Keep regions that touch an image edge
Interior Keep interior regions that do not touch an image edge

How to use

Connect nodes such as Region Cells.regions -> Region Filter.regions -> Region Fill.regions.

To remove regions that are too small, set mode = AreaRange and raise min_area. To remove edge-touching regions, use mode = EdgeTouch with invert = true.

When the input RegionMap wraps horizontally or vertically, edges in that direction connect to the opposite side instead of outside. In a tile that wraps both ways, a region is not treated as EdgeTouch merely because it lies at an edge.

Enable compact_ids only when needed. It is off by default so the original IDs remain aligned with upstream selections.

Region Mask differs in its output type. Region Filter returns the selection as a RegionMap, allowing further use of Region Fill, Region Border, Region Distance, and other region nodes. Use Region Mask when you need only a regular image mask.

Back to Node List