Retinal image synthesis through the least action principle