Multi phase Joint Segmentation and Registration