Learning Conditional Deformable Templates with Convolutional Networks