Target morphology and cell memory: a model of regenerative pattern formation