Modeling image patches with a directed hierarchy of Markov random fields