### R code from vignette source 'segmentation.Rnw'