An automatic image segmentation algorithm involving shortest path basins