Medical image segmentation and 3D reconstruction