Neural network model of the primary visual cortex: From functional architecture to lateral connectivity and back