atlas_region_keep
atlas_region_keep(atlas, pattern, match_on='region')Keep only regions matching a pattern.
Non-matching regions are removed from core, palette, and 3D data, but sf geometry is preserved for surface continuity.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| atlas | BrainAtlas | Brain atlas object. | required |
| pattern | str | Regex pattern to match (case-insensitive). | required |
| match_on | str | Column to match: ‘region’ or ‘label’. | 'region' |
Returns
| Name | Type | Description |
|---|---|---|
| BrainAtlas | Modified atlas copy. |
Examples
>>> from ggsegpy import dk, atlas_region_keep
>>> atlas = dk()
>>> frontal = atlas_region_keep(atlas, "frontal")