Robust image segmentation applied to magnetic resonance and ultrasound images of the prostate