webknossos-libs
webknossos-libs copied to clipboard
Auto-detect segmentation layers
When cubing datasets the user has to specify which layers are segmentation layers. It would be helpful to add a heuristic that auto-determines this. E.g. find patches of uniform color/id vs noisy images (which are probably raw data). It may be possible to run this heuristic only on a sampled subset of the data
A very cheap heuristic could be the following:
- sample N bboxes à 4x4x4 pixel (ignore bounding boxes which are all zero)
- per bbox, count the unique values
- compare average unique values per bounding box against a threshold (for segmentation, I would assume the value of unique ids to be <= 2)
Dataset.from_images currently has a cheap heuristic by checking if segmentation or labels is a substring in the relative path of the layer. A data-driven heuristic would be even better.