RFCT Move segmentation code to _labeled.cpp

Segmentation and labeling are very related. Additionally, I want to use
the union-find algorithm there instead of reimplementing it for SLIC
post-processing.