Generative and recognition models for neuroanatomy