We have developed a trainable method of shape representation which can automatically capture the invariant properties of a class of shapes and provide a compact parametric description of variability. We have applied the method to a family of flexible ribbons (worms) and to heart shapes in echocardiograms. We show that in both cases a natural parameterisation of shape results.