A Mean Field Theory of Layer IV of Visual Cortex and Its Application to Artificial Neural Networks