Segmentation generation script