Mass-preserving registration of medical images