RegionExpr

RegionExpr#

class braincell.filter.RegionExpr[source]#

Base class for lazy region selectors.

evaluate(morpho, cache=None)[source]#

Evaluate this expression against morpho.

Parameters:
  • morpho (Morphology) – Morphology to evaluate against.

  • cache (SelectionCache | None) – Shared memoization scratch space, threaded to sub-expressions.

Returns:

The selected interval set.

Return type:

RegionMask

Raises:

TypeError – If morpho is not a braincell.Morphology.

Notes

This is the type-checked entry point every caller uses; subclasses implement _evaluate() instead. Keeping the guard here rather than in each leaf is why it cannot be forgotten – it previously was, by EmptyRegion, which accepted arguments every sibling rejected.