The transformation process of masonry buildings in historic towns: the case of Medicina in northern Italy