Deformable templates guided discriminative models for robust 3D brain MRI segmentation