Finite element techniques for medical image processing