Pass a function to define regions with RegionManager#addRegions

Implements #1371.
I don't think you need this.