Library for patch-based segmentation (pbs) with spatial context. (Spatially Aware Patch-based Segmentation)