Ultrasound Elastography: a Dynamic Programming Approach