Prior-Based Piecewise-Smooth Segmentation by Template Competitive Deformation Using Partitions of Unity