Generalizable automated pixel-level structural segmentation of medical and biological data