neu_lib.predicates

Region tests: builders for the inside() callable that Skeleton.crop() takes.

An InsideFn takes an (N, 3) array of zyx nm points and returns a bool per point. Any callable of that shape works, so a caller can supply regions this module does not build (a mesh hull, a distance field). Points beyond a region’s extent are outside it, not an error.

Functions

box_predicate(box) → neu_lib.skeleton.InsideFn

inside() for a bounding box in nm.

mask_predicate(mask_zyx, frame) → neu_lib.skeleton.InsideFn

inside() for a dense boolean mask, zyx, whose voxel size and origin are given by

union(*predicates) → neu_lib.skeleton.InsideFn

Inside any of the predicates; union() of nothing is inside nothing. The

Module Contents

neu_lib.predicates.box_predicate(box: neu_lib.grid.BBox) → neu_lib.skeleton.InsideFn

inside() for a bounding box in nm.

neu_lib.predicates.mask_predicate(mask_zyx: numpy.ndarray, frame: neu_lib.frame.Frame) → neu_lib.skeleton.InsideFn

inside() for a dense boolean mask, zyx, whose voxel size and origin are given by frame. Meant for small masks: a compartment or ROI at a coarse level, or a crop.

neu_lib.predicates.union(*predicates: neu_lib.skeleton.InsideFn) → neu_lib.skeleton.InsideFn

Inside any of the predicates; union() of nothing is inside nothing. The predicates need not share a resolution or frame.