Thesis: probabilistic models of natural images for understanding how brains work