An algorithm for image segmentation and its applications in medical imaging.