Tuning the asymmetric response of metasurfaces for optical spatial filtering