A generalized analysis for mercury porosimetry