Machine learning methods for processing biological and medical images