Connected component labeling for level sets