A Novel Algorithm for Extraction of Cancer Nests from Pathological Images