Template-Based Cortical Surface Reconstruction with Minimal Energy Deformation