From sensory perception to spatial cognition