Inline helper functions of label
Add option to return number of labels
Add test case for number of labels
Merge pull request #496 from ahojnnes/label-performance

ENH: Inline helper functions of label and add number of regions as an optional return.