Atlas-based segmentation of medical images