Image segmentation codes