Hierarchical atlas estimation code